meta_package_manager.managers.zero_install module¶

class meta_package_manager.managers.zero_install.ZeroInstall[source]¶

Bases: PackageManager

Zero Install is a decentralised, cross-platform installation system.

There is no central registry. A program is identified by the URL of its feed, an XML document its own publisher hosts and signs with their own GPG key, so a package id here is a feed URI rather than a short name. Short names collide freely across publishers: one search for python returns a Python feed from apps.0install.net, another from 0install.de and a third from dispcalgui.hoech.net.

A second identifier sits beside the URI. An application is a pet name the user invents and binds to a feed, which is what destroy and update address. The two identifier spaces are what shape the operation set below.

Caution

No installed: 0install list looks like an inventory and is not. It prints the URI of every feed in the local cache, which is the set of feeds ever fetched rather than the set of programs installed. Upstream says so in the command’s own source, src/cli/list_ifaces.ml, which calls Feed_cache.list_all_feeds under the comment “Actually, we list all the cached feeds. Close enough.”

Driving it proves how wide the gap is. On a host where exactly one application was added, 0install list returned thirteen URIs: the feeds the solver merely consulted to resolve dependencies, and xz, whose selection had failed outright with “No usable implementations” and which downloaded not one byte. Reporting those as installed would be false. The listing also never prints a pet name, so nothing it emits can be handed back to destroy.

Caution

No install: 0install add takes two mandatory arguments, the pet name to create and the feed URI to bind it to, and refuses a lone URI. mpm’s install carries a single package id, which cannot supply both, and inventing a pet name for the user would name their application for them. sheldon declines the operation for the same reason.

Note

No outdated: nothing reports staleness without acting on it. update does print when a newer version exists, but it is the upgrade itself and needs an application named on the command line.

Note

No upgrade of either shape. 0install update requires an application or a URI and the tool ships no bulk form, so there is no upgrade --all to build. The single-package form is out for a second reason: mpm resolves which manager sources a package by querying its inventory, and this manager has none to query, so the operation could never be dispatched here.

Note

No sync: refreshing is the --refresh flag of the commands that already resolve a feed, never a command of its own.

Note

No version floor is declared. Every subcommand this class drives predates the oldest release upstream’s CHANGES.md documents, so no floor could be verified rather than guessed. The class was driven against 2.18.

Documentation: 0install.

Initialize cli_errors list.

name: str = 'Zero Install'¶

Return package manager’s common name.

Default value is based on class name.

homepage_url: str | None = 'https://0install.net'¶

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

platforms: frozenset[Platform] | Group | Platform | Iterable[Platform | Group] = frozenset({Platform(id='aix', name='IBM AIX'), 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='cygwin', name='Cygwin'), Platform(id='debian', name='Debian'), Platform(id='dragonfly_bsd', name='DragonFly BSD'), Platform(id='endeavouros', name='EndeavourOS'), Platform(id='exherbo', name='Exherbo Linux'), Platform(id='fedora', name='Fedora'), Platform(id='freebsd', name='FreeBSD'), Platform(id='generic_linux', name='Generic Linux'), Platform(id='gentoo', name='Gentoo Linux'), Platform(id='guix', name='Guix System'), Platform(id='haiku', name='Haiku'), Platform(id='hurd', name='GNU/Hurd'), Platform(id='ibm_powerkvm', name='IBM PowerKVM'), Platform(id='illumos', name='illumos'), Platform(id='kali', name='Kali Linux'), Platform(id='kvmibm', name='KVM for IBM z Systems'), Platform(id='linuxmint', name='Linux Mint'), Platform(id='macos', name='macOS'), Platform(id='mageia', name='Mageia'), Platform(id='mandriva', name='Mandriva Linux'), Platform(id='manjaro', name='Manjaro Linux'), Platform(id='midnightbsd', name='MidnightBSD'), Platform(id='netbsd', name='NetBSD'), Platform(id='nixos', name='NixOS'), Platform(id='nobara', name='Nobara'), Platform(id='nutyx', name='NuTyX'), Platform(id='openbsd', name='OpenBSD'), Platform(id='opensuse', name='openSUSE'), Platform(id='openwrt', name='OpenWrt'), Platform(id='oracle', name='Oracle Linux'), Platform(id='os400', name='IBM i'), 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='solaris', name='Solaris'), Platform(id='solus', name='Solus'), Platform(id='sourcemage', name='Source Mage GNU/Linux'), Platform(id='sunos', name='SunOS'), Platform(id='tuxedo', name='Tuxedo OS'), Platform(id='ubuntu', name='Ubuntu'), Platform(id='ultramarine', name='Ultramarine'), Platform(id='void', name='Void Linux'), Platform(id='windows', name='Windows'), Platform(id='wsl1', name='Windows Subsystem for Linux v1'), Platform(id='wsl2', name='Windows Subsystem for Linux v2'), Platform(id='xenserver', name='XenServer')})¶

