Bug 1804720

Summary: repomanage tool is not working correctly with modules in AppStream
Product: Red Hat Enterprise Linux 8 Reporter: Roman Bobek <rbobek>
Component: dnfAssignee: amatej
Status: CLOSED ERRATA QA Contact: Luca Berton <lberton>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 8.1CC: amatej, henson, james.antill, kwalker, lberton, mdomonko, packaging-team-maint, paul, pkratoch
Target Milestone: rcKeywords: Triaged
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-plugins-core-4.0.17-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 01:52:37 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:
Bug Depends On:    
Bug Blocks: 1825061    

Description Roman Bobek 2020-02-19 14:06:34 UTC
Description of problem:
repomange tool is not working correctly with modules in the new AppStream type repository. It is detecting the packages in modules with older available versions of software as obsolete/old:

# repomanage -k 1 rhel-8-for-x86_64-appstream-rpms
[...]
Packages/p/postgresql-12.1-2.module+el8.1.1+4794+c82b6e09.x86_64.rpm
Packages/p/postgresql-contrib-12.1-2.module+el8.1.1+4794+c82b6e09.x86_64.rpm
Packages/p/postgresql-docs-12.1-2.module+el8.1.1+4794+c82b6e09.x86_64.rpm
Packages/p/postgresql-jdbc-42.2.3-1.el8.noarch.rpm
Packages/p/postgresql-jdbc-javadoc-42.2.3-1.el8.noarch.rpm
Packages/p/postgresql-odbc-10.03.0000-2.el8.x86_64.rpm
Packages/p/postgresql-odbc-tests-10.03.0000-2.el8.x86_64.rpm
Packages/p/postgresql-plperl-12.1-2.module+el8.1.1+4794+c82b6e09.x86_64.rpm
Packages/p/postgresql-plpython3-12.1-2.module+el8.1.1+4794+c82b6e09.x86_64.rpm
Packages/p/postgresql-pltcl-12.1-2.module+el8.1.1+4794+c82b6e09.x86_64.rpm
Packages/p/postgresql-server-12.1-2.module+el8.1.1+4794+c82b6e09.x86_64.rpm
Packages/p/postgresql-server-devel-12.1-2.module+el8.1.1+4794+c82b6e09.x86_64.rpm
Packages/p/postgresql-static-12.1-2.module+el8.1.1+4794+c82b6e09.x86_64.rpm
Packages/p/postgresql-test-12.1-2.module+el8.1.1+4794+c82b6e09.x86_64.rpm
Packages/p/postgresql-test-rpm-macros-10.6-1.module+el8+2469+5ecd5aae.x86_64.rpm
Packages/p/postgresql-test-rpm-macros-12.1-2.module+el8.1.1+4794+c82b6e09.noarch.rpm
Packages/p/postgresql-upgrade-12.1-2.module+el8.1.1+4794+c82b6e09.x86_64.rpm
Packages/p/postgresql-upgrade-devel-12.1-2.module+el8.1.1+4794+c82b6e09.x86_64.rpm
[...]
# repomanage -o -k 1 rhel-8-for-x86_64-appstream-rpms
[...]
Packages/p/postgresql-10.6-1.module+el8+2469+5ecd5aae.x86_64.rpm
Packages/p/postgresql-9.6.10-1.module+el8+2470+d1bafa0e.x86_64.rpm
Packages/p/postgresql-contrib-10.6-1.module+el8+2469+5ecd5aae.x86_64.rpm
Packages/p/postgresql-contrib-9.6.10-1.module+el8+2470+d1bafa0e.x86_64.rpm
Packages/p/postgresql-docs-10.6-1.module+el8+2469+5ecd5aae.x86_64.rpm
Packages/p/postgresql-docs-9.6.10-1.module+el8+2470+d1bafa0e.x86_64.rpm
Packages/p/postgresql-plperl-10.6-1.module+el8+2469+5ecd5aae.x86_64.rpm
Packages/p/postgresql-plperl-9.6.10-1.module+el8+2470+d1bafa0e.x86_64.rpm
Packages/p/postgresql-plpython3-10.6-1.module+el8+2469+5ecd5aae.x86_64.rpm
Packages/p/postgresql-plpython3-9.6.10-1.module+el8+2470+d1bafa0e.x86_64.rpm
Packages/p/postgresql-pltcl-10.6-1.module+el8+2469+5ecd5aae.x86_64.rpm
Packages/p/postgresql-pltcl-9.6.10-1.module+el8+2470+d1bafa0e.x86_64.rpm
Packages/p/postgresql-server-10.6-1.module+el8+2469+5ecd5aae.x86_64.rpm
Packages/p/postgresql-server-9.6.10-1.module+el8+2470+d1bafa0e.x86_64.rpm
Packages/p/postgresql-server-devel-10.6-1.module+el8+2469+5ecd5aae.x86_64.rpm
Packages/p/postgresql-server-devel-9.6.10-1.module+el8+2470+d1bafa0e.x86_64.rpm
Packages/p/postgresql-static-10.6-1.module+el8+2469+5ecd5aae.x86_64.rpm
Packages/p/postgresql-static-9.6.10-1.module+el8+2470+d1bafa0e.x86_64.rpm
Packages/p/postgresql-test-10.6-1.module+el8+2469+5ecd5aae.x86_64.rpm
Packages/p/postgresql-test-9.6.10-1.module+el8+2470+d1bafa0e.x86_64.rpm
Packages/p/postgresql-test-rpm-macros-9.6.10-1.module+el8+2470+d1bafa0e.x86_64.rpm
Packages/p/postgresql-upgrade-10.6-1.module+el8+2469+5ecd5aae.x86_64.rpm
Packages/p/postgresql-upgrade-devel-10.6-1.module+el8+2469+5ecd5aae.x86_64.rpm
[...]

Version-Release number of selected component (if applicable):
yum-utils-4.0.8-3

How reproducible:
allways

Steps to Reproduce:
1. sync the AppStream repository with reposync
  # dnf reposync --repoid=rhel-8-for-x86_64-appstream-rpms
2. use the -o switch with repomanage command to list the old packages in the synced repository
  # repomanage -o -k 1 rhel-8-for-x86_64-appstream-rpms


Actual results:
RPM packages from 'older' modules are listed.

Expected results:
RPM packages from 'older' modules are not considered as old and are not listed.

Comment 2 amatej 2020-05-05 07:04:35 UTC
I agree with the proposed AC and test and also with the note, modular metadata has to be present in order to work properly with modular packages (Maybe we could also include that in the AC and test scenario specification, but not sure if necessary).

PR: https://github.com/rpm-software-management/dnf-plugins-core/pull/394
tests: https://github.com/rpm-software-management/ci-dnf-stack/pull/825

Comment 3 Pavla Kratochvilova 2020-05-06 12:33:25 UTC
Removing needinfo since it was answered in Comment #2.

Comment 11 Paul Howarth 2020-10-25 11:08:31 UTC
I think the fix for this introduces a new problem. The repomanage plugin creates a new temporary repo "repomanage_repo" for the directory to be managed, and that gets cached like a regular repo. Typically, repomanage is used to prune directories of old packages, but the cache can remember packages that were there previously and were removed by a previous run of repomanage, so when repomanage is run again it outputs the names of the packages from the cache that are no longer present.

I think the plugin needs to disable this caching behaviour.

Comment 12 amatej 2020-10-26 14:07:30 UTC
I see, thanks for the heads up.

I will try to address the problem as part of https://bugzilla.redhat.com/show_bug.cgi?id=1890314.

Comment 14 errata-xmlrpc 2020-11-04 01:52:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (yum bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2020:4510

Comment 15 amatej 2020-11-20 14:25:36 UTC
(In reply to Paul Howarth from comment #11)
> I think the fix for this introduces a new problem. The repomanage plugin
> creates a new temporary repo "repomanage_repo" for the directory to be
> managed, and that gets cached like a regular repo. Typically, repomanage is
> used to prune directories of old packages, but the cache can remember
> packages that were there previously and were removed by a previous run of
> repomanage, so when repomanage is run again it outputs the names of the
> packages from the cache that are no longer present.
> 
> I think the plugin needs to disable this caching behaviour.

Turns out the bug I mentioned is unrelated, but I have created a fix here: https://github.com/rpm-software-management/dnf-plugins-core/pull/414

Comment 16 Paul Howarth 2020-11-20 14:34:40 UTC
(In reply to amatej from comment #15)
> (In reply to Paul Howarth from comment #11)
> > I think the fix for this introduces a new problem. The repomanage plugin
> > creates a new temporary repo "repomanage_repo" for the directory to be
> > managed, and that gets cached like a regular repo. Typically, repomanage is
> > used to prune directories of old packages, but the cache can remember
> > packages that were there previously and were removed by a previous run of
> > repomanage, so when repomanage is run again it outputs the names of the
> > packages from the cache that are no longer present.
> > 
> > I think the plugin needs to disable this caching behaviour.
> 
> Turns out the bug I mentioned is unrelated, but I have created a fix here:
> https://github.com/rpm-software-management/dnf-plugins-core/pull/414

Thanks. Currently, I've been working around this by using repomanage --setopt=metadata_expire=1