Skip to content

bpetlert/pacman-repo-stats

Repository files navigation

pacman-repo-stats

pacman-repo-stats is a tool to show usage statistics of repositories in pacman.conf. This is helpful for removing unused repositories.

Installation

Cargo

pacman-repo-stats can be used without installation by run:

For normal output
$ cargo run
For JSON output
$ cargo run -- --json

To install in $HOME/.cargo/bin, run:

$ cargo install --path .

Arch Linux

To build and install arch package from GIT source:

$ git clone https://github.com/bpetlert/pacman-repo-stats.git
$ cd pacman-repo-stats
$ makepkg -p PKGBUILD.local
$ pacman -U pacman-repo-stats-xxxx-1-x86_64.pkg.tar

Usage

Normal output
$ pacman-repo-stats
============= ========= =========== ============= ===========
 Name            Total   Installed   % Installed   % Overall
============= ========= =========== ============= ===========
 core              261         213         81.61        1.24
 extra            3077        1143         37.15        6.67
 community        9795         713          7.28        4.16
 multilib          276          95         34.42        0.55
 archlinuxcn      2446          15          0.61        0.09
 arch4edu         1242           9          0.72        0.05
 bpl-repo           46          42         91.30        0.24
               (17143)      (2230)       (13.01)     (13.01)
============= ========= =========== ============= ===========
Local Installed Packages: 2231
Installed Packages Not Found In Repo: 1
    qt5-webkit
Export as JSON and pretty print using jq
$ pacman-repo-stats --json | jq
{
  "RepoStats": [
    {
      "Name": "core",
      "Total": 261,
      "Installed": 213,
      "InstalledPercentage": 81.60919540229885,
      "OverallPercentage": 1.2424896459196173
    },
    {
      "Name": "extra",
      "Total": 3077,
      "Installed": 1143,
      "InstalledPercentage": 37.14657133571661,
      "OverallPercentage": 6.667444437963017
    },
    {
      "Name": "community",
      "Total": 9795,
      "Installed": 713,
      "InstalledPercentage": 7.279224093925472,
      "OverallPercentage": 4.159132007233273
    },
    {
      "Name": "multilib",
      "Total": 276,
      "Installed": 95,
      "InstalledPercentage": 34.42028985507246,
      "OverallPercentage": 0.5541620486495946
    },
    {
      "Name": "archlinuxcn",
      "Total": 2446,
      "Installed": 15,
      "InstalledPercentage": 0.6132461161079313,
      "OverallPercentage": 0.08749927083940967
    },
    {
      "Name": "arch4edu",
      "Total": 1242,
      "Installed": 9,
      "InstalledPercentage": 0.7246376811594203,
      "OverallPercentage": 0.052499562503645805
    },
    {
      "Name": "bpl-repo",
      "Total": 46,
      "Installed": 42,
      "InstalledPercentage": 91.30434782608695,
      "OverallPercentage": 0.24499795835034707
    },
    {
      "Name": "",
      "Total": 17143,
      "Installed": 2230,
      "InstalledPercentage": 13.008224931458905,
      "OverallPercentage": 13.008224931458905
    }
  ],
  "RepoTotal": 17143,
  "RepoInstalledTotal": 2230,
  "LocalInstalledTotal": 2231,
  "PackagesNotInReo": [
    "qt5-webkit"
  ]
}