The OCaml implementation builds for Windows alongside every Unix, and ships the manifest and resource files to prove it under src/windows.

cli_names: tuple[str, ...] = ('0install',)¶

The binary leads with a digit, where the manager id cannot.

Every id doubles as a --<id> selector, and Click derives an option’s Python identifier from that flag, which leaves --0install named by the empty string. So the id follows the project’s own name, Zero Install, and only the binary keeps its digit.

pre_args: tuple[str, ...] = ('--console',)¶

Keeps every call on the terminal.

0install switches to a graphical policy editor whenever it needs the network and DISPLAY is set, so a search run from a desktop session would otherwise open a window and wait for a human.

version_regexes: tuple[str, ...] = ('0install\\s+\\(zero-install\\)\\s+(?P<version>\\S+)',)¶
$ 0install --console --version
0install (zero-install) 2.18
Copyright (C) 2019 Thomas Leonard
This program comes with ABSOLUTELY NO WARRANTY,
to the extent permitted by law. You may redistribute copies of this program
under the terms of the GNU Lesser General Public License.
For more information about these matters, see the file named COPYING.
Compiled with D-Bus support: false
HTTP client library: libcurl (C)
id: str = 'zeroinstall'¶

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.

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.

search(query, extended, exact)[source]¶

Fetch matching packages.

The query goes to the mirror server, which indexes feeds it has been told about. Results carry no version, the mirror indexing feeds rather than the implementations inside them.

Caution

Search does not support extended or exact matching.

$ 0install --console search hello
http://gfxmonk.net/dist/0install/template.xml
  template - A command-line jinja2 template script [100%]

http://gfxmonk.net/dist/0install/python-pyquery.xml
  python-pyquery - A jquery-like library for python [45%]

http://gfxmonk.net/dist/0install/python-argh.xml
  python-argh - An unobtrusive argparse wrapper with natural syntax [38%]

http://gfxmonk.net/dist/0install/should.js.xml
  should.js - should.js [8%]

http://gfxmonk.net/dist/0install/python-colorama.xml
  python-colorama - Cross-platform colored terminal text. [7%]
Return type:

Iterator[Package]

remove(package_id)[source]¶

Remove one package.

destroy takes the pet name alone, the one add created, and deletes the application directory with any launcher script it placed on the user’s path. A feed URI is refused with No such application, so the URIs that search yields are not what this operation consumes.

$ 0install --console destroy zeroinstall
Return type:

str

cleanup_cache()[source]¶

Optimise the implementation cache.

Hard-links files shared by several implementations in the store, so a program kept at more than one version stops paying for each copy.

$ 0install --console store optimise
Optimising /Users/kde/.cache/0install.net/implementations
[0 / 1] Reading manifests...Original size  : 2.1 MB (excluding the 27.9 KB of manifests)
Already saved  : 0 bytes
Optimised size : 2.1 MB
Space freed up : 40 bytes (0.00%)
Optimisation complete.
Return type:

None