Home | History | Annotate | Line # | Download | only in misc
add-to-archive revision 1.1
      1 #! /bin/sh
      2 #
      3 # Copyright (C) 2002, 2006 Free Software Foundation, Inc.
      4 #
      5 # This program is free software; you can redistribute it and/or modify
      6 # it under the terms of the GNU General Public License as published by
      7 # the Free Software Foundation; either version 2, or (at your option)
      8 # any later version.
      9 #
     10 # This program is distributed in the hope that it will be useful,
     11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 # GNU General Public License for more details.
     14 #
     15 # You should have received a copy of the GNU General Public License
     16 # along with this program; if not, write to the Free Software Foundation,
     17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     18 #
     19 
     20 # Usage: add-to-archive /somewhere/gettext-0.xx.yy.tar.gz
     21 # Adds the infrastructure files for gettext version 0.xx.yy to the compressed
     22 # CVS repository in the archive.tar.gz file.
     23 
     24 if test $# != 1; then
     25   echo "Usage: add-to-archive /somewhere/gettext-0.xx.yy.tar.gz"
     26   exit 1
     27 fi
     28 
     29 sourcetgz="$1"
     30 case "$sourcetgz" in
     31   *.tar.gz) ;;
     32   *) echo "$0: first argument should be a gettext release tar.gz file"; exit 1;;
     33 esac
     34 
     35 pack_ver=`basename "$sourcetgz" | sed -e 's/\.tar\.gz$//'`
     36 if test -d "$pack_ver"; then
     37   echo "$0: directory $pack_ver already exists"; exit 1
     38 fi
     39 pack=`echo "$pack_ver" | sed -e 's/^\([^-]*\)-.*/\1/'`
     40 ver=`echo "$pack_ver" | sed -e 's/^[^-]*-\(.*\)/\1/'`
     41 
     42 # Set a nonstandard variable, for a good-looking cvs history.
     43 cvsuser=bruno
     44 gcc -shared -O cvsuser.c -o cvsuser.so
     45 cvsuser_hack=`pwd`/cvsuser.so
     46 
     47 # Unpack, build and install the source distribution.
     48 myprefix=`pwd`/${pack_ver}-inst
     49 gunzip -c < "$sourcetgz" | tar xvf -
     50 cd $pack_ver
     51 ./configure --prefix="$myprefix"
     52 make
     53 make install
     54 cd ..
     55 rm -rf $pack_ver
     56 
     57 # Copy the relevant files into an empty directory.
     58 work_dir=tmpwrk$$
     59 mkdir "$work_dir"
     60 mkdir "$work_dir/archive"
     61 work_archive=`pwd`/"$work_dir/archive"
     62 (cd "$myprefix"/share/gettext
     63  for file in *; do
     64    case $file in
     65      ABOUT-NLS)
     66        cp -p $file "$work_archive/$file" ;;
     67      config.rpath)
     68        cp -p $file "$work_archive/$file" ;;
     69    esac
     70  done
     71  mkdir "$work_archive/intl"
     72  cd intl
     73  for file in *; do
     74    if test $file != COPYING.LIB-2 && test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then
     75      cp -p $file "$work_archive/intl/$file"
     76    fi
     77  done
     78  cd ..
     79  mkdir "$work_archive/po"
     80  cd po
     81  for file in *; do
     82    if test $file != Makevars; then
     83      cp -p $file "$work_archive/po/$file"
     84    fi
     85  done
     86  cd ..
     87  mkdir "$work_archive/m4"
     88  cd "$myprefix"/share/aclocal
     89  for file in *; do
     90    cp -p $file "$work_archive/m4/$file"
     91  done
     92 )
     93 
     94 # Add the contents of this directory to the repository.
     95 cvsroot=`pwd`/autopoint-files
     96 mkdir "$cvsroot"
     97 cvs -d "$cvsroot" init
     98 (cd autopoint-files && tar xvfz ../archive.tar.gz)
     99 cvsver=$pack-`echo "$ver" | sed -e 's/\./_/g'`
    100 (cd "$work_archive"
    101  CVSUSER=$cvsuser LD_PRELOAD=$cvsuser_hack \
    102  cvs -d "$cvsroot" import -m "Import $pack_ver" archive release "$cvsver"
    103 )
    104 (cd autopoint-files && tar cvfz ../archive.tar.gz --owner=root --group=root archive)
    105 (cd autopoint-files && du archive)
    106 
    107 # Clean up.
    108 rm -rf "$cvsroot"
    109 rm -rf "$work_dir"
    110 rm -rf "$myprefix"
    111 
    112 exit 0
    113