livecheck

Tool to update ebuilds.

View on GitHub

livecheck

Python versions PyPI - Version GitHub tag (with filter) License GitHub commits since latest release (by SemVer including pre-releases) CodeQL QA Tests Coverage Status Dependabot Documentation Status mypy pre-commit Poetry pydocstyle pytest Ruff Downloads Stargazers Prettier

@Tatsh Buy Me A Coffee Libera.Chat Mastodon Follow Patreon

Tool for overlays to update ebuilds. Inspired by the MacPorts port subcommand of the same name and nvchecker.

Internal workings

The script uses the first url of the ebuild using the SRC_URI variable to search for new versions, using logic for github, PyPI, PECL or if it is configured in the livecheck.json file within the same package directory. Then if you do not find a new version, try to use the repositories within the metadata.xml file That is why it is important to have the first download url well defined and thus automatically update the ebuild.

It is recommended to activate the oauth_token of both github and gitlab to avoid Rate Limiting problems for the REST API. Use your secret storage to store github.com or gitlab.com tokens with the livecheck user. See keyring to manage tokens.

Installation

On Gentoo, add my overlay and install:

eselect overlay enable tatsh-overlay
emerge --sync
emerge livecheck

Command line usage

Usage: livecheck [OPTIONS] [PACKAGE_NAMES]...

Options:
  -a, --auto-update            Rename and modify ebuilds.
  -d, --debug                  Enable debug logging.
  -D, --development            Include development packages.
  -e, --exclude TEXT           Exclude package(s) from updates.
  -g, --git                    Use git and pkgdev to make changes.
  -H, --hook-dir               Run a hook directory scripts with various parameters.
  -k, --keep-old               Keep old ebuild versions.
  -p, --progress               Enable progress logging.
  --package-manager [npm|pnpm|yarn]
                               Package manager to use for Node.js packages.
  -W, --working-dir DIRECTORY  Working directory. Should be a port tree root.
  --help                       Show this message and exit.

Heuristic update detection

This package can do automated lookups based on commonly used hosts. Currently:

This works as long as the version system is usable with Portage’s version comparison function. For anything else, see Package configuration.

Package configuration

For packages that will not work with currently heuristic checking, a configuration file named livecheck.json can be placed in the directory alongside the ebuild.

Hook directory

The hooks directory structure is subdivided into actions, currently post and pre, within each action directory there can be several scripts that are executed in order of name.

Hook arguments

Configuration keys

Use the pattern to adjust the version using a regular expression

Only then type is regex or directory

Only then type is regex

Only then type is repology

Development use

Creating new downloads

There are 2 types of downloads: file and latest commit (currently only Git is supported) and this is evident from the first download URL of the ebuild itself.

Set up PYTHONPATH

As root, set the environment variable PYTHONPATH to include where the livecheck module is located. Use python -m livecheck instead of livecheck to execute commands.

With a virtualenv

Run poetry install --all-extras --with=dev,docs,tests to set up a virtualenv. You must also add Portage to this virtualenv manually.

Fully copy /etc/portage to the root of your virtualenv. Then you must fix make.profile. Also consider making changes in repos.conf if necessary.

Example:

eval "$(poetry env activate)"
pip install git+https://github.com/gentoo/portage.git
pip install keyrings-alt
cp -R /etc/portage "${VIRTUAL_ENV}/etc/"
ln -sf "$(readlink -f /etc/portage/make.profile)" "${VIRTUAL_ENV}/etc/portage/make.profile"