juledwar / soufi

Source finder CLI and API
Apache License 2.0
0 stars 0 forks source link

CentOS finder CLI does not seem to work #10

Closed 0xDEC0DE closed 2 years ago

0xDEC0DE commented 2 years ago

Steps to reproduce

soufi centos device-mapper-libs 1.02.175-5.el8

Expected result

https://vault.centos.org/centos/8/BaseOS/Source/SPackages/lvm2-2.03.11-5.el8.src.rpm

Actual behavior

source not found

Errata

0xDEC0DE commented 2 years ago

Clarification: when using Multiple Options, Click says:

When passing a default with multiple=True, the default value must be a list or tuple, otherwise it will be interpreted as a list of single characters.

0xDEC0DE commented 2 years ago

Additional clarification:

The problem with the epoch in source packages is that it is not a part of the sourcerpm filename. To demonstrate, load a set of repos:

>>> import repomd
>>> herp = repomd.load('https://vault.centos.org/centos/8/BaseOS/Source/')
>>> derp = repomd.load('https://vault.centos.org/centos/8/BaseOS/x86_64/os/')

Now, picking an "interesting" package, note that the epoch is returned/known about, but not encoded in the sourcerpm filename:

>>> derp.findall('device-mapper-libs')
[<Package: "device-mapper-libs-8:1.02.175-5.el8.i686">, <Package: "device-mapper-libs-8:1.02.175-5.el8.x86_64">]
>>> derp.findall('device-mapper-libs')[0].sourcerpm
'lvm2-2.03.11-5.el8.src.rpm'

Similarly, the source repo is aware of the epoch:

>>> herp.findall('lvm2')
[<Package: "lvm2-8:2.03.11-5.el8.src">]
>>> herp.findall('lvm2')[0].evr
'8:2.03.11-5.el8'

...but the soufi code has no way of knowing what the epoch is, because it simply splits up the filename to get the EVR fields. There is an epoch-less attribute that can be used instead, however:

>>> herp.findall('lvm2')[0].vr
'2.03.11-5.el8'
0xDEC0DE commented 2 years ago

Fixed by #12