@hackage dnf-repo0.5

DNF wrapper tool to control repos

dnf-repo

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

dnf is the package manager used by Fedora Linux and also modern RHEL.

DNF is a bit slow at handling multiple repos because it attempts to refresh the cached repodata frequently. So it can be advantageous to disable smaller repos by default and only enable them as needed (eg periodically).

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 repos' caches individually.

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

Help

$ dnf-repo --version
0.5
$ dnf-repo --help
DNF wrapper repo tool

Usage: dnf-repo [--version] [-n|--dryrun] [-D|--debug] [-l|--list] [-s|--save]
                [(-w|--weak-deps) | (-W|--no-weak-deps)] [--exact]
                [(-d|--disable REPOPAT) | (-e|--enable 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 COPR) | (-k|--add-koji REPO)] [DNFARGS]
  see https://github.com/juhp/dnf-repo#readme

Available options:
  -h,--help                Show this help text
  --version                Show version
  -n,--dryrun              Dry run
  -D,--debug               Debug output
  -l,--list                List all repos
  -s,--save                Save the repo enable/disable state
  -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
  -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 COPR       Create repo file for copr repo
  -k,--add-koji REPO       Create repo file for koji repo (f37-build, rawhide,
                           epel9-build, etc)

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.

Copr

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).

Later update with the copr:

$ dnf-repo -e helix update

Changing system repo config

Disable fedora modular and cisco openh264 repos permanently:

$ dnf-repo --M -d h264 --save

Use only source repos

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

Switch system from rawhide

Switch a system from Rawhide to F37:

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

:

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.

Installation

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

Building

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

Contributing

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

dnf-repo is currently distributed under a BSD license.

Contributions including suggestions for improvement are welcome.