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

Cannot build RPM on RHEL 8 using included bareos-Release-23.0.2/core/platforms/packaging/bareos.spec file #1822

Closed
RiotNrrrd opened this issue May 17, 2024 · 6 comments
Labels
bug This addresses a bug needs triage Somebody needs to look at this

Comments

@RiotNrrrd
Copy link

Bareos component version

23.0.2

Steps to reproduce

  1. Copy the file bareos-Release-23.0.2/core/platforms/packaging/bareos.spec from the 23.0.2.tar.gz bundle to ~/rpmbuild/SPECS/bareos.spec on a RHEL 8 system.

  2. cd ~/rpmbuild/SPECS

  3. Edit bareos.spec, change Version: from "0" to "23.0.2", change Release: from "0" to "1%{?dist}".

  4. Run rpmbuild -bb bareos.spec

Expected results

Expect the RPMs to build, or at least get past this error.

Actual results

Build dies with

+ install -d -m 755 /root/rpmbuild/BUILDROOT/bareos-23.0.2-1.el8.x86_64/usr/lib/systemd/system
+ install -m 644 cmake-build/core/platforms/systemd/bareos-dir.service /root/rpmbuild/BUILDROOT/bareos-23.0.2-1.el8.x86_64/usr/lib/systemd/system
install: cannot stat 'cmake-build/core/platforms/systemd/bareos-dir.service': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.1Cq7Ay (%install)

Environment

- OS: `Red Hat Enterprise Linux release 8.9 (Ootpa)`
- component: rpmbuild

Relevant log output

[root@bareos SPECS]# rpmbuild -bb bareos.spec

[...]

+ install -d -m 755 /root/rpmbuild/BUILDROOT/bareos-23.0.2-1.el8.x86_64/usr/lib/systemd/system
+ install -m 644 cmake-build/core/platforms/systemd/bareos-dir.service /root/rpmbuild/BUILDROOT/bareos-23.0.2-1.el8.x86_64/usr/lib/systemd/system
install: cannot stat 'cmake-build/core/platforms/systemd/bareos-dir.service': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.1Cq7Ay (%install)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.1Cq7Ay (%install)

Relevant traces output

No response

Anything else?

Earlier upstream in the build, the 3 bareos-*.service files had already been installed by something under BUILD/bareos/cmake-build:

[...]
Install the project...
/usr/bin/cmake -P cmake_install.cmake
-- Install configuration: ""
-- Installing: /root/rpmbuild/BUILDROOT/bareos-23.0.2-1.el8.x86_64/var/log/bareos
-- Installing: /root/rpmbuild/BUILDROOT/bareos-23.0.2-1.el8.x86_64/var/lib/bareos
-- Installing: /root/rpmbuild/BUILDROOT/bareos-23.0.2-1.el8.x86_64/etc/rc.d/init.d/bareos-fd
-- Installing: /root/rpmbuild/BUILDROOT/bareos-23.0.2-1.el8.x86_64/etc/rc.d/init.d/bareos-sd
-- Installing: /root/rpmbuild/BUILDROOT/bareos-23.0.2-1.el8.x86_64/etc/rc.d/init.d/bareos-dir
-- Installing: /root/rpmbuild/BUILDROOT/bareos-23.0.2-1.el8.x86_64/usr/lib/systemd/system/bareos-sd.service
-- Installing: /root/rpmbuild/BUILDROOT/bareos-23.0.2-1.el8.x86_64/usr/lib/systemd/system/bareos-fd.service
-- Installing: /root/rpmbuild/BUILDROOT/bareos-23.0.2-1.el8.x86_64/usr/lib/systemd/system/bareos-dir.service

so I don't really understand why these CMAKE_BUILDDIR lines in the .spec file are getting run (and the first fails):

[root@bareos SPECS]# sed -n '1021,1026p' bareos.spec
# install systemd service files
%if 0%{?systemd_support}
install -d -m 755 %{buildroot}%{_unitdir}
install -m 644 %{CMAKE_BUILDDIR}/core/platforms/systemd/bareos-dir.service %{buildroot}%{_unitdir}
install -m 644 %{CMAKE_BUILDDIR}/core/platforms/systemd/bareos-fd.service %{buildroot}%{_unitdir}
install -m 644 %{CMAKE_BUILDDIR}/core/platforms/systemd/bareos-sd.service %{buildroot}%{_unitdir}

