doccaz / scc-tools

A set of simple tools to interact with SUSE Customer Center (SCC)
MIT License
12 stars 1 forks source link

Treat duplicate packages in PackageHub #16

Closed doccaz closed 3 years ago

doccaz commented 3 years ago

As a collateral effect of issue #15 , packages that exist on both the main "Pool" repository and on PackageHub (with different versions!) now come up in the search results.

This leads to the wrong (?) package being selected as the latest version, like in this example for the package python3-hwdata on SUSE Manager 4.2:

2 packages with name containing "python3-hwdata" in SUSE Manager Server 4.2 x86_64
Name    Version License Module
python3-hwdata  2.3.5-bp153.1.13    GPL-2.0 SUSE Package Hub 15 SP3
python3-hwdata  2.3.5-1.21  GPL-2.0 SUSE Manager Server Module 4.2

The version comparison class will select 2.3.5-bp153.1.13 over 2.3.5-1.21. Still considering what to do in this case.

Thr3d commented 3 years ago

Don't know if it is possible but selecting the version from the same module as the package is installed from seems like the preferable option.

frispete commented 3 years ago

The version comparison class will select 2.3.5-bp153.1.13 over 2.3.5-1.21. Still considering what to do in this case.

Hm:

$ LANG=C zyp vcmp 2.3.5-bp153.1.13 2.3.5-1.21
Verbosity: 2
Non-option program arguments: '2.3.5-bp153.1.13' '2.3.5-1.21' 
2.3.5-bp153.1.13 is older than 2.3.5-1.21
doccaz commented 3 years ago

Don't know if it is possible but selecting the version from the same module as the package is installed from seems like the preferable option.

Good suggestion! I'm at the point where I managed to sort the duplicates by repository, so I guess I just need to take the entry that matches the base product.

doccaz commented 3 years ago

The version comparison class will select 2.3.5-bp153.1.13 over 2.3.5-1.21. Still considering what to do in this case.

Hm:

$ LANG=C zyp vcmp 2.3.5-bp153.1.13 2.3.5-1.21
Verbosity: 2
Non-option program arguments: '2.3.5-bp153.1.13' '2.3.5-1.21' 
2.3.5-bp153.1.13 is older than 2.3.5-1.21

Now that is a zypper command I did not know of 😃 I took a look at how zypper is evaluating the versions and releases, and I think my sort function is now able to do similar. Thanks for the tip!

frispete commented 3 years ago

Yeah, I know, rpm version comparison is pretty tricky in the details - been there, done that before...

It's really funny, that even experienced packagers often don't know the difference of using + versus ~ in revision extensions.

doccaz commented 3 years ago

I think I got it now. It's now dealing with better version sorting: it correctly determined what was older/newer, at least on anything I could throw at it, version and release-wise. It now gives preference to the package results that come from the corresponding Base channel for the product. If it's there and the version already matches the latest one, there's no need to report the other versions. I tested it against my dozen or so supportconfigs with a mix of different versions/products/architectures, and everything appears to match okay now.

I also noticed that I was "wasting time" looking for packages that were clearly unsupported (different vendor). The logic was corrected.

And lastly, there was an issue with escaping package names that I didn't notice before. I'm now sure "libstdc++6" shouldn't have been reported as unknown that often 😂