[Pulp-list] retain_old_count

Randy Barlow rbarlow at redhat.com
Thu Mar 6 00:13:08 UTC 2014


Jake Davis wrote:
> Any suggestion about how best to implement retain_old_count for non-feed
> repos? How is it done for feed repos? I tried searching the github repo
> for "retain_old_count" but that didn't help me.

Hi Jake,

Apologies for taking so long in responding. I'm not personally the best 
person to ask about this, as I am not too familiar with our Yum 
Importer, but I'll take a guess at what it might be doing.

If I were tasked with writing something that did this with a feed, I 
would take note of any packages that I had in my repo that were not in 
the feed. Assuming that these packages are "old", I would consider them 
for removal. For any packages that are in the feed with a newer version 
than my now "missing" packages, I could simply use version comparison to 
determine which of my packages are the oldest, and remove all but the 
retain_old_count newer ones.

For reference, I did find the code that performs this operation in our 
pulp_rpm package[0].

Since you want to copy packages, you will have to use the REST API to 
simulate a similar behavior. Query the source repo for which packages 
are present and the destination repo for which packages are present. The 
differences will show you packages that have been removed from the 
source that are still present. Then you can use version comparison to 
figure out the order ranking of the missing packages, and apply a 
similar logic to remove as many as you wish.

Does that help?

[0] 
https://github.com/pulp/pulp_rpm/blob/master/plugins/pulp_rpm/plugins/importers/yum/purge.py#L24

-- 
Randy Barlow
Raleigh, NC, USA




More information about the Pulp-list mailing list