xbps-src: added -B flag for the install target.

This commit is contained in:
Juan RP 2011-07-17 20:12:31 +02:00
parent d9f155607c
commit d734239f2e

View file

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