Simple alpine package builder with dependency resolution using abuild
Find a file
2023-08-14 12:26:17 +02:00
src Updated documentation 2023-08-14 12:26:17 +02:00
.gitignore Initialized project 2023-08-11 09:24:55 +02:00
Cargo.lock Updated dependency resolution to show a cycle trace 2023-08-13 17:26:39 +02:00
Cargo.toml Updated dependency resolution to show a cycle trace 2023-08-13 17:26:39 +02:00
README.org Updated documentation 2023-08-14 12:26:17 +02:00

Cabin

Simple alpine package builder with dependency resolution.

While abuild has the option to automatically install dependencies, it does not have the option to automatically build them. This makes it difficult to build packages for a custom mirror from scratch. (Without using upstream packages) Cabin aims to simplify this by making dependency resolution easier.

In theory Cabin should also make it possible to use the offical aports repo somewhat like portage repos on Gentoo, by indexing and compiling packages locally.

Usage

Help

You can use the help command to view a command description

$ cabin

Simple alpine package builder with dependency resolution using abuild

Usage: cabin <COMMAND>

Commands:
  list       Lists all known packages
  scan       Rescans all folders
  build-all  Build all packages in repo
  build      Builds the package
  info       Displays package information
  search     Searches the database for a package with the name or containing the name
  tree       show a list of all dependencies
  help       Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

You can also combine the commands with help to view available options

Scan

First of all, you have to generate a database file for the aports directory.

cabin scan

This will automatically scan the current folder (.), and all child-folders recursively and save the database to db.yml.

$ cabin help scan

Searches the folder for APKBUILDs recursively and builds a local database

Usage: cabin scan [FOLDER] [DB]

Arguments:
  [FOLDER]  workspace
  [DB]      package database path

Options:
  -h, --help  Print help

NOTE: you have to rerun the scan command every time the aports change.

List

$ cabin help list

Lists all known packages

Usage: cabin list [OPTIONS]

Options:
  -d, --db <DB>  package database path
  -h, --help     Print help

Search

unimplemented

Build

To build a given package in the repo, run the following command:

cabin build <package>

Keep in mind, that you have to add $HOME/packages to /etc/apk/repositories if you want to use the dependency resolution / auto build feature.

$ cabin help build

Builds the package

Usage: cabin build [OPTIONS] <PACKAGE>

Arguments:
  <PACKAGE>  the packagename

Options:
  -a, --arch <ARCH>  build the package for a target architecture requires abuild-rootbld and qemu-binfmt to be installed (for the given architecture) and the .rootbld-repositories file to be configured correctly (even if set to host architecture)
  -r                 disables dependency resolution wont compile the dependencies locally however this will still pass -r to abuild and fetch the prebuild packages from upstream
  -d, --db <DB>      package database path
  -v                 allows the build log to be toggled on and off
  -h, --help         Print help

Build All

$ cabin help build-all

Build all packages in repo

Usage: cabin build-all [OPTIONS]

Options:
  -a, --arch <ARCH>  build the package for a target architecture requires abuild-rootbld and qemu-binfmt to be installed (for the given architecture) and the .rootbld-repositories file to be configured correctly (even if set to host architecture)
  -d, --db <DB>      package database path
  -v                 allows the build log to be toggled on and off
  -h, --help         Print help

Tree

$ cabin help tree

show a list of all dependencies

Usage: cabin tree [OPTIONS] <PACKAGE>

Arguments:
  <PACKAGE>  the packagename

Options:
  -d, --db <DB>  package database path
  -l             shows only local dependencies, that can be found in the local database will also topologically sort the dependencies
  -h, --help     Print help

Dependencies

Compile-time

  • cargo
  • rust

rustup can setup the compile-time dependencies for you, just follow the official setup instructions.

Runtime

  • apk (to install packages)
  • abuild (to build packages)
  • qemu-binfmt (and the user packages for the given architecture, only needed when building with -a (arch) set to an architecture other than the host architecture)

Assuming you are running Alpine Linux, you can use the following command to install abuild

apk add abuild

However you also have to configure abuild to use a rsa key-pair, luckily the steps are documented on the Alpine Wiki.

Building

You can use cargo to build cabin and its dependencies:

cargo build --release