[Rpm-maint] [rpm-software-management/rpm] Avoid libmagic calculation for source files (PR #1951)
Stephan Kulow
notifications at github.com
Wed Mar 9 14:22:44 UTC 2022
I was a little frustruated that the openSUSE kernel-source (which just unpacks the upstream tar and applies patched to put it back in a rpm) takes half an hour to build: https://build.opensuse.org/build/openSUSE:Factory/standard/x86_64/kernel-source/_log
What caught my eye was
```
[ 107s] Processing files: kernel-source-5.16.11-1.1.noarch
[ 429s] Provides: kernel-source = 5.16.11-1 kernel-source = 5.16.11-1.1 kernel-source-srchash-90630c5cfa6cd19e0fb58ba792e3cc3fb0ba340e linux multiversion(kernel)
[ 429s] Requires(interp): /bin/sh
```
5 minutes to calculcate non existant auto provides (`AutoReqProv: off` in the spec file). So I diged into the code and noticed the 2 calls to magic function - for 130K files this sums up heavily. If we ignore the files we can guess from file extension, we're down to 6 seconds for the same thing.
Possibly we can extend this and make it a little nicer by having a table of known extensions instead of the if else cascade, but this is my initial proposal.
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1951#issuecomment-1062971322
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/1951/c1062971322 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20220309/eef8d5e1/attachment-0001.html>
More information about the Rpm-maint
mailing list