From de16af43082def3db298693c66d513456ab37555 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 4 Jul 2011 23:30:30 +0200 Subject: [PATCH] xbps-src: add -D flag replacing the install-destdir target. --- xbps-src/xbps-src.sh.in | 156 +++++++++++++++++++++++++--------------- 1 file changed, 99 insertions(+), 57 deletions(-) diff --git a/xbps-src/xbps-src.sh.in b/xbps-src/xbps-src.sh.in index 8ea3cf17520..183edb97951 100644 --- a/xbps-src/xbps-src.sh.in +++ b/xbps-src/xbps-src.sh.in @@ -51,50 +51,93 @@ check_reqhost_utils() usage() { cat << _EOF -$progname: [-ChKS] [-c ] [-m ] [-p ] [-s ] [] +$progname: [-CDhKS] [-c ] [-m ] [-p ] [-s ] [] Targets: - bootstrap Build and install the bootstrap packages into . - build [pkgname] Build a package (fetch + extract + configure + build). + bootstrap + Build and install from source the bootstrap packages + into . + + build [pkgname] + Build package source (fetch + extract + configure + build). + build-pkg [pkgname|all] - Build a binary package from . - Package must be installed into destdir. If the - keyword is used all packages currently installed in - / will be used. Otherwise - if specified, or the one in cwd. - checkvers Checks installed package versions against srcpkgs - for new available versions. - chroot Enter to the chroot in . - clean [pkgname] Remove build directory. - configure [pkgname] Configure a package (fetch + extract + configure). - extract [pkgname] Extract distribution file(s) into build directory. - Build directory is always available in - /pkg-builddir/. - fetch [pkgname] Download distribution file(s). - info [pkgname] Show information for current pkg build template. - install-destdir [pkgname] build + install into destdir. - install [pkgname] install-destdir + stow. - list List installed packages in . - list-files List installed files from . - make-repoidx Build a package index for the local repository associated - with the master directory or , - or updates it. - remove [pkgname] Remove package completely (destdir + masterdir). - stow [pkgname] Stow files from into and - register package in database. - unstow [pkgname] Remove files from and unregister - package from database. + Build a binary package from or all packages if + is specified. Package must be installed into destination directory. + + checkvers + Checks installed package versions in + against srcpkgs for new available versions. + + chroot + Enter to the chroot in . + + clean [pkgname] + Remove build directory. + + configure [pkgname] + Configure a package (fetch + extract + configure). + + extract [pkgname] + Extract package source distribution file(s) into the build directory. + By default set to /pkg-builddir. + + fetch [pkgname] + Download package source distribution file(s). + + info [pkgname] + 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. + + list + List installed packages in . + + list-files + List package files from . + + make-repoidx + Build a package index for the local repository associated with + the master directory . By default set to + /pkg-binpkgs. To specify another repo, use -p . + + remove [pkgname] + 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. + + unstow [pkgname] + 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 +is omitted xbps-src assumes that CWD is in the target package. Example: + + $ cd srcpkgs/libX11 && xbps-src install + $ xbps-src install libX11 + +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 /pkg-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 Package directory, overwritting default path at + -p Local packages repository, overwritting default path at /pkg-binpkgs. -S Overrides and disables XBPS_PREFER_BINPKG_DEPS even if it was set in the configuration file xbps-src.conf. @@ -172,29 +215,30 @@ check_config_vars() # # main() # -while getopts "Cc:hKm:p:Ss:" opt; do +while getopts "Cc:DhKm:p:Ss:" opt; do case $opt in - C) export KEEP_WRKSRC=1;; - c) XBPS_CONFIG_FILE="$OPTARG";; - h) usage && exit 0;; - K) export KEEP_AUTODEPS=1;; - m) - _MASTERDIR_FLAG=1 - _MASTERDIR="$OPTARG" - if [ ! -d ${_MASTERDIR} ]; then - mkdir -p ${_MASTERDIR} - fi - ;; - p) - _PACKAGEDIR="$OPTARG" - if [ ! -d ${_PACKAGEDIR} ]; then - mkdir -p ${_PACKAGEDIR}/${xbps_machine} - mkdir -p ${_PACKAGEDIR}/noarch - fi - ;; - S) UNSET_PREFER_BINPKG_DEPS=1;; - s) export XBPS_SRCDISTDIR="$OPTARG";; - --) shift; break;; + C) export KEEP_WRKSRC=1;; + c) XBPS_CONFIG_FILE="$OPTARG";; + D) export DESTDIR_ONLY_INSTALL=1;; + h) usage && exit 0;; + K) export KEEP_AUTODEPS=1;; + m) + _MASTERDIR_FLAG=1 + _MASTERDIR="$OPTARG" + if [ ! -d ${_MASTERDIR} ]; then + mkdir -p ${_MASTERDIR} + fi + ;; + p) + _PACKAGEDIR="$OPTARG" + if [ ! -d ${_PACKAGEDIR} ]; then + mkdir -p ${_PACKAGEDIR}/${xbps_machine} + mkdir -p ${_PACKAGEDIR}/noarch + fi + ;; + S) UNSET_PREFER_BINPKG_DEPS=1;; + s) export XBPS_SRCDISTDIR="$OPTARG";; + --) shift; break;; esac done shift $(($OPTIND - 1)) @@ -365,14 +409,12 @@ extract|fetch|info) fetch_distfiles $update_checksum extract_distfiles ;; -install|install-destdir) +install) if [ -z "${_pkgname}" ]; then [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" _pkgname=$(basename_cwd) fi setup_tmpl ${_pkgname} - [ "$target" = "install-destdir" ] && DESTDIR_ONLY_INSTALL=1 - _ORIGINPKG="${_pkgname}" if [ -z "$IN_CHROOT" -a -z "$base_chroot" ]; then . $XBPS_SHUTILSDIR/chroot.sh @@ -431,7 +473,7 @@ unstow) stow_pkg_handler unstow ;; *) - echo "=> ERROR: invalid target: $target." + msg_red "xbps-src: invalid target $target.\n" usage && exit 1 esac