xbps-src: make some targets work by specifying its pkgname.
There are now two ways to use the following targets: build, build-pkg, clean, configure, extract, fetch, info, install, install-destdir, remove, stow, unstow. 1) The known way: 'cd srcpkgs/foo && xbps-src <target>" 2) The new way: 'xbps-src <target> foo'.
This commit is contained in:
parent
b5e94efcfb
commit
2d32c8fd9e
|
@ -66,34 +66,36 @@ usage()
|
|||
$progname: [-Ch] [-c <file>] [-m <dir>] [-p <dir>] [-s <dir>] <target>
|
||||
|
||||
Targets:
|
||||
bootstrap Build and install the bootstrap packages into <masterdir>.
|
||||
build Build a package (fetch + extract + configure + build).
|
||||
build-pkg [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.
|
||||
checkvers Checks installed package versions against srcpkgs
|
||||
for new available versions.
|
||||
chroot Enter to the chroot in <masterdir>.
|
||||
clean Remove <pkg> build directory.
|
||||
configure Configure a package (fetch + extract + configure).
|
||||
extract Extract distribution file(s) into build directory.
|
||||
Build directory is always available in
|
||||
<masterdir>/pkg-builddir/<pkg>.
|
||||
fetch Download distribution file(s).
|
||||
info Show information for current pkg build template.
|
||||
install-destdir build + install into destdir.
|
||||
install install-destdir + stow.
|
||||
list List installed packages in <masterdir>.
|
||||
listfiles 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 Remove package completely (destdir + masterdir).
|
||||
stow Stow <pkg> files from <destdir> into <masterdir> and
|
||||
register package in database.
|
||||
unstow Remove <pkg> files from <masterdir> and unregister
|
||||
package from database.
|
||||
bootstrap Build and install the bootstrap packages into <masterdir>.
|
||||
build [pkgname] Build a package (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>.
|
||||
listfiles <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.
|
||||
|
||||
Options:
|
||||
-C Do not remove build directory after successful installation.
|
||||
|
@ -205,6 +207,7 @@ shift $(($OPTIND - 1))
|
|||
[ $# -eq 0 -o $# -gt 2 ] && usage && exit 1
|
||||
|
||||
target="$1"
|
||||
_pkgname="$2"
|
||||
if [ -z "$target" ]; then
|
||||
echo "=> ERROR: missing target."
|
||||
usage && exit 1
|
||||
|
@ -280,14 +283,17 @@ bootstrap)
|
|||
;;
|
||||
build|configure)
|
||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
. ./template
|
||||
if [ -z "${_pkgname}" ]; then
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
. ./template
|
||||
_pkgname=$(basename_cwd)
|
||||
fi
|
||||
|
||||
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
|
||||
. $XBPS_SHUTILSDIR/chroot.sh
|
||||
xbps_chroot_handler $target $(basename_cwd)
|
||||
xbps_chroot_handler $target ${_pkgname}
|
||||
else
|
||||
_ORIGINPKG="$(basename_cwd)"
|
||||
_ORIGINPKG="${_pkgname}"
|
||||
setup_tmpl ${_ORIGINPKG}
|
||||
# If pkg has dependencies, install them first.
|
||||
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
|
||||
|
@ -333,8 +339,11 @@ build-pkg)
|
|||
fi
|
||||
done
|
||||
else
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
setup_tmpl $(basename_cwd)
|
||||
if [ -z "${_pkgname}" ]; then
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
_pkgname=$(basename_cwd)
|
||||
fi
|
||||
setup_tmpl ${_pkgname}
|
||||
xbps_make_binpkg
|
||||
fi
|
||||
;;
|
||||
|
@ -349,14 +358,20 @@ chroot)
|
|||
;;
|
||||
clean)
|
||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
setup_tmpl $(basename_cwd)
|
||||
if [ -z "${_pkgname}" ]; then
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
_pkgname=$(basename_cwd)
|
||||
fi
|
||||
setup_tmpl ${_pkgname}
|
||||
remove_tmpl_wrksrc $wrksrc
|
||||
;;
|
||||
extract|fetch|info)
|
||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
setup_tmpl $(basename_cwd)
|
||||
if [ -z "${_pkgname}" ]; then
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
_pkgname=$(basename_cwd)
|
||||
fi
|
||||
setup_tmpl ${_pkgname}
|
||||
if [ "$target" = "info" ]; then
|
||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||
info_tmpl
|
||||
|
@ -372,13 +387,15 @@ extract|fetch|info)
|
|||
;;
|
||||
install|install-destdir)
|
||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
. ./template
|
||||
|
||||
if [ -z "${_pkgname}" ]; then
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
_pkgname=$(basename_cwd)
|
||||
fi
|
||||
setup_tmpl ${_pkgname}
|
||||
install_destdir_target=no
|
||||
[ "$target" = "install-destdir" ] && install_destdir_target=yes
|
||||
|
||||
_ORIGINPKG="$(basename_cwd)"
|
||||
_ORIGINPKG="${_pkgname}"
|
||||
if [ -z "$in_chroot" -a -z "$base_chroot" ]; then
|
||||
. $XBPS_SHUTILSDIR/chroot.sh
|
||||
xbps_chroot_handler $target ${_ORIGINPKG} $dontrm_builddir
|
||||
|
@ -407,22 +424,31 @@ make-repoidx)
|
|||
;;
|
||||
remove)
|
||||
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
setup_tmpl $(basename_cwd)
|
||||
if [ -z "${_pkgname}" ]; then
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
_pkgname=$(basename_cwd)
|
||||
fi
|
||||
setup_tmpl ${_pkgname}
|
||||
remove_pkg
|
||||
;;
|
||||
stow)
|
||||
stow_flag=yes
|
||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
setup_tmpl $(basename_cwd)
|
||||
if [ -z "${_pkgname}" ]; then
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
_pkgname=$(basename_cwd)
|
||||
fi
|
||||
setup_tmpl ${_pkgname}
|
||||
. $XBPS_SHUTILSDIR/stow_funcs.sh
|
||||
stow_pkg_handler stow
|
||||
;;
|
||||
unstow)
|
||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
setup_tmpl $(basename_cwd)
|
||||
if [ -z "${_pkgname}" ]; then
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
_pkgname=$(basename_cwd)
|
||||
fi
|
||||
setup_tmpl ${_pkgname}
|
||||
. $XBPS_SHUTILSDIR/stow_funcs.sh
|
||||
stow_pkg_handler unstow
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue