Whamcloud - gitweb
LU-13197 e2fsck: consistently use ext2fs_get_mem()
[tools/e2fsprogs.git] / util / gen-tarball.in
1 #!/bin/sh
2 #
3 # This script is used to generate the distribution tarball
4 #
5 srcdir=@srcdir@
6 top_srcdir=@top_srcdir@
7 top_dir=`cd $top_srcdir; pwd`
8 base_ver=`echo @E2FSPROGS_VERSION@ | sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
9 base_e2fsprogs=`basename $top_dir`
10 exclude=/tmp/exclude$$
11 GZIP=gzip
12
13 #
14 # This hack is needed because texi2dvi blows up horribly if there are 
15 # any '~' characters in the directory pathname.  So we kludge around it by
16 # using a non-standard directory name for WIP releases.  dpkg-source
17 # complains, but life goes on.
18 #
19 deb_pkgver=`echo @E2FSPROGS_PKGVER@ | sed -e 's/~/-/g'`
20     
21 case $1 in
22     debian|ubuntu)
23         SRCROOT="e2fsprogs-$deb_pkgver"
24         tarout="e2fsprogs_@E2FSPROGS_PKGVER@.orig.tar.gz"
25         ;;
26    all|*)
27         SRCROOT="e2fsprogs-$base_ver"
28         tarout="$SRCROOT.tar.gz"
29         ;;
30 esac
31
32 if test -z "$SOURCE_DATE_EPOCH" ; then
33     export SOURCE_DATE_EPOCH=$(cd $top_srcdir; git log -1 --pretty=%ct)
34 fi
35
36 (cd $top_srcdir/.. ; find $base_e2fsprogs \( -name \*~ -o -name \*.orig \
37                 -o -name CVS -o -name \*.rej -o -name Makefile.pq \
38                 -o -name TAGS -o -name \*.old -o -name SCCS \
39                 -o -name changed-files -o -name .#\* -o -name \*.tar.gz \
40                 -o -name autom4te.cache \) \
41                 -print) > $exclude
42 sed -e "s;^;$base_e2fsprogs/;" < $srcdir/all.exclude >> $exclude
43
44 (cd $top_srcdir/.. ; \
45  tar -c -f - -X $exclude --sort=name --owner=0 --group=0 \
46      --transform "flags=r;s|^$base_e2fsprogs|$SRCROOT|" \
47      --numeric-owner --mtime="@${SOURCE_DATE_EPOCH}" $base_e2fsprogs) \
48     | $GZIP -9n -c > $tarout
49 $GZIP -ln $tarout
50 rm -f "$exclude"