autodist, autoport: support for distdb.*, legacy.*, unstage.* from repository

This commit is contained in:
Silvan Calarco 2014-05-31 14:43:42 +02:00
parent e6ee8dbd5b
commit eff79c5bf8
2 changed files with 43 additions and 28 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# Autodist -- batch build tool for RPM based distributions
# Copyright (C) 2006-2013 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (C) 2006-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
# Released under the terms of the GNU GPL release 3 license
#
@ -57,21 +57,17 @@ ${me[0]} ${me[1]}
}
function fetch_repository_list() {
local REPOLIST=$1
if [ -r ${LOCAL_REPS_BASE_DIR}/$REPOLIST ]; then
echo ${LOCAL_REPS_BASE_DIR}/$REPOLIST
function fetch_repository_file() {
local REPOFILE=$1
if [ -r ${LOCAL_REPS_BASE_DIR}/$REPOFILE ]; then
echo ${LOCAL_REPS_BASE_DIR}/$REPOFILE
return 0
else
if [ ! -r $USERCONFDIR/$REPOLIST -o "`find $USERCONFDIR/$REPOLIST -mmin +60 2>/dev/null`" ]; then
mkdir -p `dirname $USERCONFDIR/$REPOLIST`
curl -s $REPS_BASE_URL/$REPOLIST -o $USERCONFDIR/$REPOLIST || {
echo "Error: unable to fetch $REPS_BASE_DIR/$REPOLIST"
exit 1
}
if [ ! -r $USERCONFDIR/$REPOFILE -o "`find $USERCONFDIR/$REPOFILE -mmin +60 2>/dev/null`" ]; then
mkdir -p `dirname $USERCONFDIR/$REPOFILE`
curl -f -L -s $REPS_BASE_URL/$REPOFILE -o $USERCONFDIR/$REPOFILE || return 1
fi
echo $USERCONFDIR/$REPOLIST
echo $USERCONFDIR/$REPOFILE
return 0
fi
}
@ -859,10 +855,20 @@ function log_date() {
mkdir -p $LOGBASEDIR/send/{ok,failed}
}
#
# Main
#
DISTDB=`fetch_repository_file ${AUTODIST_REPOSITORY/-*}/distdb`
[ "$DISTDB" ] || DISTDB=$SYSCONFDIR/distdb
DISTDBFILES="$DISTDB"
[ -e $DISTDB.$TARGETARCH ] && DISTDBFILES="$DISTDBFILES $DISTDB.$TARGETARCH"
[ -e ~/.autodist/distdb ] && DISTDBFILES="$DISTDBFILES ~/.autodist/distdb"
[ -e ~/.autodist/distdb.$TARGETARCH ] && DISTDBFILES="$DISTDBFILES ~/.autodist/distdb.$TARGETARCH"
DISTDBARCH=`fetch_repository_file ${AUTODIST_REPOSITORY/-*}/distdb.$TARGETARCH`
if [ "$DISTDBARCH" ]; then
DISTDBFILES="$DISTDBFILES $DISTDBARCH"
elif [ -e $DISTDB.$TARGETARCH ]; then
DISTDBFILES="$DISTDBFILES $DISTDB.$TARGETARCH"
fi
if [ "$do_listjobs" ]; then
for f in $DISTDBFILES; do
@ -920,12 +926,19 @@ SOURCESDIR=$AUTOUPDATEDIR/sources/
SUCCESSLISTDIR=$AUTOUPDATEDIR
SKIPPEDLISTDIR=$AUTOUPDATEDIR
SRCPKGLIST=`fetch_repository_list $AUTODIST_REPOSITORY/srcpkglist`
[ "$AUTODIST_DELAYED_REPOSITORY" ] && SRCPKGLIST_DELAYED=`fetch_repository_list $AUTODIST_DELAYED_REPOSITORY/srcpkglist`
SRCPKGLIST=`fetch_repository_file $AUTODIST_REPOSITORY/srcpkglist`
[ $? -eq 0 ] || echo "Warning: unable to fetch $SRCPKGLIST">&2
BUILDSLIST=`fetch_repository_list distromatic/$AUTODIST_REPOSITORY/builds-$TARGETARCH`
[ "$AUTODIST_DELAYED_REPOSITORY" ] && BUILDSLIST_DELAYED=`fetch_repository_list distromatic/$AUTODIST_DELAYED_REPOSITORY/builds-$TARGETARCH`
[ "$AUTODIST_DELAYED_REPOSITORY" ] && SRCPKGLIST_DELAYED=`fetch_repository_file $AUTODIST_DELAYED_REPOSITORY/srcpkglist`
[ $? -eq 0 ] || echo "Warning: unable to fetch $SRCPKGLIST_DELAYED">&2
BUILDSLIST=`fetch_repository_file distromatic/$AUTODIST_REPOSITORY/builds-$TARGETARCH`
[ "$AUTODIST_DELAYED_REPOSITORY" ] && BUILDSLIST_DELAYED=`fetch_repository_file distromatic/$AUTODIST_DELAYED_REPOSITORY/builds-$TARGETARCH`
[ $? -eq 0 ] || echo "Warning: unable to fetch $BUILDSLIST">&2
LEGACYLIST=`fetch_repository_file ${AUTODIST_REPOSITORY/-*}/legacy`
[ "$LEGACYLIST" ] || LEGACYLIST=$SYSCONFDIR/legacy
[ $? -eq 0 ] || echo "Warning: unable to fetch $LEGACYLIST">&2
echo "%% Autodist started with PID $$ @ `LANG=C date`"

View File

@ -1,6 +1,6 @@
#!/bin/bash
# autoport -- batch cross-build tool based on autodist
# Copyright (C) 2011-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (C) 2011-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
# Released under the terms of the GNU GPL release 3 license
#
@ -232,12 +232,14 @@ function find_requirements() {
}
fetch_repfiles() {
curl -s ${REPS_BASE_URL}/$PORT_REPOSITORY/srcpkglist -o $DATADIR/$PORT_REPOSITORY/srcpkglist ||
curl -f -L -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 ||
curl -f -L -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 ||
curl -f -L -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"
curl -f -L -s ${REPS_BASE_URL}/${PORT_REPOSITORY/-*}/unstage.$TARGET_ARCH -o $DATADIR/$PORT_REPOSITORY/unstage.$TARGET_ARCH ||
echo "Error: unable to fetch ${REPS_BASE_URL}/${PORT_REPOSITORY/-*}/unstage.$TARGET_ARCH"
}
[ $# -gt 0 ] || { usage ; exit 1; }
@ -438,8 +440,8 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
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
if [ "`grep "^${JOB_CURRENT}$" /etc/autodist/unstage.${TARGET_ARCH} 2>/dev/null`" -o \
"`grep "^${JOB_CURRENT}$" $DATADIR/$PORT_REPOSITORY/unstage.${TARGET_ARCH} 2>/dev/null`" ]; then
echo -n "^ $JOB_CURRENT: "
STAGEOPTS=
else
@ -654,8 +656,8 @@ MESSAGE=`cgi_encodevar \"ported <b>$JOB_CURRENT</b> to <b>$TARGET_ARCH</b> and s
JOB_CANTINSTALL=()
for JOB_NUM in `seq 1 ${#JOB_CANTINSTALL_OLD[*]}`; do
JOB_CURRENT=${JOB_CANTINSTALL_OLD[$JOB_NUM-1]}
if [ "`grep "^${JOB_CURRENT}$" /etc/autodist/unstage 2>/dev/null`" -o \
"`grep "^${JOB_CURRENT}$" /etc/autodist/unstage.${TARGET_ARCH} 2>/dev/null`" ]; then
if [ "`grep "^${JOB_CURRENT}$" /etc/autodist/unstage.${TARGET_ARCH} 2>/dev/null`" -o \
"`grep "^${JOB_CURRENT}$" $DATADIR/$PORT_REPOSITORY/unstage.$TARGET_ARCH 2>/dev/null`" ]; then
echo -n "$JOB_CURRENT: "
STAGEOPTS=
else