@RiotNrrrd RiotNrrrd added bug This addresses a bug needs triage Somebody needs to look at this labels May 17, 2024
@arogge
Copy link
Member

arogge commented May 17, 2024

We're building with that spec-file in continous integration all the time. However, the additional install looks redundant, maybe you can just remove that section?

Other than that, could you try building from the bareos-23 branch with the following steps and see if that fails for you, too?

git clone https://github.com/bareos/bareos.git
cd bareos
git checkout bareos-23
devtools/build-rpm.sh --nocheck

@RiotNrrrd
Copy link
Author

@arogge Hi Andreas, sorry for the delayed response.

I thought what you thought and commented out those 4 lines; unfortunately that just gave me different errors. :-(

I have not had time to try your request to build from the bareos-23 branch yet. I just wanted to add that shortly after I posted this issue, I went back and did an RPM build of Bareos 22.1.4 from the source tarball and the included .spec file it came with (with 2 minor edits) and it worked fine. So something seems to have changed in the 23 release lineage that broke it.

@arogge
Copy link
Member

arogge commented May 24, 2024

I can assure you that every set of Bareos RPMs we publish is built using the core/platforms/packaging/bareos.spec from the source-tree.

I tried the follwing process:

[user@host ~]$ SRCDIR="$(rpm --eval '%{_sourcedir}')"
[user@host ~]$ mkdir -p "$SRCDIR"
[user@host ~]$ curl -L https://github.com/bareos/bareos/archive/refs/tags/Release/23.0.2.tar.gz >"$SRCDIR/bareos-23.0.2.tar.gz"
[user@host ~]$ tar xzfO "$SRCDIR/bareos-23.0.2.tar.gz" '**/core/platforms/packaging/bareos.spec' > bareos.spec
[user@host ~]$ rpmdev-bumpspec --new="23.0.2-1%{?dist}" bareos.spec
[user@host ~]$ rpmbuild -bb --nocheck bareos.spec

And it worked just like I expected.

To rule out that it just accidentially works on our CI and my machine I tried with a fresh RHEL8 container:

[user@host ~]$ podman run --rm -it registry.redhat.io/ubi8/ubi
[root@container /]$ dnf install rpm-build rpmdevtools
[root@container /]$ useradd build
[root@container /]$ su - build
[build@container /]$ rpmdev-setuptree
(follow steps outlined above with the build failing due to missing buildrequires)
# disable glusterfs as devel-packages are next to unobtainable for RHEL
[build@container ~]$ sed -e '/%define glusterfs 1/d' -i bareos.spec
[build@container /]$ exit
[root@container /]$ dnf install -y <all-the-packages-rpmbuild-reported-missing>
[root@container /]$ su - build
[build@container ~]$ rpmbuild -bb --nocheck bareos.spec

That errored out because it didn't build droplet while rpm wanted to package it. The problem here is missing BuildRequires for libxml2-devel and json-c-devel. After installing these two packages, the build works fine.

So if you want, you can open a PR to add the missing BuildRequires. Besides that I'm pretty sure the SPECfile is working fine (even though there is a lot of room for improvement left).

@arogge
Copy link
Member

arogge commented Jun 4, 2024

If I understand correctly, the issue is solved. I'll close it.

@arogge arogge closed this as completed Jun 4, 2024
@RiotNrrrd
Copy link
Author

Hi Andreas,

I had not yet had a chance to test your suggestion. Not sure why you say it is solved unless some update to the .spec file has been recently made. I apologize for the delay in responding/testing your suggestion.

@arogge
Copy link
Member

arogge commented Jun 4, 2024

The response I got was your 👍 to my comment. Feel free to reopen if you can reproduce the issue in a clean build environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This addresses a bug needs triage Somebody needs to look at this
Projects
None yet
Development

No branches or pull requests

2 participants