Dne 03. 07. 24 v 6:02 odp. Marián Konček napsal(a):
As many of you know, as packages change, so do their BuildRequires. In the current state, maintaining them requires some manual work from the maintainer.

1. So I got around the idea of a simple tool that checks file accesses during the build and using RPM queries, detects whether some package's files are not accessed at all therefore the package is not needed for the build. To my knowledge there is no such project. The project is here: https://github.com/mkoncek/unbreq

Great idea. I am not aware of anything similar.

It may not be completely reliable, but it also may be good enough to catch 
simple mistakes.

*nod* but it can be improved later :)

It would be good if you do not enforce changes in spec file. This is big block for any testing/prototyping. I highly recommend to implement it as Mock plugins. Here are some pointers

https://rpm-software-management.github.io/mock/#plugins

https://github.com/rpm-software-management/mock/tree/main/mock/py/mockbuild/plugins

You run the `resolve` at the end of %install but some BuildRequires are needed 
because of %check which is run after %install



3. In the case of maven, we have a manual tool: xmvn-builddep, which reads the build.log and constructs the actual BuildRequires from it, using knowledge about the build procedure. This could be used as an additional step of this tool, having similar tools for other languages.

See

https://rpm-software-management.github.io/rpm/manual/spec.html#generate_buildrequires-since-rpm--415

You can check https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/ 
how Python uses this.


Ultimately, I am interested in the possibility of having automated unused BuildRequires detection as part of rpmbuild / mockbuild.

rpmbuild does not have any isolation and uses any other package installed on 
system beside these specified in BuildRequires.

Mock on the other hand install only minimal systems + BuildRequires. So it is 
more suitable for this task and check.

If you need some assistance or guidance with integration to Mock please contact me off-list and I will be happy to assist you.

--
Miroslav Suchy, RHCA
Red Hat, Manager, Packit and CPT, #brno, #fedora-buildsys

--
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to