alatools

2022-07-15 12:40 UTC
  • Xyne

Metadata

Description: Tools for the Arch Linux Archive.
Latest Version: 2022.6
Source Code: src/
Architecture:
  • any
Dependencies:
  • python-pyxdg
  • python3
Arch Repositories:
  • [xyne-any]
  • [xyne-i686]
  • [xyne-x86_64]
AUR Page: alatools
Arch Forum Thread: 226221
Tags:

About

alatools will be used to collect my tools related to the Arch Linux Archive (ALA) located at https://archive.archlinux.org/.

ala-config

Parse a Pacman configuration file and get the last modification time of each repo database. Generate a new configuration file where the repo server URL is replaced with an ALA equivalent dated to the last modification time of the local sync database. The generated configuration file should make it possible to install older versions of packages on a system without upgrading. This can be useful when you need a new package but cannot risk upgrading the system. The script can also be used to run a command with a temporary configuration file.

Example: Installing A “Missing” Package

Let’s say that you haven’t updated your system in 2 weeks or more because you’re working on something critical and you don’t have the time to deal with possible breakage in core packages. You now need to install package <foo> so you run pacman -S <foo> but you get a 404 Not Found error because the repo and the package have been updated on the server. You can’t run pacman -Sy <foo> because that may break the system (and partial upgrades are not supported). But wait, there’s this thing called ALA with older versions of packages. You could try to download <foo> directly from there but you would need to figure out which dated URL to use, which dependencies you need for <foo> and then manually install them all with pacman -U. You could also edit pacman.conf manually and point your repos to ALA, but you would rather use your precious time to work on your critical project.

That’s where ala-config steps in. It will automatically parse pacman.conf and then check the last modification times of your repos to get the right ALA server URLs (per repo). With it, you can just do this:

ala-config --pacman -S <foo>

It can also be used with pacman wrapper, e.g.

ala-config -- powerpill --config '%CONFIG%' -S <foo>

If you need to run such commands regulary, create an alias, e.g.

alias alapp="ala-config -- powerpill --config '%CONFIG%'"

Example: Stepping Through Upgrades

This is untested but it should be possible to use the --date option to step through upgrades while following the Arch front page new. In theory, you should be able to point ala-config to the date of each change that requires manual intervention and work through them sequentially. The revocation of signing keys will likely require additional manual intervention and careful vigilance.

Caveats

This script should only be used occasionally under particular circumstances and not as an alternative to regular system updates. Postponing Arch updates can multiply the complexity of the upgrade path (e.g. due to missed intermediate steps).

ala-config Help Message

$ ala-config --help

usage: ala-config [-h] [--arch <arch>] [--check] [--config <path>]
                  [--date <%Y-%m-%d>] [--dbs <path>] [--out <path>]
                  [--pacman ...] [--sudo]
                  [<cmd> ...]

Print a copy of a Pacman configuration file to STDOUT with server paths
modified to point to Arch Linux Archive servers created on the same day as the
local sync databases.

positional arguments:
  <cmd>              Run a command with the modified configuration file.
                     "%CONFIG% will be replaced with the path of the modified
                     configuration file. Escape "%" with "%%". Use "--" to end
                     argument parsing and interpret all remaining parameters
                     as a command. Example: ala-config -- pacman -S --config
                     '%CONFIG%' foo_pkg bar_pkg

options:
  -h, --help         show this help message and exit
  --arch <arch>      The system architecture. Default: x86_64
  --check            Check the availability of each repo database with a HEAD
                     request.
  --config <path>    The path to the Pacman configuration file. Default:
                     /etc/pacman.conf
  --date <%Y-%m-%d>  Select a specific date instead of using the last
                     modification time of each sync repo. Edit the generated
                     file manually if you need greater precision.
  --dbs <path>       The path to the Pacman sync database directory. Default:
                     /var/lib/pacman/sync
  --out <path>       Save the generated configuration file. If not given or
                     "-", the file is printed to STDOUT. Printing to STDOUT
                     will be overridden if a command is also passed.
  --pacman ...       Interpret all remaining arguments as pacman argument.
                     This will prepend "pacman --config '%CONFIG%'" to them.
                     Example: ala-config --pacman -S foo_pkg bar_pkg
  --sudo             Run the optional command with sudo.

Arch Linux Archive: https://wiki.archlinux.org/index.php/Arch_Linux_Archive
https://archive.archlinux.org/
Contact
echo xyne.archlinux.org | sed 's/\./@/'
Validation
XHTML 1.0 Strict CSS level 3 Atom 1.0