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

Wrong version reported for Ruby #35

Closed
voxik opened this issue Dec 1, 2022 · 1 comment · Fixed by #36
Closed

Wrong version reported for Ruby #35

voxik opened this issue Dec 1, 2022 · 1 comment · Fixed by #36
Assignees
Labels

Comments

@voxik
Copy link
Contributor

voxik commented Dec 1, 2022

This is mostly clone of https://pagure.io/mdapi/issue/115

I was complaining, that the-new-hotness does not report new versions available, but the analysis discovered, that the mdapi is to blame, because it reports wrong version. This is the latest Ruby build:

https://koji.fedoraproject.org/koji/buildinfo?buildID=2093827

Apparently, it is ruby-3.1.3-172.fc38, but the mdapi reports version 6.4.0. There is actually rubygem-rdoc-6.4.0-172.fc38.noarch.rpm subpackage of Ruby package, but I have no idea why is this version represented as the Ruby version.

@voxik
Copy link
Contributor Author

voxik commented Dec 1, 2022

Analyzing the issue, the problem seems to be here:

async with dtbsobjc.execute(GET_PACKAGE_BY_SRC, ("%s-%%" % srcn,)) as dbcursor:
pkgc = await dbcursor.fetchall()
if pkgc:
srcn = re.escape(srcn)
ptrn = re.compile("%s-[0-9]" % srcn)
for pkgx in pkgc:
if ptrn.match(pkgx[3]):
pckg = Packages(*pkgx)
break

The GET_PACKAGE_BY_SRC returns somethig like this:

sqlite> SELECT pkgKey,pkgId,name,rpm_sourcerpm,epoch,version,release,arch,summary FROM packages WHERE rpm_sourcerpm LIKE 'ruby-%' ORDER BY epoch DESC, version DESC, release DESC;
pkgKey|pkgId|name|rpm_sourcerpm|epoch|version|release|arch|summary
38788|50f352b42e9c829c7ba7a8401fae72cdbd7ef2c46fe4518b59973c473d13f0ab|rubygem-rdoc|ruby-3.1.3-172.fc38.src.rpm|0|6.4.0|172.fc38|noarch|A tool to generate HTML and command-line documentation for Ruby projects
38565|f32ba51918ff49a02b2a121f699deb77fa7aa7bddae210d2c13c96d5af21dc7b|rubygem-minitest|ruby-3.1.3-172.fc38.src.rpm|0|5.15.0|172.fc38|noarch|Minitest provides a complete suite of testing facilities
38726|de9d4c528526558afb30053f712bd476d6703819e296eca15fb141db3b881c8c|rubygem-psych|ruby-3.1.3-172.fc38.src.rpm|0|4.0.4|172.fc38|x86_64|A libyaml wrapper for Ruby
38970|2974c671192386b3d0704862a58f88d3de645227a1dff1790e465419121228f8|rubygem-test-unit|ruby-3.1.3-172.fc38.src.rpm|0|3.5.3|172.fc38|noarch|An xUnit family unit testing framework for Ruby
39074|82386a71740e58baba01bf949c760146d8e74c420ac5322fda605f7552605be9|rubygems|ruby-3.1.3-172.fc38.src.rpm|0|3.3.26|172.fc38|noarch|The Ruby standard for packaging ruby libraries
39075|20119b07d66b912f68a191846258f1bb5fcac06286d610589e07dd49c60cf78e|rubygems-devel|ruby-3.1.3-172.fc38.src.rpm|0|3.3.26|172.fc38|noarch|Macros and development tools for packaging RubyGems
38811|132c918ff67d62c21ae2a88fdf43c55b419541391a8bd2dee242c043e3e79add|rubygem-rexml|ruby-3.1.3-172.fc38.src.rpm|0|3.2.5|172.fc38|noarch|An XML toolkit for Ruby
38023|7c82d3aecfc90fede9c52139886b653185bef8509707d1fe3db02142204b63dc|ruby|ruby-3.1.3-172.fc38.src.rpm|0|3.1.3|172.fc38|x86_64|An interpreter of object-oriented scripting language

... snip ...

38067|b578216f79903bce787b6d609a5180f989de80baf8999faf4ca48d4b95d097e3|ruby-romkan|ruby-romkan-0.4-27.fc37.src.rpm|0|0.4|27.fc37|noarch|Romaji <-> Kana conversion library for Ruby
39013|f083a8acc3dfbbff9232e8c0302146a3eae775205c7ecdb7793fe342cb09f850|rubygem-typeprof|ruby-3.1.3-172.fc38.src.rpm|0|0.21.3|172.fc38|noarch|TypeProf is a type analysis tool for Ruby code based on abstract interpretation
38842|3c08549df9601010b3204cd2e832d5f138f7638e2375ed02543c35bde01a34fa|rubygem-rss|ruby-3.1.3-172.fc38.src.rpm|0|0.2.9|172.fc38|noarch|Family of libraries that support various formats of XML "feeds"
38051|8a6464d83afd226369531f2a3c359a48a9231ca2994a37ad69143997ec89a721|ruby-icon-artist|ruby-icon-artist-0.1.92-24.fc37.src.rpm|0|0.1.92|24.fc37|noarch|Supporting libraries for icon artists

This is later filtered by:

ptrn = re.compile("%s-[0-9]" % srcn)

I.e. the rpm_sourcerpm has to match srcn-[0-9], which still matches the first item and that is the rubygem-rdoc. While this is certainly better then prior 1d7d14d, it is still not enough. I thing that if there is row, where name == srcn, that line should be preferred. Of course there might not be such line, if I am not mistaken, this is common for python packages. So there still should be some fallback.

voxik added a commit to voxik/mdapi that referenced this issue Dec 1, 2022
If there is multiple subpackages from single SRPM, the first subpackage
is taken. This is fine as long as the subpackages are reusing the main
package versioning, which might not always be the case.

To avoid issue, from the list of subpackages, try to select first the
package which matches the source package name.

Unfortunately, this still leaves room for issues, where there is no
subpackage of the same name as SRPM and when the versioning of
subpackages differs from the SRPM version.

Fixes fedora-infra#35
voxik added a commit to voxik/mdapi that referenced this issue Dec 1, 2022
If there is multiple subpackages from single SRPM, the first subpackage
is taken. This is fine as long as the subpackages are reusing the main
package versioning, which might not always be the case.

To avoid issue, from the list of subpackages, try to select first the
package which matches the source package name.

Unfortunately, this still leaves room for issues, where there is no
subpackage of the same name as SRPM and when the versioning of
subpackages differs from the SRPM version.

Fixes fedora-infra#35
voxik added a commit to voxik/mdapi that referenced this issue Dec 1, 2022
If there is multiple subpackages from single SRPM, the first subpackage
is taken. This is fine as long as the subpackages are reusing the main
package versioning, which might not always be the case.

To avoid issue, from the list of subpackages, try to select first the
package which matches the source package name.

Unfortunately, this still leaves room for issues, where there is no
subpackage of the same name as SRPM and when the versioning of
subpackages differs from the SRPM version.

Fixes fedora-infra#35
@gridhead gridhead added the bug label Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants