Monday, March 6, 2017

Yum: search for a package through the disabled repos

Recently, I was searching for a package, it soon turned out that I need to archive this at least for myself. Here is it

Look for all the repos :

[stack@undercloud ~]$ yum repolist all
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: mirror.raystedman.net
* extras: mirror.pac-12.org
* updates: mirrors.sonic.net
515 packages excluded due to repository priority protections
repo id repo name status
!base/7/x86_64 CentOS-7 - Base 9,363
!centos-ceph-jewel/7/x86_64 CentOS-7 - Ceph Jewel 82
!delorean delorean-python-networking-bigswitch-2dd6c2693b8b203b9ac2148e9747609161514af9 520+236
!delorean-newton-testing/x86_64 dlrn-newton-testing 830+515
!extras/7/x86_64 CentOS-7 - Extras 264
!rdo-qemu-ev/x86_64 RDO CentOS-7 - QEMU EV 70
!updates/7/x86_64 CentOS-7 - Updates 856
repolist: 11,985

Find a package in disabled repolist

#!/bin/bashset -ex

for i in `yum repolist all | awk '{print $1}' | cut -d '/' -f 1 | sed 's/!//'`;
do
yum --disablerepo="*" --enablerepo="${i}" search $1done

Breaking up the script


  1. yum repolist all | awk '{print $1}' --> get the first columns and remove anything after '/'
  2. sed 's/!//' remove the annoying ! at the beginning
  3. search for the package use -
 yum --disablerepo="*" --enablerepo=$REPONAME search $PACKAGE_NAME


More here

No comments:

VIM issues with powerline

What to do if you get this annoying issue - vi requirements.txt ...