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

Fixes #29768 - Use debversion extension for sorting deb-versions #8708

Merged
merged 1 commit into from Jun 4, 2020

Conversation

m-bucher
Copy link
Contributor

This requires that rh-postgresql12-postgresql-debversion package is installed.
Additionally the extension must be activated in the database:

CREATE EXTENSION debversion;

Not sure if this can/should be done in the migration-script.

Having this merged would make it possible to merge/review #7961 and #8277, because they rely on a possibility to compare Debian version numbers.

@m-bucher
Copy link
Contributor Author

OK, so the test fails because db/schema.rb is not correctly created:

# Could not dump table "katello_debs" because of following StandardError
#   Unknown type 'debversion' for column 'version_sortable'

Any ideas?

@m-bucher m-bucher force-pushed the use_debversion_pg-extension branch from d5995fb to b2ff5ff Compare May 14, 2020 20:17
@m-bucher m-bucher force-pushed the use_debversion_pg-extension branch from b2ff5ff to d5e3899 Compare May 14, 2020 20:18
@m-bucher
Copy link
Contributor Author

Patched the debversion into the PostgreSQLAdapter 😁

@chris1984
Copy link
Member

@m-bucher what are the steps for me to test this? Just install the package and run a db:migrate/seed?

@m-bucher
Copy link
Contributor Author

@chris1984 yes, if the postgresql-debversion package is installed, the migration should work.

@chris1984
Copy link
Member

Awesome will test it Monday

@chris1984 chris1984 self-assigned this May 15, 2020
@chris1984
Copy link
Member

@m-bucher

To testing the sorting, do I just need to upload a few deb packages of different names, or the same name but with different versions?

@m-bucher
Copy link
Contributor Author

@chris1984, either that or you just sync any apt-repository (I do not recommend Debian stable repository because it is fairly large 😁 ).
Something like Ubuntu focal-security should have a reasonable size, because it is fairly new:

URL Release Architecture
http://archive.ubuntu.com/ubuntu/ focal-security amd64

Then you can compare the results of ORDER BY version and ORDER BY version_sortable in the DB-console.
At least that's what I did 😃

Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK looks good to me based on the results being different:

                    name                     |            version             
---------------------------------------------+--------------------------------
 libjson-c-dev                               | 0.13.1+dfsg-7ubuntu0.2
 libjson-c4                                  | 0.13.1+dfsg-7ubuntu0.2
 libjson-c-doc                               | 0.13.1+dfsg-7ubuntu0.2
 libexif-doc                                 | 0.6.21-6ubuntu0.1
 libexif-dev                                 | 0.6.21-6ubuntu0.1
 libexif12                                   | 0.6.21-6ubuntu0.1


katello=# select name, version from katello_debs ORDER by version_sortable;
                    name                     |            version             
---------------------------------------------+--------------------------------
 libexif-doc                                 | 0.6.21-6ubuntu0.1
 libexif12                                   | 0.6.21-6ubuntu0.1
 libexif-dev                                 | 0.6.21-6ubuntu0.1
 libjson-c-dev                               | 0.13.1+dfsg-7ubuntu0.2
 libjson-c4                                  | 0.13.1+dfsg-7ubuntu0.2
 libjson-c-doc                               | 0.13.1+dfsg-7ubuntu0.2

@jturel any comments?

@jlsherrill jlsherrill changed the title Use debversion extension for sorting deb-versions Fixes #29768 - Use debversion extension for sorting deb-versions Jun 1, 2020
@jlsherrill
Copy link
Member

This looks good to me, just waiting on https://github.com/theforeman/puppet-katello/pull/341/files so we don't break nightlies

@jlsherrill
Copy link
Member

I think this is good to go. Thanks @m-bucher !

@jlsherrill jlsherrill merged commit 5147705 into Katello:master Jun 4, 2020
@m-bucher m-bucher deleted the use_debversion_pg-extension branch June 5, 2020 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants