Set/get repo priority with dnf cmd line?

does ‘dnf’ support setting a repo’s “priority=” from cmd-line?

what’s the cmd syntax? I thought “–setopt” option might do the trick, but haven’t stumbled on correct usage …

also, can ‘dnf’, or other tool, list/sort repos by parameters?

e.g., i’d like a list of all ‘enabled’ repos, showing & sorted-by their priority.

1 Like
sudo dnf config-manager --save --setopt="rpmfusion-*.priority=100"
dnf config-manager --dump "rpmfusion-*" | grep -e "^=" -e "^priority\s"
grep -e "^priority=" /etc/yum.repos.d/rpmfusion-*
2 Likes

works perfectly for the ‘set’. thx!

1 Like

not quite what I’m ‘used’ to,

 zypper lr -Pd
#   | Alias                            | Name                                      | Enabled | GPG Check | Refresh | Priority | Type   | URI                                                                                                            | Service
----+----------------------------------+-------------------------------------------+---------+-----------+---------+----------+--------+----------------------------------------------------------------------------------------------------------------+--------
 43 | OS15-non-oss-update-debug        | OS15-non-oss-update-debug                 | No      | ----      | ----    |    1     | rpm-md | http://download.opensuse.org/debug/update/leap/15.1/non-oss                                                    |
 46 | OS15-oss-update-debug            | OS15-oss-update-debug                     | No      | ----      | ----    |    1     | rpm-md | http://download.opensuse.org/debug/update/leap/15.1/oss                                                        |
 42 | OS15-non-oss-debug               | OS15-non-oss-debug                        | No      | ----      | ----    |    2     | rpm-md | http://download.opensuse.org/debug/distribution/leap/15.1/repo/non-oss                                         |
 45 | OS15-oss-debug                   | OS15-oss-debug                            | No      | ----      | ----    |    2     | rpm-md | http://download.opensuse.org/debug/distribution/leap/15.1/repo/oss                                             |
 47 | OS15-security                    | OS15-security                             | Yes     | (r ) Yes  | Yes     |   90     | rpm-md | https://ftp.gwdg.de/pub/opensuse/repositories/security/openSUSE_Leap_15.1                                      |
 50 | OS15-update                      | OS15-update                               | Yes     | (r ) Yes  | Yes     |   90     | rpm-md | http://download.opensuse.org/update/leap/15.1/oss                                                              |
 51 | OS15-update-non-oss              | OS15-update-non-oss                       | Yes     | (r ) Yes  | Yes     |   90     | rpm-md | http://download.opensuse.org/update/leap/15.1/non-oss/                                                         |
 41 | OS15-non-oss                     | OS15-non-oss                              | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://provo-mirror.opensuse.org/distribution/leap/15.1/repo/non-oss                                           |
 44 | OS15-oss                         | OS15-oss                                  | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.1/repo/oss                                                   |
 48 | OS15-src-non-oss                 | OS15-src-non-oss                          | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://provo-mirror.opensuse.org/source/distribution/leap/15.1/repo/non-oss                                    |
 49 | OS15-src-oss                     | OS15-src-oss                              | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://provo-mirror.opensuse.org/source/distribution/leap/15.1/repo/oss                                        |
...

but the

config-manager --dump

has the raw data I can certainly wrap some scripting around.

thx!

1 Like

Well looky here!

dnf search zypp
	Last metadata expiration check: 1:13:59 ago on Wed 01 Jul 2020 05:02:12 PM PDT.
	=============================================== Name & Summary Matched: zypp ================================================
	libzypp-devel.i686 : Development files for libzypp
	libzypp-devel.x86_64 : Development files for libzypp
	libzypp-devel-doc.noarch : Documentation for development using libzypp
	zypp-common.noarch : Common files for ZYpp
	zypp-plugins.noarch : Plugins for libzypp users
	zypp-tools.x86_64 : Tools for libzypp users
	zypper.x86_64 : Command line package manager using libzypp
	zypper-aptitude.noarch : apt/aptitude CLI compatibility interface for Zypper
	zypper-log.noarch : Zypper log file command line tool
	==================================================== Name Matched: zypp =====================================================
	libzypp.i686 : A package management library
	libzypp.x86_64 : A package management library

that warrants some ‘further investigation’ !

EDIT:

Well THIS is useful!

