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 #33525 - Add debs packages_restrict_latest #9671

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

m-bucher
Copy link
Contributor

This should implement the packages_restrict_latest parameter, but I am not sure I really want to have this merged, because it does not scale well at all.
This originates in the way we compare debian versions and the fact that we have to compare them and are not able to simply sort them.

Maybe some kind of restriction to a max number of packages is in order for this to be usable.

@theforeman-bot
Copy link

Issues: #33525

@sbernhard
Copy link
Member

Can you add some benchmark values here? https://ruby-doc.org/stdlib-2.5.3/libdoc/benchmark/rdoc/Benchmark.html

How can we get this fast?

Copy link
Member

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

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

Ack from the logic point of view

Comment on lines +108 to +112
return relation.joins(
"LEFT OUTER JOIN(#{relation.to_sql}) AS katello_debs2 ON " \
'katello_debs.name = katello_debs2.name AND katello_debs.architecture = katello_debs2.architecture AND ' \
'deb_version_cmp(katello_debs.version, katello_debs2.version) < 0 ' \
).where('katello_debs2.id IS NULL')
Copy link
Member

Choose a reason for hiding this comment

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

Capturing things we talked about live: If I were doing this I'd probably drop the explicit return and used a squiggly heredoc, but that's just personal preference so feel free to ignore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since most of the code was shamelessly copied over from app/models/katello/rpm.rb, I would keep it that way for being consistent.

Eventually, we should think about enforcing a certain style through rubocop. AFAIK Katello's rubocop rules are currently pretty flexible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants