From 096b6d6f6957b57cb70806bd254894d4551c2e3f Mon Sep 17 00:00:00 2001 From: Silvan Date: Thu, 17 Aug 2023 11:30:12 +0200 Subject: [PATCH] autoport: fetch repfiles for all archs but only if local files are older than 60 minutes --- autoport | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/autoport b/autoport index 07255cd..e334cd7 100755 --- a/autoport +++ b/autoport @@ -6,7 +6,6 @@ # VERSION=1.3 -BASE_ARCH=i586 BASE_REPOSITORY=base PORT_REPOSITORY=base @@ -242,16 +241,23 @@ function find_requirements() { fetch_repfiles() { local u - [ "$VERBOSE_MODE" = "1" ] && echo "Fetching ${REPS_BASE_URL}/$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" + f=${DATADIR}/${PORT_REPOSITORY}/srcpkglist + if [ ! -e ${f} -o "`find ${f} -mmin +60 2>/dev/null`" ]; then + [ "$VERBOSE_MODE" = "1" ] && echo "Fetching ${REPS_BASE_URL}/$PORT_REPOSITORY/srcpkglist" + curl -f -L -s ${REPS_BASE_URL}/$PORT_REPOSITORY/srcpkglist -o ${f} || + echo "Warning: unable to fetch ${REPS_BASE_URL}/$PORT_REPOSITORY/srcpkglist" + fi for a in ${AUTODIST_ARCHS[*]}; do - if [ "$a" == "${TARGET_ARCH}" ]; then + f=${DATADIR}/${PORT_REPOSITORY}/sources-${a} + if [ ! -e ${f} -o "`find ${f} -mmin +60 2>/dev/null`" ]; then [ "$VERBOSE_MODE" = "1" ] && echo "Fetching $PORT_REPOSITORY_DISTROMATIC_URL/sources-${a}" - curl -f -L -s $PORT_REPOSITORY_DISTROMATIC_URL/sources-${a} -o $DATADIR/$PORT_REPOSITORY/sources-${a} || + curl -f -L -s $PORT_REPOSITORY_DISTROMATIC_URL/sources-${a} -o ${f} || echo "Warning: unable to fetch $PORT_REPOSITORY_DISTROMATIC_URL/sources-${a}" + fi + f=${DATADIR}/${PORT_REPOSITORY}/builds-${a}.sh + if [ ! -e ${f} -o "`find ${f} -mmin +60 2>/dev/null`" ]; then [ "$VERBOSE_MODE" = "1" ] && echo "Fetching $PORT_REPOSITORY_DISTROMATIC_URL/builds-${a}.sh" - curl -f -L -s $PORT_REPOSITORY_DISTROMATIC_URL/builds-${a}.sh -o $DATADIR/$PORT_REPOSITORY/builds-${a}.sh || + curl -f -L -s $PORT_REPOSITORY_DISTROMATIC_URL/builds-${a}.sh -o ${f} || echo "Warning: unable to fetch $PORT_REPOSITORY_DISTROMATIC_URL/builds-${a}.sh" fi done @@ -386,10 +392,6 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do echo "Port repository is $PORT_REPOSITORY" echo "Release repository is $DEST_REPOSITORY" - # old files cleanup - rm -f $DATADIR/$PORT_REPOSITORY/sources-* - rm -f $DATADIR/$PORT_REPOSITORY/builds-*.sh - fetch_repfiles [ "$AUTO_MODE" -a -e $DATAARCHDIR/last ] && . $DATAARCHDIR/last