]> Dogcows Code - chaz/tar/blobdiff - bootstrap
Relicense under GPLv3
[chaz/tar] / bootstrap
index 5e7082ad621477ca996b3d39555409a232b58fa3..ef7b81244172e7dae1475564a3d5fcb46321caac 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -2,11 +2,11 @@
 
 # Bootstrap this package from CVS.
 
-# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 2006, 2007 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
-# the Free Software Foundation; either version 2, or (at your option)
+# the Free Software Foundation; either version 3, or (at your option)
 # any later version.
 
 # This program is distributed in the hope that it will be useful,
@@ -49,12 +49,18 @@ Options:
  --force                  Attempt to bootstrap even if the sources seem
                           not to have been checked out.
  --skip-po                Do not download po files.
+ --update-po[=LANG]       Update po file(s) and exit.
  --cvs-user=USERNAME      Set the CVS username to be used when accessing
                           the gnulib repository.
 
-If the file .bootstrap.conf exists in the current working directory, its
+If the file bootstrap.conf exists in the current working directory, its
 contents are read as shell variables to configure the bootstrap.
 
+Local defaults can be provided by placing the file \`.bootstrap' in the
+current working directory.  The file is read after bootstrap.conf, comments
+and empty lines are removed, shell variables expanded and the result is
+prepended to the command line options. 
+
 Running without arguments will suffice in most cases.
 "
 }
@@ -159,6 +165,12 @@ copy=false
 # Override the default configuration, if necessary.
 test -r bootstrap.conf && . ./bootstrap.conf
 
+# Read local configuration file
+if [ -r .bootstrap ]; then
+  echo "$0: Reading configuration file .bootstrap"
+  eval set -- "`sed 's/#.*$//;/^$/d' .bootstrap | tr '\n' ' '` $*"
+fi
+
 # Translate configuration into internal form.
 
 # Parse options.
@@ -176,7 +188,11 @@ do
   --cvs-user=*)
     CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
   --skip-po | --no-po) # --no-po is for compatibility with 'tar' tradition.
-    SKIP_PO=t;;
+    DOWNLOAD_PO=skip;;
+  --update-po=*)
+    DOWNLOAD_PO=`expr "$option" : '--update-po=\(.*\)'`;;
+  --update-po)
+    DOWNLOAD_PO=only;;
   --force)
     CVS_only_file=;;
   --copy)
@@ -194,6 +210,80 @@ fi
 
 echo "$0: Bootstrapping CVS $package..."
 
+# Get translations.
+
+get_translations() {
+  subdir=$1
+  domain=$2
+  po_file=$3
+
+  case $WGET_COMMAND in
+  '')
+    echo "$0: wget not available; skipping translations";;
+  ?*)
+    echo "$0: getting ${po_file:-translations} into $subdir for $domain..."  &&
+    case $po_file in
+    '') (cd $subdir && rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'`);;
+    esac &&
+  
+    $WGET_COMMAND -O "$subdir/$domain.html" "$TP_URL$domain" &&
+
+    sed -n 's|.*"http://[^"]*/translation/teams/PO/\([^/"]*\)/'"$domain"'-\([^/"]*\)\.[^."]*\.po".*|\1.\2|p' <"$subdir/$domain.html" |
+    sort -k 1,1 -k 2,2n -k2,2 -k3,3n -k3,3 -k4,4n -k4,4 -k5,5n -k5.5 |
+    awk -F. '
+      { if (lang && $1 != lang) print lang, ver }
+      { lang = $1; ver = substr($0, index($0, ".") + 1) }
+      END { if (lang) print lang, ver }
+    ' | awk -v domain="$domain" -v po_file="$po_file" -v subdir="$subdir" '
+      {
+       lang = $1
+        if (po_file && po_file != (lang ".po")) next
+       
+       ver = $2
+       urlfmt = ""
+       printf "{ $WGET_COMMAND -O %s/%s.po '\'"$TP_PO_URL"'/%s/%s-%s.%s.po'\'' &&\n", subdir, lang, lang, domain, ver, lang
+       printf "  msgfmt -c -o /dev/null %s/%s.po || {\n", subdir, lang
+       printf "    echo >&2 '\'"$0"': omitting translation for %s'\''\n", lang
+       printf "    rm -f %s/%s.po; }; } &&\n", subdir, lang
+      }
+      END { print ":" }
+    ' | WGET_COMMAND="$WGET_COMMAND" sh;;
+  esac &&
+  ls "$subdir"/*.po 2>/dev/null |
+    sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" &&
+  rm -f "$subdir/$domain.html"
+}
+
+case `wget --help` in
+*'--no-cache'*)
+    WGET_COMMAND='wget -nv --no-cache';;
+*'--cache=on/off'*)
+    WGET_COMMAND='wget -nv --cache=off';;
+*'--non-verbose'*)
+    WGET_COMMAND='wget -nv';;
+*)
+    WGET_COMMAND='';;
+esac
+
+case $DOWNLOAD_PO in
+'skip')
+  ;;
+'')
+  get_translations po $package || exit
+  ;;
+'only')
+  get_translations po $package
+  exit
+  ;;
+*.po)
+  get_translations po $package "$DOWNLOAD_PO"
+  exit
+  ;;
+*)
+  get_translations po $package "${DOWNLOAD_PO}.po"
+  exit
+esac
+
 # Get paxutils files.
 
 case ${PAXUTILS_SRCDIR--} in
@@ -208,6 +298,24 @@ if [ -r $PAXUTILS_SRCDIR/gnulib.modules ]; then
   `
 fi
 
+ignore_file_list=
+cleanup_ifl() {
+       test -n "$ignore_file_list" && rm -f $ignore_file_list
+}
+
+trap 'cleanup_ifl' 1 2 3 15
+
+# ignorefile DIR FILE 
+#  add FILE to the temporary ignorelist in the directory DIR
+ignorefile() {
+  file=$1/.ignore.$$ 
+  echo "$2" >> $file
+  if `echo $ignore_list | grep -qv $file`; then
+    ignore_file_list="$ignore_file_list
+$file"
+  fi
+}  
+
 # copy_files srcdir dstdir
 copy_files() {
   for file in `cat $1/DISTFILES`
@@ -224,6 +332,7 @@ copy_files() {
     fi
     echo "$0: Copying file $1/$file to $2/$dst"
     cp -p $1/$file $2/$dst
+    ignorefile $2 $dst
   done
 }
 
@@ -234,6 +343,7 @@ echo "$0: Creating m4/paxutils.m4"
  echo "AC_DEFUN([${package}_PAXUTILS],["
  cat ${PAXUTILS_SRCDIR}/m4/DISTFILES | sed '/^#/d;s/\(.*\)\.m4/pu_\1/' | tr a-z A-Z
  echo "])") > ./m4/paxutils.m4
+ignorefile m4 paxutils.m4
 
 if [ -d rmt ]; then
    :
@@ -259,65 +369,6 @@ esac
 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
 <$gnulib_tool || exit
 
-# Get translations.
-
-get_translations() {
-  subdir=$1
-  domain=$2
-
-  case $WGET_COMMAND in
-  '')
-    echo "$0: wget not available; skipping translations";;
-  ?*)
-    echo "$0: getting translations into $subdir for $domain..." &&
-
-    (cd $subdir && rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'`) &&
-    $WGET_COMMAND -O "$subdir/$domain.html" "$TP_URL$domain" &&
-
-    sed -n 's|.*"http://[^"]*/translation/teams/PO/\([^/"]*\)/'"$domain"'-\([^/"]*\)\.[^."]*\.po".*|\1.\2|p' <"$subdir/$domain.html" |
-    sort -k 1,1 -k 2,2n -k2,2 -k3,3n -k3,3 -k4,4n -k4,4 -k5,5n -k5.5 |
-    awk -F. '
-      { if (lang && $1 != lang) print lang, ver }
-      { lang = $1; ver = substr($0, index($0, ".") + 1) }
-      END { if (lang) print lang, ver }
-    ' | awk -v domain="$domain" -v subdir="$subdir" '
-      {
-       lang = $1
-       ver = $2
-       urlfmt = ""
-       printf "{ $WGET_COMMAND -O %s/%s.po '\'"$TP_PO_URL"'/%s/%s-%s.%s.po'\'' &&\n", subdir, lang, lang, domain, ver, lang
-       printf "  msgfmt -c -o /dev/null %s/%s.po || {\n", subdir, lang
-       printf "    echo >&2 '\'"$0"': omitting translation for %s'\''\n", lang
-       printf "    rm -f %s/%s.po; }; } &&\n", subdir, lang
-      }
-      END { print ":" }
-    ' | WGET_COMMAND="$WGET_COMMAND" sh;;
-  esac &&
-  ls "$subdir"/*.po 2>/dev/null |
-    sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" &&
-  rm -f "$subdir/$domain.html"
-}
-
-case $SKIP_PO in
-'')
-  case `wget --help` in
-  *'--no-cache'*)
-    WGET_COMMAND='wget -nv --no-cache';;
-  *'--cache=on/off'*)
-    WGET_COMMAND='wget -nv --cache=off';;
-  *'--non-verbose'*)
-    WGET_COMMAND='wget -nv';;
-  *)
-    WGET_COMMAND='';;
-  esac
-
-  get_translations po $package || exit
-
-  if test -d runtime-po; then
-    get_translations runtime-po $package-runtime || exit
-  fi;;
-esac
-
 symlink_to_gnulib()
 {
   src=$GNULIB_SRCDIR/$1
@@ -427,7 +478,7 @@ slurp() {
       done
       if test $file = Makefile.am; then
         copied=$copied${sep}gnulib.mk; sep=$nl
-       remove_intl='/^[^#].*\/intl/s/^/#/'
+       remove_intl='/^[^#].*\/intl/s/^/#/;'"s,/$bt,,g"
         sed "$remove_intl" $1/$dir/$file | cmp -s - $dir/gnulib.mk || {
          echo "$0: Copying $1/$dir/$file to $dir/gnulib.mk ..." &&
          rm -f $dir/gnulib.mk &&
@@ -455,13 +506,43 @@ slurp() {
       fi || exit
     done
 
-    for dot_ig in .cvsignore .gitignore; do
+    if test -n "$copied"; then
+      copied="Makefile
+Makefile.in
+$copied"
+      if test -d CVS; then
+       dot_ig=.cvsignore
+      else
+        dor_ig=.gitignore
+      fi
+
       ig=$dir/$dot_ig
-      if test -n "$copied" && test -f $ig; then
-       echo "$copied" | sort -u - $ig | cmp -s - $ig ||
-       echo "$copied" | sort -u - $ig -o $ig || exit
+      if [ -f $dir/.ignore.$$ ]; then
+         tfile=$dir/.ignore.$$
+      else
+         tfile=
       fi
-    done
+      if test -f $ig; then
+         echo "$copied" | sort -u - $ig | cmp -s - $ig ||
+         echo "$copied" | sort -u - $ig $tfile -o $ig
+      else
+          copied="$dot_ig
+$copied"         
+         if [ "$dir" = "po" ]; then
+           copied="LINGUAS
+Makevars
+POTFILES
+*.mo
+*.gmo
+*.po
+remove-potcdate.sed
+stamp-po
+$package.pot
+$copied"
+          fi  
+          echo "$copied" | sort -u - $tfile -o $ig
+      fi || exit
+    fi
   done
 }
 
@@ -563,5 +644,5 @@ if test -d runtime-po; then
   # Copy identical files from po to runtime-po.
   (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
 fi
-
+cleanup_ifl
 echo "$0: done.  Now you can run './configure'."
This page took 0.025973 seconds and 4 git commands to generate.