xbps-src: new targets: update-bulk and update-sys.

* update-bulk:
	This rebuilds all pkgs in system repositories that are outdated.
	with this xbps-bulk is now considered fully obsolete.

* update-sys:
	This rebuilds all pkgs in system that are oudated and once built,
	updates them via xbps-install(8).

	This target defines a new configuration option "XBPS_SUCMD" that
	is the command to execute to update the system. By default set to
	"sudo sh -c".

CAVEATS
	- need to check if binpkg is in local repo.
	- need to add support to specify alternative rootdir.
	- need to add support to specify system repos.
This commit is contained in:
Juan RP 2014-04-09 16:42:07 +02:00
parent 1af40eb476
commit d4e4d826e6
3 changed files with 97 additions and 48 deletions

View file

@ -79,11 +79,17 @@ Targets: (only one may be specified)
Prints the value of <var> if it's defined in xbps-src.
show-repo-updates
Prints the list of outdated packages in repositories.
Prints the list of outdated packages in XBPS repositories.
show-sys-updates
Prints the list of oudated packages in your system.
update-bulk
Rebuilds all packages in the system repositories that are outdated.
update-sys
Rebuilds all packages in your system that are outdated and updates them.
zap
Removes a masterdir but preserving ccache, distcc and host directories.
@ -479,53 +485,6 @@ check_build_requirements
trap 'exit_func' INT TERM HUP
bulk_getlink() {
local p="$(basename $1)"
local target="$(readlink $XBPS_SRCPKGDIR/$p)"
if [ $? -eq 0 -a -n "$target" ]; then
p=$target
fi
echo $p
}
bulk_build() {
local args="$1" pkg= pkgs= _pkgs= _realdep= _deps= found= x= result=
if ! command -v xbps-checkvers &>/dev/null; then
msg_error "xbps-src: cannot find xbps-{repo,}checkvers command!\n"
fi
_pkgs=$(xbps-checkvers ${args} -d $XBPS_DISTDIR | awk '{print $2}')
# Only add to the list real pkgs, not subpkgs.
for pkg in ${_pkgs}; do
_realdep=$(bulk_getlink $pkg)
unset found
for x in ${pkgs}; do
if [ "$x" = "${_realdep}" ]; then
found=1
break
fi
done
if [ -z "$found" ]; then
pkgs="$pkgs ${_realdep}"
fi
done
for pkg in ${pkgs}; do
unset found
setup_pkg $pkg $XBPS_CROSS_BUILD
_deps="$(show_pkg_build_deps | sed -e 's|[<>].*\$||g')"
_realdep=$(bulk_getlink $pkg)
for x in ${_deps}; do
if [ "${_realdep}" = "${pkg}" ]; then
found=1
break
fi
done
[ -n $found ] && result="${_realdep} ${result}"
done
echo "$result"
}
#
# Main switch.
#
@ -625,6 +584,12 @@ show-repo-updates)
show-sys-updates)
bulk_build -i
;;
update-bulk)
bulk_update
;;
update-sys)
bulk_update -i
;;
zap)
masterdir_zap
;;