diff --git a/.gitignore b/.gitignore index 2918d58..229737a 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,111 @@ /nmstate-1.0.2.tar.gz /nmstate-1.0.3.tar.gz /nmstate-1.0.3.tar.gz.asc +/nmstate-1.1.0.tar.gz +/nmstate-1.1.0.tar.gz.asc +/nmstate-1.2.0.tar.gz.asc +/nmstate-1.2.0.tar.gz +/nmstate-2.0.0.tar.gz +/nmstate-2.0.0.tar.gz.asc +/nmstate-2.1.0-alpha1.tar.gz +/nmstate-2.1.0-alpha1.tar.gz.asc +/nmstate-2.1.0-alpha2.tar.gz +/nmstate-2.1.0-alpha2.tar.gz.asc +/nmstate-2.1.0.tar.gz +/nmstate-2.1.0.tar.gz.asc +/nmstate-2.1.2.tar.gz +/nmstate-2.1.2.tar.gz.asc +/nmstate-2.1.4.tar.gz +/nmstate-2.1.4.tar.gz.asc +/nmstate-2.2.0.tar.gz +/nmstate-2.2.0.tar.gz.asc +/nmstate-2.2.2.tar.gz +/nmstate-2.2.2.tar.gz.asc +/nmstate-2.2.3.tar.gz.asc +/nmstate-2.2.3.tar.gz +/nmstate-2.2.4.tar.gz +/nmstate-2.2.4.tar.gz.asc +/nmstate-2.2.5.tar.gz +/nmstate-2.2.5.tar.gz.asc +/nmstate-2.2.8.tar.gz +/nmstate-2.2.8.tar.gz.asc +/nmstate-2.2.9.tar.gz +/nmstate-2.2.9.tar.gz.asc +/nmstate-2.2.10.tar.gz +/nmstate-2.2.10.tar.gz.asc +/nmstate-vendor-2.2.10.tar.xz +/nmstate-2.2.12.tar.gz +/nmstate-2.2.12.tar.gz.asc +/nmstate-vendor-2.2.12.tar.xz +/nmstate-2.2.13.tar.gz +/nmstate-2.2.13.tar.gz.asc +/nmstate-vendor-2.2.13.tar.xz +/nmstate-2.2.14.tar.gz +/nmstate-2.2.14.tar.gz.asc +/nmstate-vendor-2.2.14.tar.xz +/nmstate-2.2.15.tar.gz +/nmstate-2.2.15.tar.gz.asc +/nmstate-vendor-2.2.15.tar.xz +/nmstate-2.2.21.tar.gz +/nmstate-2.2.21.tar.gz.asc +/nmstate-vendor-2.2.21.tar.xz +/nmstate-2.2.26.tar.gz +/nmstate-2.2.26.tar.gz.asc +/nmstate-vendor-2.2.26.tar.xz +/nmstate-2.2.33.tar.gz +/nmstate-2.2.33.tar.gz.asc +/nmstate-vendor-2.2.33.tar.xz +/nmstate-2.2.34.tar.gz +/nmstate-2.2.34.tar.gz.asc +/nmstate-vendor-2.2.34.tar.xz +/nmstate-2.2.35.tar.gz +/nmstate-2.2.35.tar.gz.asc +/nmstate-vendor-2.2.35.tar.xz +/nmstate-2.2.39.tar.gz +/nmstate-2.2.39.tar.gz.asc +/nmstate-vendor-2.2.39.tar.xz +/nmstate-2.2.40.tar.gz +/nmstate-2.2.40.tar.gz.asc +/nmstate-vendor-2.2.40.tar.xz +/nmstate-2.2.41.tar.gz +/nmstate-2.2.41.tar.gz.asc +/nmstate-vendor-2.2.41.tar.xz +/nmstate-2.2.42.tar.gz +/nmstate-2.2.42.tar.gz.asc +/nmstate-vendor-2.2.42.tar.xz +/nmstate-2.2.43.tar.gz +/nmstate-2.2.43.tar.gz.asc +/nmstate-vendor-2.2.43.tar.xz +/nmstate-2.2.44.tar.gz +/nmstate-2.2.44.tar.gz.asc +/nmstate-vendor-2.2.44.tar.xz +/nmstate-2.2.45.tar.gz +/nmstate-2.2.45.tar.gz.asc +/nmstate-vendor-2.2.45.tar.xz +/nmstate-2.2.46.tar.gz +/nmstate-2.2.46.tar.gz.asc +/nmstate-vendor-2.2.46.tar.xz +/nmstate-2.2.47.tar.gz +/nmstate-2.2.47.tar.gz.asc +/nmstate-vendor-2.2.47.tar.xz +/nmstate-2.2.48.tar.gz +/nmstate-2.2.48.tar.gz.asc +/nmstate-vendor-2.2.48.tar.xz +/nmstate-2.2.49.tar.gz +/nmstate-2.2.49.tar.gz.asc +/nmstate-vendor-2.2.49.tar.xz +/nmstate-2.2.50.tar.gz +/nmstate-2.2.50.tar.gz.asc +/nmstate-vendor-2.2.50.tar.xz +/nmstate-2.2.52.tar.gz +/nmstate-2.2.52.tar.gz.asc +/nmstate-vendor-2.2.52.tar.xz +/nmstate-2.2.54.tar.gz +/nmstate-2.2.54.tar.gz.asc +/nmstate-vendor-2.2.54.tar.xz +/nmstate-2.2.55.tar.gz +/nmstate-2.2.55.tar.gz.asc +/nmstate-vendor-2.2.55.tar.xz +/nmstate-2.2.57.tar.gz +/nmstate-2.2.57.tar.gz.asc +/nmstate-vendor-2.2.57.tar.xz diff --git a/.packit.yaml b/.packit.yaml new file mode 100644 index 0000000..cd4cca0 --- /dev/null +++ b/.packit.yaml @@ -0,0 +1,29 @@ +--- +downstream_package_name: nmstate +upstream_project_url: https://github.com/nmstate/nmstate +issue_repository: https://github.com/nmstate/nmstate +update_release: false +upstream_package_name: nmstate +upstream_tag_template: v{version} +copy_upstream_release_description: true + +jobs: + # This is triggered by https://release-monitoring.org/ + - job: pull_from_upstream + trigger: release + dist_git_branches: + - fedora-all + + # This is triggered at Fedora dist-git for creating koji build after + # PR in src.fedoraproject.org been merged. + - job: koji_build + trigger: commit + allowed_pr_authors: ["packit-stg", "packit"] + dist_git_branches: + - fedora-all + + # This is triggered at Fedora messaging bus about koji build finished. + - job: bodhi_update + trigger: commit + dist_git_branches: + - fedora-branched diff --git a/0001-nmstatectl-fix-long-arguments-support.patch b/0001-nmstatectl-fix-long-arguments-support.patch deleted file mode 100644 index 4334857..0000000 --- a/0001-nmstatectl-fix-long-arguments-support.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 99c7f643bab33a26c317e1b72ca3b8490cb1ea60 Mon Sep 17 00:00:00 2001 -From: Fernando Fernandez Mancera -Date: Fri, 16 Jul 2021 08:57:27 +0200 -Subject: [PATCH 1/4] nmstatectl: fix long arguments support - -The support for long arguments is broken. This patch is fixing it and -solving the following errors: - -``` -[root@d0b4a6a0f7a5 nmstate-workspace]# nmstatectl show --running-config -usage: nmstatectl [-h] [--version] - {commit,edit,rollback,set,apply,show,version,gc} ... -nmstatectl: error: unrecognized arguments: --running-config -[root@d0b4a6a0f7a5 nmstate-workspace]# nmstatectl show --show-secrets -usage: nmstatectl [-h] [--version] - {commit,edit,rollback,set,apply,show,version,gc} ... -nmstatectl: error: unrecognized arguments: --show-secrets -``` - -Integration test case added. - -Signed-off-by: Fernando Fernandez Mancera -Signed-off-by: Gris Ge ---- - nmstatectl/nmstatectl.py | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/nmstatectl/nmstatectl.py b/nmstatectl/nmstatectl.py -index a9f4cb6..6f83069 100644 ---- a/nmstatectl/nmstatectl.py -+++ b/nmstatectl/nmstatectl.py -@@ -223,14 +223,16 @@ def setup_subcommand_show(subparsers): - dest="yaml", - ) - parser_show.add_argument( -- "-r, --running-config", -+ "-r", -+ "--running-config", - help="Show running configurations", - default=False, - action="store_true", - dest="running_config", - ) - parser_show.add_argument( -- "-s, --show-secrets", -+ "-s", -+ "--show-secrets", - help="Show secrets also", - default=False, - action="store_true", --- -2.32.0 - diff --git a/0002-nm-ethtool-Preserve-existing-ethtool-settings-when-u.patch b/0002-nm-ethtool-Preserve-existing-ethtool-settings-when-u.patch deleted file mode 100644 index 5f5ebec..0000000 --- a/0002-nm-ethtool-Preserve-existing-ethtool-settings-when-u.patch +++ /dev/null @@ -1,105 +0,0 @@ -From b1cb57d1dc4bba6592ba5cfc5c810a2ad19ac941 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Thu, 22 Jul 2021 18:40:50 +0800 -Subject: [PATCH 2/4] nm ethtool: Preserve existing ethtool settings when - undesired - -When user does not define ethtool settings in desire state, -we should preserve existing ethtool setting. - -Integration test case included. - -Signed-off-by: Gris Ge -Signed-off-by: Fernando Fernandez Mancera ---- - libnmstate/nm/connection.py | 18 +++--------------- - libnmstate/nm/ethtool.py | 26 +++++++++++++++++++++++++- - 2 files changed, 28 insertions(+), 16 deletions(-) - -diff --git a/libnmstate/nm/connection.py b/libnmstate/nm/connection.py -index 5d60f6d..5a79c6f 100644 ---- a/libnmstate/nm/connection.py -+++ b/libnmstate/nm/connection.py -@@ -22,8 +22,6 @@ - import uuid - - from libnmstate.error import NmstatePluginError --from libnmstate.ifaces import IfaceEthtool --from libnmstate.schema import Ethtool - from libnmstate.schema import Interface - from libnmstate.schema import InterfaceType - from libnmstate.schema import LinuxBridge as LB -@@ -240,19 +238,9 @@ def create_new_nm_simple_conn(iface, nm_profile): - if iface.ieee_802_1x_conf: - settings.append(create_802_1x_setting(iface.ieee_802_1x_conf)) - -- if Ethtool.CONFIG_SUBTREE in iface.original_desire_dict: -- iface_ethtool = IfaceEthtool( -- iface.original_desire_dict[Ethtool.CONFIG_SUBTREE] -- ) -- iface_ethtool.canonicalize( -- iface.original_desire_dict[Ethtool.CONFIG_SUBTREE] -- ) -- setting = create_ethtool_setting( -- iface_ethtool, -- nm_profile, -- ) -- if setting: -- settings.append(setting) -+ ethtool_setting = create_ethtool_setting(iface, nm_profile) -+ if ethtool_setting: -+ settings.append(ethtool_setting) - - nm_simple_conn = NM.SimpleConnection.new() - for setting in settings: -diff --git a/libnmstate/nm/ethtool.py b/libnmstate/nm/ethtool.py -index 466f4f9..3cad1bf 100644 ---- a/libnmstate/nm/ethtool.py -+++ b/libnmstate/nm/ethtool.py -@@ -22,6 +22,7 @@ import logging - from .common import NM - from .common import GLib - -+from libnmstate.ifaces import IfaceEthtool - from libnmstate.schema import Ethtool - - -@@ -59,7 +60,7 @@ _NM_COALESCE_OPT_NAME_MAP = { - } - - --def create_ethtool_setting(iface_ethtool, base_con_profile): -+def _create_ethtool_setting(iface_ethtool, base_con_profile): - nm_setting = None - - if base_con_profile: -@@ -159,3 +160,26 @@ def nm_set_pause(nm_setting, autoneg, rx, tx): - tx_value, - ) - # pylint: enable=no-member -+ -+ -+def create_ethtool_setting(iface, base_con_profile): -+ if Ethtool.CONFIG_SUBTREE in iface.original_desire_dict: -+ iface_ethtool = IfaceEthtool( -+ iface.original_desire_dict[Ethtool.CONFIG_SUBTREE] -+ ) -+ iface_ethtool.canonicalize( -+ iface.original_desire_dict[Ethtool.CONFIG_SUBTREE] -+ ) -+ return _create_ethtool_setting( -+ iface_ethtool, -+ base_con_profile, -+ ) -+ else: -+ # Preserve existing setting but not create new -+ if base_con_profile: -+ ethtool_setting = base_con_profile.get_setting_by_name( -+ NM.SETTING_ETHTOOL_SETTING_NAME -+ ) -+ if ethtool_setting: -+ return ethtool_setting.duplicate() -+ return None --- -2.32.0 - diff --git a/0003-ovs-fix-state-ignore-for-ovs-port-when-removing-them.patch b/0003-ovs-fix-state-ignore-for-ovs-port-when-removing-them.patch deleted file mode 100644 index ba000ef..0000000 --- a/0003-ovs-fix-state-ignore-for-ovs-port-when-removing-them.patch +++ /dev/null @@ -1,87 +0,0 @@ -From f4d190653c55d399b32afc956b2b4a1ff8d20101 Mon Sep 17 00:00:00 2001 -From: Fernando Fernandez Mancera -Date: Mon, 26 Jul 2021 09:58:23 +0200 -Subject: [PATCH 3/4] ovs: fix state=ignore for ovs port when removing them - -When removing an ovs port while the interface is marked as ignored, the -interface should not being removed from the ovs bridge as the user -specidied it should be ignored. - -Example: - -``` -interfaces: -- name: dummy0 - type: dummy - state: ignore -- name: ovsbr0 - type: ovs-bridge - state: up - bridge: - port: - - name: ovs0 -``` - -Integration test case added. - -Signed-off-by: Fernando Fernandez Mancera -Signed-off-by: Gris Ge ---- - libnmstate/nm/profiles.py | 22 ++++++++++++++++++++-- - 1 file changed, 20 insertions(+), 2 deletions(-) - -diff --git a/libnmstate/nm/profiles.py b/libnmstate/nm/profiles.py -index beda5c7..3b0b6be 100644 ---- a/libnmstate/nm/profiles.py -+++ b/libnmstate/nm/profiles.py -@@ -23,6 +23,8 @@ - import logging - from operator import attrgetter - -+from libnmstate.schema import Interface -+from libnmstate.schema import InterfaceState - from libnmstate.schema import InterfaceType - - from .common import NM -@@ -359,7 +361,7 @@ def _delete_orphan_nm_ovs_port_profiles( - continue - # When OVS port has no child, delete it - ovs_bridge_iface = ovs_bridge_profile.iface -- if not _nm_ovs_port_has_child( -+ if not _nm_ovs_port_has_child_or_is_ignored( - nm_profile, ovs_bridge_iface, net_state - ): - ProfileDelete( -@@ -404,7 +406,9 @@ def _use_uuid_as_controller_and_parent(nm_profiles): - nm_profile.update_parent(uuid) - - --def _nm_ovs_port_has_child(nm_profile, ovs_bridge_iface, net_state): -+def _nm_ovs_port_has_child_or_is_ignored( -+ nm_profile, ovs_bridge_iface, net_state -+): - ovs_port_uuid = nm_profile.get_uuid() - ovs_port_name = nm_profile.get_interface_name() - for ovs_iface_name in ovs_bridge_iface.port: -@@ -415,4 +419,18 @@ def _nm_ovs_port_has_child(nm_profile, ovs_bridge_iface, net_state): - and ovs_iface.controller_type == InterfaceType.OVS_PORT - ): - return True -+ # Gather the ovs bridge interface from the current state in order to check -+ # if any port is ignored in the original desired state. -+ current_ovs_bridge = net_state.ifaces.get_cur_iface( -+ ovs_bridge_iface.name, InterfaceType.OVS_BRIDGE -+ ) -+ if current_ovs_bridge: -+ for port_name in current_ovs_bridge.port: -+ port_iface = net_state.ifaces.all_kernel_ifaces.get(port_name) -+ if ( -+ port_iface -+ and port_iface.original_desire_dict.get(Interface.STATE) -+ == InterfaceState.IGNORE -+ ): -+ return True - return False --- -2.32.0 - diff --git a/0004-nispor-fix-show-of-empty-next_hop_address-and-destin.patch b/0004-nispor-fix-show-of-empty-next_hop_address-and-destin.patch deleted file mode 100644 index 40be31b..0000000 --- a/0004-nispor-fix-show-of-empty-next_hop_address-and-destin.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 369ed3210ecedfa1deda88a6eb7cacc19a47f89d Mon Sep 17 00:00:00 2001 -From: Fernando Fernandez Mancera -Date: Mon, 26 Jul 2021 16:13:15 +0200 -Subject: [PATCH 4/4] nispor: fix show of empty next_hop_address and - destination - -The correct way of representing an empty next_hop_address is using -"0.0.0.0" for IPv4 and "::" for IPv6. This configuration is valid -because an user should be able to specify the following routes: - -``` ---- -routes: - config: - - destination: 0.0.0.0/0 - next-hop-address: 0.0.0.0 - next-hop-interface: dummy - - destination: ::/0 - next-hop-address: "::" - next-hop-interface: dummy - -``` - -That means each of the hosts within the range of the route are -considered to be directly connected through that interface. - -For example, using iproute2 the user should introduce the following -command: - -`ip route 0.0.0.0 0.0.0.0 dummy` - -Integration test case added. - -Ref: https://bugzilla.redhat.com/1985879 - -Signed-off-by: Fernando Fernandez Mancera -Signed-off-by: Gris Ge ---- - libnmstate/nispor/route.py | 13 +++++++++---- - 1 file changed, 9 insertions(+), 4 deletions(-) - -diff --git a/libnmstate/nispor/route.py b/libnmstate/nispor/route.py -index 510ddc3..9852ba5 100644 ---- a/libnmstate/nispor/route.py -+++ b/libnmstate/nispor/route.py -@@ -23,6 +23,9 @@ from libnmstate.schema import Route - IPV4_DEFAULT_GATEWAY_DESTINATION = "0.0.0.0/0" - IPV6_DEFAULT_GATEWAY_DESTINATION = "::/0" - -+IPV4_EMPTY_NEXT_HOP_ADDRESS = "0.0.0.0" -+IPV6_EMPTY_NEXT_HOP_ADDRESS = "::" -+ - LOCAL_ROUTE_TABLE = 255 - - -@@ -50,21 +53,23 @@ def nispor_route_state_to_nmstate_static(np_routes): - def _nispor_route_to_nmstate(np_rt): - if np_rt.dst: - destination = np_rt.dst -- elif np_rt.gateway: -+ else: - destination = ( - IPV6_DEFAULT_GATEWAY_DESTINATION - if np_rt.address_family == "ipv6" - else IPV4_DEFAULT_GATEWAY_DESTINATION - ) -- else: -- destination = "" - - if np_rt.via: - next_hop = np_rt.via - elif np_rt.gateway: - next_hop = np_rt.gateway - else: -- next_hop = "" -+ next_hop = ( -+ IPV6_EMPTY_NEXT_HOP_ADDRESS -+ if np_rt.address_family == "ipv6" -+ else IPV4_EMPTY_NEXT_HOP_ADDRESS -+ ) - - return { - Route.TABLE_ID: np_rt.table, --- -2.32.0 - diff --git a/README.md b/README.md index d1ae56e..2642134 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ # nmstate -The nmstate package \ No newline at end of file +The nmstate package + +## Bundle update with rust-netlink and nispor + +When certain nmstate update requires new release of rust-netlink or nispor, +please check this document on correct procedure: + +https://docs.fedoraproject.org/en-US/package-maintainers/Package_Update_Guide/#multiple_packages diff --git a/README.packit b/README.packit new file mode 100644 index 0000000..e03362b --- /dev/null +++ b/README.packit @@ -0,0 +1,3 @@ +This repository is maintained by packit. +https://packit.dev/ +The file was generated using packit 1.12.0.post1.dev13+gd51655c23. diff --git a/nmstate.spec b/nmstate.spec index a441dee..172d11c 100644 --- a/nmstate.spec +++ b/nmstate.spec @@ -1,28 +1,58 @@ -%?python_enable_dependency_generator %define srcname nmstate %define libname libnmstate Name: nmstate -Version: 1.1.0 -Release: 2%{?dist} +Version: 2.2.57 +Release: %autorelease Summary: Declarative network manager API -License: LGPLv2+ +License: Apache-2.0 AND LGPL-2.1-or-later URL: https://github.com/%{srcname}/%{srcname} Source0: %{url}/releases/download/v%{version}/%{srcname}-%{version}.tar.gz Source1: %{url}/releases/download/v%{version}/%{srcname}-%{version}.tar.gz.asc -Source2: nmstate.gpg -Patch1: 0001-nmstatectl-fix-long-arguments-support.patch -Patch2: 0002-nm-ethtool-Preserve-existing-ethtool-settings-when-u.patch -Patch3: 0003-ovs-fix-state-ignore-for-ovs-port-when-removing-them.patch -Patch4: 0004-nispor-fix-show-of-empty-next_hop_address-and-destin.patch -BuildArch: noarch +Source2: https://nmstate.io/nmstate.gpg +Source3: %{url}/releases/download/v%{version}/%{srcname}-vendor-%{version}.tar.xz +# Force nmstate-libs upgrade along with nmstate rpm when installed +# https://issues.redhat.com/browse/RHEL-52890 +Requires: (nmstate-libs%{?_isa} = %{version}-%{release} if nmstate-libs) BuildRequires: python3-devel -BuildRequires: python3-setuptools BuildRequires: gnupg2 BuildRequires: systemd-devel BuildRequires: systemd-rpm-macros -Requires: python3-setuptools -Requires: python3-%{libname} = %{?epoch:%{epoch}:}%{version}-%{release} +%if 0%{?rhel} +BuildRequires: rust-toolset +%else +BuildRequires: rust-packaging +BuildRequires: (crate(clap/cargo) >= 3.1 with crate(clap/cargo) < 4.0) +BuildRequires: (crate(clap/default) >= 3.1 with crate(clap/default) < 4.0) +BuildRequires: (crate(time/std) >= 0.3 with crate(time/std) < 0.4) +BuildRequires: (crate(time/formatting) >= 0.3 with crate(time/formatting) < 0.4) +BuildRequires: (crate(time/parsing) >= 0.3 with crate(time/parsing) < 0.4) +BuildRequires: (crate(env_logger/default) >= 0.11 with crate(env_logger/default) < 0.12) +BuildRequires: (crate(libc/default) >= 0.2 with crate(libc/default) < 0.3) +BuildRequires: (crate(log/default) >= 0.4 with crate(log/default) < 0.5) +BuildRequires: (crate(nispor/default) >= 1.2.27 with crate(nispor/default) < 2.0) +BuildRequires: (crate(serde/default) >= 1.0 with crate(serde/default) < 2.0) +BuildRequires: (crate(serde/derive) >= 1.0 with crate(serde/derive) < 2.0) +BuildRequires: (crate(serde_json/default) >= 1.0 with crate(serde_json/default) < 2.0) +BuildRequires: (crate(serde_yaml/default) >= 0.9 with crate(serde_yaml/default) < 1.0) +BuildRequires: (crate(uuid/v4) >= 1.1 with crate(uuid/v4) < 2.0) +BuildRequires: (crate(uuid/v5) >= 1.1 with crate(uuid/v5) < 2.0) +BuildRequires: (crate(zbus/default) >= 5.1 with crate(zbus/default) < 6.0) +BuildRequires: (crate(zvariant/default) >= 5.1 with crate(zvariant/default) < 6.0) +BuildRequires: (crate(nix/default) >= 0.30 with crate(nix/default) < 0.31) +BuildRequires: (crate(toml/default) >= 0.9 with crate(toml/default) < 1.0) +BuildRequires: (crate(tokio/default) >= 1.3 with crate(tokio/default) < 2.0) +BuildRequires: (crate(tokio/net) >= 1.3 with crate(tokio/net) < 2.0) +BuildRequires: (crate(tokio/rt) >= 1.3 with crate(tokio/rt) < 2.0) +BuildRequires: (crate(tokio/signal) >= 1.3 with crate(tokio/signal) < 2.0) +BuildRequires: (crate(tokio/time) >= 1.3 with crate(tokio/time) < 2.0) +BuildRequires: (crate(once_cell/default) >= 1.12 with crate(once_cell/default) < 2.0) +%endif + +%generate_buildrequires +pushd rust/src/python >/dev/null +%pyproject_buildrequires +popd >/dev/null %description Nmstate is a library with an accompanying command line tool that manages host @@ -31,9 +61,38 @@ needs to manage host networking through a northbound declarative API and multi provider support on the southbound. +%package libs +Summary: C binding of nmstate +# Use Recommends for NetworkManager because only access to NM DBus is required, +# but NM could be running on a different host +Recommends: NetworkManager +# Avoid automatically generated profiles +Recommends: NetworkManager-config-server +License: Apache-2.0 + +%description libs +C binding of nmstate. + +%package devel +Summary: Development files for nmstate +Group: Development/Libraries +Requires: %{name}-libs%{?_isa} = %{version}-%{release} +License: Apache-2.0 + +%description devel +Development files of nmstate C binding. + +%package static +Summary: Static development files for nmstate +Group: Development/Libraries +License: Apache-2.0 +Requires: %{name}-devel%{?_isa} = %{version}-%{release} + +%description static +Static C library bindings for nmstate. + %package -n python3-%{libname} Summary: nmstate Python 3 API library -Requires: NetworkManager-libnm >= 1:1.26.0 # Use Recommends for NetworkManager because only access to NM DBus is required, # but NM could be running on a different host Recommends: NetworkManager @@ -44,238 +103,171 @@ Recommends: (nmstate-plugin-ovsdb if openvswitch) # required for OVS and team support Suggests: NetworkManager-ovs Suggests: NetworkManager-team -# FIXME: Once upstream included nispor into requirement.txt, remove below line -Requires: python3dist(nispor) - -%package -n nmstate-plugin-ovsdb -Summary: nmstate plugin for OVS database manipulation -Requires: python3-%{libname} = %{?epoch:%{epoch}:}%{version}-%{release} -%if 0%{?rhel} -# The python-openvswitch rpm package is not in the same repo with nmstate, -# require only if openvswitch is installed. -Requires: (python3dist(ovs) if openvswitch) -Recommends: python3dist(ovs) -%else -Requires: python3dist(ovs) -%endif - +Provides: nmstate-plugin-ovsdb = %{version}-%{release} +Requires: %{name}-libs%{?_isa} = %{version}-%{release} +Obsoletes: nmstate-plugin-ovsdb < 2.0-1 +License: Apache-2.0 %description -n python3-%{libname} This package contains the Python 3 library for Nmstate. -%description -n nmstate-plugin-ovsdb -This package contains the nmstate plugin for OVS database manipulation. +%if ! 0%{?rhel} +%package -n rust-%{name}-devel +Summary: Rust crate of nmstate +BuildArch: noarch +License: Apache-2.0 + +%description -n rust-%{name}-devel +This package contains library source intended for building other packages +which use "%{name}" crate. + +%package -n rust-%{name}+default-devel +Summary: Rust crate of nmstate with default feature +BuildArch: noarch +License: Apache-2.0 + +%description -n rust-%{name}+default-devel +This package contains library source intended for building other packages +which use "%{name}" crate with default feature. + +%package -n rust-%{name}+gen_conf-devel +Summary: Rust crate of nmstate with default feature +BuildArch: noarch +License: Apache-2.0 + +%description -n rust-%{name}+gen_conf-devel +This package contains library source intended for building other packages +which use "%{name}" crate with gen_conf feature. + +%package -n rust-%{name}+query_apply-devel +Summary: Rust crate of nmstate with query_apply feature +BuildArch: noarch +License: Apache-2.0 +# https://bugzilla.redhat.com/show_bug.cgi?id=2161128 +Requires: (crate(nispor/default) >= 1.2.17 with crate(nispor/default) < 2.0) +Requires: (crate(nix/default) >= 0.26 with crate(nix/default) < 0.27) +Requires: (crate(zbus/default) >= 5.1 with crate(zbus/default) < 6.0) + +%description -n rust-%{name}+query_apply-devel +This package contains library source intended for building other packages +which use "%{name}" crate with query_apply feature. + +%package -n rust-%{name}+gen_revert-devel +Summary: Rust crate of nmstate with gen_revert feature +BuildArch: noarch +License: Apache-2.0 + +%description -n rust-%{name}+gen_revert-devel +This package contains library source intended for building other packages +which use "%{name}" crate with gen_revert feature. +%endif %prep -gpg2 --import --import-options import-export,import-minimal %{SOURCE2} > ./gpgkey-mantainers.gpg +gpg2 --import --import-options import-export,import-minimal \ + %{SOURCE2} > ./gpgkey-mantainers.gpg gpgv2 --keyring ./gpgkey-mantainers.gpg %{SOURCE1} %{SOURCE0} -%setup -q + +%autosetup -n %{name}-%{version_no_tilde} -p1 %{?rhel:-a3} + +pushd rust +%if 0%{?rhel} +mv ../vendor ./ +%cargo_prep -v vendor +%else +%cargo_prep +%endif +popd %build -%py3_build +pushd rust +%cargo_build +%cargo_license_summary +%{cargo_license} > ../LICENSE.dependencies +%if 0%{?rhel} +%cargo_vendor_manifest +%endif +popd + +pushd rust/src/python +%pyproject_wheel +popd %install -%py3_install -mkdir -p %{buildroot}%{_unitdir} -install -p -m 644 %{buildroot}%{python3_sitelib}/nmstatectl/nmstate-varlink.service \ - %{buildroot}%{_unitdir}/nmstate-varlink.service +env SKIP_PYTHON_INSTALL=1 \ + PREFIX=%{_prefix} \ + LIBDIR=%{_libdir} \ + SYSCONFDIR=%{_sysconfdir} \ + %make_install + +pushd rust/src/python +%pyproject_install +popd + +%if ! 0%{?rhel} +pushd rust/src/lib +# Fedora cargo2rpm has problem when working with worksace dependency +# https://pagure.io/fedora-rust/cargo2rpm/issue/13 +# we use `cargo package` to generate the expanded Cargo.toml which +# is also the one used in crates.io +cargo package --frozen --no-verify --target-dir %{_tmppath} +tar xf %{_tmppath}/package/nmstate-%{version}.crate \ + nmstate-%{version}/Cargo.toml +mv nmstate-%{version}/Cargo.toml ./Cargo.toml +# Remove worksapce Cargo.toml +rm ../../Cargo.toml +%cargo_install +popd +%endif %files %doc README.md +%license LICENSE.dependencies +%if 0%{?rhel} +%license rust/cargo-vendor.txt +%endif %doc examples/ %{_mandir}/man8/nmstatectl.8* %{_mandir}/man8/nmstate-autoconf.8* -%{python3_sitelib}/nmstatectl +%{_mandir}/man8/nmstate.service.8* %{_bindir}/nmstatectl %{_bindir}/nmstate-autoconf -%{_unitdir}/nmstate-varlink.service +%{_unitdir}/nmstate.service +%dir %{_sysconfdir}/%{name} +%{_sysconfdir}/%{name}/README + +%files libs +%{_libdir}/libnmstate.so.* + +%files devel +%{_libdir}/libnmstate.so +%{_includedir}/nmstate.h +%{_libdir}/pkgconfig/nmstate.pc %files -n python3-%{libname} %license LICENSE %{python3_sitelib}/%{libname} -%{python3_sitelib}/%{srcname}-*.egg-info/ -%exclude %{python3_sitelib}/%{libname}/plugins/nmstate_plugin_* -%exclude %{python3_sitelib}/%{libname}/plugins/__pycache__/nmstate_plugin_* +%{python3_sitelib}/%{srcname}-*.dist-info/ -%files -n nmstate-plugin-ovsdb -%{python3_sitelib}/%{libname}/plugins/nmstate_plugin_ovsdb* -%{python3_sitelib}/%{libname}/plugins/__pycache__/nmstate_plugin_ovsdb* +%files static +%{_libdir}/libnmstate.a + +%if ! 0%{?rhel} +%files -n rust-%{name}-devel +%license LICENSE +%{cargo_registry}/%{name}-%{version}/ + +%files -n rust-%{name}+default-devel +%ghost %{cargo_registry}/%{name}-%{version}/Cargo.toml + +%files -n rust-%{name}+gen_conf-devel +%ghost %{cargo_registry}/%{name}-%{version}/Cargo.toml + +%files -n rust-%{name}+query_apply-devel +%ghost %{cargo_registry}/%{name}-%{version}/Cargo.toml + +%files -n rust-%{name}+gen_revert-devel +%ghost %{cargo_registry}/%{name}-%{version}/Cargo.toml +%endif %changelog -* Tue Jul 27 2021 Gris Ge - 1.1.0-2 -- Add varlink service back. - -* Tue Jul 27 2021 Gris Ge - 1.1.0-1 -- Upgrade to 1.1.0 - -* Thu Jul 22 2021 Fedora Release Engineering - 1.0.3-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Fri Jun 04 2021 Python Maint - 1.0.3-3 -- Rebuilt for Python 3.10 - -* Mon Apr 19 2021 Fernando Fernandez Mancera - 1.0.3-2 -- Fix installation nmstate-varlink.service - -* Thu Apr 15 2021 Fernando Fernandez Mancera - 1.0.3-1 -- Upgrade to 1.0.3 - -* Sun Feb 21 2021 Fernando Fernandez Mancera - 1.0.2-1 -- Upgrade to 1.0.2 - -* Tue Jan 26 2021 Fedora Release Engineering - 1.0.1-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Tue Jan 19 2021 Fernando Fernandez Mancera - 1.0.1-1 -- Upgrade to 1.0.1 - -* Tue Dec 08 2020 Fernando Fernandez Mancera - 1.0.0-1 -- Upgrade to 1.0.0 - -* Thu Oct 22 2020 Fernando Fernandez Mancera - 0.4.1-1 -- Upgrade to 0.4.1 - -* Tue Oct 13 2020 Gris Ge - 0.4.0-2 -- Fix the ELN build by put ovs stuff as soft requirement. - -* Sun Sep 20 2020 Gris Ge - 0.4.0-1 -- Upgrade to 0.4.0 - -* Mon Aug 31 2020 Fernando Fernandez Mancera - 0.3.5-1 -- Update to 0.3.5 - -* Tue Jul 28 2020 Fedora Release Engineering - 0.3.4-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Sat Jul 25 2020 Fernando Fernandez Mancera - 0.3.4-1 -- Update to 0.3.4 -- Sync. with upstream specfile - -* Thu Jul 02 2020 Fernando Fernandez Mancera - 0.3.3-1 -- Update to 0.3.3 - -* Tue Jun 16 2020 Fernando Fernandez Mancera - 0.3.2-1 -- Update to 0.3.2 -- Sync with upstream specfile - -* Tue Jun 09 2020 Fernando Fernandez Mancera - 0.3.1-1 -- Update to 0.3.1 - -* Tue May 26 2020 Miro Hrončok - 0.3.0-5 -- Rebuilt for Python 3.9 - -* Fri May 08 2020 Fernando Fernandez Mancera - 0.3.0-4 -- Fix source path - -* Fri May 08 2020 Fernando Fernandez Mancera - 0.3.0-3 -- Fix signature verification - -* Fri May 08 2020 Fernando Fernandez Mancera - 0.3.0-2 -- Update signature verification - -* Fri May 08 2020 Fernando Fernandez Mancera - 0.3.0-1 -- Update to 0.3.0 -- Sync with upstream specfile - -* Tue Apr 21 2020 Fernando Fernandez Mancera - 0.2.10-1 -- Update to 0.2.10 - -* Thu Mar 26 2020 Fernando Fernandez Mancera - 0.2.9-1 -- Update to 0.2.9 - -* Fri Mar 13 2020 Fernando Fernandez Mancera - 0.2.8-1 -- Update to 0.2.8 - -* Wed Mar 04 2020 Fernando Fernandez Mancera - 0.2.7-1 -- Update to 0.2.7 - -* Mon Feb 24 2020 Fernando Fernandez Mancera - 0.2.6-1 -- Update to 0.2.6 - -* Wed Feb 19 2020 Fernando Fernandez Mancera - 0.2.5-1 -- Update to 0.2.5 -- Sync with upstream specfile - -* Wed Feb 12 2020 Fernando Fernandez Mancera - 0.2.4-1 -- Update to 0.2.4 - -* Wed Feb 05 2020 Fernando Fernandez Mancera - 0.2.3-1 -- Update to 0.2.3 - -* Tue Feb 04 2020 Fernando Fernandez Mancera - 0.2.2-1 -- Update to 0.2.2 -- Sync with upstream specfile - -* Wed Jan 29 2020 Fedora Release Engineering - 0.2.1-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Tue Jan 14 2020 Fernando Fernandez Mancera - 0.2.1-2 -- Fix changelog - -* Tue Jan 14 2020 Fernando Fernandez Mancera - 0.2.1-1 -- Update to 0.2.1 - -* Tue Dec 03 2019 Fernando Fernandez Mancera - 0.2.0-2 -- Fix changelog - -* Tue Dec 03 2019 Fernando Fernandez Mancera - 0.2.0-1 -- Update to 0.2.0 - -* Mon Dec 02 2019 Till Maas - 0.1.1-1 -- Update to 0.1.1 -- Sync with upstream specfile - -* Thu Oct 03 2019 Miro Hrončok - 0.0.8-3 -- Rebuilt for Python 3.8.0rc1 (#1748018) - -* Mon Aug 19 2019 Miro Hrončok - 0.0.8-2 -- Rebuilt for Python 3.8 - -* Fri Jul 26 2019 Gris Ge - 0.0.8-1 -- Upgrade to 0.0.8. - -* Thu Jul 25 2019 Fedora Release Engineering - 0.0.7-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Fri Jun 14 2019 Gris Ge - 0.0.7-2 -- Workaround broken dbus-python packaging: - https://bugzilla.redhat.com/show_bug.cgi?id=1654774 - -* Fri Jun 14 2019 Gris Ge - 0.0.7-1 -- Upgrade to 0.0.7 - -* Sun May 05 2019 Gris Ge - 0.0.6-1 -- Upgrade to 0.0.6 - -* Fri Apr 12 2019 Gris Ge - 0.0.5-1 -- Upgrade to 0.0.5 - -* Fri Feb 01 2019 Fedora Release Engineering - 0.0.4-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Tue Jan 29 2019 Till Maas - 0.0.4-2 -- Sync with upstream spec -- Use Recommends for NetworkManager -- Add Suggests for NetworkManager-ovs -- package examples as doc - -* Thu Jan 24 2019 Gris Ge - 0.0.4-1 -- Upgrade to 0.0.4. - -* Mon Jan 21 2019 Gris Ge - 0.0.3-3 -- Add missing runtime dependency for nmstatectl. - -* Wed Jan 02 2019 Gris Ge - 0.0.3-2 -- Add source file PGP verification. - -* Thu Dec 20 2018 Gris Ge - 0.0.3-1 -- Upgrade to 0.0.3. - -* Mon Dec 03 2018 Gris Ge - 0.0.2-2 -- Trival RPM SPEC fix. - -* Wed Nov 28 2018 Gris Ge - 0.0.2-1 -- Initial release. +%autochangelog diff --git a/sources b/sources index abecfea..93fcb0a 100644 --- a/sources +++ b/sources @@ -1,3 +1,4 @@ -SHA512 (nmstate-1.1.0.tar.gz) = f99e4fdcc0317d0b3d88e8281f5f222adcce4b8ce2d6c2f48858c934219d61701af75e416e04fc03416ce9c7787ec989673c20208b9efe0fe7bf3346a7f48373 -SHA512 (nmstate-1.1.0.tar.gz.asc) = 9bd8075b08ccadefb3920a78ab569e36991bce34e9c527913da35a307e40a74b162d91a9517827c0043394ec2fa5604f2d81c361a763aaf9c11c133999376a3b -SHA512 (nmstate.gpg) = af6af2024ea46b5c87c6c71d4be278ce4eed58c1783385619987fe8e254eb599f9b218897e7db67050b0e9f7101b206561f63218fda18a0d95103a04682c8309 +SHA512 (nmstate-2.2.57.tar.gz) = b203455ce70e8c2f0e0d67d0b57ded8da1a8a6492bc636412b4682d15453cdb694cf33b1c84498ab50e3a42a79d3a763ef3316943b356ccab5f858df03fd0a63 +SHA512 (nmstate-2.2.57.tar.gz.asc) = 972de00f4b4e18410c5aa6a6d23606ceda496c18747f7ba95e6602f21f24f8b3eaffe1d3e82aaf3e529592989f12ce1198b40c8b83abb6b7d108666b56ec7359 +SHA512 (nmstate.gpg) = e465239bc2a037457c5cb105f69cb033c092708285689f906b5e40cae01e12629bec1cdee7eb6aa3a327e4fc93dfd5ce0e006b295fe5ced8df039f9098cef0bc +SHA512 (nmstate-vendor-2.2.57.tar.xz) = 88c69f1f20367acd858b25bb0e834ae7b21b4291d90b0ed62dd33c9a427f845b98fa56ba6b8d4228bc6c807f2293d77f4cd6ed7a568e6ceff19c875ef3bea6dd diff --git a/tests/cli_query_reapply.sh b/tests/cli_query_reapply.sh index 50cba9d..492857d 100755 --- a/tests/cli_query_reapply.sh +++ b/tests/cli_query_reapply.sh @@ -2,6 +2,8 @@ TMP_FILE=$(mktemp /tmp/nmstate.XXXXXX.yaml) -nmstatectl show > $TMP_FILE 2>/dev/null +nmstatectl show > $TMP_FILE -nmstatectl set $TMP_FILE 2>/dev/null +cat $TMP_FILE + +nmstatectl set $TMP_FILE 2>&1