xbps-src: add -D flag replacing the install-destdir target.

This commit is contained in:
Juan RP 2011-07-04 23:30:30 +02:00
parent cdb129b3f2
commit de16af4308

View file

@ -51,50 +51,93 @@ check_reqhost_utils()
usage() usage()
{ {
cat << _EOF cat << _EOF
$progname: [-ChKS] [-c <file>] [-m <dir>] [-p <dir>] [-s <dir>] <target> [<pkgname>] $progname: [-CDhKS] [-c <file>] [-m <dir>] [-p <dir>] [-s <dir>] <target> [<pkgname>]
Targets: Targets:
bootstrap Build and install the bootstrap packages into <masterdir>. bootstrap
build [pkgname] Build a package (fetch + extract + configure + build). Build and install from source the bootstrap packages
into <masterdir>.
build [pkgname]
Build package source (fetch + extract + configure + build).
build-pkg [pkgname|all] build-pkg [pkgname|all]
Build a binary package from <pkg>. Build a binary package from <pkgname> or all packages if <all>
Package must be installed into destdir. If the <all> is specified. Package must be installed into destination directory.
keyword is used all packages currently installed in
<masterdir>/<destdir> will be used. Otherwise <pkgname> checkvers
if specified, or the one in cwd. Checks installed package versions in <masterdir>
checkvers Checks installed package versions against srcpkgs against srcpkgs for new available versions.
for new available versions.
chroot Enter to the chroot in <masterdir>. chroot
clean [pkgname] Remove <pkg> build directory. Enter to the chroot in <masterdir>.
configure [pkgname] Configure a package (fetch + extract + configure).
extract [pkgname] Extract distribution file(s) into build directory. clean [pkgname]
Build directory is always available in Remove <pkgname> build directory.
<masterdir>/pkg-builddir/<pkg>.
fetch [pkgname] Download distribution file(s). configure [pkgname]
info [pkgname] Show information for current pkg build template. Configure a package (fetch + extract + configure).
install-destdir [pkgname] build + install into destdir.
install [pkgname] install-destdir + stow. extract [pkgname]
list List installed packages in <masterdir>. Extract package source distribution file(s) into the build directory.
list-files <pkgname> List installed files from <pkg>. By default set to <masterdir>/pkg-builddir.
make-repoidx Build a package index for the local repository associated
with the master directory <masterdir> or <pkgdir>, fetch [pkgname]
or updates it. Download package source distribution file(s).
remove [pkgname] Remove package completely (destdir + masterdir).
stow [pkgname] Stow <pkg> files from <destdir> into <masterdir> and info [pkgname]
register package in database. Show information for the specified package.
unstow [pkgname] Remove <pkg> files from <masterdir> and unregister
package from database. install [pkgname]
Installs a package into destination directory and \`stows' its
files into <masterdir>. If a package is not from bootstrap group,
its files will be symlinked rather than copied.
list
List installed packages in <masterdir>.
list-files <pkgname>
List package files from <pkgname>.
make-repoidx
Build a package index for the local repository associated with
the master directory <masterdir>. By default set to
<masterdir>/pkg-binpkgs. To specify another repo, use -p <dir>.
remove [pkgname]
Remove package completely from <destdir> and <masterdir>.
stow [pkgname]
Stow <pkgname> files from <destdir> into <masterdir> and register
package in database. When a package is \`stown', its files will
be available in <masterdir>, and other packages will be able to
depend on it.
unstow [pkgname]
Remove <pkgname> files from <masterdir> 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: Options:
-C Do not remove build directory after successful installation. -C Do not remove build directory after successful installation.
-c Path to global configuration file: -c Path to global configuration file:
if not specified @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf is used. if not specified @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf is used.
-D Only install <pkgname> to package's destination directory set
to <masterdir>/pkg-destdir/<pkgname>-<version>.
-h Usage output. -h Usage output.
-K Do not remove automatic package dependencies while building -K Do not remove automatic package dependencies while building
or installing a package with XBPS_PREFER_BINPKG_DEPS enabled. or installing a package with XBPS_PREFER_BINPKG_DEPS enabled.
-m Master directory, overwritting the value set in the configuration -m Master directory, overwritting the value set in the configuration
file xbps-src.conf. file xbps-src.conf.
-p Package directory, overwritting default path at -p Local packages repository, overwritting default path at
<masterdir>/pkg-binpkgs. <masterdir>/pkg-binpkgs.
-S Overrides and disables XBPS_PREFER_BINPKG_DEPS even if it was -S Overrides and disables XBPS_PREFER_BINPKG_DEPS even if it was
set in the configuration file xbps-src.conf. set in the configuration file xbps-src.conf.
@ -172,29 +215,30 @@ check_config_vars()
# #
# main() # main()
# #
while getopts "Cc:hKm:p:Ss:" opt; do while getopts "Cc:DhKm:p:Ss:" opt; do
case $opt in case $opt in
C) export KEEP_WRKSRC=1;; C) export KEEP_WRKSRC=1;;
c) XBPS_CONFIG_FILE="$OPTARG";; c) XBPS_CONFIG_FILE="$OPTARG";;
h) usage && exit 0;; D) export DESTDIR_ONLY_INSTALL=1;;
K) export KEEP_AUTODEPS=1;; h) usage && exit 0;;
m) K) export KEEP_AUTODEPS=1;;
_MASTERDIR_FLAG=1 m)
_MASTERDIR="$OPTARG" _MASTERDIR_FLAG=1
if [ ! -d ${_MASTERDIR} ]; then _MASTERDIR="$OPTARG"
mkdir -p ${_MASTERDIR} if [ ! -d ${_MASTERDIR} ]; then
fi mkdir -p ${_MASTERDIR}
;; fi
p) ;;
_PACKAGEDIR="$OPTARG" p)
if [ ! -d ${_PACKAGEDIR} ]; then _PACKAGEDIR="$OPTARG"
mkdir -p ${_PACKAGEDIR}/${xbps_machine} if [ ! -d ${_PACKAGEDIR} ]; then
mkdir -p ${_PACKAGEDIR}/noarch mkdir -p ${_PACKAGEDIR}/${xbps_machine}
fi mkdir -p ${_PACKAGEDIR}/noarch
;; fi
S) UNSET_PREFER_BINPKG_DEPS=1;; ;;
s) export XBPS_SRCDISTDIR="$OPTARG";; S) UNSET_PREFER_BINPKG_DEPS=1;;
--) shift; break;; s) export XBPS_SRCDISTDIR="$OPTARG";;
--) shift; break;;
esac esac
done done
shift $(($OPTIND - 1)) shift $(($OPTIND - 1))
@ -365,14 +409,12 @@ extract|fetch|info)
fetch_distfiles $update_checksum fetch_distfiles $update_checksum
extract_distfiles extract_distfiles
;; ;;
install|install-destdir) install)
if [ -z "${_pkgname}" ]; then if [ -z "${_pkgname}" ]; then
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
_pkgname=$(basename_cwd) _pkgname=$(basename_cwd)
fi fi
setup_tmpl ${_pkgname} setup_tmpl ${_pkgname}
[ "$target" = "install-destdir" ] && DESTDIR_ONLY_INSTALL=1
_ORIGINPKG="${_pkgname}" _ORIGINPKG="${_pkgname}"
if [ -z "$IN_CHROOT" -a -z "$base_chroot" ]; then if [ -z "$IN_CHROOT" -a -z "$base_chroot" ]; then
. $XBPS_SHUTILSDIR/chroot.sh . $XBPS_SHUTILSDIR/chroot.sh
@ -431,7 +473,7 @@ unstow)
stow_pkg_handler unstow stow_pkg_handler unstow
;; ;;
*) *)
echo "=> ERROR: invalid target: $target." msg_red "xbps-src: invalid target $target.\n"
usage && exit 1 usage && exit 1
esac esac