Skip to content

vincentdephily/emlop

Repository files navigation

EMerge LOg Parser

Emlop parses emerge logs (as generated by portage, the Gentoo package manager) to yield useful info like merge history and merge time prediction.

It draws inspiration from genlop and qlop but aims to be faster, more accurate, and more ergonomic, see comparison.

Usage

Emlop is split into commands. Command names and arguments can be abbreviated (so emlop log --from '1 day' --duration human is the same as emlop l -f1d --dur h), and shell completion is available. See emlop --help and emlop <command> --help for complete and up to date usage info.

Common options

All commands share these arguments, affecting parsing and output:

Options:
  -F, --logfile <file>  Location of emerge log file
  -v...                 Increase verbosity (can be given multiple times)
  -h, --help            Print help (see more with '--help')
  -V, --version         Print version
Filter:
  -f, --from <date>  Only parse log entries after <date>
  -t, --to <date>    Only parse log entries before <date>
Format:
  -H, --header [<bool>]    Show table header
      --duration <format>  Output durations in different formats
      --date <format>      Output dates in different formats
      --utc [<bool>]       Parse/display dates in UTC instead of local time
      --color [<bool>]     Enable color (yes/no/auto)
  -o, --output <format>    Ouput format (columns/tab/auto)

List merges, unmerges, and syncs with log

Log demo

Log-specific options:

Format:
      --starttime [<bool>]  Display start time instead of end time
Filter:
  [search]...           Show only packages/repos matching <search>
  -e, --exact           Match <search> using plain string
  -s, --show <m,u,s,a>  Show (m)erges, (u)nmerges, (s)yncs, and/or (a)ll
  -N, --first [<num>]   Show only the first <num> entries
  -n, --last [<num>]    Show only the last <num> entries

Note that emaint sync currently doesn't write to emerge.log, so emlop l --show s will appear empty if you use emaint. Use emerge --sync or eix-sync instead.

Estimate how long a merge with take with predict

Predict demo

Predict-specific arguments:

Options:
      --tmpdir <dir>    Location of portage tmpdir
Filter:
  -s, --show <e,m,t,a>     Show (e)emerge processes, (m)erges, (t)otal, and/or (a)ll
  -N, --first [<num>]      Show only the first <num> entries
  -n, --last [<num>]       Show only the last <num> entries
      --resume [<source>]  Use main, backup, either, or no portage resume list
Stats:
      --limit <num>     Use the last <num> merge times to predict durations
      --avg <fn>        Select function used to predict durations
      --unknown <secs>  Assume unkown packages take <secs> seconds to merge

Show aggregated statistics with stats

Stats demo

Stats-specific arguments:

Filter:
  [search]...           Show only packages/repos matching <search>
  -e, --exact           Match <search> using plain string
  -s, --show <p,t,s,a>  Show (p)ackages, (t)otals, (s)yncs, and/or (a)ll
Stats:
  -g, --groupby <y,m,w,d,n>  Group by (y)ear, (m)onth, (w)eek, (d)ay, (n)one
      --limit <num>          Use the last <num> merge times to predict durations
      --avg <fn>             Select function used to predict durations

Other commands

  • complete: shell completion helper
  • accuracy: analize predictions accuracy

Configuration file

Config demo

Emlop reads default settings from $HOME/.config/emlop.toml. Set $EMLOP_CONFIG env var to change the file location, or set it to "" to disable.

This example file documents the format, and lists supported options. Command-line arguments take precedence over the config file.

Installation

Using portage

emerge emlop

The ebuild is also maintained in the moltonel overlay, which you can enable using eselect-repository.

Using cargo

Install Rust and using portage or rustup. Make sure ~/.cargo/bin/, is in your $PATH.

The current Minimum Supported Rust Version is 1.71. When building emlop with an old rustc version, you might need to pass --locked to cargo install, to use explicitly tested dependency versions.

From crates.io

cargo install -f emlop

From git

git clone https://github.com/vincentdephily/emlop
cd emlop
cargo test
cargo install -f --path .

Misc files

Cargo only installs the binary, which is all you really need, but you may want to manualy install some files fetched from github or the crates.io page: bash completion, zsh completion, fish completion, and example config file.

Contributing

Thanks in advance. See contributing for pointers. Emlop is licensed as GPLv3.