yum — priorities matters

One of the most commonly asked questions in the CentOS forums is concerned with 3rd party repositories. In addition to referring to the Repositories wiki article, we need to make sure people use the yum priorities plugin appropriately.

Often times, we want to know how they set up the priority scores but there is no easy way to display them. yum repolist all does not include this info. A forum helper jlehtone posted a one-liner that does just that:

cat /etc/yum.repos.d/*.repo | sed -n -e "/^\[/h; /priority *=/{ G; s/\n/ /; s/ity=/ity = /; p }"  | sort -k3n

The output may look like this:

priority = 10 [base]
priority = 10 [updates]
priority = 30 [extras]
priority = 50 [centosplus]
priority = 60 [c5-testing]
priority = 70 [rpmforge]
priority = 75 [kbs-CentOS-Testing]
priority = 90 [kbs-CentOS-Misc-Testing]
priority = 94 [epel]

Almost immediately after the above post, Alan the perfectionist, a cat person himself, opposed the use of over-working cats and came up with his version of the one-liner:

sed -n -e "/^\[/h; /priority *=/{ G; s/\n/ /; s/ity=/ity = /; p }" /etc/yum.repos.d/*.repo | sort -k3n

Personally … I want to see the cats working for the community … 😀

yum — when all is not all

A while ago, I was talking with my buddies and the subject was about installing / updating a package using yum.  yum did not find the package that had just been added.  No problem, either yum clean metadata or yum clean all will do.  Err … it didn’t. 

As it turned out, it didn’t work because the repository in question was disabled by default.  The man page for yum clearly states:

Note that "all files" in the commands below means "all files in 
currently enabled repositories".   If you  want  to  also clean  any 
(temporarily)  disabled  repositories you need to use --enablerepo=’*’ 
option.