]> Dogcows Code - chaz/tar/blobdiff - bootstrap
Bugfixes.
[chaz/tar] / bootstrap
index c515b0173ff105810214bf9cbaf2ce905cce5423..a967cc74f0e6123a01091aed5423d1108264931a 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -2,11 +2,11 @@
 
 # Bootstrap this package from CVS.
 
 
 # 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
 
 # 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,
 # any later version.
 
 # This program is distributed in the hope that it will be useful,
@@ -49,9 +49,9 @@ Options:
  --force                  Attempt to bootstrap even if the sources seem
                           not to have been checked out.
  --skip-po                Do not download po files.
  --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.
+ --update-po              Update po files and exit.
  --cvs-user=USERNAME      Set the CVS username to be used when accessing
  --cvs-user=USERNAME      Set the CVS username to be used when accessing
-                          the gnulib repository.
+                          the paxutils repository.
 
 If the file bootstrap.conf exists in the current working directory, its
 contents are read as shell variables to configure the bootstrap.
 
 If the file bootstrap.conf exists in the current working directory, its
 contents are read as shell variables to configure the bootstrap.
@@ -69,24 +69,34 @@ checkout() {
   if [ ! -d $1 ]; then
     echo "$0: getting $1 files..."
 
   if [ ! -d $1 ]; then
     echo "$0: getting $1 files..."
 
-    case ${CVS_AUTH-pserver} in
-    pserver)
-      CVS_PREFIX=':pserver:anonymous@';;
-    ssh)
-      CVS_PREFIX="$CVS_USER${CVS_USER+@}";;
-    *)
-      echo "$0: $CVS_AUTH: Unknown CVS access method" >&2
-      exit 1;;
-    esac
+    case $1 in
+    paxutils)
+      case ${CVS_AUTH-pserver} in
+      pserver)
+        CVS_PREFIX=':pserver:anonymous@';;
+      ssh)
+        CVS_PREFIX="$CVS_USER${CVS_USER+@}";;
+      *)
+        echo "$0: $CVS_AUTH: Unknown CVS access method" >&2
+        exit 1;;
+      esac
+
+      case $CVS_RSH in
+      '') CVS_RSH=ssh; export CVS_RSH;;
+      esac
 
 
-    case $CVS_RSH in
-    '') CVS_RSH=ssh; export CVS_RSH;;
+      CVSURL=${CVS_PREFIX}cvs.savannah.gnu.org:/cvsroot/"$1"
+      ;;
+      
+    gnulib)
+      CVSURL=:pserver:anonymous@pserver.git.sv.gnu.org:/gnulib.git
+      ;;
+      
     esac
 
     trap "cleanup $1" 1 2 13 15
 
     esac
 
     trap "cleanup $1" 1 2 13 15
 
-    cvs -z3 -q -d ${CVS_PREFIX}cvs.savannah.gnu.org:/cvsroot/"$1" co $1 ||
-      cleanup $1
+    cvs -z3 -q -d $CVSURL co $1 || cleanup $1
 
     trap - 1 2 13 15
   fi
 
     trap - 1 2 13 15
   fi
@@ -106,10 +116,13 @@ gnulib_modules=
 # Any gnulib files needed that are not in modules.
 gnulib_files=
 
 # Any gnulib files needed that are not in modules.
 gnulib_files=
 