zypper lr -Pd
#  | Alias                                               | Name                                             | Enabled | GPG Check | Refresh | Priority | Type   | URI                                                                                             | Service
---+-----------------------------------------------------+--------------------------------------------------+---------+-----------+---------+----------+--------+-------------------------------------------------------------------------------------------------+--------
 1 | copr:copr.fedorainfracloud.org:pgfed:nginx-mainline | Copr repo for nginx-mainline owned by pgfed      | Yes     | ( p) Yes  | No      |   80     | rpm-md | https://download.copr.fedorainfracloud.org/results/pgfed/nginx-mainline/fedora-32-x86_64/       |
11 | redis-6-local                                       | redis-6-local                                    | Yes     | (  ) No   | No      |   80     | rpm-md | file:/usr/local/LOCAL_REPO/redis-6                                                              |
10 | nginx-mainline-local                                | nginx-mainline-local                             | Yes     | (  ) No   | No      |   90     | rpm-md | file:/usr/local/LOCAL_REPO/nginx-mainline                                                       |
 2 | fedora                                              | Fedora 32 - x86_64                               | Yes     | ( p) Yes  | No      |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=fedora-32&arch=x86_64                           |
 3 | fedora-cisco-openh264                               | Fedora 32 openh264 (From Cisco) - x86_64         | Yes     | ( p) Yes  | No      |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=fedora-cisco-openh264-32&arch=x86_64            |
 4 | fedora-cisco-openh264-debuginfo                     | Fedora 32 openh264 (From Cisco) - x86_64 - Debug | No      | ----      | ----    |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=fedora-cisco-openh264-debug-32&arch=x86_64      |
 5 | fedora-debuginfo                                    | Fedora 32 - x86_64 - Debug                       | No      | ----      | ----    |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-32&arch=x86_64                     |
 6 | fedora-modular                                      | Fedora Modular 32 - x86_64                       | Yes     | ( p) Yes  | No      |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=fedora-modular-32&arch=x86_64                   |
 7 | fedora-modular-debuginfo                            | Fedora Modular 32 - x86_64 - Debug               | No      | ----      | ----    |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=fedora-modular-debug-32&arch=x86_64             |
 8 | fedora-modular-source                               | Fedora Modular 32 - Source                       | No      | ----      | ----    |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=fedora-modular-source-32&arch=x86_64            |
 9 | fedora-source                                       | Fedora 32 - Source                               | No      | ----      | ----    |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=fedora-source-32&arch=x86_64                    |
12 | updates                                             | Fedora 32 - x86_64 - Updates                     | Yes     | ( p) Yes  | No      |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=updates-released-f32&arch=x86_64                |
13 | updates-debuginfo                                   | Fedora 32 - x86_64 - Updates - Debug             | No      | ----      | ----    |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f32&arch=x86_64          |
14 | updates-modular                                     | Fedora Modular 32 - x86_64 - Updates             | Yes     | ( p) Yes  | No      |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-f32&arch=x86_64        |
15 | updates-modular-debuginfo                           | Fedora Modular 32 - x86_64 - Updates - Debug     | No      | ----      | ----    |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-debug-f32&arch=x86_64  |
16 | updates-modular-source                              | Fedora Modular 32 - Updates Source               | No      | ----      | ----    |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-source-f32&arch=x86_64 |
17 | updates-source                                      | Fedora 32 - Updates Source                       | No      | ----      | ----    |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f32&arch=x86_64         |
18 | updates-testing                                     | Fedora 32 - x86_64 - Test Updates                | No      | ----      | ----    |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=updates-testing-f32&arch=x86_64                 |
19 | updates-testing-debuginfo                           | Fedora 32 - x86_64 - Test Updates Debug          | No      | ----      | ----    |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=updates-testing-debug-f32&arch=x86_64           |
20 | updates-testing-modular                             | Fedora Modular 32 - x86_64 - Test Updates        | No      | ----      | ----    |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=updates-testing-modular-f32&arch=x86_64         |
21 | updates-testing-modular-debuginfo                   | Fedora Modular 32 - x86_64 - Test Updates Debug  | No      | ----      | ----    |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=updates-testing-modular-debug-f32&arch=x86_64   |
22 | updates-testing-modular-source                      | Fedora Modular 32 - Test Updates Source          | No      | ----      | ----    |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=updates-testing-modular-source-f32&arch=x86_64  |
23 | updates-testing-source                              | Fedora 32 - Test Updates Source                  | No      | ----      | ----    |   99     | rpm-md | https://mirrors.fedoraproject.org/metalink?repo=updates-testing-source-f32&arch=x86_64          |
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.