summaryrefslogtreecommitdiffstats
path: root/util/gen-tarball.in
blob: 997bd935f7306261881ced6fdf5557e9c6f2780e (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
#!/bin/sh
#
# This script is used to generate the distribution tarball
#
srcdir=@srcdir@
top_srcdir=@top_srcdir@
top_dir=`cd $top_srcdir; pwd`
base_ver=`echo @E2FSPROGS_VERSION@ | sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
base_e2fsprogs=`basename $top_dir`
exclude=/tmp/exclude$$
GZIP=gzip

#
# This hack is needed because texi2dvi blows up horribly if there are 
# any '~' characters in the directory pathname.  So we kludge around it by
# using a non-standard directory name for WIP releases.  dpkg-source
# complains, but life goes on.
#
deb_pkgver=`echo @E2FSPROGS_PKGVER@ | sed -e 's/~/-/g'`
    
case $1 in
    debian|ubuntu)
	SRCROOT="e2fsprogs-$deb_pkgver"
	tarout="e2fsprogs_@E2FSPROGS_PKGVER@.orig.tar.gz"
	;;
   all|*)
	SRCROOT="e2fsprogs-$base_ver"
	tarout="$SRCROOT.tar.gz"
	;;
esac

if test -z "$SOURCE_DATE_EPOCH" ; then
    export SOURCE_DATE_EPOCH=$(cd $top_srcdir; git log -1 --pretty=%ct)
fi

(cd $top_srcdir/.. ; find $base_e2fsprogs \( -name \*~ -o -name \*.orig \
		-o -name CVS -o -name \*.rej -o -name Makefile.pq \
		-o -name TAGS -o -name \*.old -o -name SCCS \
		-o -name changed-files -o -name .#\* -o -name \*.tar.gz \
		-o -name autom4te.cache \) \
		-print) > $exclude
sed -e "s;^;$base_e2fsprogs/;" < $srcdir/all.exclude >> $exclude

(cd $top_srcdir/.. ; \
 tar -c -f - -X $exclude --sort=name --owner=0 --group=0 \
     --transform "flags=r;s|^$base_e2fsprogs|$SRCROOT|" \
     --numeric-owner --mtime="@${SOURCE_DATE_EPOCH}" $base_e2fsprogs) \
    | $GZIP -9n -c > $tarout
$GZIP -ln $tarout
rm -f "$exclude"