A minimal package manager for OPENSTEP.
sh ./pkg download bash
sh ./pkg build bash
sh ./pkg install bash
sh ./pkg install bash grep
sh ./pkg test bash
sh ./pkg list
sh ./pkg remove bashEach package is a directory named after the package:
bash/
build
version
depends
sources
post-install
pre-remove
test
Required:
buildversion
Optional:
dependssourcespost-installpre-removetest
Contains the package version as a single field.
Example:
3.2.57
One source per line. Blank lines and # comments are ignored.
Examples:
https://ftp.gnu.org/gnu/bash/bash-3.2.57.tar.gz
bash-3.2.57-openstep.patch
files/site.h patches
Rules:
- remote URLs are downloaded into the source cache
- local paths are copied from the package directory
.tar.gz,.tgz, and.tararchives are extracted into the build root- non-archive files are copied as plain files
.tar.bz2,.tbz2,.tar.xz, and.txzare rejected
The optional second field is the destination directory inside the build root.
Optional file with one package name per line.
Prefix a package name with ! to declare a conflicting package that must not be installed.
Example:
make
grep
!gcc33
Behavior:
pkg buildchecks them before buildingpkg buildrequires positive dependencies to already be installedpkg buildrequires negative dependencies to be absentpkg installinstalls missing dependencies automatically when their package directories can be found alongside the requested packagepkg installfails if a negative dependency is already installedpkg installaccepts multiple package directories and installs them in the order provided- no build-vs-runtime distinction
build is run with:
- current directory set to the extracted source root when possible
$1set toDESTDIR$2set to the package versionDESTDIRexported in the environmentPKG_BUILD_HELPERSexported as the path tobuild-helpers.sh/usr/local/bin/kshused as the build shell for normal packages when available; the bootstrappdkshpackage is built with/bin/sh
Example:
#!/bin/sh
set -e
DESTDIR=$1
. "$PKG_BUILD_HELPERS"
run_configure --prefix=/usr/local
gnumake
gnumake install DESTDIR="$DESTDIR"test is an optional /bin/sh script that validates the installed package.
sh ./pkg test <name>runs the installed copy from/usr/local/var/pkg/db/installed/<name>/test- the package must already be installed
PKG_NAME,PKG_VERSION,ROOT_DIR, andLOCAL_ROOTare exported for the scriptPATHis prefixed with$LOCAL_ROOT/bin:$LOCAL_ROOT/sbin
Installed packages are tracked under:
/usr/local/var/pkg/db/installed
The default cache/staging area is:
/usr/local/var/pkg/cache
After a successful pkg build, the download cache and unpacked build tree
under:
/usr/local/var/pkg/cache/sources/<name>
/usr/local/var/pkg/cache/build/<name>
are removed automatically to save space.
The staged install image under:
/usr/local/var/pkg/cache/pkg/<name>
is kept so a later pkg install can reuse it without rebuilding.
After a successful pkg install, that staged install image is also removed,
so no per-package cache remains.
If a package ships a test script, pkg install copies it into the installed
package database so pkg test <name> can validate the installed files later.
This layout assumes /usr/local is writable by the installing user. That lets
non-root users build and install packages into the shared /usr/local tree.
Paths can still be overridden with:
PKG_ROOTPKG_DBPKG_CACHE