[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] maintenance: cleanup old sbuild directories too

Holger Levsen gitlab at salsa.debian.org
Mon May 3 10:53:17 BST 2021



Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net


Commits:
c6a25c95 by Holger Levsen at 2021-05-03T11:52:21+02:00
maintenance: cleanup old sbuild directories too

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


1 changed file:

- bin/reproducible_maintenance.sh


Changes:

=====================================
bin/reproducible_maintenance.sh
=====================================
@@ -1,7 +1,7 @@
 #!/bin/bash
 # vim: set noexpandtab:
 
-# Copyright 2014-2020 Holger Levsen <holger at layer-acht.org>
+# Copyright 2014-2021 Holger Levsen <holger at layer-acht.org>
 #         © 2015-2018 Mattia Rizzolo <mattia at debian.org>
 # released under the GPLv2
 
@@ -480,6 +480,30 @@ if [ ! -z "$OLDSTUFF" ]; then
 	DIRTY=true
 fi
 
+# remove too old sbuild directories
+dir=/var/lib/sbuild/build
+if [ -d $dir ] ; then
+	echo "$(date -u) - Removing sbuild directories older than 7 days."
+	OLDSTUFF=$(find "$dir" -mindepth 1 -maxdepth 1 -type d -mtime +6 -exec ls -lad {} \;)
+	if [ ! -z "$OLDSTUFF" ]; then
+		echo
+		echo "sbuild directories older than 7 days found, which will be deleted:"
+		echo "$OLDSTUFF"
+		echo
+		# do nothing first / for now
+		find "$dir" -mindepth 1 -maxdepth 1 -type d -mtime +6 -exec echo rm -r {} \;
+		OLDSTUFF=$(find "$dir" -mindepth 1 -maxdepth 1 -type d -mtime +6 -exec ls -lad {} \;)
+		if [ ! -z "$OLDSTUFF" ]; then
+			echo
+			echo "Warning: Tried, but failed to delete these sbuild directories:"
+			echo "$OLDSTUFF"
+			echo "Manual cleanup needed"
+		fi
+		echo
+		DIRTY=true
+	fi
+fi
+
 if [ "$HOSTNAME" = "$MAINNODE" ] ; then
 	#
 	# find failed builds due to network problems and reschedule them



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/c6a25c9564e84cf6f0ff2636056a08d696013fd0

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/c6a25c9564e84cf6f0ff2636056a08d696013fd0
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20210503/de5a2846/attachment-0001.htm>


More information about the Qa-jenkins-scm mailing list