Bug 32527 - dnf builddep.py doesn't work with the current version of rpm: AttributeError: 'rpm.hdr' object has no attribute 'dsFromHeader'
Summary: dnf builddep.py doesn't work with the current version of rpm: AttributeError:...
Status: NEW
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: All Packagers
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-15 12:21 CET by Daniel Garcia Moreno
Modified: 2023-11-19 22:40 CET (History)
3 users (show)

See Also:
Source RPM: dnf-plugins-core-4.3.1-1.mga9.src.rpm
CVE:
Status comment: fixed since version 4.4.


Attachments

Description Daniel Garcia Moreno 2023-11-15 12:21:18 CET
Noticed that in Packit CI:

https://download.copr.fedorainfracloud.org/results/packit/rpm-software-management-rpmlint-1142/mageia-cauldron-x86_64/06637958-rpmlint/builder-live.log.gz

Looks like a problem related with the "rpm" package version and "python3-dnf-plugins-core", that's version 4.3.1 and this problem is fixed since version 4.4.1: https://github.com/rpm-software-management/dnf-plugins-core/commit/3be0b79fcda9e8106dc066de73b003758bc4f9e1

Relevant log:

INFO: Buildroot is handled by package management installed into bootstrap:
  rpm-4.19.0-2.mga10.aarch64
  python3-dnf-4.14.0-1.mga9.noarch
  python3-dnf-plugins-core-4.3.1-1.mga9.noarch
Start: build phase for rpmlint-2.5.0-0.20231115093033933497.pr1142.685.g7e018d16.mga10.src.rpm
Start: build setup for rpmlint-2.5.0-0.20231115093033933497.pr1142.685.g7e018d16.mga10.src.rpm
Building target platforms: aarch64
Building for target aarch64
Wrote: /builddir/build/SRPMS/rpmlint-2.5.0-0.20231115093033933497.pr1142.685.g7e018d16.mga10.src.rpm
Failed to set locale, defaulting to C
No matches found for the following disable plugin patterns: local, spacewalk, versionlock
Copr repository                                  51 kB/s | 1.5 kB     00:00    
determining the fastest mirror (6 hosts).. done.
Mageia Cauldron - aarch64                       1.6 kB/s | 2.5 kB     00:01    
Traceback (most recent call last):
  File "/usr/bin/dnf-3", line 62, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 201, in user_main
    errcode = main(args)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 67, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 106, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 122, in cli_run
    cli.run()
  File "/usr/lib/python3.10/site-packages/dnf/cli/cli.py", line 1057, in run
    return self.command.run()
  File "/usr/lib/python3.10/site-packages/dnf-plugins/builddep.py", line 137, in run
    self._src_deps(pkgspec)
  File "/usr/lib/python3.10/site-packages/dnf-plugins/builddep.py", line 195, in _src_deps
    ds = h.dsFromHeader('requirename')
AttributeError: 'rpm.hdr' object has no attribute 'dsFromHeader'
WARNING: DNF command failed, retrying, attempt #2, sleeping 10s
Failed to set locale, defaulting to C
No matches found for the following disable plugin patterns: local, spacewalk, versionlock
Copr repository                                  78 kB/s | 1.5 kB     00:00    
determining the fastest mirror (5 hosts).. done.
Mageia Cauldron - aarch64                       2.2 kB/s | 2.5 kB     00:01    
Traceback (most recent call last):
  File "/usr/bin/dnf-3", line 62, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 201, in user_main
    errcode = main(args)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 67, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 106, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 122, in cli_run
    cli.run()
  File "/usr/lib/python3.10/site-packages/dnf/cli/cli.py", line 1057, in run
    return self.command.run()
  File "/usr/lib/python3.10/site-packages/dnf-plugins/builddep.py", line 137, in run
    self._src_deps(pkgspec)
  File "/usr/lib/python3.10/site-packages/dnf-plugins/builddep.py", line 195, in _src_deps
    ds = h.dsFromHeader('requirename')
AttributeError: 'rpm.hdr' object has no attribute 'dsFromHeader'
WARNING: DNF command failed, retrying, attempt #3, sleeping 10s
Failed to set locale, defaulting to C
No matches found for the following disable plugin patterns: local, spacewalk, versionlock
Copr repository                                  69 kB/s | 1.5 kB     00:00    
determining the fastest mirror (4 hosts).. done.
Mageia Cauldron - aarch64                       2.2 kB/s | 2.5 kB     00:01    
Traceback (most recent call last):
  File "/usr/bin/dnf-3", line 62, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 201, in user_main
    errcode = main(args)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 67, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 106, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 122, in cli_run
    cli.run()
  File "/usr/lib/python3.10/site-packages/dnf/cli/cli.py", line 1057, in run
    return self.command.run()
  File "/usr/lib/python3.10/site-packages/dnf-plugins/builddep.py", line 137, in run
    self._src_deps(pkgspec)
  File "/usr/lib/python3.10/site-packages/dnf-plugins/builddep.py", line 195, in _src_deps
    ds = h.dsFromHeader('requirename')
AttributeError: 'rpm.hdr' object has no attribute 'dsFromHeader'
Daniel Garcia Moreno 2023-11-15 12:21:34 CET

CC: (none) => daniel.garcia

Comment 1 Lewis Smith 2023-11-15 21:20:47 CET
Thank you for the report.

Unsure whether Luigi still maintains things, so assigning this update globally; and CC'ing him in hope.

