2 releases

0.0.14 Jan 1, 2021
0.0.11 Jan 1, 2021

#376 in Build Utils

22 downloads per month
Used in relic

MIT/Apache

39KB
580 lines

librelic

license-badge build codecov crates.io Minimum rustc

Package management library for the Arch Linux packaging ecosystem

Usage

Requires rustc >= 1.42

This minimum rustc requirement is driven by the tracing_subscriber requirements

Research

Collecting the research done while developing this project here.

References:

Arch build system (ABS)

The Arch build system (ABS) packages all the software for the Arch Linux ecosystem and consists of the following tools:

  • ABS repository tree - a collection of git repositories that contain package descriptions
  • PKGBUILD - a bash script in each software package directory desribing build and packaging steps
  • makepkg - command line tool for building packages from package directories with PKGBUILD
  • pacman - command line tool for managing Arch Linux packages
  • AUR - the Arch User Repository is a repository similar to the ABS maintained by the community

ABS repository tree

  • Packages - git repo for the Arch Linux core, extra and testing package repositories
  • Community - git repo for the community and multilib package repositories

Each package has its own subdirectory containing repos and trunk directories:

  • repos contains the official arch linux repo configuration
  • trunk is used for latest development still being tested before being promoted to repos

Exmple:

acl
acl/repos
acl/repos/core-x86_64
acl/repos/core-x86_64/PKGBUILD
acl/trunk
acl/trunk/PKGBUILD

asp package

The asp package is just a thin wrapper around the svntogit repositories.

To clone the git repository for a specific package use:

$ asp checkout <pkg-name>

To update the cloned repo run:

$ asp update; git pull

Build container

Building in a clean chroot prevents missing dependencies in packages and allows for a separation from your current system. The best way to do this is to use a container to build in.

Pacman

The pacman package manager combines a simple binary package format with an easy-to-use build system. pacman internally uses the libalpm library for interacting with the package databases.

Arch Linux Package Management (ALPM)

Arch Linux's package management depends on the Arch Linux Package Management (ALPM) library libalpm for all of its automation.

ALPM Public Interface

pacman and libalpm are written in C and share the same git repo. alpm.h and alpm_list.h constitute the sum of all structures, data and functions declared available to the frontend i.e. pacman. pacman provides a facade to the library. All the library internal functions are prefixed with _alpm_ while the public functions are prefixed wih alpm_.

alpm databases

alpm hooks

alpm hooks provide the ability to specify scripts to run before or after transactions based on the packages and/or files being modified. Hooks condist of a single Action section describing the action to be run and one or more Trigger sections describing which tranactions it should run.

Hooks are read from files located in the system hook directory /usr/local/share/libalpm/hooks and additional custom directories specified in pacman.conf which defaults to /usr/local/share/etc/pacman.d/hooks. File names are required to have the suffix .hook. Hooks are run in alphabetical order of their file names.

alpm interface

alpm list

alpm log

alpm misc

alpm packages

alpm sync

alpm trans

Contribute

Pull requests are always welcome. However understand that they will be evaluated purely on whether or not the change fits with my goals/ideals for the project.

Git-Hook

Enable the git hooks to have automatic version increments

cd ~/Projects/relic
git config core.hooksPath .githooks

License

This project is licensed under either of:

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


Backlog

  • Parse PKGBUILD file
  • Add cli for working with relic directly
  • ffi bindings for libalpm or rewrite in rust
  • pacman database access
    • read pacman.conf to locate and load local and sync databases
    • -Q query the local database for provided targets
    • -S sync search the sync database for provided targets
  • rank mirrors
  • ABS interactions
    • download, build and package
    • install, update, remove packaages
  • Add rust doc comments

Changelog

Dependencies

~19–32MB
~546K SLoC