Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#71146 - [pyalpm] 0.10.3-1 breaks syncdbs

Attached to Project: Arch Linux
Opened by lxgr (lxgr) - Sunday, 06 June 2021, 17:00 GMT
Last edited by Jelle van der Waa (jelly) - Sunday, 13 June 2021, 16:34 GMT
Task Type Bug Report
Category General
Status Closed
Assigned To Jelle van der Waa (jelly)
Architecture All
Severity High
Priority Normal
Reported Version 6.0.0
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Summary and Info:
The searching and information feature of pyalpm (like documented here: https://pyalpm.readthedocs.io/en/latest/pyalpm/pyalpm.html#basic-usage) does not work with sncdbs.

Steps to Reproduce:
Execute this:
import pyalpm
from pyalpm import Handle
handle = Handle('.', '/var/lib/pacman/')
core = handle.register_syncdb("core", pyalpm.SIG_DATABASE)
core.search("linux.*")
linux = core.get_pkg("linux")
print(linux.download_size)

In the python shell and you may get this output:
Python 3.9.5 (default, May 24 2021, 12:50:35)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyalpm
>>> from pyalpm import Handle
>>> handle = Handle('.', '/var/lib/pacman/')
>>> core = handle.register_syncdb("core", pyalpm.SIG_DATABASE)
>>> core.search("linux.*")
[]
>>> linux = core.get_pkg("linux")
>>> print(linux.download_size)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'download_size'

This task depends upon

Closed by  Jelle van der Waa (jelly)
Sunday, 13 June 2021, 16:34 GMT
Reason for closing:  Implemented
Additional comments about closing:  Updated documentation in 6af848a3a292a508309487848fd7ab23f3695fec
Comment by Jelle van der Waa (jelly) - Monday, 07 June 2021, 12:47 GMT
get_pkg() indeed does not work for syncdb's this has not changed with recent version so might be expected.

[root@archtest ~]# pacman -Q pyalpm
pyalpm 0.9.1-3

[root@archtest ~]# python3 foo.py
[]
None
Comment by lxgr (lxgr) - Monday, 07 June 2021, 21:51 GMT
But then why doesn't it work and why is it documented as it should work?
Comment by Felix Yan (felixonmars) - Monday, 07 June 2021, 22:04 GMT
You need to use something other than pyalpm.SIG_DATABASE:

Python 3.9.5 (default, May 24 2021, 12:50:35)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyalpm
>>> from pyalpm import Handle
>>> handle = Handle('.', '/var/lib/pacman/')
>>> core = handle.register_syncdb("core", 0)
>>> core.search("linux.*")
[<alpm.Package("archlinux-keyring-20210110-1-any") at 0x7f34ad1fd3f0>, <alpm.Package("base-2-2-any") at 0x7f34ad1fd2d0>, <alpm.Package("efibootmgr-17-2-x86_64") at 0x7f34ad282b40>, <alpm.Package("filesystem-2021.05.31-1-x86_64") at 0x7f34ad1b4330>, <alpm.Package("hdparm-9.61-1-x86_64") at 0x7f34ad1b41b0>, <alpm.Package("iptables-1:1.8.7-1-x86_64") at 0x7f34ad1b4120>, <alpm.Package("iptables-nft-1:1.8.7-1-x86_64") at 0x7f34ad1b4d80>, <alpm.Package("keyutils-1.6.3-1-x86_64") at 0x7f34ad1b4390>, <alpm.Package("kmod-29-1-x86_64") at 0x7f34ad1b4cf0>, <alpm.Package("libaio-0.3.112-2-x86_64") at 0x7f34ad1b41e0>, <alpm.Package("linux-5.12.9.arch1-1-x86_64") at 0x7f34ad1b4ea0>, <alpm.Package("linux-api-headers-5.12.3-1-any") at 0x7f34ad1b4f60>, <alpm.Package("linux-docs-5.12.9.arch1-1-x86_64") at 0x7f34ad1b4210>, <alpm.Package("linux-firmware-20210511.7685cf4-1-any") at 0x7f34ad1bfed0>, <alpm.Package("linux-headers-5.12.9.arch1-1-x86_64") at 0x7f34ad1bf030>, <alpm.Package("linux-lts-5.10.42-1-x86_64") at 0x7f34ad1bf1b0>, <alpm.Package("linux-lts-docs-5.10.42-1-x86_64") at 0x7f34ad1bfc60>, <alpm.Package("linux-lts-headers-5.10.42-1-x86_64") at 0x7f34ad1bff00>, <alpm.Package("man-pages-5.11-1-any") at 0x7f34ad0f7ab0>, <alpm.Package("mdadm-4.1-2-x86_64") at 0x7f34ad0f7a80>, <alpm.Package("net-tools-2.10-1-x86_64") at 0x7f34ad0f7a50>, <alpm.Package("pacman-mirrorlist-20210509-1-any") at 0x7f34ad0f7a20>, <alpm.Package("syslinux-6.04.pre2.r11.gbf6db5b4-3-x86_64") at 0x7f34ad0f7930>, <alpm.Package("util-linux-2.37-1-x86_64") at 0x7f34ad0f7720>, <alpm.Package("util-linux-libs-2.37-1-x86_64") at 0x7f34ad0f7750>]
>>> linux = core.get_pkg("linux")
>>> print(linux.download_size)
99516768

I got hit by this too some time ago...
Comment by lxgr (lxgr) - Monday, 07 June 2021, 22:15 GMT
Oh, thank you, I think this should then be added to the documentation.

Loading...