0

How do I use dnfor yum to list all packages, sorted by popularity (assuming that this is an available feature)?

I don't have a rigorous definition of popularity, but a standard metric such as number of downloads should do.

  • 5
    AFAIK this information is not tracked anywhere. – Michael Hampton Aug 6 '18 at 20:13
  • 3
    Even if the mirrors did track this information, there isn't a subcommand for yum or dnf to report it. – Nasir Riley Aug 6 '18 at 22:15
  • You need to define what popularity even means to make this answerable. – slm Aug 7 '18 at 0:31
  • grub-common.noarch would most likely be on top of the list, followed by kernel.x86_64 and systemd.x86_64. :p – Mio Rin Aug 8 '18 at 11:37
4

The best you could do is show google result count and package name in sorted columns, something like;

UA='user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/68.0.3440.75 Chrome/68.0.3440.75 Safari/537.36'
while read -r P ; do
    C=$(curl -s 'https://www.google.ca/search?q=$P' -H "$UA" \
    | grep About \
    | perl -pe 's/<[^<>]+>/ /g;s/.*About +([0-9,]+) +results.*$/$1/g;s/^.*[a-z].*$//g')
    echo -e "$C\t$P"
done \
< <(yum list all | grep "    " | perl -pe 's/[ .].*//g' | sort -u) \
| sort -rn

(Ommitting user-agent will get you "403 Forbidden")

The results may not be useful though (head);

14,740,000,000  SDL
14,740,000,000  PyYAML
14,740,000,000  GeoIP
14,740,000,000  autogen-libopts
14,740,000,000  authconfig
14,740,000,000  audit-libs-python
14,740,000,000  audit-libs
14,740,000,000  audit
14,740,000,000  alsa-lib
14,740,000,000  acl
  • LOL. Never thought of this. Nice. I’ll try it when I get home. – extremeaxe5 Aug 6 '18 at 23:09
  • 1
    Your creativity is outstanding. Great approach. Maybe add "linux" or the distribution name to the query to get a more useful result? – confetti Aug 7 '18 at 1:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.