fpm icon indicating copy to clipboard operation
fpm copied to clipboard

adding --rpm-buildhost

Open francois4224 opened this issue 6 years ago • 3 comments

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

francois4224 avatar Feb 07 '19 08:02 francois4224

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)

mathieu-aubin avatar Feb 11 '19 05:02 mathieu-aubin

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

jordansissel avatar Jun 05 '22 21:06 jordansissel

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

jordansissel avatar Jun 05 '22 22:06 jordansissel