dnf-repo: A dnf wrapper with fine control of enabled repos

[ bsd3, gpl, program, utility ] [ Propose Tags ]

A command-line wrapper of the dnf package manager to control the repos enabled for a dnf invocation.

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS] 0.1, 0.2, 0.3, 0.4, 0.5, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.5.6, 0.6, 0.6.1
Change log ChangeLog.md
Dependencies base (<5), curl, directory, extra, filepath, Glob, http-directory (>=0.1.9), simple-cmd (>=0.2.2), simple-cmd-args (>=0.1.8), simple-prompt (>=0.2) [details]
License GPL-3.0-only
Copyright 2022-2024 Jens Petersen <petersen@redhat.com>
Author Jens Petersen <petersen@redhat.com>
Maintainer Jens Petersen <petersen@redhat.com>
Category Utility
Home page https://github.com/juhp/dnf-repo
Bug tracker https://github.com/juhp/dnf-repo/issues
Source repo head: git clone https://github.com/juhp/dnf-repo.git
Uploaded by JensPetersen at 2024-06-14T14:41:47Z
Distributions Fedora:0.6
Executables dnf-repo
Downloads 515 total (40 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2024-06-14 [all 2 reports]

Readme for dnf-repo-0.6.1

[back to package description]


A wrapper of the dnf package manager for fine control of enabled/disabled yum repos (eg Copr repos).

dnf is the package manager used by Fedora Linux, Centos Stream, and RHEL.

DNF can get slower with many repos enabled because it attempts to refresh its cached repodata frequently. So it can be advantageous to disable some small repos by default and only enable them periodically as needed.

This tool can temporarily enable/disable repo(s) selected by substring(s). Changes to repos' enabled states can be saved too. It is also possible to expire repo caches individually.

There are also smart options to enable/disable testing repos (and even source/debuginfo repos), and also to add Copr repo or Koji repo file.


$ dnf-repo --version


$ dnf-repo --help

DNF wrapper repo tool

Usage: dnf-repo [--version] [-n|--dryrun] [-q|--quiet] [-D|--debug] [-l|--list]
                [-s|--save] [--dnf4] [(-w|--weak-deps) | (-W|--no-weak-deps)]
                [(-d|--disable REPOPAT) | (-e|--enable REPOPAT) |
                  (-o|--only REPOPAT) | (-x|--expire REPOPAT) |
                  (-X|--clear-expires) | (-E|--delete-repofile REPOPAT) |
                  (-t|--enable-testing) | (-T|--disable-testing) |
                  (-m|--enable-modular) | (-M|--disable-modular) |
                  --enable-debuginfo | --disable-debuginfo | --enable-source |
                  --disable-source | (-c|--add-copr [SERVER/]COPR/PROJECT|URL)
                  [--osname OSNAME] [--releasever RELEASEVER] |
                  (-k|--add-koji REPO) | (-r|--add-repofile REPOFILEURL)
                  [--releasever RELEASEVER] |
                  (-u|--repourl URL)] [DNFARGS]

  see https://github.com/juhp/dnf-repo#readme

Available options:
  -h,--help                Show this help text
  --version                Show version
  -n,--dryrun              Dry run
  -q,--quiet               Suppress necessary output
  -D,--debug               Debug output
  -l,--list                List all repos
  -s,--save                Save the repo enable/disable state
  --dnf4                   Use dnf4 (if dnf5 available)
  -w,--weak-deps           Use weak dependencies
  -W,--no-weak-deps        Disable weak dependencies
  --exact                  Match repo names exactly
  -d,--disable REPOPAT     Disable repos
  -e,--enable REPOPAT      Enable repos
  -o,--only REPOPAT        Only use matching repos
  -x,--expire REPOPAT      Expire repo cache
  -X,--clear-expires       Undo cache expirations
  -E,--delete-repofile REPOPAT
                           Remove unwanted .repo file
  -t,--enable-testing      Enable testing repos
  -T,--disable-testing     Disable testing repos
  -m,--enable-modular      Enable modular repos
  -M,--disable-modular     Disable modular repos
  --enable-debuginfo       Enable debuginfo repos
  --disable-debuginfo      Disable debuginfo repos
  --enable-source          Enable source repos
  --disable-source         Disable source repos
  -c,--add-copr [SERVER/]COPR/PROJECT|URL
                           Install copr repo file (defaults to fedora server)
  --osname OSNAME          Specify OS Name to override (eg epel)
  --releasever RELEASEVER  Specify OS Release Version to override (eg rawhide)
  -k,--add-koji REPO       Create repo file for a Fedora koji repo (f40-build,
                           rawhide, epel9-build, etc)
  -r,--add-repofile REPOFILEURL
                           Install repo file
  --releasever RELEASEVER  Specify OS Release Version to override (eg rawhide)
  -u,--repourl URL         Use temporary repo from a baseurl

Usage examples

List repos:

$ dnf-repo [--list]

Update with testing repos enabled:

$ dnf-repo -t update

Note that sudo is used implicitly when needed: there is no need to run dnf-repo with sudo.


List disabled copr repos (ie lists copr repos that would be enabled):

$ dnf-repo -e copr

Disable active copr repos for update:

$ dnf-repo -d copr update

Install a package directly from a new copr:

$ dnf-repo -c varlad/helix install helix

(note the copr repo is not permanently enabled).

Also you can use the equivalent abbreviation: dnf-repo -c varlad/helix install if the package and repo have the same name.

Later update with the copr:

$ dnf-repo -e helix update

Changing system repo config

Disable fedora updates-testing and cisco openh264 repos permanently:

$ dnf-repo -T -d h264 --save

Use only source repos

$ dnf-repo -d \* --enable-source
with enabled 'fedora-source'
with enabled 'updates-source'
with disabled 'fedora'
with disabled 'updates'

Switch system from rawhide

Switch a system from Rawhide to F40:

$ dnf-repo -d rawhide -e fedora distrosync --releasever 40 fedora-\*
with disabled 'rawhide'
with enabled 'fedora'


Repo patterns

By default repo patterns are matched as infix substrings (unless you use --exact).

But you can also prepend ^/append $ (or both) to match a repo name from its beginning/end (or exactly).

You can also use glob patterns to match one or more repo names: see the supported Glob syntax.

Without a glob (eg '*') a shortest common repo match will be sought, otherwise all matching repos will be considered.

An initial ^ (final $) in a glob pattern prevents the automatic prepending (appending) of * before (after) the pattern.

Repo actions expand to a sequence of --enablerepo=, --disablerepo=, --repo=, etc, so as usual later settings will overrule conflicting earlier settings.


A copr repo is available: https://copr.fedorainfracloud.org/coprs/petersen/dnf-repo/


Use {cabal,stack,cabal-rpm} install.


dnf-repo is distributed under the GPL license version 3 or later.

The source repository is https://github.com/juhp/dnf-repo/

Contributions including reports and suggestions for improvement are welcome.