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
1 changed files with 74 additions and 48 deletions
|
@ -66,34 +66,36 @@ usage()
|
||||||
$progname: [-Ch] [-c <file>] [-m <dir>] [-p <dir>] [-s <dir>] <target>
|
$progname: [-Ch] [-c <file>] [-m <dir>] [-p <dir>] [-s <dir>] <target>
|
||||||
|
|
||||||
Targets:
|
Targets:
|
||||||
bootstrap Build and install the bootstrap packages into <masterdir>.
|
bootstrap Build and install the bootstrap packages into <masterdir>.
|
||||||
build Build a package (fetch + extract + configure + build).
|
build [pkgname] Build a package (fetch + extract + configure + build).
|
||||||
build-pkg [all] Build a binary package from <pkg>.
|
build-pkg [pkgname|all]
|
||||||
Package must be installed into destdir. If the <all>
|
Build a binary package from <pkg>.
|
||||||
keyword is used all packages currently installed in
|
Package must be installed into destdir. If the <all>
|
||||||
<masterdir>/<destdir> will be used.
|
keyword is used all packages currently installed in
|
||||||
checkvers Checks installed package versions against srcpkgs
|
<masterdir>/<destdir> will be used. Otherwise <pkgname>
|
||||||
for new available versions.
|
if specified, or the one in cwd.
|
||||||
chroot Enter to the chroot in <masterdir>.
|
checkvers Checks installed package versions against srcpkgs
|
||||||
clean Remove <pkg> build directory.
|
for new available versions.
|
||||||
configure Configure a package (fetch + extract + configure).
|
chroot Enter to the chroot in <masterdir>.
|
||||||
extract Extract distribution file(s) into build directory.
|
clean [pkgname] Remove <pkg> build directory.
|
||||||
Build directory is always available in
|
configure [pkgname] Configure a package (fetch + extract + configure).
|
||||||
<masterdir>/pkg-builddir/<pkg>.
|
extract [pkgname] Extract distribution file(s) into build directory.
|
||||||
fetch Download distribution file(s).
|
Build directory is always available in
|
||||||
info Show information for current pkg build template.
|
<masterdir>/pkg-builddir/<pkg>.
|
||||||
install-destdir build + install into destdir.
|
fetch [pkgname] Download distribution file(s).
|
||||||
install install-destdir + stow.
|
info [pkgname] Show information for current pkg build template.
|
||||||
list List installed packages in <masterdir>.
|
install-destdir [pkgname] build + install into destdir.
|
||||||
listfiles List installed files from <pkg>.
|
install [pkgname] install-destdir + stow.
|
||||||
make-repoidx Build a package index for the local repository associated
|
list List installed packages in <masterdir>.
|
||||||
with the master directory <masterdir> or <pkgdir>,
|
listfiles <pkgname> List installed files from <pkg>.
|
||||||
or updates it.
|
make-repoidx Build a package index for the local repository associated
|
||||||
remove Remove package completely (destdir + masterdir).
|
with the master directory <masterdir> or <pkgdir>,
|
||||||
stow Stow <pkg> files from <destdir> into <masterdir> and
|
or updates it.
|
||||||
register package in database.
|
remove [pkgname] Remove package completely (destdir + masterdir).
|
||||||
unstow Remove <pkg> files from <masterdir> and unregister
|
stow [pkgname] Stow <pkg> files from <destdir> into <masterdir> and
|
||||||
package from database.
|
register package in database.
|
||||||
|
unstow [pkgname] Remove <pkg> files from <masterdir> and unregister
|
||||||
|
package from database.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-C Do not remove build directory after successful installation.
|
-C Do not remove build directory after successful installation.
|
||||||
|
@ -205,6 +207,7 @@ shift $(($OPTIND - 1))
|
||||||
[ $# -eq 0 -o $# -gt 2 ] && usage && exit 1
|
[ $# -eq 0 -o $# -gt 2 ] && usage && exit 1
|
||||||
|
|
||||||
target="$1"
|
target="$1"
|
||||||
|
_pkgname="$2"
|
||||||
if [ -z "$target" ]; then
|
if [ -z "$target" ]; then
|
||||||
echo "=> ERROR: missing target."
|
echo "=> ERROR: missing target."
|
||||||
usage && exit 1
|
usage && exit 1
|
||||||
|
@ -280,14 +283,17 @@ bootstrap)
|
||||||
;;
|
;;
|
||||||
build|configure)
|
build|configure)
|
||||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
if [ -z "${_pkgname}" ]; then
|
||||||
. ./template
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||||
|
. ./template
|
||||||
|
_pkgname=$(basename_cwd)
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
|
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
|
||||||
. $XBPS_SHUTILSDIR/chroot.sh
|
. $XBPS_SHUTILSDIR/chroot.sh
|
||||||
xbps_chroot_handler $target $(basename_cwd)
|
xbps_chroot_handler $target ${_pkgname}
|
||||||
else
|
else
|
||||||
_ORIGINPKG="$(basename_cwd)"
|
_ORIGINPKG="${_pkgname}"
|
||||||
setup_tmpl ${_ORIGINPKG}
|
setup_tmpl ${_ORIGINPKG}
|
||||||
# If pkg has dependencies, install them first.
|
# If pkg has dependencies, install them first.
|
||||||
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
|
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
|
||||||
|
@ -333,8 +339,11 @@ build-pkg)
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
if [ -z "${_pkgname}" ]; then
|
||||||
setup_tmpl $(basename_cwd)
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||||
|
_pkgname=$(basename_cwd)
|
||||||
|
fi
|
||||||
|
setup_tmpl ${_pkgname}
|
||||||
xbps_make_binpkg
|
xbps_make_binpkg
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
@ -349,14 +358,20 @@ chroot)
|
||||||
;;
|
;;
|
||||||
clean)
|
clean)
|
||||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
if [ -z "${_pkgname}" ]; then
|
||||||
setup_tmpl $(basename_cwd)
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||||
|
_pkgname=$(basename_cwd)
|
||||||
|
fi
|
||||||
|
setup_tmpl ${_pkgname}
|
||||||
remove_tmpl_wrksrc $wrksrc
|
remove_tmpl_wrksrc $wrksrc
|
||||||
;;
|
;;
|
||||||
extract|fetch|info)
|
extract|fetch|info)
|
||||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
if [ -z "${_pkgname}" ]; then
|
||||||
setup_tmpl $(basename_cwd)
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||||
|
_pkgname=$(basename_cwd)
|
||||||
|
fi
|
||||||
|
setup_tmpl ${_pkgname}
|
||||||
if [ "$target" = "info" ]; then
|
if [ "$target" = "info" ]; then
|
||||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||||
info_tmpl
|
info_tmpl
|
||||||
|
@ -372,13 +387,15 @@ extract|fetch|info)
|
||||||
;;
|
;;
|
||||||
install|install-destdir)
|
install|install-destdir)
|
||||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
if [ -z "${_pkgname}" ]; then
|
||||||
. ./template
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||||
|
_pkgname=$(basename_cwd)
|
||||||
|
fi
|
||||||
|
setup_tmpl ${_pkgname}
|
||||||
install_destdir_target=no
|
install_destdir_target=no
|
||||||
[ "$target" = "install-destdir" ] && install_destdir_target=yes
|
[ "$target" = "install-destdir" ] && install_destdir_target=yes
|
||||||
|
|
||||||
_ORIGINPKG="$(basename_cwd)"
|
_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
|
||||||
xbps_chroot_handler $target ${_ORIGINPKG} $dontrm_builddir
|
xbps_chroot_handler $target ${_ORIGINPKG} $dontrm_builddir
|
||||||
|
@ -407,22 +424,31 @@ make-repoidx)
|
||||||
;;
|
;;
|
||||||
remove)
|
remove)
|
||||||
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
|
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
|
||||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
if [ -z "${_pkgname}" ]; then
|
||||||
setup_tmpl $(basename_cwd)
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||||
|
_pkgname=$(basename_cwd)
|
||||||
|
fi
|
||||||
|
setup_tmpl ${_pkgname}
|
||||||
remove_pkg
|
remove_pkg
|
||||||
;;
|
;;
|
||||||
stow)
|
stow)
|
||||||
stow_flag=yes
|
stow_flag=yes
|
||||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
if [ -z "${_pkgname}" ]; then
|
||||||
setup_tmpl $(basename_cwd)
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||||
|
_pkgname=$(basename_cwd)
|
||||||
|
fi
|
||||||
|
setup_tmpl ${_pkgname}
|
||||||
. $XBPS_SHUTILSDIR/stow_funcs.sh
|
. $XBPS_SHUTILSDIR/stow_funcs.sh
|
||||||
stow_pkg_handler stow
|
stow_pkg_handler stow
|
||||||
;;
|
;;
|
||||||
unstow)
|
unstow)
|
||||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
if [ -z "${_pkgname}" ]; then
|
||||||
setup_tmpl $(basename_cwd)
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||||
|
_pkgname=$(basename_cwd)
|
||||||
|
fi
|
||||||
|
setup_tmpl ${_pkgname}
|
||||||
. $XBPS_SHUTILSDIR/stow_funcs.sh
|
. $XBPS_SHUTILSDIR/stow_funcs.sh
|
||||||
stow_pkg_handler unstow
|
stow_pkg_handler unstow
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue