diff --git a/.gitignore b/.gitignore index 229737a..7f1d57a 100644 --- a/.gitignore +++ b/.gitignore @@ -91,81 +91,3 @@ /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/0001-Workaround-for-Fedora-rust-packaging.patch b/0001-Workaround-for-Fedora-rust-packaging.patch new file mode 100644 index 0000000..15cd542 --- /dev/null +++ b/0001-Workaround-for-Fedora-rust-packaging.patch @@ -0,0 +1,33 @@ +From a78d7610a7a3adc4cd80433bdded7d37e738eb12 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Mon, 16 Jan 2023 11:56:16 +0800 +Subject: [PATCH] Workaround for Fedora rust packaging + +Signed-off-by: Gris Ge +--- + rust/src/lib/Cargo.toml | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/rust/src/lib/Cargo.toml b/rust/src/lib/Cargo.toml +index 801b3e33..67c7f3dd 100644 +--- a/rust/src/lib/Cargo.toml ++++ b/rust/src/lib/Cargo.toml +@@ -9,7 +9,7 @@ documentation = "https://nmstate.io" + repository = "https://github.com/nmstate/nmstate" + keywords = ["network", "linux"] + categories = ["network-programming", "os::linux-apis"] +-rust-version = "1.58" ++rust-version = "1.60" + edition = "2018" + + [lib] +@@ -62,5 +62,5 @@ serde_yaml = "0.9" + + [features] + default = ["query_apply", "gen_conf"] +-query_apply = ["nispor", "nix", "zbus"] ++query_apply = ["dep:nispor", "dep:nix", "dep:zbus"] + gen_conf = [] +-- +2.39.0 + diff --git a/0002-Upgrade-to-nix-0.26-and-env_logger-0.10.patch b/0002-Upgrade-to-nix-0.26-and-env_logger-0.10.patch new file mode 100644 index 0000000..5281828 --- /dev/null +++ b/0002-Upgrade-to-nix-0.26-and-env_logger-0.10.patch @@ -0,0 +1,71 @@ +From f9d3f0cdcabfa18d465068508d7b69b2a65823bc Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Thu, 23 Mar 2023 21:35:08 +0800 +Subject: [PATCH] dependency: Upgrade to nix 0.26 and env_logger 0.10 + +Signed-off-by: Gris Ge +--- + rust/src/cli/Cargo.toml | 2 +- + rust/src/lib/Cargo.toml | 2 +- + rust/src/lib/nispor/hostname.rs | 14 +++++++++----- + 3 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/rust/src/cli/Cargo.toml b/rust/src/cli/Cargo.toml +index 350c9fcc..2902804a 100644 +--- a/rust/src/cli/Cargo.toml ++++ b/rust/src/cli/Cargo.toml +@@ -21,7 +21,7 @@ nmstate = {path = "../lib", version = "2.2", default-features = false} + serde_yaml = "0.9" + clap = { version = "3.1", features = ["cargo"] } + serde = { version = "1.0", features = ["derive"] } +-env_logger = "0.9.0" ++env_logger = "0.10.0" + log = "0.4.14" + serde_json = "1.0.75" + ctrlc = { version = "3.2.1", optional = true } +diff --git a/rust/src/lib/Cargo.toml b/rust/src/lib/Cargo.toml +index 721fe6a3..4a6b6b3e 100644 +--- a/rust/src/lib/Cargo.toml ++++ b/rust/src/lib/Cargo.toml +@@ -55,7 +55,7 @@ default-features = false + features = ["derive"] + + [dependencies.nix] +-version = "0.24.1" ++version = "0.26.0" + optional = true + default-features = false + features = ["feature", "hostname"] +diff --git a/rust/src/lib/nispor/hostname.rs b/rust/src/lib/nispor/hostname.rs +index 517bf7c7..5e9f1ba8 100644 +--- a/rust/src/lib/nispor/hostname.rs ++++ b/rust/src/lib/nispor/hostname.rs +@@ -1,3 +1,5 @@ ++// SPDX-License-Identifier: Apache-2.0 ++ + use std::io::Read; + + use crate::{ErrorKind, HostNameState, NmstateError}; +@@ -5,12 +7,14 @@ use crate::{ErrorKind, HostNameState, NmstateError}; + const HOST_NAME_MAX: usize = 64; + + pub(crate) fn get_hostname_state() -> Option { +- let mut buffer = [0u8; HOST_NAME_MAX]; +- let running = match nix::unistd::gethostname(&mut buffer) { ++ let running = match nix::unistd::gethostname() { + Ok(hostname_cstr) => match hostname_cstr.to_str() { +- Ok(h) => Some(h.to_string()), +- Err(e) => { +- log::error!("Failed to convert hostname to String: {}", e); ++ Some(h) => Some(h.to_string()), ++ None => { ++ log::error!( ++ "Failed to convert hostname from OsString \ ++ to String: {hostname_cstr:?}" ++ ); + None + } + }, +-- +2.40.0 + diff --git a/README.md b/README.md index 2642134..d1ae56e 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,3 @@ # nmstate -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 +The nmstate package \ No newline at end of file diff --git a/README.packit b/README.packit deleted file mode 100644 index e03362b..0000000 --- a/README.packit +++ /dev/null @@ -1,3 +0,0 @@ -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 172d11c..be2a230 100644 --- a/nmstate.spec +++ b/nmstate.spec @@ -2,57 +2,44 @@ %define libname libnmstate Name: nmstate -Version: 2.2.57 +Version: 2.2.9 Release: %autorelease Summary: Declarative network manager API -License: Apache-2.0 AND LGPL-2.1-or-later +License: LGPLv2+ 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: 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) +# We use `dep: dep_name` to prevent rust packaging generate incorect dependency +# https://bugzilla.redhat.com/show_bug.cgi?id=2161128 +# but list Requires manually +Patch1: 0001-Workaround-for-Fedora-rust-packaging.patch +Patch2: 0002-Upgrade-to-nix-0.26-and-env_logger-0.10.patch +BuildRequires: patchelf BuildRequires: python3-devel +BuildRequires: python3-setuptools BuildRequires: gnupg2 BuildRequires: systemd-devel BuildRequires: systemd-rpm-macros -%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(chrono/default) >= 0.4 with crate(chrono/default) < 0.5) +BuildRequires: (crate(ctrlc/default) >= 3.2 with crate(ctrlc/default) < 4.0) +BuildRequires: (crate(env_logger/default) >= 0.10 with crate(env_logger/default) < 0.11) +BuildRequires: (crate(ipnet/default) >= 2.5 with crate(ipnet/default) < 3.0) 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(nispor/default) >= 1.2.10 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 +BuildRequires: (crate(zbus/default) >= 1.9 with crate(zbus/default) < 2.0) +BuildRequires: (crate(zvariant/default) >= 2.10 with crate(zvariant/default) < 3.0) +BuildRequires: (crate(nix/default) >= 0.26 with crate(nix/default) < 0.27) %description Nmstate is a library with an accompanying command line tool that manages host @@ -68,7 +55,7 @@ Summary: C binding of nmstate Recommends: NetworkManager # Avoid automatically generated profiles Recommends: NetworkManager-config-server -License: Apache-2.0 +License: ASL 2.0 %description libs C binding of nmstate. @@ -77,7 +64,7 @@ C binding of nmstate. Summary: Development files for nmstate Group: Development/Libraries Requires: %{name}-libs%{?_isa} = %{version}-%{release} -License: Apache-2.0 +License: ASL 2.0 %description devel Development files of nmstate C binding. @@ -85,7 +72,6 @@ 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 @@ -106,16 +92,13 @@ Suggests: NetworkManager-team 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. -%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 @@ -124,7 +107,6 @@ 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 @@ -133,63 +115,41 @@ 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 +Summary: Rust crate of nmstate with default 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) +Requires: (crate(nispor/default) >= 1.2.9 with crate(nispor/default) < 2.0) +Requires: (crate(nix/default) >= 0.24 with crate(nix/default) < 0.25) +Requires: (crate(zbus/default) >= 1.9 with crate(zbus/default) < 2.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 gpgv2 --keyring ./gpgkey-mantainers.gpg %{SOURCE1} %{SOURCE0} - -%autosetup -n %{name}-%{version_no_tilde} -p1 %{?rhel:-a3} +%autosetup -p1 pushd rust -%if 0%{?rhel} -mv ../vendor ./ -%cargo_prep -v vendor -%else +rm .cargo/config.toml %cargo_prep -%endif popd %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 +%py3_build popd %install @@ -198,33 +158,23 @@ env SKIP_PYTHON_INSTALL=1 \ LIBDIR=%{_libdir} \ SYSCONFDIR=%{_sysconfdir} \ %make_install +patchelf --set-soname libnmstate.so.2 \ + %{buildroot}/%{_libdir}/libnmstate.so.%{version} pushd rust/src/python -%pyproject_install +%py3_install popd -%if ! 0%{?rhel} +# cargo_install has problem on detecting library when running in workspace +# due to bug https://pagure.io/fedora-rust/cargo2rpm/issue/5 +# Removing the workspace Cargo.toml will workaround this problem. +rm rust/Cargo.toml 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* @@ -246,12 +196,11 @@ popd %files -n python3-%{libname} %license LICENSE %{python3_sitelib}/%{libname} -%{python3_sitelib}/%{srcname}-*.dist-info/ +%{python3_sitelib}/%{srcname}-*.egg-info/ %files static %{_libdir}/libnmstate.a -%if ! 0%{?rhel} %files -n rust-%{name}-devel %license LICENSE %{cargo_registry}/%{name}-%{version}/ @@ -265,9 +214,5 @@ popd %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 %autochangelog diff --git a/sources b/sources index 93fcb0a..898443e 100644 --- a/sources +++ b/sources @@ -1,4 +1,3 @@ -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 +SHA512 (nmstate.gpg) = 91c6b1d8aef4944520d4bdd4e90121bbbbaf772444f5eb6081cee81e17b21b66798437cdc09a117c6fc77c54d798aaa30400857aa090cb2102b47841f45cf6eb +SHA512 (nmstate-2.2.9.tar.gz) = 117ed9a903be298691883b87b0727d4bddb6dfb744023611e645c87602bfec578008db38d21dde4279dc8ff2dc7b0838ab35248ddb5e250484cc694003f93094 +SHA512 (nmstate-2.2.9.tar.gz.asc) = 1bcde90966d188d94ef02c6d4b00f8cb63f6d4e0115c4f1900d13eb4b59c9fd21891b7eaea7e240465899b281c8e4ea340b7ce6326c217b6eede0cca8859425e diff --git a/tests/cli_query_reapply.sh b/tests/cli_query_reapply.sh index 492857d..50cba9d 100755 --- a/tests/cli_query_reapply.sh +++ b/tests/cli_query_reapply.sh @@ -2,8 +2,6 @@ TMP_FILE=$(mktemp /tmp/nmstate.XXXXXX.yaml) -nmstatectl show > $TMP_FILE +nmstatectl show > $TMP_FILE 2>/dev/null -cat $TMP_FILE - -nmstatectl set $TMP_FILE 2>&1 +nmstatectl set $TMP_FILE 2>/dev/null