Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebuilding RPMs fails due to incorrect buildroot on F41 #2076

Open
antheas opened this issue Oct 20, 2024 · 1 comment
Open

Rebuilding RPMs fails due to incorrect buildroot on F41 #2076

antheas opened this issue Oct 20, 2024 · 1 comment

Comments

@antheas
Copy link

antheas commented Oct 20, 2024

When rebuilding an rpm from an rpm on F41, it fails with the following:

Setting attribute {:virtualenv_system_site_packages?=>nil, :level=>:debug, :file=>"fpm/command.rb", :line=>"354", :method=>"block (2 levels) in execute"}
Setting attribute {:virtualenv_find_links_urls=>nil, :level=>:debug, :file=>"fpm/command.rb", :line=>"354", :method=>"block (2 levels) in execute"}
Setting from flags: epoch= {:level=>:info, :file=>"fpm/command.rb", :line=>"414", :method=>"block in execute"}
Setting from flags: vendor= {:level=>:info, :file=>"fpm/command.rb", :line=>"414", :method=>"block in execute"}
Converting rpm to rpm {:level=>:info, :file=>"fpm/package.rb", :line=>"195", :method=>"convert"}
Cleaning up staging path {:path=>"/tmp/package-rpm-staging-30e7807184f08ef9573d38fceaebfd6966d76f2879315e51a8c510523fd7", :level=>:debug, :file=>"fpm/package.rb", :line=>"284", :method=>"cleanup_staging"}
Reading template {:path=>"/usr/local/share/gems/gems/fpm-1.15.1/templates/rpm.erb", :level=>:info, :file=>"fpm/package.rb", :line=>"333", :method=>"template"}
Running rpmbuild {:args=>["rpmbuild", "-bb", "--define", "buildroot /tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8/BUILD", "--define", "_topdir /tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8", "--define", "_sourcedir /tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8", "--define", "_rpmdir /tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8/RPMS", "--define", "_tmppath /tmp", "/tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8/SPECS/kmod-kvmfr-6.11.3-300.fc41.x86_64.spec"], :level=>:info, :file=>"fpm/package/rpm.rb", :line=>"568", :method=>"output"}
Running command {:args=>["rpmbuild", "-bb", "--define", "buildroot /tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8/BUILD", "--define", "_topdir /tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8", "--define", "_sourcedir /tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8", "--define", "_rpmdir /tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8/RPMS", "--define", "_tmppath /tmp", "/tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8/SPECS/kmod-kvmfr-6.11.3-300.fc41.x86_64.spec"], :level=>:debug, :file=>"fpm/util.rb", :line=>"138", :method=>"execmd"}
Process is running {:pid=>319, :level=>:debug, :file=>"fpm/util.rb", :line=>"147", :method=>"execmd"}
warning: Macro expanded in comment on line 24: %undefine __check_files {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
 {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
warning: %source_date_epoch_from_changelog is set, but %changelog has no entries to take a date from {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
Executing(%mkbuilddir): /bin/sh -e /tmp/rpm-tmp.N6MH7X {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
Executing(%prep): /bin/sh -e /tmp/rpm-tmp.EnUYjF {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
Executing(%build): /bin/sh -e /tmp/rpm-tmp.YDVXXn {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
Executing(%install): /bin/sh -e /tmp/rpm-tmp.IrRq3d {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
Processing files: kmod-kvmfr-6.11.3-300.fc41.x86_64-0.0.git.24.a7102df3-1.fc41.x86_64 {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
 {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
error: File not found: /tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8/BUILD/kmod-kvmfr-6.11.3-300.fc41.x86_64-0.0.git.24.a7102df3-build/BUILDROOT/lib/modules/6.11.3-300.fc41.x86_64/extra/kvmfr/kvmfr.ko.xz {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
RPM build warnings: {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
    Macro expanded in comment on line 24: %undefine __check_files {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
 {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
 {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
RPM build errors: {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
    %source_date_epoch_from_changelog is set, but %changelog has no entries to take a date from {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
    File not found: /tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8/BUILD/kmod-kvmfr-6.11.3-300.fc41.x86_64-0.0.git.24.a7102df3-build/BUILDROOT/lib/modules/6.11.3-300.fc41.x86_64/extra/kvmfr/kvmfr.ko.xz {:level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}
Process failed: rpmbuild failed (exit code 1). Full command was:["rpmbuild", "-bb", "--define", "buildroot /tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8/BUILD", "--define", "_topdir /tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8", "--define", "_sourcedir /tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8", "--define", "_rpmdir /tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8/RPMS", "--define", "_tmppath /tmp", "/tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8/SPECS/kmod-kvmfr-6.11.3-300.fc41.x86_64.spec"] {:level=>:error, :file=>"fpm/command.rb", :line=>"521", :method=>"rescue in execute"}
plugin directory {:plugin=>"rpm", :pathtype=>:staging_path, :path=>"/tmp/package-rpm-staging-2dd28958c255e3489d3f6f28afd491e33a891eecda136050526ea6efab7b", :file=>"fpm/command.rb", :line=>"528", :method=>"each"}
plugin directory {:plugin=>"rpm", :pathtype=>:staging_path, :path=>"/tmp/package-rpm-staging-2dd28958c255e3489d3f6f28afd491e33a891eecda136050526ea6efab7b", :file=>"fpm/command.rb", :line=>"528", :method=>"each"}
plugin directory {:plugin=>"rpm", :pathtype=>:build_path, :path=>"/tmp/package-rpm-build-d6b034159fb7b1f85af19c562878dff7b6948bf4732683e066b0b108c5b8", :file=>"fpm/command.rb", :line=>"528", :method=>"each"}

It appears that in F41 the buildroot define does not work, and rpmbuild tries to use BUILD/pkgname/BUILDROOT and fails since the files are not there.

The following patch fixes it:

sed -i -e 's/args = \["rpmbuild", "-bb"\]/args = \["rpmbuild", "-bb", "--buildroot", "#{build_path}\/BUILD"\]/g' /usr/local/share/gems/gems/fpm-*/lib/fpm/package/rpm.rb

Essentially, adding the arg --buildroot to rpmbuild. That arg says it is deprecated however a quick search online finds no replacement... As to what happened to --define buildroot <root> I do not know.

@Romain-Geissler-1A
Copy link
Contributor

A reproducer that is runnable via podman (or docker) if this is needed for the maintainers to confirm the problem (and the fix as proposed in #2082):

> cat Dockerfile
ARG FEDORA_VERSION=41
 
FROM quay.io/fedora/fedora:${FEDORA_VERSION} 
 
RUN dnf install -y \ 
    gcc \
    libffi-devel \
    rpm-build \
    ruby-devel

RUN gem install --no-document fpm

RUN mkdir -p /package-content && touch package-content/some-file

RUN fpm --verbose -a noarch -s dir -t rpm -n some-package -v 1.0.42 /package-content




> podman build --build-arg FEDORA_VERSION=41 .
Trying to pull quay.io/fedora/fedora:41...
Getting image source signatures
Copying blob sha256:369613bebfa25e0c521a99acae45fac060a223d7c89b4c678a35221a3772be91
Copying config sha256:ef6d734948fdbd09a99edcd486a7b01f5adfa3c8846186c62673d26c1dc7d324
Writing manifest to image destination
STEP 2/5: RUN dnf install -y     gcc     libffi-devel     rpm-build     ruby-devel
 ... (snapped)
STEP 4/5: RUN mkdir -p /package-content && touch package-content/some-file
--> 993dccd7d451
STEP 5/5: RUN fpm --verbose -a noarch -s dir -t rpm -n some-package -v 1.0.42 /package-content
{:timestamp=>"2024-11-04T23:30:03.305935+0000", :message=>"Setting workdir", :workdir=>"/tmp", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.309508+0000", :message=>"Setting from flags: architecture=noarch", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.309567+0000", :message=>"Setting from flags: epoch=", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.309587+0000", :message=>"Setting from flags: iteration=", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.309615+0000", :message=>"Setting from flags: name=some-package", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.309635+0000", :message=>"Setting from flags: url=http://example.com/no-uri-given", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.309662+0000", :message=>"Setting from flags: version=1.0.42", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.309716+0000", :message=>"Converting dir to rpm", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.313736+0000", :message=>"Reading template", :path=>"/usr/local/share/gems/gems/fpm-1.15.1/templates/rpm.erb", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.316696+0000", :message=>"Running rpmbuild", :args=>["rpmbuild", "-bb", "--target", "noarch", "--define", "buildroot /tmp/package-rpm-build-b4e60ee6d12dcb42e9a90eb872c34a2c23085601b35a04dc8eea26024886/BUILD", "--define", "_topdir /tmp/package-rpm-build-b4e60ee6d12dcb42e9a90eb872c34a2c23085601b35a04dc8eea26024886", "--define", "_sourcedir /tmp/package-rpm-build-b4e60ee6d12dcb42e9a90eb872c34a2c23085601b35a04dc8eea26024886", "--define", "_rpmdir /tmp/package-rpm-build-b4e60ee6d12dcb42e9a90eb872c34a2c23085601b35a04dc8eea26024886/RPMS", "--define", "_tmppath /tmp", "/tmp/package-rpm-build-b4e60ee6d12dcb42e9a90eb872c34a2c23085601b35a04dc8eea26024886/SPECS/some-package.spec"], :level=>:info} 
{:timestamp=>"2024-11-04T23:30:03.325700+0000", :message=>"Building target platforms: noarch", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.325771+0000", :message=>"Building for target noarch", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.328723+0000", :message=>"warning: Macro expanded in comment on line 24: %undefine __check_files", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.328772+0000", :message=>"", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.330938+0000", :message=>"warning: %source_date_epoch_from_changelog is set, but %changelog has no entries to take a date from", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.335808+0000", :message=>"Executing(%mkbuilddir): /bin/sh -e /tmp/rpm-tmp.DZdulW", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.345195+0000", :message=>"Executing(%prep): /bin/sh -e /tmp/rpm-tmp.ez9QB3", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.347225+0000", :message=>"Executing(%build): /bin/sh -e /tmp/rpm-tmp.7TELox", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.349317+0000", :message=>"Executing(%install): /bin/sh -e /tmp/rpm-tmp.pF8m7w", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.351546+0000", :message=>"Processing files: some-package-1.0.42-1.noarch", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.351588+0000", :message=>"", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.351652+0000", :message=>"error: File not found: /tmp/package-rpm-build-b4e60ee6d12dcb42e9a90eb872c34a2c23085601b35a04dc8eea26024886/BUILD/some-package-1.0.42-build/BUILDROOT/package-content/some-file", :level=>:info} 
{:timestamp=>"2024-11-04T23:30:03.351685+0000", :message=>"RPM build warnings:", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.351707+0000", :message=>"    Macro expanded in comment on line 24: %undefine __check_files", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.351726+0000", :message=>"", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.351741+0000", :message=>"", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.351756+0000", :message=>"RPM build errors:", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.351783+0000", :message=>"    %source_date_epoch_from_changelog is set, but %changelog has no entries to take a date from", :level=>:info}
{:timestamp=>"2024-11-04T23:30:03.351822+0000", :message=>"    File not found: /tmp/package-rpm-build-b4e60ee6d12dcb42e9a90eb872c34a2c23085601b35a04dc8eea26024886/BUILD/some-package-1.0.42-build/BUILDROOT/package-content/some-file", :level=>:info}    
{:timestamp=>"2024-11-04T23:30:03.355213+0000", :message=>"Process failed: rpmbuild failed (exit code 1). Full command was:[\"rpmbuild\", \"-bb\", \"--target\", \"noarch\", \"--define\", \"buildroot /tmp/package-rpm-build-b4e60ee6d12dcb42e9a90eb872c34a2c23085601b35a04dc8eea26024886/BUILD\", \"--define\", \"_topdir /tmp/package-rpm-build-b4e60ee6d12dcb42e9a90eb872c34a2c23085601b35a04dc8eea26024886\", \"--define\", \"_sourcedir /tmp/package-rpm-build-b4e60ee6d12dcb42e9a90eb872c34a2c23085601b35a04dc8eea26024886\", \"--define\", \"_rpmdir /tmp/package-rpm-build-b4e60ee6d12dcb42e9a90eb872c34a2c23085601b35a04dc8eea26024886/RPMS\", \"--define\", \"_tmppath /tmp\", \"/tmp/package-rpm-build-b4e60ee6d12dcb42e9a90eb872c34a2c23085601b35a04dc8eea26024886/SPECS/some-package.spec\"]", :level=>:error} 
Error: building at STEP "RUN fpm --verbose -a noarch -s dir -t rpm -n some-package -v 1.0.42 /package-content": while running runtime: exit status 1

The same reproducer with FEDORA_VERSION=40 works fine with the current code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants