~comcloudway/cabin

Simple alpine package builder with dependency resolution using abuild
Added --run-after to multi package build
Fixed quote formatting
added package search feature

clone

read-only
https://git.hut.ccw.icu/~comcloudway/cabin
read/write
git@git.hut.ccw.icu:~comcloudway/cabin

You can also use your local clone with git send-email.

#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.

#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 scan
# view the help page
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

The list command can be used to list known packages:

cabin list

For a list of all options, see the help page

cabin help list
Lists all known packages

Usage: cabin list [OPTIONS]

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

Search through package names, descriptions and urls and lists package names,versions and rels.

cabin help search
Searches the database for a package with the name or containing the name

Usage: cabin search [OPTIONS] <QUERY>

Arguments:
  <QUERY>  search query

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

#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

#Build Group

Allows building multiple packages in topologically sorted order.

cabin build-group [...packages]
Builds multiple packages from a list

Usage: cabin build-group [OPTIONS] [PACKAGES]...

Arguments:
  [PACKAGES]...  list of packages to be build

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