import CS nmstate-1.4.6-2.el8

This commit is contained in:
eabdullin 2024-07-03 08:39:18 +00:00
parent 0bc8b1a931
commit f405b7806f
7 changed files with 91 additions and 189 deletions

4
.gitignore vendored
View File

@ -1,2 +1,2 @@
SOURCES/nmstate-1.4.5.tar.gz
SOURCES/nmstate-vendor-1.4.5.tar.xz
SOURCES/nmstate-1.4.6.tar.gz
SOURCES/nmstate-vendor-1.4.6.tar.xz

View File

@ -1,2 +1,2 @@
cd4f8e938eabaf7e70fb251c06e477ba3bc9d8c8 SOURCES/nmstate-1.4.5.tar.gz
4735ef08c31684624a7844832cc2ba20e67983f6 SOURCES/nmstate-vendor-1.4.5.tar.xz
2c5d46ae03fe2d836e165aa3562f03386d215fdf SOURCES/nmstate-1.4.6.tar.gz
4735ef08c31684624a7844832cc2ba20e67983f6 SOURCES/nmstate-vendor-1.4.6.tar.xz

View File

@ -0,0 +1,60 @@
From 0b530d4c8e75f60015d13c225b1c634389fbe798 Mon Sep 17 00:00:00 2001
From: Gris Ge <fge@redhat.com>
Date: Fri, 17 May 2024 13:12:14 +0800
Subject: [PATCH] clib: Use build.rs to fix SONAME
Use [`cargo:rustc-cdylib-link-arg`][1] to `build.rs` to fix the SONAME issue
of cargo.
Removed workarounds in rpm spec and `.cargo/config.toml`.
Changed Makefile to place `-lnmstate` after the source file to fix
compile issue on ubuntu 20.04 old gcc.
[1]: https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-cdylib-link-arg
Signed-off-by: Gris Ge <fge@redhat.com>
---
rust/.cargo/config.toml | 3 ---
rust/src/clib/Cargo.toml | 1 +
rust/src/clib/build.rs | 6 ++++++
3 files changed, 7 insertions(+), 3 deletions(-)
create mode 100644 rust/src/clib/build.rs
diff --git a/rust/.cargo/config.toml b/rust/.cargo/config.toml
index 018e59d4..ca6c72f7 100644
--- a/rust/.cargo/config.toml
+++ b/rust/.cargo/config.toml
@@ -1,5 +1,2 @@
-[build]
-rustflags = "-Clink-arg=-Wl,-soname=libnmstate.so.1"
-
[target.x86_64-unknown-linux-gnu]
runner = 'sudo -E'
diff --git a/rust/src/clib/Cargo.toml b/rust/src/clib/Cargo.toml
index 462757ca..0eb00922 100644
--- a/rust/src/clib/Cargo.toml
+++ b/rust/src/clib/Cargo.toml
@@ -6,6 +6,7 @@ authors = ["Gris Ge <fge@redhat.com>"]
license = "Apache-2.0"
edition = "2018"
rust-version = "1.58"
+build = "build.rs"
[lib]
name = "nmstate"
diff --git a/rust/src/clib/build.rs b/rust/src/clib/build.rs
new file mode 100644
index 00000000..74ad7e48
--- /dev/null
+++ b/rust/src/clib/build.rs
@@ -0,0 +1,6 @@
+// SPDX-License-Identifier: Apache-2.0
+
+fn main() {
+ #[cfg(target_os = "linux")]
+ println!("cargo:rustc-cdylib-link-arg=-Wl,-soname=libnmstate.so.1");
+}
--
2.45.1

View File

