r49569 - /scripts/examples/clean_sourcetree
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Wed Dec 30 21:49:05 UTC 2009
Author: gregoa
Date: Wed Dec 30 21:48:56 2009
New Revision: 49569
URL: http://svn.debian.org/wsvn/?sc=1&rev=49569
Log:
add clean_sourcetree: script for removing old packages and svn temp files
Added:
scripts/examples/clean_sourcetree (with props)
Added: scripts/examples/clean_sourcetree
URL: http://svn.debian.org/wsvn/scripts/examples/clean_sourcetree?rev=49569&op=file
==============================================================================
--- scripts/examples/clean_sourcetree (added)
+++ scripts/examples/clean_sourcetree Wed Dec 30 21:48:56 2009
@@ -1,0 +1,70 @@
+#!/bin/sh
+
+# clean_sourcetree
+# new disk space is cheap, re-using old one is cheaper
+#
+# Copyright: 2009, gregor herrmann <gregoa at debian.org>
+# License: GPL-2+
+#
+# clean_sourcetree frees up space in your source directories. It
+# - removes subversion temporary files
+# - deletes old Debian (source and binary) packages
+
+# defaults
+SRCDIR=~/src
+AGE=365
+DELETE=-print
+
+# helper functions
+usage() {
+ cat <<-HERE
+
+ Usage for $(basename $0):
+
+ -s DIR Top of source directory, defaults to ~/src.
+ -a DAYS Age (mtime >= days), defaults to 365.
+ -d Delete!, defaults to print only.
+ -h Help.
+ HERE
+}
+
+# command line options
+while getopts :s:a:dh OPTION; do
+ case "$OPTION" in
+ s)
+ SRCDIR=$OPTARG
+ ;;
+ a)
+ AGE=$OPTARG
+ ;;
+ d)
+ DELETE=-delete
+ ;;
+ h)
+ usage
+ exit 0
+ ;;
+ *)
+ echo "E: unknown option -$OPTARG!"
+ usage
+ exit 1
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+
+# SVN temp files
+echo "I: looking for subversion temporary files ..."
+find $SRCDIR -type f -path '*/.svn/tmp/*.tmp' $DELETE
+echo "I: done"
+
+# remove old stuff from build-area and tarballs
+echo "I: looking for Debian packages older then $AGE days ..."
+find $SRCDIR -type f -mtime $AGE \
+ \( -path '*/build-area/*' -o -path '*/tarballs/*' \) \
+ \( -name '*.deb' -o \
+ -name '*.orig.tar.gz' -o -name '*.dsc' -o -name '*.diff.gz' -o -name '*.debian.tar.gz' -o \
+ -name '*.build' -o -name '*.changes' -o -name '*.upload' \) \
+ $DELETE
+echo "I: done"
Propchange: scripts/examples/clean_sourcetree
------------------------------------------------------------------------------
svn:executable = *
More information about the Pkg-perl-cvs-commits
mailing list