From 1676c09d91378897a2620da11506f1bc35e4bc59 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 4 Dec 2017 16:18:05 +0100 Subject: [PATCH] initial import Signed-off-by: Igor Gnatenko --- .gitignore | 1 + 0001-port-to-cc-crate.patch | 42 ++++++++++++++++++++ rust-sys-info.spec | 66 ++++++++++++++++++++++++++++++++ sources | 1 + sys-info-0.5.3-fix-metadata.diff | 10 +++++ 5 files changed, 120 insertions(+) create mode 100644 .gitignore create mode 100644 0001-port-to-cc-crate.patch create mode 100644 rust-sys-info.spec create mode 100644 sources create mode 100644 sys-info-0.5.3-fix-metadata.diff diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ec81800 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/sys-info-0.5.3.crate diff --git a/0001-port-to-cc-crate.patch b/0001-port-to-cc-crate.patch new file mode 100644 index 0000000..cfe19aa --- /dev/null +++ b/0001-port-to-cc-crate.patch @@ -0,0 +1,42 @@ +From b224a310f0260aff647347758b7d913cc20c3507 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Mon, 4 Dec 2017 00:32:37 +0100 +Subject: [PATCH] port to cc crate + +Signed-off-by: Igor Gnatenko +--- + build.rs | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/build.rs b/build.rs +index c09ab88..04f2871 100644 +--- a/build.rs ++++ b/build.rs +@@ -1,4 +1,4 @@ +-extern crate gcc; ++extern crate cc; + + use std::env; + +@@ -6,13 +6,15 @@ fn main() { + let target = env::var("TARGET").unwrap(); + let target_os = target.split('-').nth(2).unwrap(); + ++ let mut builder = cc::Build::new(); + match target_os { +- "linux" => gcc::compile_library("libinfo.a", &["c/linux.c"]), +- "darwin" => gcc::compile_library("libinfo.a", &["c/macos.c"]), ++ "linux" => builder.file("c/linux.c"), ++ "darwin" => builder.file("c/macos.c"), + "windows" => { +- gcc::compile_library("libinfo.a", &["c/windows.c"]); + println!("cargo:rustc-flags=-l psapi"); ++ builder.file("c/windows.c") + }, + _ => panic!("Unsupported system") + }; ++ builder.compile("info"); + } +-- +2.15.1 + diff --git a/rust-sys-info.spec b/rust-sys-info.spec new file mode 100644 index 0000000..64275b1 --- /dev/null +++ b/rust-sys-info.spec @@ -0,0 +1,66 @@ +# Generated by rust2rpm +%bcond_without check +%global debug_package %{nil} + +%global crate sys-info + +Name: rust-%{crate} +Version: 0.5.3 +Release: 1%{?dist} +Summary: Get system information in Rust + +License: MIT +URL: https://crates.io/crates/sys-info +Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate +# Initial patched metadata +# * Replace gcc with cc, https://github.com/FillZpp/sys-info-rs/pull/21 +Patch0: sys-info-0.5.3-fix-metadata.diff +# Finish gcc->cc +Patch1: 0001-port-to-cc-crate.patch + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging +# [dependencies] +BuildRequires: (crate(libc) >= 0.2.29 with crate(libc) < 0.3.0) +# [build-dependencies] +BuildRequires: (crate(cc) >= 1.0.0 with crate(cc) < 2.0.0) +BuildRequires: %{_bindir}/hostname + +%description +%{summary}. + +%package devel +Summary: %{summary} +Requires: %{_bindir}/hostname +BuildArch: noarch + +%description devel +Get system information in Rust. + +This package contains library source intended for building other packages +which use %{crate} from crates.io. + +%prep +%autosetup -n %{crate}-%{version} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%files devel +%license LICENSE +%doc README.md +%{cargo_registry}/%{crate}-%{version}/ + +%changelog +* Mon Dec 04 2017 Igor Gnatenko - 0.5.3-1 +- Initial package diff --git a/sources b/sources new file mode 100644 index 0000000..8496cf7 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (sys-info-0.5.3.crate) = 0eddce4753453753929129657c90dc2c37e0d2d80ec45707950adb4f9ec29deef950caabe118561309060c9d8a93fcfd67253763fad1a50391ada4781d3801ba diff --git a/sys-info-0.5.3-fix-metadata.diff b/sys-info-0.5.3-fix-metadata.diff new file mode 100644 index 0000000..361de31 --- /dev/null +++ b/sys-info-0.5.3-fix-metadata.diff @@ -0,0 +1,10 @@ +--- sys-info-0.5.3/Cargo.toml 1970-01-01T01:00:00+01:00 ++++ sys-info-0.5.3/Cargo.toml 2017-12-04T01:13:02.629820+01:00 +@@ -28,5 +28,5 @@ + path = "lib.rs" + [dependencies.libc] + version = "0.2.29" +-[build-dependencies.gcc] +-version = "0.3.51" ++[build-dependencies.cc] ++version = "1"