summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-03-15 02:05:57 +0000
committerCoprDistGit <infra@openeuler.org>2023-03-15 02:05:57 +0000
commitdec96244fe1e17fa047a603fced1eda027bdfc8a (patch)
tree1e13fd78cfd2ecc93ad6181031dc74a71582636f
parent3938ed728125bfb016618b054f22922e7769404b (diff)
automatic import of rust-packagingopeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--0001-macros-Do-not-use-awk-s-inplace-feature.patch30
-rw-r--r--rust-packaging.spec81
-rw-r--r--sources1
4 files changed, 113 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..f42b591 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/rust2rpm-v21.tar.gz
diff --git a/0001-macros-Do-not-use-awk-s-inplace-feature.patch b/0001-macros-Do-not-use-awk-s-inplace-feature.patch
new file mode 100644
index 0000000..507677f
--- /dev/null
+++ b/0001-macros-Do-not-use-awk-s-inplace-feature.patch
@@ -0,0 +1,30 @@
+From fac21ad662a14a4f901b3365a25749b516918554 Mon Sep 17 00:00:00 2001
+From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
+Date: Mon, 24 Jun 2019 20:27:20 +0200
+Subject: [PATCH] macros: Do not use awk's inplace feature
+
+gawk 5.x changed variable name to `inplace::suffix` but gawk 4.x does
+not like that name so we can't set both.
+
+Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
+---
+ data/macros.cargo | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/data/macros.cargo b/data/macros.cargo
+index 9bafc86..d13b7fa 100644
+--- a/data/macros.cargo
++++ b/data/macros.cargo
+@@ -89,7 +89,8 @@ if %__cargo_is_lib; then \
+ # Drop all dependency/features information \
+ # so that cargo doesn't fail resolving dependencies: \
+ # https://github.com/rust-lang/cargo/pull/6729 \
+- %{__awk} -i inplace -v INPLACE_SUFFIX=.deps '/^\\\[((.+\\\.)?((dev|build)-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \
++ mv Cargo.toml{,.deps} \
++ awk '/^\\\[((.+\\\.)?((dev|build)-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml.deps > Cargo.toml \
+ %{__cargo} package -l | grep -w -E -v 'Cargo.(lock|toml.orig)' | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \
+ %{__mv} Cargo.toml{.deps,} \
+ %{__cp} -a Cargo.toml $REG_DIR/Cargo.toml \
+--
+1.8.3.1
+
diff --git a/rust-packaging.spec b/rust-packaging.spec
new file mode 100644
index 0000000..b834df9
--- /dev/null
+++ b/rust-packaging.spec
@@ -0,0 +1,81 @@
+%{?python_enable_dependency_generator}
+# https://pagure.io/koji/issue/659
+%global debug_package %{nil}
+
+Name: rust-packaging
+Version: 21
+Release: 1
+Summary: RPM macros for building Rust packages on various architectures
+License: MIT
+URL: https://pagure.io/fedora-rust/rust2rpm
+Source: https://pagure.io/fedora-rust/rust2rpm/archive/v%{version}/rust2rpm-v%{version}.tar.gz
+
+Patch0001: 0001-macros-Do-not-use-awk-s-inplace-feature.patch
+
+BuildRequires: python3-devel python3-setuptools
+# use for check
+BuildRequires: python3-pytest cargo python3-semantic_version
+
+# gawk is needed for stripping dev-deps in macro
+Requires: gawk python3-rust2rpm = %{version}-%{release}
+Requires: rust-srpm-macros rust cargo
+
+%description
+The package provides macros for building projects in Rust
+on various architectures.
+
+%package -n python3-rust2rpm
+Summary: Convert Rust packages to RPM
+
+Requires: cargo
+
+Provides: rust2rpm = %{version}-%{release}
+%{?python_provide:%python_provide python3-rust2rpm}
+
+%description -n python3-rust2rpm
+Convert Rust packages to RPM.
+
+%prep
+%autosetup -n rust2rpm-v%{version} -p1
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -D -p -m 0644 -t %{buildroot}%{_rpmmacrodir} data/macros.rust data/macros.cargo
+install -D -p -m 0644 -t %{buildroot}%{_fileattrsdir} data/cargo.attr
+
+%check
+py.test-%{python3_version} -vv test.py
+
+%files
+%defattr(-,root,root)
+%license LICENSE
+%{_rpmmacrodir}/macros.rust
+%{_rpmmacrodir}/macros.cargo
+%{_fileattrsdir}/cargo.attr
+
+%files -n python3-rust2rpm
+%defattr(-,root,root)
+%license LICENSE
+%{_bindir}/rust2rpm
+%{_bindir}/cargo-inspector
+%{python3_sitelib}/rust2rpm/
+%{python3_sitelib}/rust2rpm-*.egg-info/
+
+%changelog
+* Sat Aug 06 2022 tianlijing <tianlijing@kylinos.cn> - 21-1
+- update to 21
+
+* Tue Jan 18 2022 SimpleUpdate Robot <tc@openeuler.org> - 20-1
+- Upgrade to version 20
+
+* Thu Mar 18 2021 shixuantong <shixuantong@huawei.com> - 15-2
+- fix install fail issue because nothing provides rust-srpm-macros = 15
+
+* Tue Feb 02 2021 shixuantong <shixuantong@huawei.com> - 15-1
+- Upgrade to version 15
+
+* Wed Mar 4 2020 hexiujun <hexiujun1@huawei.com> - 10-1
+- Package init
diff --git a/sources b/sources
new file mode 100644
index 0000000..f5770c6
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+9846ea5a2784b26c8b8cb6589e532662 rust2rpm-v21.tar.gz