From 86f794f3eeb72a04a8cf8d3744002f46597d9607 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Tue, 20 Jun 2017 18:54:10 +0200 Subject: reproducible Debian: delete old stuff first, so that deletes still happen even if updates fail later Signed-off-by: Holger Levsen --- bin/reproducible_maintenance.sh | 56 ++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 26 deletions(-) (limited to 'bin') diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh index d5f0c103..c5beb35a 100755 --- a/bin/reproducible_maintenance.sh +++ b/bin/reproducible_maintenance.sh @@ -57,6 +57,36 @@ fi # set -e +# +# delete old temp directories +# +echo "$(date -u) - Deleting temp directories, older than 3 days." +OLDSTUFF=$(find $REP_RESULTS/rbuild-debian -maxdepth 1 -type d -mtime +2 -name "tmp.*" -exec ls -lad {} \; || true) +if [ ! -z "$OLDSTUFF" ] ; then + echo + echo "Old temp directories found in $REP_RESULTS/rbuild-debian" + find $REP_RESULTS/rbuild-debian -maxdepth 1 -type d -mtime +2 -name "tmp.*" -exec rm -rv {} \; || true + echo "These old directories have been deleted." + echo + DIRTY=true +fi + +# +# delete old pbuilder build directories +# +if [ -d /srv/workspace/pbuilder/ ] ; then + echo "$(date -u) - Deleting pbuilder build directories, older than 3 days." + OLDSTUFF=$(find /srv/workspace/pbuilder/ -maxdepth 2 -regex '.*/[0-9]+' -type d -mtime +2 -exec ls -lad {} \; || true) + if [ ! -z "$OLDSTUFF" ] ; then + echo + echo "Old pbuilder build directories found in /srv/workspace/pbuilder/" + echo -n "$OLDSTUFF" + find /srv/workspace/pbuilder/ -maxdepth 2 -regex '.*/[0-9]+' -type d -mtime +2 -exec sudo rm -rf --one-file-system {} \; || true + echo + DIRTY=true + fi +fi + # # check for working proxy # @@ -139,32 +169,6 @@ if [ "$HOSTNAME" = "${ARCHLINUX_BUILD_NODE}" ] ; then fi set -e -# delete old temp directories -echo "$(date -u) - Deleting temp directories, older than 3 days." -OLDSTUFF=$(find $REP_RESULTS/rbuild-debian -maxdepth 1 -type d -mtime +2 -name "tmp.*" -exec ls -lad {} \; || true) -if [ ! -z "$OLDSTUFF" ] ; then - echo - echo "Old temp directories found in $REP_RESULTS/rbuild-debian" - find $REP_RESULTS/rbuild-debian -maxdepth 1 -type d -mtime +2 -name "tmp.*" -exec rm -rv {} \; || true - echo "These old directories have been deleted." - echo - DIRTY=true -fi - -# delete old pbuilder build directories -if [ -d /srv/workspace/pbuilder/ ] ; then - echo "$(date -u) - Deleting pbuilder build directories, older than 3 days." - OLDSTUFF=$(find /srv/workspace/pbuilder/ -maxdepth 2 -regex '.*/[0-9]+' -type d -mtime +2 -exec ls -lad {} \; || true) - if [ ! -z "$OLDSTUFF" ] ; then - echo - echo "Old pbuilder build directories found in /srv/workspace/pbuilder/" - echo -n "$OLDSTUFF" - find /srv/workspace/pbuilder/ -maxdepth 2 -regex '.*/[0-9]+' -type d -mtime +2 -exec sudo rm -rf --one-file-system {} \; || true - echo - DIRTY=true - fi -fi - # delete build services logfiles if [ "$HOSTNAME" = "$MAINNODE" ] ; then if [ -d /var/lib/jenkins/userContent/reproducible/debian/build_service/ ] ; then -- cgit v1.2.3-70-g09d2