autodist: fix manual version update and autoupdate script management

This commit is contained in:
Silvan Calarco 2014-06-13 14:35:54 +02:00
parent f72d0b3663
commit a89e2b9a13

View File

@ -12,7 +12,7 @@ exec 3>`readlink /proc/self/fd/0`
function usage() {
echo "\
${me[0]} ${me[1]}
"$"Copyright (C) 2006-2012 Silvan Calarco <silvan.calarco@mambasoft.it>""
"$"Copyright (C) 2006-2014 Silvan Calarco <silvan.calarco@mambasoft.it>""
"$"Released under the terms of the GNU GPL v3 license"
echo "
"$"Batch build tool for bulding a whole distribution and much more.""
@ -198,8 +198,9 @@ for ((i=1; i<=$#; i++)); do
fi
;;
*) if [ "$AUTOSPEC_ARGS_MODE" != "1" ]; then
JOBNAME[${#JOBNAME[@]}]="${!i/\#*}"
[ "${!i/*\#}" != "${!i}" ] && JOBVER[${#JOBNAME[@]}]="+${!i/*\#}"
JOBIDX=${#JOBNAME[@]}
JOBNAME[$JOBIDX]="${!i/\#*}"
[ "${!i/*\#}" != "${!i}" ] && JOBVER[$JOBIDX]="+${!i/*\#}"
else
if [ "${!i/ }" != "${!i}" ]; then
# pass multiple word arguments inside quotation marks
@ -494,7 +495,7 @@ function launch_pkgs_loop() {
# launch loop for each package
for pkg in ${JOB_PKGS[*]}; do
unset LOGFILE_SUFFIX
unset LOGFILE_SUFFIX AUTOUPDATE_SCRIPT_ALREADY_RUN
for a in ${JOB_VALUES[*]}; do
tr_job=`echo $a | tr / _`
LOGFILE_SUFFIX=${LOGFILE_SUFFIX}__$tr_job
@ -604,7 +605,7 @@ function launch_pkgs_loop() {
if [ "$PKGLINE" ]; then
set -- $PKGLINE
pkglinever=$2
# warning: asasuming version is passed first
# warning: assuming version is passed first
version_find_bigger "${passed_arguments/ *}" "$pkglinever"
[ $? -eq 1 ] || {
echo "!! Warning: skipping ${pkg} package already up to date ($pkglinever >= ${passed_arguments/ *})."
@ -614,6 +615,11 @@ function launch_pkgs_loop() {
continue
}
fi
if [ -e $source_dir/$pkg-autoupdate ]; then
echo "?= Running $pkg-autoupdate script with version ${passed_arguments/ *}"
(cd $source_dir; sh ./$pkg-autoupdate ${passed_arguments/ *} >/dev/null)
AUTOUPDATE_SCRIPT_ALREADY_RUN=1
fi
command_opts="-a3:4" ;;
build)
# skip package in job if it is in the delayed repository
@ -785,9 +791,10 @@ function launch_pkgs_loop() {
}
fi
fi
if [ "$2" != "$SPEC_VERSION" -a -e $source_dir/$pkg-autoupdate ]; then
echo "?= Running autoupdate script with version $SPEC_VERSION"
sh $source_dir/$pkg-autoupdate $SPEC_VERSION
if [ "$2" != "$SPEC_VERSION" -a -e $source_dir/$pkg-autoupdate -a ! "$AUTOUPDATE_SCRIPT_ALREADY_RUN" ]; then
echo "?= Running $pkg-autoupdate script with version ${passed_arguments/ *}"
(cd $source_dir; sh ./$pkg-autoupdate ${passed_arguments/ *} >/dev/null)
AUTOUPDATE_SCRIPT_ALREADY_RUN=1
fi
fi
;;