Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vincentdephily/emlop

EMerge LOg Parser
https://github.com/vincentdephily/emlop

emerge gentoo portage

Last synced: 6 days ago
JSON representation

EMerge LOg Parser

Awesome Lists containing this project

README

        

# EMerge LOg Parser

Emlop parses emerge logs (as generated by [portage](https://wiki.gentoo.org/wiki/Project:Portage),
the [Gentoo](https://www.gentoo.org/) package manager) to yield useful info like merge history and
merge time prediction.

It draws inspiration from [genlop](https://github.com/gentoo-perl/genlop) and
[qlop](https://github.com/gentoo/portage-utils) but aims to be faster, more accurate, and more
ergonomic, see [comparison](docs/COMPARISON.md).

## 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 --help` for complete and up to date usage info.

### Common options

All commands share these arguments, affecting parsing and output:

Options:
-F, --logfile 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 Only parse log entries after
-t, --to Only parse log entries before
Format:
-H, --header [] Show table header
--duration Output durations in different formats
--date Output dates in different formats
--utc [] Parse/display dates in UTC instead of local time
--color [] Enable color (yes/no/auto)
-o, --output Ouput format (columns/tab/auto)

### List merges, unmerges, and syncs with `log`

![Log demo](log.webp)

Log-specific options:

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

Note that `emaint sync` currently [doesn't write to emerge.log](https://bugs.gentoo.org/553788), 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.webp)

Predict-specific arguments:

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

### Show aggregated statistics with `stats`

![Stats demo](stats.webp)

Stats-specific arguments:

Filter:
[search]... Show only packages/repos matching
-e, --exact Match using plain string
-s, --show

Show (p)ackages, (t)otals, (s)yncs, and/or (a)ll
Stats:
-g, --groupby Group by (y)ear, (m)onth, (w)eek, (d)ay, (n)one
--limit Use the last merge times to predict durations
--avg Select function used to predict durations

### Other commands

* `complete`: shell completion helper
* `accuracy`: analize predictions accuracy

### Configuration file

![Config demo](config.webp)

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](emlop.toml) 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](https://github.com/vincentdephily/moltonel-ebuilds)
overlay, which you can enable using
[eselect-repository](https://wiki.gentoo.org/wiki/Eselect/Repository).

### Using cargo

Install Rust and using [portage](https://wiki.gentoo.org/wiki/Rust) or
[rustup](https://www.rust-lang.org/en-US/install.html). Make sure `~/.cargo/bin/`, is in your
`$PATH`.

The current Minimum Supported Rust Version is 1.74. 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](https://github.com/vincentdephily/emlop) or the [crates.io
page](https://crates.io/crates/emlop): [bash completion](completion.bash), [zsh
completion](completion.zsh), [fish completion](completion.fish), and [example config
file](emlop.toml).

## Contributing

Thanks in advance. See [contributing](docs/CONTRIBUTING.md) for pointers. Emlop is licensed as GPLv3.