|
|
@ -1,4 +1,4 @@
|
|
|
|
From 7b06496a5c1ded5e3cf59d6af0e757974c6ff704 Mon Sep 17 00:00:00 2001
|
|
|
|
From 37cf4d78df2f3805f1f230252e1c0030a2f08877 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
|
|
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
|
|
Date: Sat, 8 Jun 2019 19:35:38 +0200
|
|
|
|
Date: Sat, 8 Jun 2019 19:35:38 +0200
|
|
|
|
Subject: [PATCH 13/14] Implement %__cargo_skip_build
|
|
|
|
Subject: [PATCH 13/14] Implement %__cargo_skip_build
|
|
|
@ -8,37 +8,16 @@ module builds.
|
|
|
|
|
|
|
|
|
|
|
|
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
|
|
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
|
|
---
|
|
|
|
---
|
|
|
|
data/macros.cargo | 80 ++++++++++++++++++++++++------------
|
|
|
|
data/macros.cargo | 65 +++++++++++++++++++++---------------
|
|
|
|
rust2rpm/templates/main.spec | 34 ++++++++-------
|
|
|
|
data/macros.rust-srpm | 16 +++++++++
|
|
|
|
2 files changed, 72 insertions(+), 42 deletions(-)
|
|
|
|
rust2rpm/templates/main.spec | 34 ++++++++++---------
|
|
|
|
|
|
|
|
3 files changed, 73 insertions(+), 42 deletions(-)
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/data/macros.cargo b/data/macros.cargo
|
|
|
|
diff --git a/data/macros.cargo b/data/macros.cargo
|
|
|
|
index a60289a..961732d 100644
|
|
|
|
index a60289a..1182850 100644
|
|
|
|
--- a/data/macros.cargo
|
|
|
|
--- a/data/macros.cargo
|
|
|
|
+++ b/data/macros.cargo
|
|
|
|
+++ b/data/macros.cargo
|
|
|
|
@@ -10,6 +10,21 @@
|
|
|
|
@@ -49,27 +49,35 @@ EOF\
|
|
|
|
|
|
|
|
|
|
|
|
%cargo_registry %{_datadir}/cargo/registry
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+# If crate not in _build_crates and _module_build is set, we should skip the build
|
|
|
|
|
|
|
|
+%__cargo_skip_build %{lua:
|
|
|
|
|
|
|
|
+local crate = rpm.expand('%{crate}')
|
|
|
|
|
|
|
|
+local build_crate = false
|
|
|
|
|
|
|
|
+for w in rpm.expand('%{?_build_crates}'):gmatch('%S+') do
|
|
|
|
|
|
|
|
+ if w == crate then
|
|
|
|
|
|
|
|
+ build_crate = true
|
|
|
|
|
|
|
|
+ break
|
|
|
|
|
|
|
|
+ end
|
|
|
|
|
|
|
|
+end
|
|
|
|
|
|
|
|
+if (rpm.expand('%{defined _module_build}') ~= '0' and not build_crate) then
|
|
|
|
|
|
|
|
+ print(1)
|
|
|
|
|
|
|
|
+else
|
|
|
|
|
|
|
|
+ print(0)
|
|
|
|
|
|
|
|
+end}
|
|
|
|
|
|
|
|
%__cargo_is_lib() %__cargo_inspector --target-kinds Cargo.toml | grep -q -F -x "$(printf 'lib\\\nrlib\\\nproc-macro')"
|
|
|
|
|
|
|
|
%__cargo_is_bin() %__cargo_inspector --target-kinds Cargo.toml | grep -q -F -x bin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -49,27 +64,35 @@ EOF\
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
%cargo_generate_buildrequires(af:) \
|
|
|
|
%cargo_generate_buildrequires(af:) \
|
|
|
@ -92,7 +71,7 @@ index a60289a..961732d 100644
|
|
|
|
|
|
|
|
|
|
|
|
%cargo_install(t:naf:) (\
|
|
|
|
%cargo_install(t:naf:) (\
|
|
|
|
set -eu \
|
|
|
|
set -eu \
|
|
|
|
@@ -88,15 +111,18 @@ if %__cargo_is_lib; then \
|
|
|
|
@@ -88,15 +96,18 @@ if %__cargo_is_lib; then \
|
|
|
|
%{__rm} -f $REG_DIR/Cargo.toml.{orig,deps} \
|
|
|
|
%{__rm} -f $REG_DIR/Cargo.toml.{orig,deps} \
|
|
|
|
echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \
|
|
|
|
echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \
|
|
|
|
fi \
|
|
|
|
fi \
|
|
|
@ -120,6 +99,30 @@ index a60289a..961732d 100644
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
%__cargo_feature_from_name(n:) %{lua:
|
|
|
|
%__cargo_feature_from_name(n:) %{lua:
|
|
|
|
|
|
|
|
diff --git a/data/macros.rust-srpm b/data/macros.rust-srpm
|
|
|
|
|
|
|
|
index 872b87f..88d5a0f 100644
|
|
|
|
|
|
|
|
--- a/data/macros.rust-srpm
|
|
|
|
|
|
|
|
+++ b/data/macros.rust-srpm
|
|
|
|
|
|
|
|
@@ -37,3 +37,19 @@
|
|
|
|
|
|
|
|
\
|
|
|
|
|
|
|
|
print(url .. crate .. '/' .. version .. '/download#/' .. crate .. '-' .. version .. '.crate')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+# If crate not in _build_crates and _module_build is set, we should skip the build
|
|
|
|
|
|
|
|
+%__cargo_skip_build %{lua:
|
|
|
|
|
|
|
|
+local crate = rpm.expand('%{crate}')
|
|
|
|
|
|
|
|
+local build_crate = false
|
|
|
|
|
|
|
|
+for w in rpm.expand('%{?_build_crates}'):gmatch('%S+') do
|
|
|
|
|
|
|
|
+ if w == crate then
|
|
|
|
|
|
|
|
+ build_crate = true
|
|
|
|
|
|
|
|
+ break
|
|
|
|
|
|
|
|
+ end
|
|
|
|
|
|
|
|
+end
|
|
|
|
|
|
|
|
+if (rpm.expand('%{defined _module_build}') ~= '0' and not build_crate) then
|
|
|
|
|
|
|
|
+ print(1)
|
|
|
|
|
|
|
|
+else
|
|
|
|
|
|
|
|
+ print(0)
|
|
|
|
|
|
|
|
+end}
|
|
|
|
diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec
|
|
|
|
diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec
|
|
|
|
index 660bb60..69d23d7 100644
|
|
|
|
index 660bb60..69d23d7 100644
|
|
|
|
--- a/rust2rpm/templates/main.spec
|
|
|
|
--- a/rust2rpm/templates/main.spec
|
|
|
|