diff --git a/xbps-src/xbps-src.sh.in b/xbps-src/xbps-src.sh.in index 28493e4af3..4a78244d30 100644 --- a/xbps-src/xbps-src.sh.in +++ b/xbps-src/xbps-src.sh.in @@ -57,71 +57,70 @@ check_reqhost_utils() usage() { cat << _EOF -$progname: [-CDhKS] [-c ] [-m ] [-p ] [-s ] [] +$progname: [-BCDhKS] [-c file] [-m dir] [-p dir] [-s dir] [target] [pkgname] Targets: bootstrap - Build and install from source the bootstrap packages - into . + Build and install from source the bootstrap packages into . build [pkgname] - Build package source (fetch + extract + configure + build). + Build package source (fetch + extract + configure + build). build-pkg [pkgname|all] - Build a binary package from or all packages if - is specified. Package must be installed into destination directory. + Build a binary package from or all packages with the + keyword. The package(s) must be installed into for this to work. checkvers - Checks installed package versions in - against srcpkgs for new available versions. + Checks installed package versions in against the srcpkgs tree + for new available versions. chroot - Enter to the chroot in . + Enter to the chroot in . clean [pkgname] - Remove build directory. + Remove build directory. configure [pkgname] - Configure a package (fetch + extract + configure). + Configure a package (fetch + extract + configure). extract [pkgname] - Extract package source distribution file(s) into the build directory. - By default set to /builddir. + Extract package source distribution file(s) into the build directory. + By default set to /builddir. fetch [pkgname] - Download package source distribution file(s). + Download package source distribution file(s). info [pkgname] - Show information for the specified package. + Show information for the specified package. install [pkgname] - Installs a package into destination directory and \`stows' its - files into . If a package is not from bootstrap group, - its files will be symlinked rather than copied. + Installs a package into destination directory and \`stows' its files into + . If a package is not from bootstrap group, its files will be + symlinked rather than being fully copied. list - List installed packages in . + List installed packages in . list-files - List package files from . + List package files from . Package must be fully installed + into for this to work. make-repoidx - Build a package index for the local repository associated with - the master directory . By default set to - /host/binpkgs. To specify another repo, use -p . + Build a package index for the local repository associated with the + master directory . By default set to . remove [pkgname] - Remove package completely from and . + Remove package completely from and . stow [pkgname] - Stow files from into and register - package in database. When a package is \`stown', its files will - be available in , and other packages will be able to - depend on it. + Stow files from into and register package + in database. When a package is \`stown', its files will be available in + , and other packages will be able to found it. unstow [pkgname] - Remove files from and unregister package - from database. + Remove files from and unregister package + from database. On targets that accept [pkgname], a package name can be specified and xbps-src will execute the task on any CWD (Current Working Directory). If the argument @@ -133,24 +132,25 @@ is omitted xbps-src assumes that CWD is in the target package. Example: Both ways are equivalent. Options: - -C Do not remove build directory after successful installation. - -c Path to global configuration file: - if not specified @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf is used. - -D Only install to package's destination directory set - to /destdir/-. - -h Usage output. - -K Do not remove automatic package dependencies while building - or installing a package with XBPS_PREFER_BINPKG_DEPS enabled. - -m Master directory, overwritting the value set in the configuration - file xbps-src.conf. - -p Local packages repository, overwritting default path at - /host/binpkgs. - -S Overrides and disables XBPS_PREFER_BINPKG_DEPS even if it was - set in the configuration file xbps-src.conf. - it was set in the configuration file. - -s Source distribution files directory, overwritting default path at - /host/sources. - + -B Used in the install target, after successful installation a + binary package is also built for and local repository + pkg-index is created or updated. + -C Do not remove build directory after successful installation. + -c Path to global configuration file: + if not specified @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf is used. + -D Only install to package's destination directory set + to /destdir/-. + -h Usage output. + -K Do not remove automatic package dependencies while building + or installing a package with XBPS_PREFER_BINPKG_DEPS enabled. + -m Master directory, overwritting the value set in the configuration + file xbps-src.conf. + -p Local packages repository, overwritting default path at + /host/binpkgs or if XBPS_HOSTDIR is set /binpkgs. + -S Overrides and disables XBPS_PREFER_BINPKG_DEPS even if it was + set in the configuration file xbps-src.conf. + -s Source distribution files directory, overwritting default path at + /host/sources or if XBPS_HOSTDIR is set /sources. _EOF } @@ -221,8 +221,9 @@ check_config_vars() # # main() # -while getopts "Cc:DhKm:p:Ss:" opt; do +while getopts "CBc:DhKm:p:Ss:" opt; do case $opt in + B) export BUILD_BINPKG=1;; C) export KEEP_WRKSRC=1;; c) XBPS_CONFIG_FILE="$OPTARG";; D) export DESTDIR_ONLY_INSTALL=1;; @@ -253,6 +254,7 @@ shift $(($OPTIND - 1)) target="$1" _pkgname="$2" + if [ -z "$target" ]; then echo "=> ERROR: missing target." usage && exit 1 @@ -359,17 +361,17 @@ build|configure) fi # All deps were installed, continue with the origin pkg... setup_tmpl ${_ORIGINPKG} - fetch_distfiles + fetch_distfiles || exit $? if [ ! -f "$XBPS_EXTRACT_DONE" ]; then - extract_distfiles + extract_distfiles || exit $? fi if [ "$target" = "configure" ]; then - configure_src_phase + configure_src_phase || exit $? else if [ ! -f "$XBPS_CONFIGURE_DONE" ]; then - configure_src_phase + configure_src_phase || exit $? fi - build_src_phase + build_src_phase || exit $? fi fi ;; @@ -429,29 +431,33 @@ install) setup_tmpl ${_pkgname} _ORIGINPKG="${_pkgname}" if [ -z "$IN_CHROOT" -a -z "$bootstrap" ]; then - xbps_chroot_handler $target ${_ORIGINPKG} + xbps_chroot_handler $target ${_ORIGINPKG} || exit $? else setup_tmpl ${_ORIGINPKG} - install_pkg $pkgname + install_pkg $pkgname || exit $? + fi + if [ -z "$IN_CHROOT" -a -n "$BUILD_BINPKG" ]; then + setup_tmpl ${_ORIGINPKG} + xbps_make_binpkg + [ -n "${_PACKAGEDIR}" ] && XBPS_PACKAGESDIR="${_PACKAGEDIR}" + msg_normal "Updating pkg-index for local repository at:\n" + msg_normal " $XBPS_PACKAGESDIR\n" + ${XBPS_REPO_CMD} genindex ${XBPS_PACKAGESDIR} 2>/dev/null fi ;; -list|list-files) - if [ "$target" = "list" ]; then - $XBPS_BIN_CMD list - else - list_pkg_files $2 - fi +list) + $XBPS_BIN_CMD list + ;; +list-files) + list_pkg_files ${_pkgname} ;; make-repoidx) if [ -n "${_PACKAGEDIR}" ]; then export XBPS_PACKAGESDIR=${_PACKAGEDIR} fi - echo "=> Updating package index for local repository at" - echo " $XBPS_PACKAGESDIR..." - [ ! -d "$XBPS_PACKAGESDIR/$(uname -m)" ] && \ - mkdir -p "$XBPS_PACKAGESDIR/$(uname -m)" + msg_normal "Updating pkg-index for local repository at:\n" + msg_normal " $XBPS_PACKAGESDIR\n" ${XBPS_REPO_CMD} genindex ${XBPS_PACKAGESDIR} 2>/dev/null - [ $? -eq 0 ] && echo "=> done." ;; remove) if [ -z "${_pkgname}" ]; then