Bug 1097634 - RFE : add option --latest to spacewalk-repo-sync
Summary: RFE : add option --latest to spacewalk-repo-sync
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Server
Version: 2.2
Hardware: All
OS: All
unspecified
medium
Target Milestone: ---
Assignee: Jiří Dostál
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: spacewalk-rfe space24
TreeView+ depends on / blocked
 
Reported: 2014-05-14 08:26 UTC by Stéphane Gaubert
Modified: 2015-10-08 13:27 UTC (History)
2 users (show)

Fixed In Version: spacewalk-backend-2.4.14-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-10-08 13:27:18 UTC
Embargoed:


Attachments (Terms of Use)

Description Stéphane Gaubert 2014-05-14 08:26:09 UTC
Hello,

I'd like to have an option --latest added to spacewalk-repo-sync in order to limit the synchronization to the latest versions of each packages contained in a yum repository.

I need to regularly suppress obsolete versions of packages from my channels in order to free disk space. I know that obsolete versions of RPMs that are not already installed on any registered client won't be of nay use, and I use a script based on swalk-clean-old-packages.py from Nicolas PRADELLES that suppresses them from spacewalk.

Once this cleanup is done, the next taskomatic's execution of spacewalk-repo-sync will download the obsolete versions of RPMs from the external YUM repositories again, making the cleanup useless.

An option --latest would be useful in order to avoid to synchronize the obsoleted versions of packages in the cleaned channels again.

A corresponding parameter should also be added to spacewalk's repositories in order to be able to configure the use of this option per repository.

Regards,

Stéphane

Comment 1 Jiří Dostál 2015-08-04 08:46:41 UTC
Hello,

You can now use --latest or -n option to sync only latest packages. I have also added this feature to web interface, so you can now schedule sync with latest packages only. Hope this helps.

spacewalk-repo-sync fix: 58f90487820c2f139b8d1d1600401b6129de6288
web interface feature: 7801fb5e5cd76e84d04ac4c866fddec6dcbaa3ea

Comment 2 Stéphane Gaubert 2015-08-04 13:53:49 UTC
Hello,

Thank you for this work. I have pulled your fix for spacewalk-repo-sync from git and quick tested it on a small channel.

It seems that the result of of latest_packages function from spacewalk.satellite_tools.reposync contains more than the latest packages contained in the yum repository to synchronize.

For example, from this list of RPMs :

java-1.7.1-ibm-1.7.1.0.0-1jpp.4.el7-1.i686
java-1.7.1-ibm-1.7.1.0.0-1jpp.4.el7-1.x86_64
java-1.7.1-ibm-1.7.1.1.0-1jpp.2.el7_0-1.i686
java-1.7.1-ibm-1.7.1.1.0-1jpp.2.el7_0-1.x86_64
java-1.7.1-ibm-1.7.1.1.0-1jpp.3.el7_0-1.i686
java-1.7.1-ibm-1.7.1.1.0-1jpp.3.el7_0-1.x86_64
java-1.7.1-ibm-1.7.1.1.1-1jpp.1.el7_0-1.i686
java-1.7.1-ibm-1.7.1.1.1-1jpp.1.el7_0-1.x86_64
java-1.7.1-ibm-1.7.1.2.0-1jpp.3.el7_0-1.i686
java-1.7.1-ibm-1.7.1.2.0-1jpp.3.el7_0-1.x86_64
java-1.7.1-ibm-1.7.1.2.10-1jpp.3.el7_0-1.i686
java-1.7.1-ibm-1.7.1.2.10-1jpp.3.el7_0-1.x86_64
java-1.7.1-ibm-1.7.1.3.0-1jpp.2.el7_1-1.i686
java-1.7.1-ibm-1.7.1.3.0-1jpp.2.el7_1-1.x86_64
java-1.7.1-ibm-1.7.1.3.10-1jpp.1.el7_1-1.i686
java-1.7.1-ibm-1.7.1.3.10-1jpp.1.el7_1-1.x86_64

the latest_packages function returns all RPMs except java-1.7.1-ibm-1.7.1.0.0-1jpp.4.el7-1.i686 and java-1.7.1-ibm-1.7.1.0.0-1jpp.4.el7-1.x86_64. I'd expect it to return java-1.7.1-ibm-1.7.1.3.10-1jpp.1.el7_1-1.i686 and java-1.7.1-ibm-1.7.1.3.10-1jpp.1.el7_1-1.x86_64.

I also see that this function removes all but the latest versions of a package from the Spacewalk channel by calling self.disassociate_package for all packages that are not the latest version present in the repository to synchronize. I would like to be able to keep the previous versions of a package in my channels until I decide to cleanup the obsoleted versions that are not currently installed on one of my system. I'd wish that spacewalk-repo-sync didn't call disassociate package for the packages not selected by the --latest option.

Regards,

Stéphane

Comment 3 Jiří Dostál 2015-08-14 12:05:24 UTC
Please check spacewalk git 9f189c34f6d18fc064a2a8e21c195f3c6152b384.

Please give me some feedback if it works better.

Thanks,
Jiri

Comment 4 Stéphane Gaubert 2015-08-26 12:06:54 UTC
Hello Jiri,

Thank you for the update and sorry for the delay in testing this new version. I was away from work the previous weeks.

This new version still returns too many RPMs. From the list of RPMs from my previous post, a call to latest_packages now returns this list :

java-1.7.1-ibm-1.7.1.0.0-1jpp.4.el7-1.i686
java-1.7.1-ibm-1.7.1.0.0-1jpp.4.el7-1.x86_64
java-1.7.1-ibm-1.7.1.1.0-1jpp.2.el7_0-1.i686
java-1.7.1-ibm-1.7.1.1.0-1jpp.2.el7_0-1.x86_64
java-1.7.1-ibm-1.7.1.1.1-1jpp.1.el7_0-1.i686
java-1.7.1-ibm-1.7.1.1.1-1jpp.1.el7_0-1.x86_64
java-1.7.1-ibm-1.7.1.2.10-1jpp.3.el7_0-1.i686
java-1.7.1-ibm-1.7.1.2.10-1jpp.3.el7_0-1.x86_64
java-1.7.1-ibm-1.7.1.3.0-1jpp.2.el7_1-1.i686
java-1.7.1-ibm-1.7.1.3.0-1jpp.2.el7_1-1.x86_64
java-1.7.1-ibm-1.7.1.3.10-1jpp.1.el7_1-1.i686
java-1.7.1-ibm-1.7.1.3.10-1jpp.1.el7_1-1.x86_64

From the source code, this seems to be the consequence of taking into account the release of the RPMs when checking if a newer version of an RPM has been already seen (package.getNRA). May I suggest to just take the name and the arch of an RPM for this check ?

Regards,

Stéphane

Comment 5 Jan Dobes 2015-10-08 13:27:18 UTC
Spacewalk 2.4 has been released.


Note You need to log in before you can comment on or make changes to this bug.