meta_package_manager.managers.pkgit module

class meta_package_manager.managers.pkgit.Pkgit[source]

Bases: PackageManager

pkgit, which compiles and installs packages straight from git repositories.

A package is a git repository the user declares in ~/.config/pkgit/init.lua, which pkgit clones and builds through the repository’s own bldit.lua recipe. That configuration is the registry: pkgit reaches no catalog of its own and fronts no other package manager, so it is wrapped on its own terms rather than declined as a translation layer.

Note

The configuration is mandatory, and its absence is what makes an unconfigured pkgit correctly undetectable: every subcommand, --version included, exits 1 with cannot run configuration script, so the version probe finds nothing and mpm reports the manager unavailable until make defconfig has run.

Caution

remove is deliberately absent. pkgit --remove <package> aborts on a package declared in init.lua, with 'repositories' is not a table. followed by PANIC: unprotected error in call to Lua API (attempt to index a nil value)`, exiting``1` and leaving the package installed. It succeeds only on a repository pulled in as a build dependency, and even then leaves the checkout behind so installed() keeps reporting it.

Note

A listing carries no version. pkgit enumerates the directories under its share tree, one per cloned repository, and a package is whatever HEAD currently points at, so there is nothing to report as an installed version. Build dependencies are cloned as packages too and appear alongside what was asked for.

Documentation: pkgit README.

Initialize cli_errors list.

name: str = 'pkgit'

Return package manager’s common name.

Default value is based on class name.

homepage_url: str | None = 'https://git.symlinx.net/pkgit'

Home page of the project, only used in documentation for reference.

platforms: frozenset[Platform] | Group | Platform | Iterable[Platform | Group] = frozenset({Platform(id='almalinux', name='AlmaLinux'), Platform(id='alpine', name='Alpine Linux'), Platform(id='altlinux', name='ALT Linux'), Platform(id='amzn', name='Amazon Linux'), Platform(id='android', name='Android'), Platform(id='arch', name='Arch Linux'), Platform(id='buildroot', name='Buildroot'), Platform(id='cachyos', name='CachyOS'), Platform(id='centos', name='CentOS'), Platform(id='chromeos', name='ChromeOS'), Platform(id='clearlinux', name='Clear Linux OS'), Platform(id='cloudlinux', name='CloudLinux OS'), Platform(id='crux', name='CRUX'), Platform(id='debian', name='Debian'), Platform(id='endeavouros', name='EndeavourOS'), Platform(id='exherbo', name='Exherbo Linux'), Platform(id='fedora', name='Fedora'), Platform(id='generic_linux', name='Generic Linux'), Platform(id='gentoo', name='Gentoo Linux'), Platform(id='guix', name='Guix System'), Platform(id='ibm_powerkvm', name='IBM PowerKVM'), Platform(id='kali', name='Kali Linux'), Platform(id='kvmibm', name='KVM for IBM z Systems'), Platform(id='linuxmint', name='Linux Mint'), Platform(id='mageia', name='Mageia'), Platform(id='mandriva', name='Mandriva Linux'), Platform(id='manjaro', name='Manjaro Linux'), Platform(id='nixos', name='NixOS'), Platform(id='nobara', name='Nobara'), Platform(id='nutyx', name='NuTyX'), Platform(id='opensuse', name='openSUSE'), Platform(id='openwrt', name='OpenWrt'), Platform(id='oracle', name='Oracle Linux'), Platform(id='parallels', name='Parallels'), Platform(id='pidora', name='Pidora'), Platform(id='pikaos', name='PikaOS'), Platform(id='raspbian', name='Raspbian'), Platform(id='rhel', name='RedHat Enterprise Linux'), Platform(id='rocky', name='Rocky Linux'), Platform(id='scientific', name='Scientific Linux'), Platform(id='slackware', name='Slackware'), Platform(id='sles', name='SUSE Linux Enterprise Server'), Platform(id='slitaz', name='SliTaz GNU/Linux'), Platform(id='solus', name='Solus'), Platform(id='sourcemage', name='Source Mage GNU/Linux'), Platform(id='tuxedo', name='Tuxedo OS'), Platform(id='ubuntu', name='Ubuntu'), Platform(id='ultramarine', name='Ultramarine'), Platform(id='void', name='Void Linux'), Platform(id='wsl1', name='Windows Subsystem for Linux v1'), Platform(id='wsl2', name='Windows Subsystem for Linux v2'), Platform(id='xenserver', name='XenServer')})

src/files.c opens with O_NOFOLLOW behind no feature-test macro, which is why the build fails on macOS and the claim stops at Linux.

requirement: str | None = '>=1.2.0'

The release carrying both the verb set driven here and the listing shape parsed below: src/list_pkgs.c already prints one bare name per line there.

The floor cannot be tighter than that even where it should be. pkgit has not bumped VERSION since the tag, so the 58 commits on top of it report 1.2.0 too, and no version string separates the two.

version_regexes: tuple[str, ...] = ('(?P<version>\\d+\\S*)',)
$ pkgit --version
1.2.0
property installed: Iterator[Package]

Fetch installed packages.

Note

An empty listing is the honest answer on a machine that has installed nothing: pkgit exits 0 with could not open <share tree> on <stderr> before the directory exists, and reports no package, which is the same thing.

$ pkgit --list
git
pkgit
luajit.git
cli_names: tuple[str, ...] = ('pkgit',)

List of CLI names the package manager is known as.

This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.

..hint::

This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named python or python3.

By default, this property’s value is derived from the manager’s ID (see the MetaPackageManager.__init__ method above).

id: str = 'pkgit'

Package manager’s ID.

Derived by defaults from the lower-cased class name in which underscores _ are replaced by dashes -.

This ID must be unique among all package manager definitions and lower-case, as they’re used as feature flags for the mpm CLI.

search(query, extended, exact)[source]

Fetch matching packages.

Only the repositories the configuration declares are searched, and the result is a bare name, so mpm’s own refiltering narrows whatever comes back.

Caution

Search does not support extended or exact matching.

$ pkgit --search pkgit
pkgit
Return type:

Iterator[Package]

virtual: bool = False

Should we expose the package manager to the user?

Virtual package manager are just skeleton classes used to factorize code among managers of the same family.

install(package_id, version=None)[source]

Install one package, compiling it from its repository.

$ pkgit --install pkgit
Return type:

str

upgrade_all_cli()[source]

Generates the CLI to upgrade all installed packages.

Caution

pkgit exits 0 whether or not a repository updated, reporting each outcome on <stderr> instead, so a failed update cannot be told from a successful one by exit code alone.

$ pkgit --update
Return type:

tuple[str, ...]