From 5b6036e71028797b82de7b06d6a4800c563e2cf3 Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Date: Sat, 27 Oct 2018 22:46:15 +0200
Subject: [PATCH] Adapt to new packaging

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
---
 memchr-fix-metadata.diff | 10 ++++++
 rust-memchr.spec         | 76 ++++++++++++++++++++++++++++++----------
 2 files changed, 68 insertions(+), 18 deletions(-)
 create mode 100644 memchr-fix-metadata.diff

diff --git a/memchr-fix-metadata.diff b/memchr-fix-metadata.diff
new file mode 100644
index 0000000..a32e34f
--- /dev/null
+++ b/memchr-fix-metadata.diff
@@ -0,0 +1,10 @@
+--- memchr-2.1.0/Cargo.toml	1970-01-01T01:00:00+01:00
++++ memchr-2.1.0/Cargo.toml	2018-10-27T22:44:54.476194+02:00
+@@ -21,6 +21,7 @@
+ keywords = ["memchr", "char", "scan", "strchr", "string"]
+ license = "Unlicense/MIT"
+ repository = "https://github.com/BurntSushi/rust-memchr"
++exclude = ["/ci/*", "/.travis.yml", "/Makefile", "/appveyor.yml", "/ctags.rust", "/session.vim"]
+ [profile.test]
+ opt-level = 3
+ 
diff --git a/rust-memchr.spec b/rust-memchr.spec
index 4725a25..1cf383d 100644
--- a/rust-memchr.spec
+++ b/rust-memchr.spec
@@ -1,5 +1,5 @@
 # Generated by rust2rpm
-# Tests are run in infrastructure
+# * Tests are run in infrastructure
 %bcond_with check
 %global debug_package %{nil}
 
@@ -7,39 +7,82 @@
 
 Name:           rust-%{crate}
 Version:        2.1.0
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Safe interface to memchr
 
 # Upstream license specification: Unlicense/MIT
 License:        Unlicense or MIT
 URL:            https://crates.io/crates/memchr
 Source0:        https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate
+# Initial patched metadata
+# * Exclude CI files, https://github.com/BurntSushi/rust-memchr/pull/39
+Patch0:         memchr-fix-metadata.diff
 
 ExclusiveArch:  %{rust_arches}
 
 BuildRequires:  rust-packaging
-# [dependencies]
-BuildRequires:  (crate(cfg-if) >= 0.1.5 with crate(cfg-if) < 0.2.0)
+BuildRequires:  (crate(cfg-if/default) >= 0.1.5 with crate(cfg-if/default) < 0.2.0)
 BuildRequires:  (crate(libc) >= 0.2.18 with crate(libc) < 0.3.0)
-# [build-dependencies]
-BuildRequires:  (crate(version_check) >= 0.1.4 with crate(version_check) < 0.2.0)
+BuildRequires:  (crate(libc/use_std) >= 0.2.18 with crate(libc/use_std) < 0.3.0)
+BuildRequires:  (crate(version_check/default) >= 0.1.4 with crate(version_check/default) < 0.2.0)
 %if %{with check}
-# [dev-dependencies]
 BuildRequires:  (crate(quickcheck) >= 0.7.0 with crate(quickcheck) < 0.8.0)
 %endif
 
-%description
-%{summary}.
+%global _description \
+Safe interface to memchr.
+
+%description %{_description}
 
 %package        devel
 Summary:        %{summary}
 BuildArch:      noarch
 
-%description    devel
-Safe interface to memchr.
+%description    devel %{_description}
+
+This package contains library source intended for building other packages
+which use "%{crate}" crate.
+
+%files          devel
+%license UNLICENSE LICENSE-MIT COPYING
+%doc README.md
+%{cargo_registry}/%{crate}-%{version}/
+
+%package     -n %{name}+default-devel
+Summary:        %{summary}
+BuildArch:      noarch
+
+%description -n %{name}+default-devel %{_description}
 
 This package contains library source intended for building other packages
-which use %{crate} from crates.io.
+which use "default" feature of "%{crate}" crate.
+
+%files       -n %{name}+default-devel
+%ghost %{cargo_registry}/%{crate}-%{version}/Cargo.toml
+
+%package     -n %{name}+libc-devel
+Summary:        %{summary}
+BuildArch:      noarch
+
+%description -n %{name}+libc-devel %{_description}
+
+This package contains library source intended for building other packages
+which use "libc" feature of "%{crate}" crate.
+
+%files       -n %{name}+libc-devel
+%ghost %{cargo_registry}/%{crate}-%{version}/Cargo.toml
+
+%package     -n %{name}+use_std-devel
+Summary:        %{summary}
+BuildArch:      noarch
+
+%description -n %{name}+use_std-devel %{_description}
+
+This package contains library source intended for building other packages
+which use "use_std" feature of "%{crate}" crate.
+
+%files       -n %{name}+use_std-devel
+%ghost %{cargo_registry}/%{crate}-%{version}/Cargo.toml
 
 %prep
 %autosetup -n %{crate}-%{version} -p1
@@ -56,13 +99,10 @@ which use %{crate} from crates.io.
 %cargo_test
 %endif
 
-%files          devel
-%license UNLICENSE LICENSE-MIT COPYING
-%doc README.md
-%{cargo_registry}/%{crate}-%{version}/
-%exclude %{cargo_registry}/%{crate}-%{version}/{Makefile,appveyor.yml,ctags.rust,session.vim}
-
 %changelog
+* Sat Oct 27 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.1.0-2
+- Adapt to new packaging
+
 * Tue Sep 18 2018 Josh Stone <jistone@redhat.com> - 2.1.0-1
 - Update to 2.1.0