mirror of
https://github.com/goreleaser/nfpm
synced 2026-10-31 10:41:33 +01:00
rpmbuild runs script.req on the executable files of a package, so a package that ships a "#!/bin/bash" script requires /bin/bash without any work from the packager. nfpm has no such generator, so the interpreter of every script must be listed by hand, which is error-prone. Add the opt-in rpm.script_requires option. Like script.req with the exeonly flag of script.attr, it reads the "#!" line of each executable file and requires its interpreter, and the absolute program run by env, flagged RPMSENSE_FIND_REQUIRES like the dependencies rpmbuild generates. Documentation files, symlinks, directories and ghosts are skipped. The mode checked is the one in the package, so file_info.mode is honored and the option also works when building on Windows. The generated spec sets AutoReqProv: no, so the requires are written to it explicitly and rpmbuild --rebuild keeps them. Add unit tests, a scriptrequires acceptance stage that reads the requires back with rpm, and an executable script to the srpm rebuild acceptance test. Co-authored-by: Laurent Coustet <laurent.coustet@bluemind.net>