autodist: sync with current production changes:
- fix support for multiple words arg passed to autospec (--changelog) - yet some logs path and cleaning fixes - temporary workaround: hardcoded skipping of java-*, apache-*, jakarta-*, compiz* packages (TODO: make this configurable)
This commit is contained in:
parent
24afa0b07b
commit
6d278e3a20
102
autodist
102
autodist
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Autodist -- batch build tool for RPM based distributions
|
# Autodist -- batch build tool for RPM based distributions
|
||||||
# Copyright (C) 2006-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
# Copyright (C) 2006-2013 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
#
|
#
|
||||||
# Released under the terms of the GNU GPL release 3 license
|
# Released under the terms of the GNU GPL release 3 license
|
||||||
#
|
#
|
||||||
@ -180,7 +180,12 @@ for ((i=1; i<=$#; i++)); do
|
|||||||
JOBNAME[${#JOBNAME[@]}]="${!i/\#*}"
|
JOBNAME[${#JOBNAME[@]}]="${!i/\#*}"
|
||||||
[ "${!i/*\#}" != "${!i}" ] && JOBVER[${#JOBNAME[@]}]="+${!i/*\#}"
|
[ "${!i/*\#}" != "${!i}" ] && JOBVER[${#JOBNAME[@]}]="+${!i/*\#}"
|
||||||
else
|
else
|
||||||
AUTOSPEC_ARGS="$AUTOSPEC_ARGS ${!i}"
|
if [ "${!i/ }" != "${!i}" ]; then
|
||||||
|
# pass multiple word arguments inside quotation marks
|
||||||
|
AUTOSPEC_ARGS="$AUTOSPEC_ARGS \"${!i}\""
|
||||||
|
else
|
||||||
|
AUTOSPEC_ARGS="$AUTOSPEC_ARGS ${!i}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -520,12 +525,30 @@ function launch_pkgs_loop() {
|
|||||||
# launch loop for each package
|
# launch loop for each package
|
||||||
for pkg in ${JOB_PKGS[*]}; do
|
for pkg in ${JOB_PKGS[*]}; do
|
||||||
|
|
||||||
|
unset LOGFILE_SUFFIX
|
||||||
|
for a in ${JOB_VALUES[*]}; do
|
||||||
|
tr_job=`echo $a | tr / _`
|
||||||
|
LOGFILE_SUFFIX=${LOGFILE_SUFFIX}__$tr_job
|
||||||
|
done
|
||||||
|
LOGFILE_SUFFIX=$LOGFILE_SUFFIX.$TARGETARCH
|
||||||
|
[ "$JOB_NAME" = "${pkg}" ] &&
|
||||||
|
LOGFILE_PKG_NAME=${pkg}${LOGFILE_SUFFIX} ||
|
||||||
|
LOGFILE_PKG_NAME=${JOB_NAME}_${pkg}${LOGFILE_SUFFIX}
|
||||||
|
LOGFILE_PKG=${LOGDIR}/${LOGFILE_PKG_NAME}
|
||||||
|
|
||||||
|
# clean previous logs for this package
|
||||||
|
[ -e ${LOGDIR}/ok/${LOGFILE_PKG_NAME}${LOGFILE_SUFFIX} ] &&
|
||||||
|
rm -f ${LOGDIR}/ok/${LOGFILE_PKG_NAME}${LOGFILE_SUFFIX}
|
||||||
|
[ -e ${LOGDIR}/failed/${LOGFILE_PKG_NAME}${LOGFILE_SUFFIX} ] &&
|
||||||
|
rm -f ${LOGDIR}/failed/${LOGFILE_PKG_NAME}-${LOGFILE_SUFFIX}
|
||||||
|
|
||||||
case $operation in
|
case $operation in
|
||||||
autoupdate|update|build|buildinstall)
|
autoupdate|update|build|buildinstall)
|
||||||
[ -e $spec_dir/$pkg.spec ] || {
|
[ -e $spec_dir/$pkg.spec ] || {
|
||||||
case $SEVERITY in
|
case $SEVERITY in
|
||||||
0) ;;
|
0) ;;
|
||||||
1) echo "!! Error: spec filename must be the same as package name or invalid job name; skipping $pkg package."
|
1) echo "!! Error: spec filename must be the same as package name or invalid job name; skipping $pkg package."
|
||||||
|
[ "$do_autobuild" ] && autobuild_log $pkg $operation failed $JOB_NAME $LOGDIR/failed/${LOGFILE_PKG_NAME}
|
||||||
continue ;;
|
continue ;;
|
||||||
*) echo "!! Error: spec filename must be the same as package name or invalid job name; aborting."
|
*) echo "!! Error: spec filename must be the same as package name or invalid job name; aborting."
|
||||||
exit 1 ;;
|
exit 1 ;;
|
||||||
@ -542,6 +565,7 @@ function launch_pkgs_loop() {
|
|||||||
case $SEVERITY in
|
case $SEVERITY in
|
||||||
0) ;;
|
0) ;;
|
||||||
1) echo "%! Error: could not apply patch to specfile; skipping $pkg package."
|
1) echo "%! Error: could not apply patch to specfile; skipping $pkg package."
|
||||||
|
[ "$do_autobuild" ] && autobuild_log $pkg $operation failed $JOB_NAME $LOGDIR/failed/${LOGFILE_PKG_NAME}
|
||||||
ret=1
|
ret=1
|
||||||
continue ;;
|
continue ;;
|
||||||
*) echo "!! Error: could not apply patch to specfile; aborting."
|
*) echo "!! Error: could not apply patch to specfile; aborting."
|
||||||
@ -561,22 +585,6 @@ function launch_pkgs_loop() {
|
|||||||
SPEC_RELEASE=`grep "Release:" $spec_dir/$pkg.spec | sed "s|Release:[[:space:]]*||"`
|
SPEC_RELEASE=`grep "Release:" $spec_dir/$pkg.spec | sed "s|Release:[[:space:]]*||"`
|
||||||
}
|
}
|
||||||
|
|
||||||
unset LOGFILE_SUFFIX
|
|
||||||
for a in ${JOB_VALUES[*]}; do
|
|
||||||
tr_job=`echo $a | tr / _`
|
|
||||||
LOGFILE_SUFFIX=${LOGFILE_SUFFIX}__$tr_job
|
|
||||||
done
|
|
||||||
LOGFILE_SUFFIX=$LOGFILE_SUFFIX.$TARGETARCH
|
|
||||||
[ "$JOB_NAME" = "${pkg}" ] &&
|
|
||||||
LOGFILE_PKG_NAME=${pkg}${LOGFILE_SUFFIX} ||
|
|
||||||
LOGFILE_PKG_NAME=${JOB_NAME}_${pkg}${LOGFILE_SUFFIX}
|
|
||||||
LOGFILE_PKG=${LOGDIR}/${LOGFILE_PKG_NAME}
|
|
||||||
|
|
||||||
# clean previous logs for this package
|
|
||||||
[ -e ${LOGDIR}/ok/${LOGFILE_PKG_NAME}${LOGFILE_SUFFIX} ] &&
|
|
||||||
rm -f ${LOGDIR}/ok/${LOGFILE_PKG_NAME}${LOGFILE_SUFFIX}
|
|
||||||
[ -e ${LOGDIR}/failed/${LOGFILE_PKG_NAME}${LOGFILE_SUFFIX} ] &&
|
|
||||||
rm -f ${LOGDIR}/failed/${LOGFILE_PKG_NAME}-${LOGFILE_SUFFIX}
|
|
||||||
|
|
||||||
[ -e "$SRCPKGLIST" ] && PKGLINE=`grep "^${pkg} " $SRCPKGLIST` || PKGLINE=
|
[ -e "$SRCPKGLIST" ] && PKGLINE=`grep "^${pkg} " $SRCPKGLIST` || PKGLINE=
|
||||||
[ -e "$SRCPKGLIST_DELAYED" ] && PKGLINE_DELAYED=`grep "^${pkg} " $SRCPKGLIST_DELAYED` || PKGLINE_DELAYED=
|
[ -e "$SRCPKGLIST_DELAYED" ] && PKGLINE_DELAYED=`grep "^${pkg} " $SRCPKGLIST_DELAYED` || PKGLINE_DELAYED=
|
||||||
@ -951,10 +959,33 @@ if [ "$do_autobuild" = "1" ]; then
|
|||||||
# check blacklist
|
# check blacklist
|
||||||
awk '{ print $1 }' $BLACKLIST | grep "^$PKGNAME$" >/dev/null && {
|
awk '{ print $1 }' $BLACKLIST | grep "^$PKGNAME$" >/dev/null && {
|
||||||
BLACKLISTCOUNT=`expr $BLACKLISTCOUNT + 1`
|
BLACKLISTCOUNT=`expr $BLACKLISTCOUNT + 1`
|
||||||
#echo "?= Job $PKGNAME is in the blacklist; skipping"
|
# echo "?= Job $PKGNAME is in the blacklist; skipping"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# check skippedlist
|
||||||
|
SKIPPEDLINE=`awk '{ print $1" "$2 }' $SKIPPEDLISTDIR/*.skip | grep -m1 "^$PKGNAME "`
|
||||||
|
if [ "$SKIPPEDLINE" ]; then
|
||||||
|
set -- $SKIPPEDLINE
|
||||||
|
SKIPPEDTIME=$2
|
||||||
|
SKIPPEDDAYS=`expr \( $DATE_NOW - $SKIPPEDTIME \) / 86400`
|
||||||
|
if [ "$SKIPPEDDAYS" -le "$AUTOBUILD_SKIP_DAYS" ]; then
|
||||||
|
SKIPPEDCOUNT=`expr $SKIPPEDCOUNT + 1`
|
||||||
|
# echo "?= Package $PKGNAME has been in the skippedlist for $SKIPPEDDAYS days; skipping"
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
sed -i "/^$PKGNAME /d" $SKIPPEDLISTDIR/*.skip
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check legacylist
|
||||||
|
awk '{ print $1 }' $LEGACYLIST | grep "^$PKGNAME$" >/dev/null && {
|
||||||
|
echo "?= Job $PKGNAME is in the legacy list; skipping automatic update"
|
||||||
|
echo "$PKGNAME $DATE_NOW 100" >> $SKIPPEDLISTDIR/auto.skip
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
# manually or from lists scheduled jobs
|
||||||
if [ "${VERSION:0:1}" == "+" -a "$VERSION" != "+0" ]; then
|
if [ "${VERSION:0:1}" == "+" -a "$VERSION" != "+0" ]; then
|
||||||
TRVER=`echo ${VERSION:1} | tr - .`
|
TRVER=`echo ${VERSION:1} | tr - .`
|
||||||
get_job_vector $PKGNAME
|
get_job_vector $PKGNAME
|
||||||
@ -975,7 +1006,6 @@ if [ "$do_autobuild" = "1" ]; then
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
elif [ "$VERSION" != "+0" ]; then
|
elif [ "$VERSION" != "+0" ]; then
|
||||||
|
|
||||||
# check successlist
|
# check successlist
|
||||||
SUCCESSLINE=`awk '{ print $1" "$2 }' $SUCCESSLISTDIR/*.success | grep -m1 "^$PKGNAME "`
|
SUCCESSLINE=`awk '{ print $1" "$2 }' $SUCCESSLISTDIR/*.success | grep -m1 "^$PKGNAME "`
|
||||||
if [ "$SUCCESSLINE" ]; then
|
if [ "$SUCCESSLINE" ]; then
|
||||||
@ -991,33 +1021,15 @@ if [ "$do_autobuild" = "1" ]; then
|
|||||||
sed -i "/^$PKGNAME /d" $SUCCESSLISTDIR/*.success
|
sed -i "/^$PKGNAME /d" $SUCCESSLISTDIR/*.success
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check skippedlist
|
|
||||||
SKIPPEDLINE=`awk '{ print $1" "$2 }' $SKIPPEDLISTDIR/*.skip | grep -m1 "^$PKGNAME "`
|
|
||||||
if [ "$SKIPPEDLINE" ]; then
|
|
||||||
set -- $SKIPPEDLINE
|
|
||||||
SKIPPEDTIME=$2
|
|
||||||
SKIPPEDDAYS=`expr \( $DATE_NOW - $SKIPPEDTIME \) / 86400`
|
|
||||||
if [ "$SKIPPEDDAYS" -le "$AUTOBUILD_SKIP_DAYS" ]; then
|
|
||||||
SKIPPEDCOUNT=`expr $SKIPPEDCOUNT + 1`
|
|
||||||
# echo "?= Package $PKGNAME has been in the skippedlist for $SKIPPEDDAYS days; skipping"
|
|
||||||
continue
|
|
||||||
else
|
|
||||||
sed -i "/^$PKGNAME /d" $SKIPPEDLISTDIR/*.skip
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check legacylist
|
|
||||||
awk '{ print $1 }' $LEGACYLIST | grep "^$PKGNAME$" >/dev/null && {
|
|
||||||
echo "?= Job $PKGNAME is in the legacy list; skipping automatic update"
|
|
||||||
echo "$PKGNAME $DATE_NOW 100" >> $SKIPPEDLISTDIR/auto.skip
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $AUTOBUILD_NUMADDED -ge $AUTOBUILD_MAXNUM ]; then
|
[ $AUTOBUILD_NUMADDED -ge $AUTOBUILD_MAXNUM ] && break
|
||||||
break
|
|
||||||
elif [ $BUILDDATE -ge $AUTOBUILD_DATEFROM -o $BUILDDATE -eq 0 ]; then
|
# FIXME: hardcoded skipped packages
|
||||||
|
[ "${PKGNAME:0:5}" = "java-" -o "${PKGNAME:0:7}" = "apache-" -o \
|
||||||
|
"${PKGNAME:0:8}" = "jakarta-" -o "${PKGNAME:0:6}" = "compiz" ] && continue
|
||||||
|
|
||||||
|
if [ $BUILDDATE -ge $AUTOBUILD_DATEFROM -o $BUILDDATE -eq 0 ]; then
|
||||||
AUTOBUILD_NUMADDED=`expr $AUTOBUILD_NUMADDED + 1`
|
AUTOBUILD_NUMADDED=`expr $AUTOBUILD_NUMADDED + 1`
|
||||||
echo "$PKGNAME $VERSION" >> $pkgtmpfile
|
echo "$PKGNAME $VERSION" >> $pkgtmpfile
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user