-# Translation Project URL, for the registry of all projects
-# and for the translation-team master directory.
-TP_URL='http://www.iro.umontreal.ca/translation/registry.cgi?domain='
-TP_PO_URL='http://www.iro.umontreal.ca/translation/teams/PO/'
+# The command to download all .po files for a specified domain into
+# a specified directory.  Fill in the first %s is the domain name, and
+# the second with the destination directory.  Use rsync's -L and -r
+# options because the latest/%s directory and the .po files within are
+# all symlinks.
+po_download_command_format=\
+"rsync -Lrtvz 'translationproject.org::tp/latest/%s/' '%s'"
 
 extract_package_name='
   /^AC_INIT(/{
 
 extract_package_name='
   /^AC_INIT(/{
@@ -212,76 +225,60 @@ echo "$0: Bootstrapping CVS $package..."
 
 # Get translations.
 
 
 # Get translations.
 
-get_translations() {
+download_po_files() {
   subdir=$1
   domain=$2
   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"
+  echo "$0: getting translations into $subdir for $domain..."
+  cmd=`printf "$po_download_command_format" "$domain" "$subdir"`
+  eval "$cmd"
 }
 
 }
 
-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
+# Download .po files to $po_dir/.reference and copy only the new
+# or modified ones into $po_dir.  Also update $po_dir/LINGUAS.
+update_po_files() {
+  # Directory containing primary .po files.
+  # Overwrite them only when we're sure a .po file is new.
+  po_dir=$1
+  domain=$2
+
+  # Download *.po files into this dir.
+  # Usually contains *.s1 checksum files.
+  ref_po_dir="$po_dir/.reference"
+
+  test -d $ref_po_dir || mkdir $ref_po_dir || return
+  download_po_files $ref_po_dir $domain \
+    && ls "$ref_po_dir"/*.po 2>/dev/null |
+      sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS"
+
+  langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
+  test "$langs" = '*' && langs=x
+  for po in `cd $ref_po_dir && echo *.po|sed 's/\.po//g'`; do
+    case $po in x) continue;; esac
+    new_po="$ref_po_dir/$po.po"
+    cksum_file="$ref_po_dir/$po.s1"
+    if ! test -f "$cksum_file" ||
+       ! test -f "$po_dir/$po.po" ||
+       ! sha1sum -c --status "$cksum_file" < "$new_po" > /dev/null; then
+      echo "updated $po_dir/$po.po..."
+      cp "$new_po" "$po_dir/$po.po" && sha1sum < "$new_po" > "$cksum_file"
+    fi
+  done
+}
 
 case $DOWNLOAD_PO in
 'skip')
   ;;
 '')
 
 case $DOWNLOAD_PO in
 'skip')
   ;;
 '')
-  get_translations po $package || exit
+  if test -d po; then
+    update_po_files po $package || exit
+  fi
   ;;
 'only')
   ;;
 'only')
-  get_translations po $package
-  exit
-  ;;
-*.po)
-  get_translations po $package "$DOWNLOAD_PO"
+  if test -d po; then
+    update_po_files po $package || exit
+  fi
   exit
   ;;
   exit
   ;;
-*)
-  get_translations po $package "${DOWNLOAD_PO}.po"
-  exit
 esac
 
 # Get paxutils files.
 esac
 
 # Get paxutils files.
@@ -336,28 +333,6 @@ copy_files() {
   done
 }
 
   done
 }
 
-copy_files ${PAXUTILS_SRCDIR}/m4 m4
-echo "$0: Creating m4/paxutils.m4"
-(echo "# This file is generated automatically. Please, do not edit."
- echo "#"
- 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
-   :
-else
-   mkdir rmt
-fi
-
-for dir in doc rmt lib tests
-do
-       copy_files ${PAXUTILS_SRCDIR}/$dir $dir
-done
-
-copy_files ${PAXUTILS_SRCDIR}/paxlib lib pax
-
 # Get gnulib files.
 
 case ${GNULIB_SRCDIR--} in
 # Get gnulib files.
 
 case ${GNULIB_SRCDIR--} in
@@ -369,6 +344,12 @@ esac
 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
 <$gnulib_tool || exit
 
 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
 <$gnulib_tool || exit
 
+ensure_dir_exists()
+{
+  d=`dirname $dst`
+  test -d "$d" || mkdir -p -- "$d"
+}
+
 symlink_to_gnulib()
 {
   src=$GNULIB_SRCDIR/$1
 symlink_to_gnulib()
 {
   src=$GNULIB_SRCDIR/$1
@@ -385,6 +366,7 @@ symlink_to_gnulib()
       test -f "$dst" &&
       cmp -s "$src" "$dst" || {
        echo "$0: cp -fp $src $dst" &&
       test -f "$dst" &&
       cmp -s "$src" "$dst" || {
        echo "$0: cp -fp $src $dst" &&
+       ensure_dir_exists $dst &&
        cp -fp "$src" "$dst"
       }
     else
        cp -fp "$src" "$dst"
       }
     else
@@ -407,6 +389,7 @@ symlink_to_gnulib()
        esac
 
        echo "$0: ln -fs $dot_dots$src $dst" &&
        esac
 
        echo "$0: ln -fs $dot_dots$src $dst" &&
+       ensure_dir_exists $dst &&
        ln -fs "$dot_dots$src" "$dst"
       }
     fi
        ln -fs "$dot_dots$src" "$dst"
       }
     fi
@@ -478,7 +461,7 @@ slurp() {
       done
       if test $file = Makefile.am; then
         copied=$copied${sep}gnulib.mk; sep=$nl
       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 &&
         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 &&
@@ -589,6 +572,28 @@ slurp $bt2 $bt || exit
 
 rm -fr $bt $bt2 || exit
 
 
 rm -fr $bt $bt2 || exit
 
+# Import from paxutils
+copy_files ${PAXUTILS_SRCDIR}/m4 m4
+echo "$0: Creating m4/paxutils.m4"
+(echo "# This file is generated automatically. Please, do not edit."
+ echo "#"
+ 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
+   :
+else
+   mkdir rmt
+fi
+
+for dir in doc rmt lib tests
+do
+       copy_files ${PAXUTILS_SRCDIR}/$dir $dir
+done
+
+copy_files ${PAXUTILS_SRCDIR}/paxlib lib pax
 
 # Reconfigure, getting other files.
 
 
 # Reconfigure, getting other files.
 
This page took 0.028592 seconds and 4 git commands to generate.