[Qa-jenkins-scm] [jenkins.debian.net] 02/04: reproducible: maintenance: DRY

Mattia Rizzolo mattia at debian.org
Thu Apr 5 12:50:41 UTC 2018


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch master
in repository jenkins.debian.net.

commit 1a6c37fa1d5eacea49e65998217cb779bdc98375
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Thu Apr 5 14:40:28 2018 +0200

    reproducible: maintenance: DRY
    
    Signed-off-by: Mattia Rizzolo <mattia at debian.org>
---
 bin/reproducible_maintenance.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh
index 5708f8f..dc825c9 100755
--- a/bin/reproducible_maintenance.sh
+++ b/bin/reproducible_maintenance.sh
@@ -213,13 +213,14 @@ fi
 
 # find old schroots
 echo "$(date -u) - Removing schroots older than 3 days."
-OLDSTUFF=$(find /schroots/ -maxdepth 1 -type d -regextype posix-extended -regex "/schroots/reproducible-.*-[0-9]{1,5}" -mtime +2 -exec ls -lad {} \; || true)
+regex="/schroots/reproducible-.*-[0-9]{1,5}"
+OLDSTUFF=$(find /schroots/ -maxdepth 1 -type d -regextype posix-extended -regex "$regex" -mtime +2 -exec ls -lad {} \; || true)
 if [ ! -z "$OLDSTUFF" ] ; then
 	echo
 	echo "schroots older than 3 days found in /schroots, which will be deleted:"
-	find /schroots/ -maxdepth 1 -type d -regextype posix-extended -regex "/schroots/reproducible-.*-[0-9]{1,5}" -mtime +2 -exec sudo rm -rf --one-file-system {} \; || true
+	find /schroots/ -maxdepth 1 -type d -regextype posix-extended -regex "$regex" -mtime +2 -exec sudo rm -rf --one-file-system {} \; || true
 	echo "$OLDSTUFF"
-	OLDSTUFF=$(find /schroots/ -maxdepth 1 -type d -regextype posix-extended -regex "/schroots/reproducible-.*-[0-9]{1,5}" -mtime +2 -exec ls -lad {} \; || true)
+	OLDSTUFF=$(find /schroots/ -maxdepth 1 -type d -regextype posix-extended -regex "$regex" -mtime +2 -exec ls -lad {} \; || true)
 	if [ ! -z "$OLDSTUFF" ] ; then
 		echo
 		echo "Warning: Tried, but failed to delete these:"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list