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