Assignee: bugsquad => pkg-bugs
Status comment: (none) => fixed since version 4.4.
Source RPM: python3-dnf-plugins-core => dnf-plugins-core-4.3.1-1.mga9.src.rpm
CC: (none) => luigiwalser

Comment 2 Jens Persson 2023-11-15 21:58:43 CET
I think the new rpm update in Cauldron killed dnf5 too. Numbers changed in some libs.

CC: (none) => xerxes2

Comment 3 Jens Persson 2023-11-17 23:42:14 CET
Just noticed that rpm requires libdb. Shouldn't that be switched to sqlite?

https://svnweb.mageia.org/packages/cauldron/rpm/current/SPECS/rpm.spec?view=markup&pathrev=2007412#l253

[xerxes2@ninja ~]$ ldd /usr/bin/rpm
	linux-vdso.so.1 (0x00007fff9bfe9000)
	librpm.so.10 => /lib64/librpm.so.10 (0x00007fe8143a4000)
	librpmio.so.10 => /lib64/librpmio.so.10 (0x00007fe81436e000)
	libpopt.so.0 => /lib64/libpopt.so.0 (0x00007fe81435f000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fe81418d000)
	libsqlite3.so.0 => /lib64/libsqlite3.so.0 (0x00007fe81403b000)
	libacl.so.1 => /lib64/libacl.so.1 (0x00007fe814030000)
	libcap.so.2 => /lib64/libcap.so.2 (0x00007fe814022000)
	liblua-5.4.so => /lib64/liblua-5.4.so (0x00007fe813fdf000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fe814448000)
	libcrypto.so.3 => /lib64/libcrypto.so.3 (0x00007fe813a00000)
	libz.so.1 => /lib64/libz.so.1 (0x00007fe813fc1000)
	libbz2.so.1 => /lib64/libbz2.so.1 (0x00007fe813fae000)
	libzstd.so.1 => /lib64/libzstd.so.1 (0x00007fe81392b000)
	liblzma.so.5 => /lib64/liblzma.so.5 (0x00007fe813f6d000)
	libm.so.6 => /lib64/libm.so.6 (0x00007fe81384f000)
Comment 4 David Walser 2023-11-17 23:59:15 CET
Rpm still needs to be able to read libdb-based rpm databases so it can convert them, so it can't drop the dependency yet.
Comment 5 Jani Välimaa 2023-11-18 22:29:36 CET
I've fixed this in dnf-plugins-core-4.3.1-2.mga10 with the upstream patch mentioned in comment 0 until dnf-plugins-core gets updated to a newer version.
Comment 6 Jens Persson 2023-11-18 22:55:33 CET
(In reply to David Walser from comment #4)
> Rpm still needs to be able to read libdb-based rpm databases so it can
> convert them, so it can't drop the dependency yet.

Hmm, you're right, sort of. Read support for libdb seems to be enabled in the buildscript but maybe it's not working anyway? Write support for libdb was removed a few years ago from rpm so maybe they ditched read support too? I'm not using mga9 but I really hope that rpm uses sqlite there.
Comment 7 Jens Persson 2023-11-18 23:02:24 CET
(In reply to Jani Välimaa from comment #5)
> I've fixed this in dnf-plugins-core-4.3.1-2.mga10 with the upstream patch
> mentioned in comment 0 until dnf-plugins-core gets updated to a newer
> version.

Thanks man, seems like you're Wally then! :) Just fyi, yesterday I got tired of dnf5 not beeing updated so I did it myself. But it needed newer libsolv and there was a perl binary mismatch that may be difficult to track down. So what I ended up doing was: 1. Rebuild perl-List-MoreUtils-XS, 2. Update libsolv, 3. Update dnf5. I think that was all. DNF5 is mighty impressive so don't wanna go back to legacy now.
Comment 8 David Walser 2023-11-18 23:18:00 CET
(In reply to Jens Persson from comment #6)
> (In reply to David Walser from comment #4)
> > Rpm still needs to be able to read libdb-based rpm databases so it can
> > convert them, so it can't drop the dependency yet.
> 
> Hmm, you're right, sort of. Read support for libdb seems to be enabled in
> the buildscript but maybe it's not working anyway? Write support for libdb
> was removed a few years ago from rpm so maybe they ditched read support too?
> I'm not using mga9 but I really hope that rpm uses sqlite there.

If it wasn't working, upgrades would be broken.
Comment 9 Jens Persson 2023-11-19 22:40:02 CET
(In reply to David Walser from comment #8)
> (In reply to Jens Persson from comment #6)
> > (In reply to David Walser from comment #4)
> > > Rpm still needs to be able to read libdb-based rpm databases so it can
> > > convert them, so it can't drop the dependency yet.
> > 
> > Hmm, you're right, sort of. Read support for libdb seems to be enabled in
> > the buildscript but maybe it's not working anyway? Write support for libdb
> > was removed a few years ago from rpm so maybe they ditched read support too?
> > I'm not using mga9 but I really hope that rpm uses sqlite there.
> 
> If it wasn't working, upgrades would be broken.

Checked now and mga9 is using rpm-4.18 which only got write support for sqlite at least. Mga8 may still use libdb though? But read support for libdb could possibly be inernal in rpm and not use libdb? In any case a requires should be added for sqlite.

https://github.com/rpm-software-management/rpm/blob/master/lib/backend/bdb_ro.c

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