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

apt: Prefer deb version comparison to strcmp #735

Merged
merged 1 commit into from
May 21, 2024

Conversation

sidt4
Copy link
Contributor

@sidt4 sidt4 commented Mar 30, 2024

Fixes: #733

@sidt4
Copy link
Contributor Author

sidt4 commented Mar 30, 2024

There are few places in apt backend where we use strcmp for version comparison. But they test for equality which is OK.

./apt-cache-file.cpp:380:            strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
./apt-cache-file.cpp:386:        if (strcmp(candidateVer.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
./pkg-list.cpp:74:                strcmp(viA.VerStr(), viB.VerStr()) == 0 &&

@sidt4 sidt4 marked this pull request as ready for review March 30, 2024 12:35
@sidt4
Copy link
Contributor Author

sidt4 commented Mar 30, 2024

Packages are correctly sorted by version (making Installed first when applicable)

$ for i in gnome-calendar gnome-disk-utility gnome-chess gnome-software; do echo; echo; pkcon resolve $i; done

Resolving                               [=========================]         
Loading cache                           [=========================]         
Installed   	gnome-calendar-46~beta-1.amd64 (manual:local)               	Calendar application for GNOME
Available   	gnome-calendar-46.0-1.amd64 (debian-unstable-main)          	Calendar application for GNOME
Available   	gnome-calendar-46.0-1.amd64 (debian-unstable-main)          	Calendar application for GNOME


Resolving                               [=========================]         
Loading cache                           [=========================]         
Installed   	gnome-disk-utility-46~alpha-1.amd64 (auto:local)            	manage and configure disk drives and media
Available   	gnome-disk-utility-46.0-1.amd64 (debian-unstable-main)      	manage and configure disk drives and media
Available   	gnome-disk-utility-46.0-1.amd64 (debian-unstable-main)      	manage and configure disk drives and media


Resolving                               [=========================]         
Loading cache                           [=========================]         
Installed   	gnome-chess-1:46~beta-1+b1.amd64 (auto:local)               	simple chess game
Available   	gnome-chess-1:46.0-1.amd64 (debian-unstable-main)           	simple chess game
Available   	gnome-chess-1:46.0-1.amd64 (debian-unstable-main)           	simple chess game


Resolving                               [=========================]         
Loading cache                           [=========================]         
Installed   	gnome-software-46~beta-1.amd64 (auto:local)                 	Software Center for GNOME
Available   	gnome-software-46.0-1.amd64 (debian-unstable-main)          	Software Center for GNOME
Available   	gnome-software-46.0-1.amd64 (debian-unstable-main)          	Software Center for GNOME

@ximion ximion self-assigned this Mar 31, 2024
@ximion ximion merged commit e8626a9 into PackageKit:main May 21, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'Resolve` transaction gives results in different ordering of status ( apt backend )
2 participants