Skip to content

stable-3.6: feat: add glob pattern support for --setopt repo prefix - #599

Merged
oliverkurth merged 1 commit into
vmware:stable-3.6from
sshedi:topic/sshedi/stable-3.6-global-setopts
Aug 27, 2026
Merged

stable-3.6: feat: add glob pattern support for --setopt repo prefix#599
oliverkurth merged 1 commit into
vmware:stable-3.6from
sshedi:topic/sshedi/stable-3.6-global-setopts

Conversation

@sshedi

@sshedi sshedi commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

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.

Original PR: #594

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>
@sshedi sshedi changed the title feat: add glob pattern support for --setopt repo prefix stable-3.6: feat: add glob pattern support for --setopt repo prefix Aug 27, 2026
@oliverkurth
oliverkurth merged commit 8e07059 into vmware:stable-3.6 Aug 27, 2026
8 checks passed
@sshedi
sshedi deleted the topic/sshedi/stable-3.6-global-setopts branch August 28, 2026 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants