summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_maintenance.sh
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-04-10 12:39:12 +0200
committerHolger Levsen <holger@layer-acht.org>2015-04-16 16:47:01 +0200
commit36798da6b02677f0d8d3808bb0541148d8e1c314 (patch)
tree1eae382af734b145cc29382b550fce25870e7314 /bin/reproducible_maintenance.sh
parentefff11a45908152891feb1a1b071ad9871208190 (diff)
downloadjenkins.debian.net-36798da6b02677f0d8d3808bb0541148d8e1c314.tar.xz
reproducible: new db table: removed_packages, to track removed package and subsequently clean up files
the db now stores tuple of (pkgname, suite, architecture) of every removed packages, then reproducible_maintenance.sh pick up entries from it and find+remove files. For now the reproducible_maintenance only output what he would have remove.
Diffstat (limited to 'bin/reproducible_maintenance.sh')
-rwxr-xr-xbin/reproducible_maintenance.sh29
1 files changed, 14 insertions, 15 deletions
diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh
index 53799b20..a4362650 100755
--- a/bin/reproducible_maintenance.sh
+++ b/bin/reproducible_maintenance.sh
@@ -185,26 +185,25 @@ fi
rm $PACKAGES
# find packages which have been removed from unstable
-# commented out for now. This can't be done using the database anymore
-QUERY="SELECT source_packages.name FROM source_packages
- WHERE source_packages.name NOT IN
- (SELECT sources.name FROM sources)
- LIMIT 25"
-#PACKAGES=$(sqlite3 -init $INIT ${PACKAGES_DB} "$QUERY")
-PACKAGES=''
+QUERY="SELECT name, suite, architecture FROM removed_packages
+ LIMIT 25"
+PACKAGES=$(sqlite3 -init $INIT ${PACKAGES_DB} "$QUERY")
if [ ! -z "$PACKAGES" ] ; then
+ DIRTY=true
echo
+ echo "Warning: found files relative to old packages, no more in the archive:"
echo "Removing these removed packages from database:"
echo $PACKAGES
echo
- QUERY="DELETE FROM source_packages
- WHERE source_packages.name NOT IN
- (SELECT sources.name FROM sources)
- LIMIT 25"
- sqlite3 -init $INIT ${PACKAGES_DB} "$QUERY"
- cd /var/lib/jenkins/userContent
- for i in PACKAGES ; do
- find rb-pkg/ rbuild/ notes/ dbd/ -name "${i}_*" -exec rm -v {} \;
+ for pkg in "$PACKAGES" ; do
+ PKGNAME=$(echo "$pkg" | cut -f '|' -d 1)
+ SUITE=$(echo "$pkg" | cut -f '|' -d 2)
+ ARCH=$(echo "$pkg" | cut -f '|' -d 3)
+ QUERY="DELETE FROM removed_packages
+ WHERE name='$PKGNAME' AND suite='$SUITE' AND architecture='$ARCH'"
+ sqlite3 -init $INIT ${PACKAGES_DB} "$QUERY"
+ cd /var/lib/jenkins/userContent
+ find rb-pkg/$SUITE/$ARCH rbuild/$SUITE/$ARCH notes/ dbd/$SUITE/$ARCH buildinfo/$SUITE/$ARCH -name "${PKGNAME}_*" | xargs echo rm -v
done
cd -
fi