bazelbuild / rules_pkg

Bazel rules for creating packages of many types (zip, tar, deb, rpm, ...)
Apache License 2.0
221 stars 174 forks source link

pkg_rpm with prebuild binary is not working #798

Open rapatchi opened 9 months ago

rapatchi commented 9 months ago

I was trying out the example mentioned in https://github.com/bazelbuild/rules_pkg/tree/main/examples/prebuilt_rpmbuild to use prebuilt rpmbuild binary for creating an rpm package.

I am getting the below error:

INFO: From MakeRpm test-rpm-all.rpm:
Error calling rpmbuild:
Executing(%build): /bin/sh -e /tmp/tmpunk6msq6/TMP/rpm-tmp.Dvj25Y
+ umask 022
+ cd /tmp/tmpunk6msq6/BUILD
+ RPM_EC=0
++ jobs -p
+ exit 0
Executing(%install): /bin/sh -e /tmp/tmpunk6msq6/TMP/rpm-tmp.q63uwP
+ umask 022
+ cd /tmp/tmpunk6msq6/BUILD
+ /bin/rm -rf /tmp/tmpunk6msq6/BUILDROOT
+ /bin/mkdir -p /tmp/tmpunk6msq6
+ /bin/mkdir /tmp/tmpunk6msq6/BUILDROOT
+ cp WORKSPACE BUILD readme.md test_rpm.spec /tmp/tmpunk6msq6/BUILDROOT/
Processing files: example-1-0.x86_64
error: No file attributes configured
Provides: example = 1-0 example(x86-64) = 1-0
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1

RPM build errors:
    No file attributes configured

No RPM file created.
ERROR: /usr/local/google/home/rapatchi/rules_pkg/examples/prebuilt_rpmbuild/BUILD:18:8: output 'test-rpm-all.rpm' was not created
ERROR: /usr/local/google/home/rapatchi/rules_pkg/examples/prebuilt_rpmbuild/BUILD:18:8: MakeRpm test-rpm-all.rpm failed: not all outputs were created or valid
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 5.226s, Critical Path: 0.20s
INFO: 8 processes: 7 internal, 1 linux-sandbox.
ERROR: Build did NOT complete successfully

rpmbuild binary version:

rapatchi@rapatchi:~/rules_pkg/examples/prebuilt_rpmbuild/local$ ./rpmbuild_binary --version
RPM version 4.18.0
aiuto commented 9 months ago

It works for me. Did you follow the instructions in the readme and manually copy a version of rpmbuild into the example?

rapatchi commented 9 months ago

It did not work for me. Is the binary version which you are using is same as mine ?. And also if rpmbuild is installed can you uninstall it ?. What i observed is that if the rpmbuild is installed on the system it's not reporting the error.

aiuto commented 9 months ago

By design, it is not the same. The whole point of the exercise is to copy a working rpmbuild from your.machine someplace to your source tree and run it from there. Tte idea is that you can check it in rather than replying on it being in your system image. We can't distribute rpmbuild with rules_pkg because that would add in their license.

On Tue, Dec 26, 2023, 7:06 AM rapatchi @.***> wrote:

It did not work for me. Is the binary version which you are using is same as mine ?.

— Reply to this email directly, view it on GitHub https://github.com/bazelbuild/rules_pkg/issues/798#issuecomment-1869494773, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXHHHEB3MYGDT2YBNZYKNLYLK4UNAVCNFSM6AAAAABA6AMQTGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRZGQ4TINZXGM . You are receiving this because you commented.Message ID: @.***>

rapatchi commented 8 months ago

I did check it. And the error mentioned in the description is what I am getting. Hence I was asking you for which version is working for you locally.

My hunch is the we are using different versions of rpmbuild and in the version which I have installed is expecting rpmlib as well.

aiuto commented 8 months ago

Just tried it again on my personal machine. Works fine.

$ rpmbuild --version
RPM version 4.16.1.2

Perhaps there was some change between rpmbuild versions that breaks pkg_rpm, but I have not heard about it from other sources.

kellyma2 commented 5 months ago

My hunch is the we are using different versions of rpmbuild and in the version which I have installed is expecting rpmlib as well.

What OS + version are you doing this on?