Debian Codegraph @

repo-clean

raw
1 #!/bin/sh
2
3 # Copyright 2006 David Hilvert <[email protected]>,
4 # <[email protected]>
5
6 # This file is part of the Anti-Lamenessing Engine.
7 #
8 # The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with Anti-Lamenessing Engine; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22 ###
23 ### 'repo-clean' attempts to remove files not in the
24 ### repository.
25 ###
26
27 #
28 # Use makefile clean commands.
29 #
30
31 echo ""
32 echo "Running makefile 'clean' commands."
33 make clean &> /dev/null
34 make distclean &> /dev/null
35
36 #
37 # List other candidates for removal.
38 #
39
40 echo ""
41 echo "Other removal candidates (run manually if OK):"
42 echo ""
43 find | xargs file | grep "symbolic link" | sed -e 's/:.*//g' | xargs -n 1 -r echo "rm"
44
45 #
46 # Check for the existence of repository resources.
47 #
48
49 if ! which darcs &> /dev/null; then
50 echo "*** Cannot find 'darcs'. ***"
51 exit
52 fi
53
54 if ! ls _darcs &> /dev/null; then
55 echo "*** Cannot find repository directory '_darcs'.***"
56 exit
57 fi
58
59 #
60 # List ordinary files that the repository doesn't know about.
61 #
62
63 darcs wha -l --boring | grep "^a.*[^/]$" | sed -e 's/a //' | xargs -n 1 -r echo "rm"
64 darcs wha -l --boring | grep "^a.*/$" | sed -e 's/a //' | xargs -n 1 -r echo "rmdir"
65