@ -1,157 +0,0 @@
From c95e26154cfe105faedb6fe6187e89da658e6d02 Mon Sep 17 00:00:00 2001
From: Gris Ge <fge@redhat.com>
Date: Tue, 14 Nov 2023 16:08:35 +0800
Subject: [PATCH 1/2] dns: Fix DNS option `ndots`, `timeout` and `attempts`
The `ndots`, `timeout` and `attempts` DNS options are allowed to
hold a integer value in the format of `<opt_name>:<int>`. Previously,
nmstate is treating them as invalid DNS option. This patch fix it.
Now this YAML is supported:
```yml
dns-resolver:
config:
options:
- rotate
- ndots:9
```
Integration test cases included.
Signed-off-by: Gris Ge <fge@redhat.com>
---
libnmstate/dns.py | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/libnmstate/dns.py b/libnmstate/dns.py
index f792b896..5bb512e8 100644
--- a/libnmstate/dns.py
+++ b/libnmstate/dns.py
@@ -19,14 +19,12 @@ EMPTY_DNS = {
REMOVE_DNS_CONFIG = {DNS.CONFIG: EMPTY_DNS}
-SUPPORTED_DNS_OPTIONS = [
- "attempts",
+SUPPORTED_DNS_OPTS_NO_VALUE = [
"debug",
"edns0",
"inet6",
"ip6-bytestring",
"ip6-dotint",
- "ndots",
"no-aaaa",
"no-check-names",
"no-ip6-dotint",
@@ -35,11 +33,16 @@ SUPPORTED_DNS_OPTIONS = [
"rotate",
"single-request",
"single-request-reopen",
- "timeout",
"trust-ad",
"use-vc",
]
+SUPPORTED_DNS_OPTS_WITH_VALUE = [
+ "ndots",
+ "timeout",
+ "attempts",
+]
+
class DnsState:
PRIORITY_METADATA = "_priority"
@@ -73,10 +76,24 @@ class DnsState:
def _canonicalize_dns_options(self):
for opt in self.config_options:
- if opt not in SUPPORTED_DNS_OPTIONS:
+ if opt.find(":") > 0:
+ opt = opt[: opt.find(":")]
+ if opt not in SUPPORTED_DNS_OPTS_WITH_VALUE:
+ raise NmstateValueError(
+ "Option '{}' is not supported to hold "
+ "a value, only support these without "
+ "value: {} and these with values: {}:n",
+ opt,
+ ", ".join(SUPPORTED_DNS_OPTS_NO_VALUE),
+ ":n, ".join(SUPPORTED_DNS_OPTS_WITH_VALUE),
+ )
+ elif opt not in SUPPORTED_DNS_OPTS_NO_VALUE:
raise NmstateValueError(
- f"Unsupported DNS option {opt}, only support: "
- f"{', '.join(SUPPORTED_DNS_OPTIONS)}",
+ "Option '{}' is not supported, only support these "
+ "without value: {} and these with values: {}:n",
+ opt,
+ ", ".join(SUPPORTED_DNS_OPTS_NO_VALUE),
+ ":n, ".join(SUPPORTED_DNS_OPTS_WITH_VALUE),
)
@property
--
2.42.1
From af07271ec5044ec092a3b66c0955636819ccde04 Mon Sep 17 00:00:00 2001
From: Gris Ge <fge@redhat.com>
Date: Tue, 14 Nov 2023 16:16:53 +0800
Subject: [PATCH 2/2] dns: Fix purging DNS config
When user desires:
```yml
---
dns-resolver:
config:
search: []
```
It means user want to remove all search but preserve servers and
options, current nmstate incorrectly treat this as purge also.
This patch only treat these two as purge.
```yml
dns-resolver:
config: {}
```
and
```yml
dns-resolver:
config:
server: []
search: []
options: []
```
Integration test cases included.
Signed-off-by: Gris Ge <fge@redhat.com>
---
libnmstate/nm/dns.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libnmstate/nm/dns.py b/libnmstate/nm/dns.py
index 60ebbba7..b811fdb2 100644
--- a/libnmstate/nm/dns.py
+++ b/libnmstate/nm/dns.py
@@ -158,7 +158,11 @@ def get_dns_config_iface_names(acs_and_ipv4_profiles, acs_and_ipv6_profiles):
for nm_ac, ip_profile in chain(
acs_and_ipv6_profiles, acs_and_ipv4_profiles
):
- if ip_profile.props.dns or ip_profile.props.dns_search:
+ if (
+ ip_profile.props.dns
+ or ip_profile.props.dns_search
+ or ip_profile.props.dns_options
+ ):
try:
iface_name = nm_ac.get_devices()[0].get_iface()
iface_names.append(iface_name)
--
2.42.1

View File

@ -1,16 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEESP1vrlFad7SENoIch4lWe4cVzrwFAmVDid0ACgkQh4lWe4cV
zrx26BAAqv8ec7UMDkJ7MGAXwRpMZrLQ+zjPIDlVH0HVmdvZY2g8Lx2iK9g0xHeL
YGdVk3aL3UwQE/5Tt6qtzQ8sk76dWyveS1XxxNDLZa+TKvcGqDbxnmvOAIBJwrlD
4Q6MNWqudJDsboGotKSAoI/xHJafFzWfHU+SSp4AHtf2xHa2KFZqmaZW5gVdYq9j
/Zhepz8OQ+1s8/frVw1JEqKaTcw5gc0/2xNzh0MkC714Lkk4dhITHP6zh1HF/2i8
LPIdVHMI8Ze7w4imiamr38+G3XzCQJ/6A/N6couFyJXrLgCn0Jm7Zv8t3TLW69JA
QD/YHcFgeZmh3QRHVoNIOunG7X7eczLjy61VVXMp3F38+GWSLxK2f7DMRyzRvIxF
uBrd9yBZ4qkSEqIG2tEBIZOPg4deDADaesyD3d5c0JROsmxkmhl9SEBk03qWtJEY
kWhCF4tGvVp1r+W7AjS6QpqAtFXJcBQdj1qs49fgRxVGjmw2ljMQdLT6O/oSFNpS
wzjvGhh8WvMcmStCQ0crTOeihYTyJu2PPqJ3c373EnE9xPN3cJVh+AGwV5kcpxkk
bJF8qooJDq7MAuNqiKdXORGzG0ht16TzJ4aE+1vGFAErYZitCzU13rkW3dKIU19h
KgFqlKXUHCS6J3KzJQszDpn+Hw8WOvcCQQ1LivcyLKHlvmTQPi4=
=51yt
-----END PGP SIGNATURE-----

View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEESP1vrlFad7SENoIch4lWe4cVzrwFAmZFuTcACgkQh4lWe4cV
zrx0Jg/9FaBh+ine42rKdD+vSITPnGMB2pNSgU8RMdb35fpypVE6Fx4zavvlN14r
rqO+DA57n2NAQ0Cj+n1HOaCxzbfYG2hAX8NwuFN3iY/KadqUdjdPx9G8vEzZDOFu
MCRZxUVIyrHBB9eoTLbhF6hd0XqWminHK43xaLZFBXZAe7DO9QEz+VxM77qsZaE5
EhxASs2mUERvjuY61h9lJb41DOxGLZBM5950S9lDM8cE9ZOi7H/8Q/8fhBPdHh5T
ubPZxsgEBQPEBPz6lE5g4Wcc8ggiCROEuUqRmOTpkb6smgFDsLtCBTakv1Z2U5Q0
YKdnDBfw7T9EV3dhkHR/AHvrLDUZ/bTwe6vO0GQBaSLG/WhvcftzuiDKTcqpAVOm
yUdxla1tinB0cDXohGb50VV9aHd9gFisoLGsPE7BJTqSKhCoQL2zToLHNaMnxNtz
/fJTOyGq1bBtchjbXjaoQO8sa/cxrllWlBYVjaTH7vqwgActrznos/N1sASrMfTw
H1VCKRgwurnomWoIbFNKxPnXNW0Lo31paWhW9wVD78J7Kf9xHrfYiOK2siYgSP7x
nVMuMHZ/j9/EOgHZAPZN3Aod0LWK0/WNwTyFB4IQcLWLaBYVhqlFhShtPo8MeIsJ
Wy7UQmGhtnP8Mt1DQTsfWCH8lQnWpIb84xHYXSEs+2e39GRDCq8=
=lwjx
-----END PGP SIGNATURE-----

View File

@ -3,7 +3,7 @@
%define libname libnmstate
Name: nmstate
Version: 1.4.5
Version: 1.4.6
Release: 2%{?dist}
Summary: Declarative network manager API
License: LGPLv2+
@ -14,7 +14,7 @@ Source2: https://www.nmstate.io/nmstate.gpg
Source3: %{url}/releases/download/v%{version}/%{srcname}-vendor-%{version}.tar.xz
# Patches 0X are reserved to downstream only
Patch0: BZ_2132570-nm-reverse-IPv6-order-before-adding-them-to-setting.patch
Patch10: RHEL-13936-dns-opt-fix.patch
Patch10: 0001-clib-Use-build.rs-to-fix-SONAME.patch
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: gnupg2
@ -84,22 +84,15 @@ gpgv2 --keyring ./gpgkey-mantainers.gpg %{SOURCE1} %{SOURCE0}
pushd rust
# Source3 is vendored dependencies
%cargo_prep -V 3
# The cargo_prep will create `.cargo/config` which take precedence over
# `.cargo/config.toml` shipped by upstream which fix the SONAME of cdylib.
# To workaround that, merge upstream rustflags into cargo_prep created one.
_FLAGS=`sed -ne 's/rustflags = "\(.\+\)"/\1/p' .cargo/config.toml`
sed -i -e "s/rustflags = \[\(.\+\), \]$/rustflags = [\1, \"$_FLAGS\"]/" \
.cargo/config
rm .cargo/config.toml
popd
%build
%py3_build
pushd rust
make
# It is safe to ignore minimum rust version. The main blocker on MSRV is
# toml which just increase their MSRV by a robot for no hard reason.
%cargo_build --ignore-rust-version
popd
%install
@ -149,6 +142,12 @@ popd
/sbin/ldconfig
%changelog
* Fri May 17 2024 Gris Ge <fge@redhat.com> - 1.4.6-2
- Fix clib SONAME. RHEL-32218
* Thu May 16 2024 Gris Ge <fge@redhat.com> - 1.4.6-1
- Do not touch interface DNS if global DNS is used. RHEL-32218
* Wed Nov 15 2023 Gris Ge <fge@redhat.com> - 1.4.5-2
- Fix use case on purging DNS option. RHEL-13936