New upstream version 1.8
[debian/gzip] / build-aux / gnu-web-doc-update
index 268ecc068df9a6897d9949180d501f1b31fab5f0..271e693700999a69d2c3757fbe99561913b22995 100755 (executable)
@@ -2,9 +2,9 @@
 # Run this after each non-alpha release, to update the web documentation at
 # http://www.gnu.org/software/$pkg/manual/
 
-VERSION=2012-12-16.14; # UTC
+VERSION=2016-01-12.23; # UTC
 
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2009-2016 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -40,6 +40,7 @@ assumes all documentation is in the doc/ sub-directory.
 Options:
   -C, --builddir=DIR  location of (configured) Makefile (default: .)
   -n, --dry-run       don't actually commit anything
+  -m, --mirror        remove out of date files from document server
   --help              print this help, then exit
   --version           print version number, then exit
 
@@ -107,6 +108,7 @@ find_tool XARGS gxargs xargs
 
 builddir=.
 dryrun=
+rm_stale='echo'
 while test $# != 0
 do
   # Handle --option=value by splitting apart and putting back on argv.
@@ -115,7 +117,7 @@ do
       opt=$(echo "$1" | sed -e 's/=.*//')
       val=$(echo "$1" | sed -e 's/[^=]*=//')
       shift
-      set dummy "$opt" "$val" ${1+"$@"}; shift
+      set dummy "$opt" "$val" "$@"; shift
       ;;
   esac
 
@@ -123,6 +125,7 @@ do
     --help|--version) ${1#--};;
     -C|--builddir) shift; builddir=$1; shift ;;
     -n|--dry-run) dryrun=echo; shift;;
+    -m|--mirror) rm_stale=''; shift;;
     --*) die "unrecognized option: $1";;
     *) break;;
   esac
@@ -159,6 +162,7 @@ $GIT submodule update --recursive
 ./bootstrap
 srcdir=$(pwd)
 cd "$builddir"
+builddir=$(pwd)
   ./config.status --recheck
   ./config.status
   make
@@ -175,13 +179,25 @@ $RSYNC -avP "$builddir"/doc/manual/ $tmp/$pkg/manual
   cd $tmp/$pkg/manual
 
   # Add all the files.  This is simpler than trying to add only the
-  # new ones because of new directories: it would require iterating on
-  # adding the outer directories, and then their contents.
-  #
-  # find guarantees that we add outer directories first.
-  find . -name CVS -prune -o -print             \
+  # new ones because of new directories
+  # First add non empty dirs individually
+  find . -name CVS -prune -o -type d \! -empty -print             \
+    | $XARGS -n1 --no-run-if-empty -- $dryrun $CVS add -ko
+  # Now add all files
+  find . -name CVS -prune -o -type f -print             \
     | $XARGS --no-run-if-empty -- $dryrun $CVS add -ko
 
+  # Report/Remove stale files
+  #   excluding doc server specific files like CVS/* and .symlinks
+  if test -n "$rm_stale"; then
+    echo 'Consider the --mirror option if all of the manual is generated,' >&2
+    echo 'which will run `cvs remove` to remove stale files.' >&2
+  fi
+  { find . \( -name CVS -o -type f -name '.*' \) -prune -o -type f -print
+    (cd "$builddir"/doc/manual/ && find . -type f -print | sed p)
+  } | sort | uniq -u \
+    | $XARGS --no-run-if-empty -- ${rm_stale:-$dryrun} $CVS remove -f
+
   $dryrun $CVS ci -m $version
 )
 
@@ -189,6 +205,6 @@ $RSYNC -avP "$builddir"/doc/manual/ $tmp/$pkg/manual
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "VERSION="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End: