Bug 8302 - Cannot run rebuild script packages on Fedora 39
Summary: Cannot run rebuild script packages on Fedora 39
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Build system (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.17.0
Assignee: Alexander Zeijlon
URL:
Keywords: linma_tester, prosaic
Depends on:
Blocks:
 
Reported: 2024-02-02 13:24 CET by Alexander Zeijlon
Modified: 2024-02-07 14:19 CET (History)
1 user (show)

See Also:
Acceptance Criteria:
MUST: * It should be possible to build our cenbuild packages on: - Fedora 39 - RHEL 8


Attachments

Description Alexander Zeijlon cendio 2024-02-02 13:24:09 CET
When trying to build new packages on Fedora 39 I get the following error message:
> AttributeError: 'rpm.hdr' object has no attribute 'dsOfHeader'
This method has been deprecated since RPM v.4.8 and has now been removed as of Fedora 39.

For our use case, the ds (dependency set) we get from header objects seems to only be used to read out the epoch:version-release, the EVR, of the package that the header belongs to, and we need to find an alternative to the deprecated way of doing this so that we can build our cenbuild packages.
Comment 1 Alexander Zeijlon cendio 2024-02-02 16:04:01 CET
There are a few alternatives to the deprecated method. Given that we have a package header - hdr, then the same EVR-string can be produced by either of:

1. rpm.ds(hdr, rpm.RPMTAG_NEVR).EVR()
> This is another way of generating the same dependency set as we previously
> did with hdr.dsOfHeader().
2. rpm.ds(hdr, 'nevr').EVR()
> Same as above.
3. hdr[rpm.RPMTAG_EVR]
> Fetch EVR directly from the header
4. hdr['evr']
> Same as above.
Since all of these produce equivalent output, we might as well choose an alternative that makes the code more readable, which to me is either of point 3 or point 4. It also seems unnecessary to transform the header into a different data structure before fetching data that is already available on the header itself.
Comment 2 Alexander Zeijlon cendio 2024-02-02 16:10:27 CET
We also need to take into account that rebuild.py needs to be able to run on both our workstations (Fedora with modern libs) and on RHEL 8.

All the alternatives in comment 1 work on both Fedora 39 and on RHEL 8.
Comment 5 Alexander Zeijlon cendio 2024-02-05 09:33:11 CET
The rebuild.py script has now been updated to work on Fedora 39.
Comment 6 Alexander Zeijlon cendio 2024-02-05 09:44:25 CET
I took a look at the components of ThinLinc that handle RPMs, and we are not using the builtin rpm-module there. We are instead using subprocesses to run package operations directly with the system's own rpm-command.

This means that we are very unlikely to run into deprecation issues when running e.g. the ThinLinc installer.
Comment 7 Alexander Zeijlon cendio 2024-02-06 09:02:43 CET
> MUST:
> * It should be possible to build our cenbuild packages on:
>   - Fedora 39
>   - RHEL 8
I made a simple script which tested that the four alternatives in comment 1 had the same output as hdr.dsOfHeader().EVR() on RHEL 8. Then I ran the same script on Fedora 39 and saw that all the alternatives worked there as well.

I chose hdr['evr'] as a substitute for hdr.dsOfHeader().EVR(), since it, to me, is the most readable and most in line with other accesses to properties on the headers in rebuild.py.

Lastly, I verified that building packages on both Fedora 39 and RHEL 8 works after updates to rebuild.py.
Comment 8 Linn cendio 2024-02-07 14:19:40 CET
Since both RHEL 8 and Fedora 39 had been tested in the previous comment, I decided to test cenbuild on RHEL 9.

I tested building package docbook-xsl-x86_64 on RHEL 9. A new build was still only triggered when altering the version or release number. (Note that bug 8069 is present on a fresh RHEL 9 as well.)

I looked through the commits, they look good and minimal. Closing.

Note You need to log in before you can comment on or make changes to this bug.