summaryrefslogtreecommitdiff
path: root/gettext-tools/misc/add-to-archive
blob: f3f17427af3fbf33c4a5007f43e58e5beaeddb4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#! /bin/sh
#
# Copyright (C) 2002, 2006 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)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#

# Usage: add-to-archive /somewhere/gettext-0.xx.yy.tar.gz
# Adds the infrastructure files for gettext version 0.xx.yy to the compressed
# CVS repository in the archive.tar.gz file.

if test $# != 1; then
  echo "Usage: add-to-archive /somewhere/gettext-0.xx.yy.tar.gz"
  exit 1
fi

sourcetgz="$1"
case "$sourcetgz" in
  *.tar.gz) ;;
  *) echo "$0: first argument should be a gettext release tar.gz file"; exit 1;;
esac

pack_ver=`basename "$sourcetgz" | sed -e 's/\.tar\.gz$//'`
if test -d "$pack_ver"; then
  echo "$0: directory $pack_ver already exists"; exit 1
fi
pack=`echo "$pack_ver" | sed -e 's/^\([^-]*\)-.*/\1/'`
ver=`echo "$pack_ver" | sed -e 's/^[^-]*-\(.*\)/\1/'`

# Set a nonstandard variable, for a good-looking cvs history.
cvsuser=bruno
gcc -shared -O cvsuser.c -o cvsuser.so
cvsuser_hack=`pwd`/cvsuser.so

# Unpack, build and install the source distribution.
myprefix=`pwd`/${pack_ver}-inst
gunzip -c < "$sourcetgz" | tar xvf -
cd $pack_ver
./configure --prefix="$myprefix"
make
make install
cd ..
rm -rf $pack_ver

# Copy the relevant files into an empty directory.
work_dir=tmpwrk$$
mkdir "$work_dir"
mkdir "$work_dir/archive"
work_archive=`pwd`/"$work_dir/archive"
(cd "$myprefix"/share/gettext
 for file in *; do
   case $file in
     ABOUT-NLS)
       cp -p $file "$work_archive/$file" ;;
     config.rpath)
       cp -p $file "$work_archive/$file" ;;
   esac
 done
 mkdir "$work_archive/intl"
 cd intl
 for file in *; do
   if test $file != COPYING.LIB-2 && test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then
     cp -p $file "$work_archive/intl/$file"
   fi
 done
 cd ..
 mkdir "$work_archive/po"
 cd po
 for file in *; do
   if test $file != Makevars; then
     cp -p $file "$work_archive/po/$file"
   fi
 done
 cd ..
 mkdir "$work_archive/m4"
 cd "$myprefix"/share/aclocal
 for file in *; do
   cp -p $file "$work_archive/m4/$file"
 done
)

# Add the contents of this directory to the repository.
cvsroot=`pwd`/autopoint-files
mkdir "$cvsroot"
cvs -d "$cvsroot" init
(cd autopoint-files && tar xvfz ../archive.tar.gz)
cvsver=$pack-`echo "$ver" | sed -e 's/\./_/g'`
(cd "$work_archive"
 CVSUSER=$cvsuser LD_PRELOAD=$cvsuser_hack \
 cvs -d "$cvsroot" import -m "Import $pack_ver" archive release "$cvsver"
)
(cd autopoint-files && tar cvfz ../archive.tar.gz --owner=root --group=root archive)
(cd autopoint-files && du archive)

# Clean up.
rm -rf "$cvsroot"
rm -rf "$work_dir"
rm -rf "$myprefix"

exit 0