Project

Profile

Help

Story #5367

closed

As a user, I can have a sync option that retains the latest N packages of the same name

Added by paji@redhat.com over 4 years ago. Updated over 3 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

Goal

Provide a way to specify that for example only the latest N versions of every package with the name name are retained in the repository.

Sync time option retain-old-count

RPM sync will take a sync-time option named retain-old-count with an integer value. This will cause N versions of a package to be retained. Two packages with the same name are considered the same package.

When used the integer value needs to be validated as an Integer that is greater than 0 and raise a Validation error otherwise.

Determining latest

Latest is determine by comparison of the <epoch, version, and release> triplet.

Incompatibility with mirror=True

The mirror=True option requires the retained packages to be a mirror of the remote so mirror=True cannot to be used when the user is also specifying retain-old-count.

This needs to raise a Validation error if mirror=True and retain-old-count are specified together.

Pulp2 Equivalent

In Pulp2 it was called retain-old-count.

Implementation

The RpmDeclarativeVersion should implement a create method that will mimic the one from core The only difference in the RPM one is that instead of adding ContentUnassociation as the last stage a new custom RPM stage should be implemented. Let's call that stage ContentUnassociationRetainN (as a working name).

The ContentUnassociationRetainN stage works in place of the ContentUnassocaition in core and runs with similar assumptions. Specifically it receives queryset objects not DeclarativeContent objects like earlier stages in the pipeline. You can see those emitted from the stage before

The ContentUnassicationRetainN stage needs to further filter these unassociation querysets to filter out units that would be removed but shouldn't be due to their NEVRA. The content associated with the repository is already in place so between the queryset of items marked for removal and the content that is "known good" being outside of those querysets one should be able to compute the previous N versions somehow.

I think we can start with something inefficient but correct and improve it over time through profiling and the explain operator.

Katello Related Issue

https://projects.theforeman.org/issues/16154


Related issues

Blocked by RPM Support - Story #5402: As a developer, Package content allows ORDER_BY in postgres based on EVR comparisonsCLOSED - CURRENTRELEASEdalley

Actions

Also available in: Atom PDF