Sort output of apt-cache search by popularity

From raju

Abstract

The idea here is to sort the output of an "apt-cache search" command by the popularity of a package. This is accomplished by using a python script popsort.py

Software

Latest version of popsort.py - https://gitlab.com/d3k2mk7/rutils/blob/master/bin/popsort.py

Introduction

Debian users often find new software by running an "apt-cache search" command with appropriate keywords. The results are sorted in the alphabetical order of the package name by default. This is good enough if the user has a "rough idea" of what package they are looking for. But if that is not the case, then they will have to research and experiment each and every package one by one. If there are too many results, this can become tiring very quickly.

The idea here is to sort the output of "apt-cache search" based on the popularity of a package so that users can research and experiment with the popular packages first and go to the less popular ones only if necessary.

Case Study - Simple example

Let's say we want to find some software to browse SQLite databases. The usual approach is

    % apt-cache search sqlite browser             
    alice - Web browser (WebKit or Gecko) based IRC client
    gtkcookie - editor for cookie files
    hoteldruid - web-based property management system for hotels or B&Bs
    nova-consoleauth - OpenStack Compute - Console Authenticator
    ruby-http-cookie - Ruby library to handle HTTP Cookies based on RFC 6265
    sqlitebrowser - GUI editor for SQLite databases
    

But if we sort this by popularity rank

    % apt-cache search sqlite browser | popsort.py 
    66341 hoteldruid - web-based property management system for hotels or B&Bs
    58787 nova-consoleauth - OpenStack Compute - Console Authenticator
    43444 alice - Web browser (WebKit or Gecko) based IRC client
    36506 gtkcookie - editor for cookie files
    8052 ruby-http-cookie - Ruby library to handle HTTP Cookies based on RFC 6265
    7114 sqlitebrowser - GUI editor for SQLite databases
    

where the results are sorted in the order of increasing popularity with ranks in the first column.

This example shows that sqlitebrowser and ruby-http-cookie are way more popular than the rest. So it is probably a good idea to start researching these two packages first before looking into others.