Skip to content

Provide YumEngine.list_packages() - #5107

Open
tcornell-bus wants to merge 1 commit into
mainfrom
tcornell-yum-repoquery
Open

Provide YumEngine.list_packages()#5107
tcornell-bus wants to merge 1 commit into
mainfrom
tcornell-yum-repoquery

Conversation

@tcornell-bus

Copy link
Copy Markdown
Contributor

The repoquery command to list all packages in repos is different when using yum-utils vs. dnf

Fixes: #4805

Pull Request Checklist

  • implement the feature

The repoquery command to list all packages in repos is different
when using yum-utils vs. dnf
@tcornell-bus tcornell-bus added the plugin | artifact Related to the `prepare/artifact` plugin. label Aug 5, 2026
@github-project-automation github-project-automation Bot moved this to backlog in planning Aug 5, 2026
@tcornell-bus tcornell-bus moved this from backlog to implement in planning Aug 5, 2026
@tcornell-bus

Copy link
Copy Markdown
Contributor Author

I need to get with @cle to see the best way to create a more permanent testing repo for CentOS-7. When I modify tests/prepare/artifact/providers/repository-file/data/ and tests/prepare/artifact/providers/repository-file/test-bar.repo to point at a package in https://vault.centos.org/7.9.2009/os/x86_64/, I was able to manually verify the fix.

Old:

            stdout: [test-bar]
            stdout: name=Equivalent to copr repo of lecris/_tmt_test
            stdout: baseurl=https://vault.centos.org/7.9.2009/os/x86_64/
            stdout: gpgcheck=0
            stdout: repo_gpgcheck=0
            stdout: enabled=1
            stdout: 
            Providing repository 'test-bar' for installation 
            cmd: yum repoquery '--disablerepo=*' --enablerepo=test-bar --queryformat '%{repoid};%{name}-%{epoch}:%{version}-%{release}.%{arch}\n'
            stdout: Loaded plugins: fastestmirror, ovl
            stderr: Command line error: no such option: --queryformat
            stdout: Usage: yum [options] COMMAND
            stdout: 
            stdout: List of Commands:
            stdout: 
            stdout: check          Check for problems in the rpmdb
            stdout: check-update   Check for available package updates
            stdout: clean          Remove cached data
            stdout: deplist        List a package's dependencies
            stdout: distribution-synchronization Synchronize installed packages to the latest available versions
            stdout: downgrade      downgrade a package
            stdout: erase          Remove a package or packages from your system
            stdout: fs             Acts on the filesystem data of the host, mainly for removing docs/lanuages for minimal hosts.
            stdout: fssnapshot     Creates filesystem snapshots, or lists/deletes current snapshots.
            stdout: groups         Display, or use, the groups information
            stdout: help           Display a helpful usage message
            stdout: history        Display, or use, the transaction history
            stdout: info           Display details about a package or group of packages
            stdout: install        Install a package or packages on your system
            stdout: list           List a package or groups of packages
            stdout: load-transaction load a saved transaction from filename
            stdout: makecache      Generate the metadata cache
            stdout: provides       Find what package provides the given value
            stdout: reinstall      reinstall a package
            stdout: repo-pkgs      Treat a repo. as a group of packages, so we can install/remove all of them
            stdout: repolist       Display the configured software repositories
            stdout: search         Search package details for the given string
            stdout: shell          Run an interactive yum shell
            stdout: swap           Simple way to swap packages, instead of using shell
            stdout: update         Update a package or packages on your system
            stdout: update-minimal Works like upgrade, but goes to the 'newest' package match which fixes a problem that affects your system
            stdout: updateinfo     Acts on repository update information
            stdout: upgrade        Update packages taking obsoletes into account
            stdout: version        Display a version for the machine and/or available repos.
            stdout: 
            stdout: 
            warn: Failed to enumerate packages from repository 'test-bar'.
            warn: 
            warn: Command 'yum repoquery '--disablerepo=*' --enablerepo=test-bar --queryformat '%{repoid};%{name}-%{epoch}:%{version}-%{release}.%{arch}\n'' returned 1.
            warn: 
            warn: # stdout (34 lines)
            warn: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            warn: Loaded plugins: fastestmirror, ovl
            warn: Usage: yum [options] COMMAND
            warn: 
            warn: List of Commands:
            warn: 
            warn: check          Check for problems in the rpmdb
            warn: check-update   Check for available package updates
            warn: clean          Remove cached data
            warn: deplist        List a package's dependencies
            warn: distribution-synchronization Synchronize installed packages to the latest available versions
            warn: downgrade      downgrade a package
            warn: erase          Remove a package or packages from your system
            warn: fs             Acts on the filesystem data of the host, mainly for removing docs/lanuages for minimal hosts.
            warn: fssnapshot     Creates filesystem snapshots, or lists/deletes current snapshots.
            warn: groups         Display, or use, the groups information
            warn: help           Display a helpful usage message
            warn: history        Display, or use, the transaction history
            warn: info           Display details about a package or group of packages
            warn: install        Install a package or packages on your system
            warn: list           List a package or groups of packages
            warn: load-transaction load a saved transaction from filename
            warn: makecache      Generate the metadata cache
            warn: provides       Find what package provides the given value
            warn: reinstall      reinstall a package
            warn: repo-pkgs      Treat a repo. as a group of packages, so we can install/remove all of them
            warn: repolist       Display the configured software repositories
            warn: search         Search package details for the given string
            warn: shell          Run an interactive yum shell
            warn: swap           Simple way to swap packages, instead of using shell
            warn: update         Update a package or packages on your system
            warn: update-minimal Works like upgrade, but goes to the 'newest' package match which fixes a problem that affects your system
            warn: updateinfo     Acts on repository update information
            warn: upgrade        Update packages taking obsoletes into account
            warn: version        Display a version for the machine and/or available repos.
            warn: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            warn: 
            warn: # stderr (1 lines)
            warn: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            warn: Command line error: no such option: --queryformat
            warn: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            warn: 

