Upgrade to 2.2.9

Signed-off-by: Gris Ge <fge@redhat.com>
This commit is contained in:
Gris Ge 2023-03-23 21:53:05 +08:00
parent aebe3709e8
commit bea67c799a
4 changed files with 79 additions and 5 deletions

2
.gitignore vendored
View File

@ -89,3 +89,5 @@
/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

View File

@ -0,0 +1,71 @@
From f9d3f0cdcabfa18d465068508d7b69b2a65823bc Mon Sep 17 00:00:00 2001
From: Gris Ge <fge@redhat.com>
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 <fge@redhat.com>
---
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<HostNameState> {
- 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

View File

@ -2,7 +2,7 @@
%define libname libnmstate
Name: nmstate
Version: 2.2.8
Version: 2.2.9
Release: %autorelease
Summary: Declarative network manager API
License: LGPLv2+
@ -14,6 +14,7 @@ Source2: https://nmstate.io/nmstate.gpg
# 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
@ -25,7 +26,7 @@ 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(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.9 with crate(env_logger/default) < 1.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)
@ -38,7 +39,7 @@ 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) >= 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.24 with crate(nix/default) < 0.25)
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

View File

@ -1,3 +1,3 @@
SHA512 (nmstate.gpg) = 91c6b1d8aef4944520d4bdd4e90121bbbbaf772444f5eb6081cee81e17b21b66798437cdc09a117c6fc77c54d798aaa30400857aa090cb2102b47841f45cf6eb
SHA512 (nmstate-2.2.8.tar.gz) = ae13d09001794b002c26bf38892a8502c3b3519f56f0dd15a9d81e7590f3d49d52366b3d2d872dc634c97af2cee8c6866c173dd8f915291702192a487b565213
SHA512 (nmstate-2.2.8.tar.gz.asc) = 1da865d78cf907300c302d3fbb208d29e8139d5d59adc662c0885e7882c396de72b7172df9bee35acb8f71b15e76259edbac5bb5972d7d359abfbee1e9fe437e
SHA512 (nmstate-2.2.9.tar.gz) = 117ed9a903be298691883b87b0727d4bddb6dfb744023611e645c87602bfec578008db38d21dde4279dc8ff2dc7b0838ab35248ddb5e250484cc694003f93094
SHA512 (nmstate-2.2.9.tar.gz.asc) = 1bcde90966d188d94ef02c6d4b00f8cb63f6d4e0115c4f1900d13eb4b59c9fd21891b7eaea7e240465899b281c8e4ea340b7ce6326c217b6eede0cca8859425e