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()
{
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:
bootstrap Build and install the bootstrap packages into <masterdir>.
build [pkgname] Build a package (fetch + extract + configure + build).
bootstrap
Build and install from source the bootstrap packages
into <masterdir>.
build [pkgname]
Build package source (fetch + extract + configure + build).
build-pkg [pkgname|all]
Build a binary package from <pkg>.
Package must be installed into destdir. If the <all>
keyword is used all packages currently installed in
<masterdir>/<destdir> will be used. Otherwise <pkgname>
if specified, or the one in cwd.
checkvers Checks installed package versions against srcpkgs
for new available versions.
chroot Enter to the chroot in <masterdir>.
clean [pkgname] Remove <pkg> 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
<masterdir>/pkg-builddir/<pkg>.
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 <masterdir>.
list-files <pkgname> List installed files from <pkg>.
make-repoidx Build a package index for the local repository associated
with the master directory <masterdir> or <pkgdir>,
or updates it.
remove [pkgname] Remove package completely (destdir + masterdir).
stow [pkgname] Stow <pkg> files from <destdir> into <masterdir> and
register package in database.
unstow [pkgname] Remove <pkg> files from <masterdir> and unregister
package from database.
Build a binary package from <pkgname> or all packages if <all>
is specified. Package must be installed into destination directory.
checkvers
Checks installed package versions in <masterdir>
against srcpkgs for new available versions.
chroot
Enter to the chroot in <masterdir>.
clean [pkgname]
Remove <pkgname> 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 <masterdir>/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 <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:
-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 <pkgname> to package's destination directory set
to <masterdir>/pkg-destdir/<pkgname>-<version>.
-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
<masterdir>/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