This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: bin/preprocess


This is preparatory work for something I promised to deal with: Actually
removing obsolete pages from the web directory.

Installed.

Gerald


Add a new function remove_cruft(). Use it.

Index: preprocess
===================================================================
RCS file: /cvs/gcc/wwwdocs/bin/preprocess,v
retrieving revision 1.13
diff -u -3 -p -r1.13 preprocess
--- preprocess	2000/08/01 11:15:14	1.13
+++ preprocess	2001/02/06 13:01:12
@@ -31,7 +31,7 @@ if [ ! -d $DESTTREE ]; then
 fi

 ####
-# Good guys clean after them.
+# Exit handler. Good guys clean after them.

 TMPDIR=/tmp/`basename $0`.$$

@@ -42,6 +42,27 @@ cleanup() {
 trap "cleanup; exit 1" 1 2 15

 ####
+# Remove old cruft from the destination tree.
+
+remove_cruft() {
+    cd $DESTTREE
+
+    for f in `find . -type f` ; do
+        if [ ! -f $SOURCETREE/$f ]; then
+            echo "Removing obsolete file $f"
+            #rm $f
+        fi
+    done
+
+    for f in `find . -type d` ; do
+        if [ ! -d $SOURCETREE/$f ]; then
+            echo "Removing obsolete directory $f"
+            #rmdir $f
+        fi
+    done
+}
+
+####
 # Process a single file.

 copy_if_different()
@@ -122,6 +143,8 @@ else
         process_file $f
     done
 fi
+
+remove_cruft

 # Get a clean exit status on success.
 cleanup


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]