diff --git a/common/xbps-src/shutils/bulk.sh b/common/xbps-src/shutils/bulk.sh index 0e0e5b88308..75d92340600 100644 --- a/common/xbps-src/shutils/bulk.sh +++ b/common/xbps-src/shutils/bulk.sh @@ -10,17 +10,10 @@ bulk_getlink() { echo $p } -bulk_build() { +bulk_sortdeps() { local _pkgs _pkg pkgs pkg found f x tmpf - if [ "$XBPS_CROSS_BUILD" ]; then - source ${XBPS_COMMONDIR}/cross-profiles/${XBPS_CROSS_BUILD}.sh - export XBPS_ARCH=${XBPS_TARGET_ARCH} - fi - if ! command -v xbps-checkvers &>/dev/null; then - msg_error "xbps-src: cannot find xbps-checkvers(8) command!\n" - fi - _pkgs=$(xbps-checkvers ${1} --distdir=$XBPS_DISTDIR | awk '{print $2}') + _pkgs="$@" # Iterate over the list and make sure that only real pkgs are # added to our pkglist. for pkg in ${_pkgs}; do @@ -60,6 +53,19 @@ bulk_build() { rm -f $tmpf } +bulk_build() { + + if [ "$XBPS_CROSS_BUILD" ]; then + source ${XBPS_COMMONDIR}/cross-profiles/${XBPS_CROSS_BUILD}.sh + export XBPS_ARCH=${XBPS_TARGET_ARCH} + fi + if ! command -v xbps-checkvers &>/dev/null; then + msg_error "xbps-src: cannot find xbps-checkvers(8) command!\n" + fi + + bulk_sortdeps "$(xbps-checkvers ${1} --distdir=$XBPS_DISTDIR | awk '{print $2}')" +} + bulk_update() { local args="$1" pkgs f diff --git a/xbps-src b/xbps-src index 5f8baddd6ab..04a8ae35933 100755 --- a/xbps-src +++ b/xbps-src @@ -103,6 +103,10 @@ show-repo-updates show-sys-updates Prints the list of oudated packages in your system. +sort-dependencies ... + Given a list of packages specified as additional arguments, a sorted dependency + list will be returned to stdout. + update-bulk Rebuilds all packages in the system repositories that are outdated. @@ -381,7 +385,7 @@ while getopts "a:CEfgGhH:Ij:Lm:No:r:tV" opt; do done shift $(($OPTIND - 1)) -[ $# -eq 0 -o $# -gt 3 ] && usage && exit 1 +[ $# -eq 0 ] && usage && exit 1 umask 022 @@ -691,6 +695,9 @@ case "$XBPS_TARGET" in show-sys-updates) bulk_build -i ;; + sort-dependencies) + bulk_sortdeps ${@/$XBPS_TARGET/} + ;; update-bulk) bulk_update ;;