New:

            stdout: [test-bar]
            stdout: name=Equivalent to copr repo of lecris/_tmt_test
            stdout: baseurl=https://vault.centos.org/7.9.2009/os/x86_64/
            stdout: gpgcheck=0
            stdout: repo_gpgcheck=0
            stdout: enabled=1
            stdout: 
            Providing repository 'test-bar' for installation 
            cmd: repoquery --all '--disablerepo=*' --enablerepo=test-bar --queryformat '%{repoid};%{name}-%{epoch}:%{version}-%{release}.%{arch}\n'
            stdout: test-bar;389-ds-base-0:1.3.10.2-6.el7.x86_64
            stdout: 
[... super long list ...]
            stdout: test-bar;zziplib-utils-0:0.13.62-12.el7.x86_64
            stdout:

Works when tested manually with RHEL-6 as well.

@tcornell-bus tcornell-bus added the ci | full test Pull request is ready for the full test execution label Aug 5, 2026
@tcornell-bus tcornell-bus moved this from implement to review in planning Aug 5, 2026

@LecrisUT LecrisUT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there a /tests/prepare/artifact/provider that can be extended to cover this? I think we didn't hit this because the copr one would be incompatible, but if you have an alternative that could be used here, it would be great. Maybe we can use the local file repository? Not a blocker if it becomes too hard to implement.

'--disablerepo=*',
*[f'--enablerepo={repo_id}' for repo_id in repository.repo_ids],
'--queryformat',
r'%{repoid};%{name}-%{epoch}:%{version}-%{release}.%{arch}\n',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use _full_nevra_querytag here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci | full test Pull request is ready for the full test execution plugin | artifact Related to the `prepare/artifact` plugin.

Projects

Status: review

Development

Successfully merging this pull request may close these issues.

prepare -h artifact --provide repository-file:<some-url> on RHEL-6 gives warning

2 participants