From 948eebcaf73a9da6a6593fae2997a57bbc87f6ec Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 14 Aug 2023 12:26:17 +0200 Subject: [PATCH] Updated documentation --- README.org | 117 +++++++++++++++++++++++++++++++++++++++++++++++++--- src/main.rs | 10 +++-- 2 files changed, 118 insertions(+), 9 deletions(-) diff --git a/README.org b/README.org index 4ca57f1..9eb3368 100644 --- a/README.org +++ b/README.org @@ -12,6 +12,35 @@ to use the [[gitlab.alpinelinux.org/alpine/aports/][offical aports repo]] somewh by indexing and compiling packages locally. ** Usage + +*** Help +You can use the help command to view a command description +#+begin_src bash +$ cabin + +Simple alpine package builder with dependency resolution using abuild + +Usage: cabin + +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 +#+end_src + +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. #+begin_src bash @@ -20,21 +49,94 @@ cabin scan This will automatically scan the current folder (~.~), and all child-folders recursively and save the database to ~db.yml~. -Now you're essentially done, -try ~list~-ing all available packages, -or ~search~-ing for a specific one. -Maybe use ~cabin help~ for more option. +#+begin_src bash +$ 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 +#+end_src + +*NOTE*: you have to rerun the ~scan~ command +every time the ~aports~ change. +*** List +#+begin_src bash +$ cabin help list + +Lists all known packages + +Usage: cabin list [OPTIONS] +Options: + -d, --db package database path + -h, --help Print help +#+end_src +*** Search +unimplemented +*** Build To build a given package in the repo, run the following command: #+begin_src bash cabin build -#+end_src. +#+end_src 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. -Also you have to rerun the ~scan~ command every time the ~aports~ change. +#+begin_src bash +$ cabin help build + +Builds the package + +Usage: cabin build [OPTIONS] + +Arguments: + the packagename + +Options: + -a, --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 package database path + -v allows the build log to be toggled on and off + -h, --help Print help +#+end_src +*** Build All +#+begin_src bash +$ cabin help build-all + +Build all packages in repo + +Usage: cabin build-all [OPTIONS] + +Options: + -a, --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 package database path + -v allows the build log to be toggled on and off + -h, --help Print help +#+end_src +*** Tree +#+begin_src bash +$ cabin help tree + +show a list of all dependencies + +Usage: cabin tree [OPTIONS] + +Arguments: + the packagename + +Options: + -d, --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 +#+end_src ** Dependencies *** Compile-time @@ -46,6 +148,9 @@ just follow [[https://rustup.rs/][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 [[alpinelinux.org/][Alpine Linux]], you can use the following command to install ~abuild~ diff --git a/src/main.rs b/src/main.rs index a515740..c390e2a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,8 +13,10 @@ enum Commands { #[arg(short='d',long)] db: Option }, - /// Rescans all folders + /// Searches the folder for APKBUILDs recursively + /// and builds a local database Scan { + /// workspace folder: Option, /// package database path db: Option @@ -22,7 +24,8 @@ enum Commands { /// Build all packages in repo BuildAll { /// build the package for a target architecture - /// requires abuild-rootbld to be installed, + /// 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) #[arg(short='a',long)] @@ -39,7 +42,8 @@ enum Commands { /// the packagename package: String, /// build the package for a target architecture - /// requires abuild-rootbld to be installed, + /// 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) #[arg(short='a',long)] -- 2.38.5