fpm
fpm copied to clipboard
adding --rpm-buildhost
Is it possible to change the buildhost in rpm? It's available in rpmbuild since 2016
https://bugzilla.redhat.com/show_bug.cgi?id=1309367
as a bypass, not a fix, adding a line to your hostfile (/etc/hosts with most distributions) that map localhost to a set hostname works for setting buildhost with rpmbuild.
127.0.0.1 rpmbuild.example.com
you can then comment it after.
I have not had much luck using the rpmbuild macros for setting up the buildhost (i have also not tried in a while)
Hello! I was reminded of this issue in #1910 and found a solution. fpm allows you to pass rpm macro definitions to rpmbuild's --define
flag using fpm's --rpm-rpmbuild-define ...
flag.
For example, setting the build host to be "fancypants":
% fpm -s empty -t rpm -f -n example --rpm-rpmbuild-define "_buildhost fancypants"
...
# Query the rpm and print the BUILDHOST tag
% rpm -qp example-1.0-1.noarch.rpm --qf "Build Host: %{BUILDHOST}\n"
Build Host: fancypants
One special note, the feature to set the _buildhost
macro in rpmbuild seems to have been first added in RPM v4.14 which was made first available in Fedora 27 assuming my research is right.
https://fedoraproject.org/wiki/Changes/RPM-4.14
- Improved support for reproducible builds
https://bugzilla.redhat.com/show_bug.cgi?id=1309367
https://github.com/rpm-software-management/rpm/commit/22588250baa1bfa5c00f57d39329d0c144fc8112