[Rpm-maint] [rpm-software-management/rpm] [RFE] Autogenerate source archive decompression dependencies (#1396)

Vít Ondruch notifications at github.com
Mon Oct 12 11:10:45 UTC 2020


I am experimenting with something like this:

~~~diff
$ git diff
diff --git a/rubygem-abrt.spec b/rubygem-abrt.spec
index 22ac9aa..79e9a53 100644
--- a/rubygem-abrt.spec
+++ b/rubygem-abrt.spec
@@ -30,6 +30,25 @@ BuildArch: noarch
 %description doc
 Documentation for %{name}.
 
+%global __spec_buildrequires_pre %{expand: \
+%{?__spec_buildrequires_pre} \
+echo "%{lua:
+do
+  local compressors = {
+    gz = "__gzip",
+    xz = "__xz",
+    gem = "__gem",
+  }
+  for i, p in ipairs(sources) do
+    local suffix = compressors[rpm.expand("%{suffix:"..p.."}")]
+    print(rpm.expand("%{"..suffix.."}\\n"))
+  end
+end
+}"
+}
+
+%generate_buildrequires
+
 %prep
 %setup -q -n %{gem_name}-%{version} -b 1
 
~~~

The idea is, that since we have dynamic build dependencies, we could do better and generate dependencies on the archive tools, used to expand the sources by `setup` macro. This in turn would allow to have:

1. Better defined the SRPM dependencies, because the tools used to expand the SRPM certainly have to be specified somewhere.
2. Smaller buildroot, because not every tool had to be installed, when it is not used.

Of course this is very naive proof of concept. To make this more useful, it would be helpful if RPM provided list of supported archivers together with access to `rpmFileIsCompressed` which knows how to detect the compression tool already. Or possibly if the `%sources` macro provided more then just list of files.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1396
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20201012/76d6db12/attachment.html>


More information about the Rpm-maint mailing list