Port from match_cfg to cfg-if and bump version-sync from 0.8 to 0.9

epel10 imports/epel10/rust-hostname-0.3.1-13.el10
Fabio Valentini 5 months ago
parent 35d187eb70
commit d1124720f4
No known key found for this signature in database
GPG Key ID: 5AC5F572E5D410AF

@ -0,0 +1,49 @@
From 3976c5bac1a5e7a4e9e0b8b12d8695ec6f8f00fb Mon Sep 17 00:00:00 2001
From: Fabio Valentini <decathorpe@gmail.com>
Date: Sun, 22 Sep 2024 01:47:58 +0200
Subject: [PATCH] port from match_cfg to cfg-if
---
src/lib.rs | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/lib.rs b/src/lib.rs
index 1a817b3..7ac8fef 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -57,27 +57,25 @@ println!("{:?}", name);
#![allow(unknown_lints, unused_extern_crates)]
#[macro_use]
-extern crate match_cfg;
+extern crate cfg_if;
#[cfg(feature = "set")]
use std::ffi::OsStr;
use std::ffi::OsString;
use std::io;
-match_cfg! {
- #[cfg(any(unix, target_os = "redox"))] => {
+cfg_if! {
+ if #[cfg(any(unix, target_os = "redox"))] {
extern crate libc;
mod nix;
use ::nix as sys;
- }
- #[cfg(target_os = "windows")] => {
+ } else if #[cfg(target_os = "windows")] {
extern crate winapi;
mod windows;
use ::windows as sys;
- }
- _ => {
+ } else {
compile_error!("Unsupported target OS! Create an issue: https://github.com/svartalf/hostname/issues/new");
}
}
--
2.46.1

@ -1,9 +1,10 @@
--- hostname-0.3.1/Cargo.toml 2020-02-28T16:58:01+00:00 --- hostname-0.3.1/Cargo.toml 2020-02-28T16:58:01+00:00
+++ hostname-0.3.1/Cargo.toml 2023-05-17T09:32:55.784973+00:00 +++ hostname-0.3.1/Cargo.toml 2024-09-21T23:41:05.031544+00:00
@@ -33,6 +33,3 @@ @@ -33,6 +33,4 @@
set = [] set = []
[target."cfg(any(unix, target_os = \"redox\"))".dependencies.libc] [target."cfg(any(unix, target_os = \"redox\"))".dependencies.libc]
version = "^0.2" version = "^0.2"
-[target."cfg(target_os = \"windows\")".dependencies.winapi] -[target."cfg(target_os = \"windows\")".dependencies.winapi]
-version = "^0.3" -version = "^0.3"
-features = ["sysinfoapi"] -features = ["sysinfoapi"]
+

@ -0,0 +1,16 @@
--- hostname-0.3.1/Cargo.toml 2020-02-28T16:58:01+00:00
+++ hostname-0.3.1/Cargo.toml 2024-09-21T23:41:28.498611+00:00
@@ -23,10 +23,10 @@
[package.metadata.docs.rs]
features = ["set"]
rustdoc-args = ["--cfg", "docsrs"]
-[dependencies.match_cfg]
-version = "^0.1"
+[dependencies.cfg-if]
+version = "^1.0"
[dev-dependencies.version-sync]
-version = "0.8"
+version = "0.9"
[features]
default = []

@ -1,4 +1,4 @@
# Generated by rust2rpm 24 # Generated by rust2rpm 26
%bcond_without check %bcond_without check
%global debug_package %{nil} %global debug_package %{nil}
@ -12,10 +12,17 @@ Summary: Cross-platform system's host name functions
License: MIT License: MIT
URL: https://crates.io/crates/hostname URL: https://crates.io/crates/hostname
Source: %{crates_source} Source: %{crates_source}
# Automatically generated patch to strip foreign dependencies # Automatically generated patch to strip dependencies and normalize metadata
Patch: hostname-fix-metadata-auto.diff Patch: hostname-fix-metadata-auto.diff
# Manually created patch for downstream crate metadata changes
# * bump version-sync dev-dependency from 0.8 to 0.9:
# https://github.com/svartalf/hostname/commit/ecf28eb
# * backport upstream port from match_cfg to cfg-if:
# https://github.com/svartalf/hostname/commit/7e930e9
Patch: hostname-fix-metadata.diff
Patch: 0001-port-from-match_cfg-to-cfg-if.patch
BuildRequires: rust-packaging >= 21 BuildRequires: cargo-rpm-macros >= 24
%global _description %{expand: %global _description %{expand:
Cross-platform system's host name functions.} Cross-platform system's host name functions.}
@ -62,7 +69,7 @@ use the "set" feature of the "%{crate}" crate.
%ghost %{crate_instdir}/Cargo.toml %ghost %{crate_instdir}/Cargo.toml
%prep %prep
%autosetup -n %{crate}-%{version_no_tilde} -p1 %autosetup -n %{crate}-%{version} -p1
%cargo_prep %cargo_prep
%generate_buildrequires %generate_buildrequires

Loading…
Cancel
Save