Skip to main content

Tool to update ebuilds.

Project description

livecheck

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

@Tatsh Mastodon Follow

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.
  -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:

  • Bitbucket
  • Davinci products
  • GitHub archives
  • GitHub commit hashes
  • GitHub releases
  • Gitlab releases
  • JetBrains products
  • PECL
  • Packages from Yarnpkg and Npmjs
  • Perl CPAN
  • PyPI
  • Raphnet
  • Repology
  • RubyGems
  • Search in a url directory
  • SourceHut releases / commit hashes
  • Sourceforge

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

  • Root portage directory, e.g. /var/db/repos/gentoo.
  • Category and package name, e.g. dev-lang/php.
  • Previous version, e.g. 8.2.32-r2.
  • New version, e.g. 8.2.33.
  • SHA hash of the old version. Optional.
  • SHA hash of the new version. Optional.
  • Date associated with the hash. Optional.

Configuration keys

  • branch - string- The GitHub branch name to use for commits.
  • composer_packages - boolean - Download composer vendor modules.
  • composer_path - path - Where is 'composer.json' located (need composer_packages).
  • development - bool - Include development packages.
  • gomodule_packages - boolean - Download go vendor modules.
  • gomodule_path - path - Where is 'go.mod' located (need gomodule_packages).
  • jetbrains_packages - boolean - Update internal ID.
  • keep_old - boolean - Keep old ebuild versions.
  • no_auto_update - boolean - Do not allow auto-updating of this package.
  • nodejs_packages - boolean - Download nodejs node_modules.
  • nodejs_path - path - Where is 'package.json' located (need nodejs_packages).
  • stable_version- string - Regular expression to determine if it is a stable version.
  • sync_version - string - Category and ebuild with version to sync.
  • transformation_function - string - Function to use to transform the version string. Currently only dotize is supported. Others are for internal use.
  • type - string - Only one none, davinci, regex, directory, commit, repology or checksum.

Use the pattern to adjust the version using a regular expression

  • pattern_version - string - The pattern string
  • replace_version - string - The replace string

Only then type is regex or directory

  • url - URL of the document to run regular expressions against. Required

Only then type is regex

  • regex - string - The regular expression to use. Required

Only then type is repology

  • package - string - The package to search in repology. Required

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.

  • To download a file, a search is performed by version/tag, and optionally you can include the commit of said version, including all the results in a list so that the highest one can be selected, according to the search criteria or limit.

  • To locate the last commit of an ebuild, we need the SHA of the commit and the date. This is necessary to be able to adjust the name of the ebuild using the a.b.c_pYYYYMMDD version as a scheme. If a different SHA is detected the version is updated.

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"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

livecheck-0.1.1.tar.gz (85.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

livecheck-0.1.1-py3-none-any.whl (55.5 kB view details)

Uploaded Python 3

File details

Details for the file livecheck-0.1.1.tar.gz.

File metadata

  • Download URL: livecheck-0.1.1.tar.gz
  • Upload date:
  • Size: 85.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Linux/6.15.0-gentoo-limelight

File hashes

Hashes for livecheck-0.1.1.tar.gz
Algorithm Hash digest
SHA256 182f9056ef3bf2e081c67d34bbf9c7a7d2fd6bab6a304e45a405305b91ddbee8
MD5 241881a1bd52d91cf9bf2fa9a83a6f80
BLAKE2b-256 b1587b8b6448839879874b8cbfdf0947690172906e20c0d38a42649dc1387f40

See more details on using hashes here.

File details

Details for the file livecheck-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: livecheck-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 55.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Linux/6.15.0-gentoo-limelight

File hashes

Hashes for livecheck-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 33ba37777852379c637c7598f671082c81979dce7a701b1048562fb98a4eefd5
MD5 bf4672a09c4307f072b71200ca4d57c0
BLAKE2b-256 75d28fdd4848e76c90d6cede966a7bc6e89cc332917cf49afacb3eece54b1d46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page