bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] maint.mk: fix VPATH issues


From: Akim Demaille
Subject: Re: [PATCH] maint.mk: fix VPATH issues
Date: Thu, 7 Jun 2012 17:00:25 +0200

This time, it's gnu-web-doc-update.  I can't fully test it
now, as I had not defined manual_title in v2.5.1 :(

From bc0749a1d9c7d8b05bbe49d45205a2e5576678bd Mon Sep 17 00:00:00 2001
From: Akim Demaille <address@hidden>
Date: Thu, 7 Jun 2012 16:17:36 +0200
Subject: [PATCH] gnu-web-doc-update: VPATH builds.

* build-aux/gnu-web-doc-update (--builddir): New option.
Revamp the handling of options.
Prefer $(...) to `...`.
Don't pass --tmpdir=. to mktemp, it is useless given that we specify
the template, and it is GNU mktemp specific.
Prefer set -e to long series of &&.
Restore the initial git branch, not "master".
Properly initialize submodules (don't rely only on bootstrap)
* top/README-release: Update instructions for gnu-web-doc-update.
---
 ChangeLog                    |   13 ++++++
 build-aux/gnu-web-doc-update |   89 ++++++++++++++++++++++++++++--------------
 top/README-release           |    4 +-
 3 files changed, 75 insertions(+), 31 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9118955..f49d9f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2012-06-07  Akim Demaille  <address@hidden>
 
+       gnu-web-doc-update: VPATH builds.
+       * build-aux/gnu-web-doc-update (--builddir): New option.
+       Revamp the handling of options.
+       Prefer $(...) to `...`.
+       Don't pass --tmpdir=. to mktemp, it is useless given that we specify
+       the template, and it is GNU mktemp specific.
+       Prefer set -e to long series of &&.
+       Restore the initial git branch, not "master".
+       Properly initialize submodules (don't rely only on bootstrap).
+       * top/README-release: Update instructions for gnu-web-doc-update.
+
+2012-06-07  Akim Demaille  <address@hidden>
+
        do-release-commit-and-tag: support VPATH builds.
        * build-aux/do-release-commit-and-tag: Prefer $(...) to `...`.
        (noteworthy): Defined earlier to factor its value.
diff --git a/build-aux/gnu-web-doc-update b/build-aux/gnu-web-doc-update
index 7a43049..851f8b8 100755
--- a/build-aux/gnu-web-doc-update
+++ b/build-aux/gnu-web-doc-update
@@ -27,59 +27,80 @@ VERSION=2009-07-21.16; # UTC
 # Requirements: everything required to bootstrap your package,
 # plus these: git, cvs, cvsu, rsync, mktemp
 
-ME=`basename "$0"`
+ME=$(basename "$0")
 warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
 die() { warn "$*"; exit 1; }
 
-help_version()
+help()
 {
-  case $1 in
-    --help) cat <<EOF
+  cat <<EOF
 Usage: $ME
 
-Run this script (no options or arguments) after each non-alpha release,
-to update the web documentation at http://www.gnu.org/software/\$pkg/manual/
-Run it from your project's the top-level directory.
+Run this script from top_srcdir (no options or arguments) after each
+non-alpha release, to update the web documentation at
+http://www.gnu.org/software/\$pkg/manual/ Run it from your project's
+the top-level directory.
 
 Options:
-  --help     print this help, then exit
-  --version  print version number, then exit
+  -C, --builddir=DIR  location of (configured) Makefile (default: .)
+  --help              print this help, then exit
+  --version           print version number, then exit
 
 Report bugs and patches to <address@hidden>.
 EOF
-      exit ;;
+  exit
+}
 
-    --version)
-      year=`echo "$VERSION" | sed 's/[^0-9].*//'`
-      cat <<EOF
+version()
+{
+  year=$(echo "$VERSION" | sed 's/[^0-9].*//')
+  cat <<EOF
 $ME $VERSION
 Copyright (C) $year Free Software Foundation, Inc,
 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.
 EOF
-      exit ;;
+  exit
+}
+
+builddir=.
+while test $# != 0
+do
+  # Handle --option=value by splitting apart and putting back on argv.
+  case $1 in
+    --*=*)
+      opt=$(echo "$1" | sed -e 's/=.*//')
+      val=$(echo "$1" | sed -e 's/[^=]*=//')
+      shift
+      set dummy "$opt" "$val" ${1+"$@"}; shift
+      ;;
+  esac
 
-  *) die "unrecognized option: $1";;
+  case $1 in
+    --help|--version) ${1#--};;
+    -C|--builddir) shift; builddir=$1; shift ;;
+    --*) die "unrecognized option: $1";;
+    *) break;;
   esac
-}
+done
 
-case $# in
-  0) ;;
-  1) help_version $1 ;;
-  *) die "$ME: too many options" ;;
-esac
+test $# = 0 \
+  || die "$ME: too many arguments"
 
 prev=.prev-version
 version=$(cat $prev) || die "$ME: no $prev file?"
-pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' Makefile) || die "$ME: no Makefile?"
+pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' $builddir/Makefile) \
+  || die "$ME: no Makefile?"
 tmp_branch=web-doc-$version-$$
+current_branch=$(git branch | sed -ne '/^\* /{s///;p;q;}')
 
 cleanup()
 {
-  __st=$?;
+  __st=$?
   rm -rf "$tmp"
-  git checkout master
+  git checkout "$current_branch"
+  git submodule update --recursive
   git branch -d $tmp_branch
   exit $__st
 }
@@ -89,15 +110,23 @@ trap 'exit $?' 1 2 13 15
 # We must build using sources for which --version reports the
 # just-released version number, not some string like 7.6.18-20761.
 # That version string propagates into all documentation.
+set -e
 git checkout -b $tmp_branch v$version
-ok=0
-./bootstrap && ./configure && make && make web-manual && ok=1
-test $ok = 1 || exit 1
-
-tmp=$(mktemp -d --tmpdir=. web-doc-update.XXXXXX) || exit 1
+git submodule update --recursive
+./bootstrap
+srcdir=$(pwd)
+cd "$builddir"
+  ./config.status --recheck
+  ./config.status
+  make
+  make web-manual
+cd "$srcdir"
+set +e
+
+tmp=$(mktemp -d web-doc-update.XXXXXX) || exit 1
 ( cd $tmp \
     && cvs -d address@hidden:/webcvs/$pkg co $pkg )
-rsync -avP doc/manual/ $tmp/$pkg/manual
+rsync -avP "$builddir"/doc/manual/ $tmp/$pkg/manual
 
 (
   cd $tmp/$pkg/manual
diff --git a/top/README-release b/top/README-release
index e9804b0..321c185 100644
--- a/top/README-release
+++ b/top/README-release
@@ -93,6 +93,8 @@ Once all the builds and tests have passed,
 
     http://www.gnu.org/software/@PACKAGE@/manual/
 
-  by running this:
+  by running this from top_srcdir:
 
     build-aux/gnu-web-doc-update
+
+  possibly with "-C <BUILDDIR>"
-- 
1.7.10.4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]