xbps-src: apply indentation and avoid XBPS_MASTERDIR in the chroot case.

This commit is contained in:
Juan RP 2014-04-28 23:03:35 +02:00
parent b9f2cbed05
commit cf97b1a2b4
1 changed files with 383 additions and 373 deletions

152
xbps-src
View File

@ -7,94 +7,95 @@ $(basename $0): [options] <target> [arguments]
Targets: (only one may be specified)
binary-bootstrap [arch]
binary-bootstrap [arch]
Install bootstrap packages from host repositories into <masterdir>.
If the optional 'arch' argument is set, it will install bootstrap packages
from this architecture, and its required xbps utilities. The <masterdir>
will be initialized for chroot operations.
bootstrap
bootstrap
Build and install from source the bootstrap packages into <masterdir>.
bootstrap-update
bootstrap-update
Updates bootstrap packages with latest versions available from registered
repositories in the XBPS configuration file.
build <pkgname>
build <pkgname>
Build package source (fetch + extract + configure + build).
chroot
chroot
Enter to the chroot in <masterdir>.
clean <pkgname>
clean <pkgname>
Remove <pkgname> build directory.
configure <pkgname>
configure <pkgname>
Configure a package (fetch + extract + configure).
extract <pkgname>
extract <pkgname>
Extract package source distribution file(s) into the build directory.
By default set to <masterdir>/builddir.
fetch <pkgname>
fetch <pkgname>
Download package source distribution file(s).
install <pkgname>
install <pkgname>
Install target package into <destdir> but not building the binary package
and not removing build directory for inspection purposes.
pkg <pkgname>
pkg <pkgname>
Build binary package for <pkgname> and all required dependencies.
remove <pkgname>
remove <pkgname>
Remove target package from <destdir>. If <pkgname>-<version> is not matched
from build template nothing is removed.
remove-autodeps
remove-autodeps
Removes all package dependencies that were installed automatically.
show <pkgname>
show <pkgname>
Show information for the specified package.
show-build-deps <pkgname>
show-build-deps <pkgname>
Show required build dependencies for <pkgname>.
show-deps <pkgname>
show-deps <pkgname>
Show required run-time dependencies for <pkgname>. Package must be
installed into destdir.
show-files <pkgname>
show-files <pkgname>
Show files installed by <pkgname>. Package must be installed into destdir.
show-options <pkgname>
show-options <pkgname>
Show available build options by <pkgname>.
show-shlib-provides <pkgname>
show-shlib-provides <pkgname>
Show list of provided shlibs for <pkgname>. Package must be installed into destdir.
show-shlib-requires <pkgname>
show-shlib-requires <pkgname>
Show list of required shlibs for <pkgname>. Package must be installed into destdir.
show-var <var>
show-var <var>
Prints the value of <var> if it's defined in xbps-src.
show-repo-updates
show-repo-updates
Prints the list of outdated packages in XBPS repositories.
show-sys-updates
show-sys-updates
Prints the list of oudated packages in your system.
update-bulk
update-bulk
Rebuilds all packages in the system repositories that are outdated.
update-sys
update-sys
Rebuilds all packages in your system that are outdated and updates them.
zap
zap
Removes a masterdir but preserving ccache, distcc and host directories.
Options:
-a <profile>
-a <profile>
Cross compile packages for this profile. Supported values:
armv6hf-musl - for ARMv6 EABI (LE Hard Float) Musl/Linux
@ -107,40 +108,40 @@ Options:
mipsel - for MIPS o32 (LE Soft Float) GNU/Linux
x86_64-musl - for x86_64 Musl/Linux
-C Do not remove build directory, automatic dependencies and
-C Do not remove build directory, automatic dependencies and
package destdir after successful install.
-f Force building and registering binary packages into the local repository,
-f Force building and registering binary packages into the local repository,
even if same version is already registered.
-g Enable building -dbg packages with debugging symbols.
-g Enable building -dbg packages with debugging symbols.
-H <hostdir>
-H <hostdir>
Absolute path to a directory to be bind mounted at <masterdir>/host.
The host directory stores binary packages, sources and package dependencies
downloaded from remote repositories.
If unset defaults to xbps-packages/hostdir.
-h Usage output.
-h Usage output.
-I Ignore required dependencies, useful for extracting/fetching sources.
-I Ignore required dependencies, useful for extracting/fetching sources.
-j Number of parallel build jobs to use when building packages.
-j Number of parallel build jobs to use when building packages.
-L Disable ASCII colors.
-L Disable ASCII colors.
-m <masterdir>
-m <masterdir>
Absolute path to a directory to be used as masterdir.
The masterdir is the main directory to build/store/compile packages.
If unset defaults to xbps-packages/masterdir.
-N Disable use of remote repositories to resolve dependencies.
-N Disable use of remote repositories to resolve dependencies.
-o <opt,~opt2,...>
-o <opt,~opt2,...>
Enable or disable (prefixed with ~) package build options.
Supported options can be shown with the 'show-options' target.
-r <repo>
-r <repo>
Use an alternative local repository to store generated binary packages.
If unset defaults to <hostdir>/binpkgs. If set the binpkgs will
be stored into <hostdir>/binpkgs/<repo>.
@ -383,6 +384,15 @@ if [ -n "$IN_CHROOT" ]; then
readonly XBPS_RINDEX_CMD="xbps-rindex"
readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure"
readonly XBPS_REMOVE_CMD="xbps-remove"
readonly XBPS_SRCPKGDIR=/xbps-packages/srcpkgs
readonly XBPS_COMMONDIR=/xbps-packages/common
readonly XBPS_DESTDIR=/destdir
readonly XBPS_BUILDDIR=/builddir
readonly XBPS_SHUTILSDIR=$XBPS_COMMONDIR/xbps-src/shutils
readonly XBPS_TRIGGERSDIR=$XBPS_SRCPKGDIR/xbps-triggers/files
readonly XBPS_CROSSPFDIR=$XBPS_COMMONDIR/cross-profiles
readonly XBPS_BUILDSTYLEDIR=$XBPS_COMMONDIR/build_style
readonly XBPS_LIBEXECDIR=$XBPS_COMMONDIR/xbps-src/libexec
else
readonly XBPS_UHELPER_CMD="xbps-uhelper -r $XBPS_MASTERDIR"
readonly XBPS_INSTALL_CMD="xbps-install -C _empty.conf_ --repository=$XBPS_REPOSITORY -r $XBPS_MASTERDIR"
@ -390,16 +400,16 @@ else
readonly XBPS_RINDEX_CMD="xbps-rindex"
readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure -r $XBPS_MASTERDIR"
readonly XBPS_REMOVE_CMD="xbps-remove -r $XBPS_MASTERDIR"
readonly XBPS_SRCPKGDIR=$XBPS_DISTDIR/srcpkgs
readonly XBPS_COMMONDIR=$XBPS_DISTDIR/common
readonly XBPS_SHUTILSDIR=$XBPS_COMMONDIR/xbps-src/shutils
readonly XBPS_DESTDIR=$XBPS_MASTERDIR/destdir
readonly XBPS_BUILDDIR=$XBPS_MASTERDIR/builddir
readonly XBPS_TRIGGERSDIR=$XBPS_SRCPKGDIR/xbps-triggers/files
readonly XBPS_CROSSPFDIR=$XBPS_COMMONDIR/cross-profiles
readonly XBPS_BUILDSTYLEDIR=$XBPS_COMMONDIR/build_style
readonly XBPS_LIBEXECDIR=$XBPS_COMMONDIR/xbps-src/libexec
fi
readonly XBPS_SRCPKGDIR=$XBPS_DISTDIR/srcpkgs
readonly XBPS_COMMONDIR=$XBPS_DISTDIR/common
readonly XBPS_SHUTILSDIR=$XBPS_COMMONDIR/xbps-src/shutils
readonly XBPS_DESTDIR=$XBPS_MASTERDIR/destdir
readonly XBPS_BUILDDIR=$XBPS_MASTERDIR/builddir
readonly XBPS_TRIGGERSDIR=$XBPS_SRCPKGDIR/xbps-triggers/files
readonly XBPS_CROSSPFDIR=$XBPS_COMMONDIR/cross-profiles
readonly XBPS_BUILDSTYLEDIR=$XBPS_COMMONDIR/build_style
readonly XBPS_LIBEXECDIR=$XBPS_COMMONDIR/xbps-src/libexec
readonly CHROOT_CMD=xbps-uchroot
# XBPS_FETCH_CMD can be overriden
@ -510,10 +520,10 @@ trap 'exit_func' INT TERM HUP
# Main switch.
#
case "$XBPS_TARGET" in
binary-bootstrap)
binary-bootstrap)
install_bbotstrap
;;
bootstrap)
bootstrap)
# bootstrap from sources
# check for required host utils
check_reqhost_utils bootstrap
@ -522,17 +532,17 @@ bootstrap)
XBPS_TARGET_PKG="base-chroot"
setup_pkg $XBPS_TARGET_PKG && install_pkg $XBPS_TARGET
;;
bootstrap-update)
bootstrap-update)
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
chroot_handler ${XBPS_TARGET} dummy
else
${FAKEROOT_CMD} ${XBPS_INSTALL_CMD} -yu
fi
;;
chroot)
chroot)
chroot_handler chroot dummy
;;
clean)
clean)
read_pkg
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG || exit $?
@ -543,7 +553,7 @@ clean)
fi
fi
;;
remove-autodeps)
remove-autodeps)
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
chroot_handler remove-autodeps
else
@ -551,7 +561,7 @@ remove-autodeps)
remove_pkg_autodeps
fi
;;
fetch|extract|build|configure|install|install-destdir|pkg|build-pkg)
fetch|extract|build|configure|install|install-destdir|pkg|build-pkg)
BEGIN_INSTALL=1
read_pkg
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
@ -560,61 +570,61 @@ fetch|extract|build|configure|install|install-destdir|pkg|build-pkg)
install_pkg $XBPS_TARGET $XBPS_CROSS_BUILD
fi
;;
remove|remove-destdir)
remove|remove-destdir)
read_pkg
remove_pkg $XBPS_CROSS_BUILD
;;
list)
list)
$XBPS_QUERY_CMD -l
;;
show)
show)
read_pkg
show_pkg
;;
show-files)
show-files)
read_pkg
show_pkg_files
;;
show-deps)
show-deps)
read_pkg
show_pkg_deps
;;
show-build-deps)
show-build-deps)
read_pkg
show_pkg_build_deps
;;
show-options)
show-options)
read_pkg
show_pkg_options
;;
show-shlib-provides)
show-shlib-provides)
read_pkg
show_pkg_shlib_provides
;;
show-shlib-requires)
show-shlib-requires)
read_pkg
show_pkg_shlib_requires
;;
show-var)
show-var)
eval value="\${$XBPS_TARGET_PKG}"
echo $value
;;
show-repo-updates)
show-repo-updates)
bulk_build
;;
show-sys-updates)
show-sys-updates)
bulk_build -i
;;
update-bulk)
update-bulk)
bulk_update
;;
update-sys)
update-sys)
bulk_update -i
;;
zap)
zap)
masterdir_zap
;;
*)
*)
msg_red "xbps-src: invalid target $target.\n"
usage && exit 1
;;