stable-3.6: feat: add glob pattern support for --setopt repo prefix - #599
Merged
oliverkurth merged 1 commit intoAug 27, 2026
Merged
Conversation
Add support for glob patterns in the repo-prefix part of --setopt,
allowing a single option to target multiple repos at once.
# skip filelists for every repo
tdnf --setopt=*.skip_md_filelists=1 makecache
# skip filelists only for repos whose ID starts with "photon"
tdnf --setopt=photon*.skip_md_filelists=1 makecache
# disable gpgcheck for all repos (e.g. during testing)
tdnf --setopt=*.gpgcheck=0 install pkg
# combine with --repofrompath: glob applies to the dynamic repo too
tdnf --repofrompath=mrepo,/path/to/repo \
--repo=mrepo \
--setopt=*.skip_md_filelists=1 \
makecache
Existing syntax is unchanged:
--setopt=key=val global conf-level setting (no repo effect)
--setopt=repoid.key=val single named repo (highest precedence)
Implementation:
- Move TDNFIsGlob() from client/utils.c to common/utils.c so it is
available to all libraries including the CLI tools library.
- parseargs.c: use TDNFIsGlob() to allow glob characters (*?[) in the
prefix part of --setopt=prefix.key=val, bypassing
TDNFStrIsValidRepoName; the glob is stored in cn_repoopts under its
literal name (e.g. "*"), alongside ordinary per-repo entries.
- repolist.c (TDNFLoadRepoData): apply setopts in two passes.
Pass 1 applies all glob-pattern entries via fnmatch(3); the @cmdline
repo is skipped because its gpgcheck state is managed separately.
Pass 2 applies exact repo-id entries, which always take precedence.
Array-valued keys (baseurl, gpgkey) set by a glob are cleared before
the exact-match apply so the exact entry replaces rather than appends.
Add tests covering glob setopt for skip_md_filelists and skip_md_other
on --repofrompath repos, and per-repo setopt on file-based repos.
This is a port of commit b4309c0 from dev branch.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Shreenidhi Shedi <shreenidhi.shedi@broadcom.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for glob patterns in the repo-prefix part of --setopt, allowing a single option to target multiple repos at once.
skip filelists for every repo
tdnf --setopt=*.skip_md_filelists=1 makecache
skip filelists only for repos whose ID starts with "photon"
tdnf --setopt=photon*.skip_md_filelists=1 makecache
disable gpgcheck for all repos (e.g. during testing)
tdnf --setopt=*.gpgcheck=0 install pkg
combine with --repofrompath: glob applies to the dynamic repo too
tdnf --repofrompath=mrepo,/path/to/repo
--repo=mrepo
--setopt=*.skip_md_filelists=1
makecache
Existing syntax is unchanged:
--setopt=key=val global conf-level setting (no repo effect)
--setopt=repoid.key=val single named repo (highest precedence)
Implementation:
Add tests covering glob setopt for skip_md_filelists and skip_md_other on --repofrompath repos, and per-repo setopt on file-based repos.
This is a port of commit b4309c0 from dev branch.
Original PR: #594