diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1584a40 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/newtype_derive-0.1.6.crate diff --git a/0001-bump-rustc_version-to-0.2.patch b/0001-bump-rustc_version-to-0.2.patch new file mode 100644 index 0000000..a8e853a --- /dev/null +++ b/0001-bump-rustc_version-to-0.2.patch @@ -0,0 +1,32 @@ +From a3013a748fdcceb09f7db287e7bddfc162b903fe Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Tue, 5 Dec 2017 14:10:43 +0100 +Subject: [PATCH] bump rustc_version to 0.2 + +Signed-off-by: Igor Gnatenko +--- + newtype_derive/build.rs | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/newtype_derive/build.rs b/newtype_derive/build.rs +index c617b37..e4a10e0 100644 +--- a/newtype_derive/build.rs ++++ b/newtype_derive/build.rs +@@ -8,12 +8,12 @@ files in the project carrying such notice may not be copied, modified, + or distributed except according to those terms. + */ + extern crate rustc_version; +-use rustc_version::{version_matches}; ++use rustc_version::{version, Version}; + + fn main() { + println!("cargo:rerun-if-changed=build.rs"); + +- if version_matches("1.8.0") { ++ if version().unwrap() >= Version::parse("1.8.0").unwrap() { + println!("cargo:rustc-cfg=op_assign"); + } + } +-- +2.15.1 + diff --git a/newtype_derive-0.1.6-fix-metadata.diff b/newtype_derive-0.1.6-fix-metadata.diff new file mode 100644 index 0000000..75d04c9 --- /dev/null +++ b/newtype_derive-0.1.6-fix-metadata.diff @@ -0,0 +1,11 @@ +--- newtype_derive-0.1.6/Cargo.toml 2016-04-22T07:46:11+02:00 ++++ newtype_derive-0.1.6/Cargo.toml 2017-12-05T14:00:14.283698+01:00 +@@ -17,7 +17,7 @@ + std-unstable = [] + + [build-dependencies] +-rustc_version = "0.1.7" ++rustc_version = "0.2" + + [dev-dependencies] + custom_derive = "0.1.1" diff --git a/rust-newtype_derive.spec b/rust-newtype_derive.spec new file mode 100644 index 0000000..821f3ea --- /dev/null +++ b/rust-newtype_derive.spec @@ -0,0 +1,69 @@ +# Generated by rust2rpm +%bcond_without check +%global debug_package %{nil} + +%global crate newtype_derive + +Name: rust-%{crate} +Version: 0.1.6 +Release: 1%{?dist} +Summary: Macros for deriving common traits for newtype structures + +# https://github.com/DanielKeep/rust-custom-derive/issues/36 +License: MIT or ASL 2.0 +URL: https://crates.io/crates/newtype_derive +Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate +# Initial patched metadata +# * Bump rustc_version to 0.2, https://github.com/DanielKeep/rust-custom-derive/pull/37 +Patch0: newtype_derive-0.1.6-fix-metadata.diff +# Make it work with rustc_version v0.2 +Patch1: 0001-bump-rustc_version-to-0.2.patch + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging +# [build-dependencies] +BuildRequires: (crate(rustc_version) >= 0.2.0 with crate(rustc_version) < 0.3.0) +%if %{with check} +# [dev-dependencies] +BuildRequires: (crate(custom_derive) >= 0.1.1 with crate(custom_derive) < 0.2.0) +%endif + +%description +%{summary}. + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel +This crate provides macros for deriving common traits for newtype structures. + +This package contains library source intended for building other packages +which use %{crate} from crates.io. + +%prep +%autosetup -n %{crate}-%{version} -N +# https://github.com/DanielKeep/rust-custom-derive/issues/35 +grep -IUlr $'\r' | xargs sed -i 's/\r$//' +%patch0 -p1 +%patch1 -p2 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%files devel +%{cargo_registry}/%{crate}-%{version}/ + +%changelog +* Tue Dec 05 2017 Igor Gnatenko - 0.1.6-1 +- Initial package diff --git a/sources b/sources new file mode 100644 index 0000000..0050525 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (newtype_derive-0.1.6.crate) = 729cdadbad4e058f2a6535f4d321a668f784fe80f89f980ec825a13620f413706a8ba01af1e4857c007bebabb98c650d1e51a2008f444727c208a9980ec78dc8