diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bd9e6617827818fd043452c08c606f07b78014a0 (patch) | |
tree | 425bb4c3168f9c02f10150f235d2cb998dcc6108 /scripts/pruneemptydirs | |
download | tdesdk-bd9e6617827818fd043452c08c606f07b78014a0.tar.gz tdesdk-bd9e6617827818fd043452c08c606f07b78014a0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'scripts/pruneemptydirs')
-rwxr-xr-x | scripts/pruneemptydirs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/scripts/pruneemptydirs b/scripts/pruneemptydirs new file mode 100755 index 00000000..6f177a0f --- /dev/null +++ b/scripts/pruneemptydirs @@ -0,0 +1,46 @@ +#!/bin/sh +# Cleans up a local CVS/SVN tree, by removing directories containing +# remanants of old stuff which has been removed from CVS/SVN +# Those stale dirs often break compilation... + +# Works better with srcdir!=builddir (since it will not remove directories +# containing the old executable...) + +# NOTE: by default the script doesn't remove anything, just prints what to do +# Copy and paste, or use eval in scripts. +# Use '-f' to force it to happen (use with care, no warranties, etc.!) + +# David Faure <faure@kde.org>, script under public domain + +force=0; +if [ "$1" = "-f" ]; then force=1; fi + +# Look for toplevel dirs +files=`find . -type d | grep -v CVS\$ | grep -v admin\$ | grep -v .libs\$ | fgrep -v .svn` +toremove="rm -rf"; +for i in $files; do if test -d $i; then + # List their contents and filter out generated files + realfiles=`find $i -type f | egrep -v '.svn|CVS/|Makefile$|Makefile.in$|Makefile.rules.in$|Makefile.calls.in$|\.o$|\.lo$|\.rpo$|\.la$|\.moc|/\.#' ` + if [ -z "$realfiles" ]; then + toremove="$toremove '$i'" + fi +fi; done + +if [ "$toremove" != "rm -rf" ]; then + # Do the same in the builddir, if srcdir != builddir + if [ -n "$OBJ_REPLACEMENT" ]; then + bdir=`echo $PWD | sed -e "$OBJ_REPLACEMENT"` + if test -d $bdir; then + bdcmd="( cd $bdir ; $toremove )" + fi + fi + # Print it or do it + if [ $force -eq 1 ]; then + eval $toremove + eval $bdcmd + else + echo $toremove + echo $bdcmd + fi +fi + |