summaryrefslogtreecommitdiff
path: root/debian/tarball.sh
diff options
context:
space:
mode:
Diffstat (limited to 'debian/tarball.sh')
-rwxr-xr-xdebian/tarball.sh101
1 files changed, 76 insertions, 25 deletions
diff --git a/debian/tarball.sh b/debian/tarball.sh
index 6fdcc22..a873715 100755
--- a/debian/tarball.sh
+++ b/debian/tarball.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2004, 2005 Guillem Jover <guillem@debian.org>
+# Copyright © 2004, 2005, 2007, 2009 Guillem Jover <guillem@debian.org>
#
# 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
@@ -8,45 +8,96 @@
# (at your option) any later version.
#
-PKG=inetutils
-export CVSROOT=":pserver:anonymous@cvs.sv.gnu.org:/sources/$PKG"
-
set -e
+set -u
+
+pkg=inetutils
+pkg_file=libinetutils
+
+action=$1
+shift
-SRCDIR="$PKG-snapshot"
+get_version()
+{
+ local d=$1
-case "$1" in
+ echo $(grep ^AC_INIT $d/configure.ac | sed -e 's/.*, *\[\([^,]*\)\] *,.*/\1/')
+}
+
+echo "-> getting the source."
+case "$action" in
snapshot)
- echo "-> getting new snapshot."
-# cvs login
- cvs -z3 co -d $SRCDIR $PKG
+ echo " -> making a git snapshot."
+
+ snapshot_dir="$pkg-snapshot"
+
+ if [ -d $snapshot_dir ]; then
+ cd $snapshot_dir
+ git pull
+ cd ..
+ else
+ git clone git://git.sv.gnu.org/inetutils.git $snapshot_dir
+ fi
+
+ echo " -> bootstrapping source tree form gnulib."
+ cd $snapshot_dir
+ ./bootstrap --copy
+ cd ..
+
+ version="$(get_version $snapshot_dir)+$(date +%Y%m%d)"
;;
- update)
- echo "-> updating snapshot."
- cvs -z3 up -dP $SRCDIR
+ tarball)
+ echo " -> unpacking upstream tarball."
+
+ upstream_dir="$pkg-tarball"
+ upstream_tarball=$1
+
+ mkdir $upstream_dir
+ cd $upstream_dir
+ tar xzf ../$upstream_tarball --strip 1
+ cd ..
+
+ version=$(get_version $upstream_dir)
;;
esac
-if ! [ -e $SRCDIR/libinetutils ]
+tarball=${pkg}_${version}.orig.tar.gz
+tree=${pkg}-${version}
+
+echo "-> filling the working tree."
+case "$action" in
+ snapshot)
+ cp -al $snapshot_dir $tree
+ ;;
+ tarball)
+ mv $upstream_dir $tree
+ ;;
+esac
+
+if ! [ -e $tree/$pkg_file ]
then
- echo "error: no $PKG source dir available."
+ echo "error: no $pkg tree available."
exit 1
fi
-echo "-> creating new directory tree."
-VERSION=$(grep ^AC_INIT $SRCDIR/configure.ac | \
- sed -e 's/.*, *\[\([^,]*\)\] *,.*/\1/')
-SNAPSHOTVERSION="$VERSION+$(date +%Y%m%d)"
-TARBALLDIR="$PKG-$SNAPSHOTVERSION"
-cp -al $SRCDIR $TARBALLDIR
+echo "-> cleaning tree."
+# Clean non-free stuff
+: nothing to clean
+
+# Clean junk from CVS to git conversion
+rm -rf $tree/Attic
+
+# Clean bootstrap and autofoo stuff
+rm -rf $tree/autom4te.cache
+rm -rf $tree/gnulib
-echo "-> cleaning snapshot."
-# Clean cvs stuff
-find $TARBALLDIR -name 'CVS' -o -name '.cvsignore' | xargs rm -rf
+# Clean vcs stuff
+find $tree -name 'CVS' -o -name '.cvsignore' -o \
+ -name '.git' -o -name '.gitignore' | xargs rm -rf
echo "-> creating new tarball."
-tar czf ${PKG}_$SNAPSHOTVERSION.orig.tar.gz $TARBALLDIR
+tar czf $tarball $tree
echo "-> cleaning directory tree."
-rm -rf $TARBALLDIR
+rm -rf $tree