autoport: more checks on releases, repository fetch code reworked and more
This commit is contained in:
parent
4cf07b63e5
commit
10b3f8eff0
65
autoport
65
autoport
@ -37,6 +37,7 @@ ${me[0]} ${me[1]}
|
||||
-u changelog "$"Rebuild packages with given changelog
|
||||
-v "$"More verbose output
|
||||
-x "$"Operate in cross build mode
|
||||
--user user "$"Pass calling user name for Webbuild social messages""
|
||||
|
||||
arch "$"Target architecture
|
||||
job "$"Job specification for autodist""
|
||||
@ -86,7 +87,7 @@ function get_pkg_srcinfo() {
|
||||
[ $2 ] && pkg=$2 || return 1
|
||||
|
||||
[ -e $local_distromatic/srcpkglist ] || return 2
|
||||
|
||||
|
||||
pkg_line=`grep "^$pkg " $local_distromatic/srcpkglist`
|
||||
[ "$pkg_line" ] || return 3
|
||||
|
||||
@ -99,7 +100,6 @@ function get_pkg_srcinfo() {
|
||||
src_epoch=$5
|
||||
src_release=$6
|
||||
src_milestone=`echo $src_release | sed "s|[0-9.]*\(.*\)|\1|"`
|
||||
|
||||
}
|
||||
|
||||
# get_pkg_buildinfo - uses distromatic generated build file for
|
||||
@ -198,7 +198,14 @@ function find_requirements() {
|
||||
local OUTFILE=$1
|
||||
|
||||
if [ "`grep " is needed by " $OUTFILE`" ]; then
|
||||
grep " is needed by " $OUTFILE | awk '{ print $1 }' | sort -u > $tf1
|
||||
grep " is needed by " $OUTFILE | while read line; do
|
||||
set -- $line
|
||||
if [ "$2" = "=" -o "$2" = ">=" ]; then
|
||||
awk '{ print $1#$3 }' | sort -u > $tf1
|
||||
else
|
||||
awk '{ print $1 }' | sort -u > $tf1
|
||||
fi
|
||||
done
|
||||
elif [ "`grep " matches no packages" $OUTFILE`" ]; then
|
||||
grep " matches no packages" $OUTFILE | awk '{ print $2 }' | tr -d \' | sort -u > $tf1
|
||||
elif [ "`grep " no package provides " $OUTFILE`" ]; then
|
||||
@ -230,6 +237,15 @@ function find_requirements() {
|
||||
return 0
|
||||
}
|
||||
|
||||
fetch_repfiles() {
|
||||
curl -s ${REPS_BASE_URL}/$PORT_REPOSITORY/srcpkglist -o $DATADIR/$PORT_REPOSITORY/srcpkglist ||
|
||||
echo "Warning: unable to fetch ${REPS_BASE_URL}/$PORT_REPOSITORY/srcpkglist"
|
||||
curl -s $PORT_REPOSITORY_DISTROMATIC_URL/sources-$BASE_ARCH -o $DATADIR/$PORT_REPOSITORY/sources-$BASE_ARCH ||
|
||||
echo "Warning: unable to fetch $PORT_REPOSITORY_DISTROMATIC_URL/sources-$BASE_ARCH"
|
||||
curl -s $PORT_REPOSITORY_DISTROMATIC_URL/builds-$TARGET_ARCH.sh -o $DATADIR/$PORT_REPOSITORY/builds-$TARGET_ARCH.sh ||
|
||||
echo "Error: unable to fetch $PORT_REPOSITORY_DISTROMATIC_URL/builds-$TARGET_ARCH.sh"
|
||||
}
|
||||
|
||||
[ $# -gt 0 ] || { usage ; exit 1; }
|
||||
|
||||
BUILD_ARCH=`uname -i`
|
||||
@ -272,6 +288,13 @@ for ((i=1; i<=$#; i++)); do
|
||||
TARGET_ARCHS="`echo ${!i} | tr , ' '`"
|
||||
CROSS_MODE=1
|
||||
;;
|
||||
--user) let i+=1
|
||||
[ "${!i}" ] || {
|
||||
echo "Error: --user parameter not given, aborting."
|
||||
exit 1
|
||||
}
|
||||
WEBBUILD_USER_CMDLINE="${!i}"
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
@ -334,17 +357,13 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
|
||||
echo "Port repository is $PORT_REPOSITORY"
|
||||
echo "Release repository is $DEST_REPOSITORY"
|
||||
|
||||
curl -s ${REPS_BASE_URL}/$PORT_REPOSITORY/srcpkglist -o $DATADIR/$PORT_REPOSITORY/srcpkglist ||
|
||||
echo "Warning: unable to fetch ${REPS_BASE_URL}/$PORT_REPOSITORY/srcpkglist"
|
||||
curl -s $PORT_REPOSITORY_DISTROMATIC_URL/sources-$BASE_ARCH -o $DATADIR/$PORT_REPOSITORY/sources-$BASE_ARCH ||
|
||||
echo "Warning: unable to fetch $PORT_REPOSITORY_DISTROMATIC_URL/sources-$BASE_ARCH"
|
||||
|
||||
# old files cleanup
|
||||
rm -f $DATADIR/$PORT_REPOSITORY/sources-$TARGET_CPU
|
||||
rm -f $DATADIR/$PORT_REPOSITORY/builds-$BASE_ARCH.sh
|
||||
|
||||
curl -s $PORT_REPOSITORY_DISTROMATIC_URL/builds-$TARGET_ARCH.sh -o $DATADIR/$PORT_REPOSITORY/builds-$TARGET_ARCH.sh ||
|
||||
echo "Error: unable to fetch $PORT_REPOSITORY_DISTROMATIC_URL/builds-$TARGET_ARCH.sh"
|
||||
|
||||
fetch_repfiles
|
||||
|
||||
if [ "$BATCH_MODE" ]; then
|
||||
[ "${JOB[*]}" ] && {
|
||||
@ -403,6 +422,7 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
|
||||
|
||||
while [ "${JOB[*]}" ]; do
|
||||
step=`expr $step + 1`
|
||||
[ $step -gt 1 ] && fetch_repfiles
|
||||
[ "$BATCH_MODE" -a $step -gt $AUTOPORT_MAX_STEPS ] && {
|
||||
echo "Maximum steps count reached for batch mode; exiting. See $logfile for details."
|
||||
break
|
||||
@ -418,7 +438,12 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
|
||||
JOB_FAILED=()
|
||||
JOB_CANTINSTALL_OLD=(${JOB_CANTINSTALL[*]})
|
||||
for JOB_NUM in `seq 1 ${#JOB[*]}`; do
|
||||
JOB_CURRENT=${JOB[$JOB_NUM-1]}
|
||||
JOB_CURRENT=${JOB[$JOB_NUM-1]/\#*}
|
||||
if [ "${JOB_CURRENT}" != "${JOB[$JOB_NUM-1]}" ]; then
|
||||
JOB_CURRENT_VERSION=${JOB[$JOB_NUM-1]/*\#}
|
||||
else
|
||||
JOB_CURRENT_VERSION=
|
||||
fi
|
||||
if [ "`grep "^${JOB_CURRENT}$" /etc/autodist/unstage 2>/dev/null`" -o \
|
||||
"`grep "^${JOB_CURRENT}$" /etc/autodist/unstage.${TARGET_ARCH} 2>/dev/null`" ]; then
|
||||
echo -n "^ $JOB_CURRENT: "
|
||||
@ -444,7 +469,18 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
|
||||
JOB_FAILED=(${JOB_FAILED[*]} $JOB_CURRENT)
|
||||
continue
|
||||
fi
|
||||
get_pkg_srcinfo $DATADIR/$PORT_REPOSITORY ${JOB_CURRENT}
|
||||
get_pkg_srcinfo $DATADIR/$PORT_REPOSITORY ${JOB_CURRENT} || {
|
||||
echo "< (FAILED) [error $? in get_pkg_srcinfo]"
|
||||
JOB_FAILED=(${JOB_FAILED[*]} $JOB_CURRENT)
|
||||
continue
|
||||
}
|
||||
if [ "$JOB_CURRENT_VERSION" -a \
|
||||
"$JOB_CURRENT_VERSION" != "$src_version" -a \
|
||||
"$JOB_CURRENT_VERSION" != "$src_version-$src_release" ]; then
|
||||
echo "< (FAILED) [wrong version $src_version-$src_release != $JOB_CURRENT_VERSION]"
|
||||
JOB_FAILED=(${JOB_FAILED[*]} $JOB_CURRENT)
|
||||
continue
|
||||
fi
|
||||
|
||||
DONT_PREPARE_THIS=
|
||||
for p in ${JOB_CMDLINE[*]}; do
|
||||
@ -575,8 +611,13 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
|
||||
echo -n "(OK) "
|
||||
autoport_log ${JOB_CURRENT} port ok $tmpfile
|
||||
if [ "$WEBBUILD_URL" -a "$WEBBUILD_USER" ]; then
|
||||
curl -s "$WEBBUILD_URL?REQUEST=message&USER=$WEBBUILD_USER&SECRET=$WEBBUILD_SECRET&USER_EMAIL=$WEBBUILD_EMAIL&\
|
||||
if [ "$WEBBUILD_USER_CMDLINE" ]; then
|
||||
curl -s "$WEBBUILD_URL?REQUEST=message&USER=$WEBBUILD_USER&SECRET=$WEBBUILD_SECRET&USER_EMAIL=$WEBBUILD_EMAIL&\
|
||||
MESSAGE=`cgi_encodevar \"(invoked by $WEBBUILD_USER_CMDLINE) ported <b>$JOB_CURRENT</b> to <b>$TARGET_ARCH</b> and sent it to <b>$src_repository</b>\"`" >/dev/null
|
||||
else
|
||||
curl -s "$WEBBUILD_URL?REQUEST=message&USER=$WEBBUILD_USER&SECRET=$WEBBUILD_SECRET&USER_EMAIL=$WEBBUILD_EMAIL&\
|
||||
MESSAGE=`cgi_encodevar \"ported <b>$JOB_CURRENT</b> to <b>$TARGET_ARCH</b> and sent it to <b>$src_repository</b>\"`" >/dev/null
|
||||
fi
|
||||
fi
|
||||
}
|
||||
echo -n "install"
|
||||
|
Loading…
Reference in New Issue
Block a user