Bug 1684628

Summary: rpm2swidtag --repo should clean up existing .swidtag.xml files
Product: [Fedora] Fedora Reporter: Stephen Tweedie <sct>
Component: swid-toolsAssignee: Jan Pazdziora (Red Hat) <jpazdziora>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jpazdziora, rpm-software-management
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: swid-tools-0.8.2-1.fc30 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-15 01:35:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stephen Tweedie 2019-03-01 17:08:28 UTC
Description of problem:
When running rpm2swidtag --repo on a repo with an existing .swidtag.xml.gz tag bundle, we should delete the existing swidtag file once we have created the new one.

There is little value in maintaining multiple copies; an option could be added to preserve them if the user explicitly wants to do so.

This would be consistent with the behaviour of createrepo, which also removes old metadata when calculating new content (unless preservation of older versions is requested with createrepo --retain-old-md=N).

Comment 1 Jan Pazdziora (Red Hat) 2019-03-05 12:19:06 UTC
Should we remove just the file which was referenced from the repomd.xml when rpm2swidtag --repo started, or all *-swidtags.xml.* files from the repodata/ subdirectory?

Comment 2 Stephen Tweedie 2019-03-05 12:28:18 UTC
I don't mind greatly.  I think it depends on what behaviour we want to support when explicitly enabling preservation of older copies. 

If we go with

--preserve-old-swidtags

then let's just delete the repomd.xml referenced version by default, and leave it alone if we are asked to preserve.

But if we want to support

--retain-old-md=N

then we're required to scan multiple *-swidtags.xml.* and delete all but the N newest (by timestamp)

I don't have a strong preference between these two, but consistency with the createrepo --retain-old-md=N seems like a reasonable choice.

Comment 3 Jan Pazdziora (Red Hat) 2019-05-06 13:47:57 UTC
The --retain-old-md=N option was implemented upstream:
https://github.com/swidtags/rpm2swidtag/commit/727477c74b0002d74f86fc374b265354eb4d0dbc

Comment 4 Jan Pazdziora (Red Hat) 2019-05-06 14:49:28 UTC
Updating component.

Comment 5 Fedora Update System 2019-05-06 14:50:56 UTC
swid-tools-0.8.2-1.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-2c96e4701e

Comment 6 Fedora Update System 2019-05-06 21:04:02 UTC
swid-tools-0.8.2-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-2c96e4701e

Comment 7 Fedora Update System 2019-05-15 01:35:09 UTC
swid-tools-0.8.2-1.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.