Whamcloud - gitweb
e2fsck: merge EA blocks properly
[tools/e2fsprogs.git] / util / gen-tarball.in
index e550e2c..650d3b5 100644 (file)
@@ -5,50 +5,47 @@
 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_ver=`echo @E2FSPROGS_PKGVER@`
+base_rel=`echo @E2FSPROGS_PKGREL@`
 base_e2fsprogs=`basename $top_dir`
-exclude=/tmp/exclude
+exclude=/tmp/exclude$$
+GZIP=gzip
 
 #
 # This hack is needed because texi2dvi blows up horribly if there are 
-# any '~' chracters in the directory pathname.  So we kludge around it by
+# 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'`
+deb_pkgver="$base_ver${base_rel:+-$base_rel}"
     
 case $1 in
     debian|ubuntu)
        SRCROOT="e2fsprogs-$deb_pkgver"
-       rename_tarball="e2fsprogs_@E2FSPROGS_PKGVER@.orig.tar.gz"
-       list=all
-       ;;
-    subset)
-       SRCROOT="e2fsprogs-libs-$base_ver"
-       list=subset
+       tarout="e2fsprogs_$deb_pkgver.orig.tar.gz"
        ;;
    all|*)
        SRCROOT="e2fsprogs-$base_ver"
-       list=all
+       tarout="$SRCROOT.tar.gz"
        ;;
 esac
 
-mv ../e2fsprogs.spec $top_srcdir/e2fsprogs.spec
+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) | sed -e "s/^$base_e2fsprogs/$SRCROOT/" > $exclude
-sed -e "s;^;$SRCROOT/;" < $srcdir/$list.exclude >> $exclude
+               -print) > $exclude
+sed -e "s;^;$base_e2fsprogs/;" < $srcdir/all.exclude >> $exclude
 
-(cd $top_srcdir/.. ; rm -f $SRCROOT ; ln -sf e2fsprogs $SRCROOT)
-
-(cd $top_srcdir/.. ; tar -c -h -v -f - -X $exclude $SRCROOT) \
-        | gzip -9 > $SRCROOT.tar.gz
-
-(cd $top_srcdir/.. ; rm -f $SRCROOT)
-mv $top_srcdir/e2fsprogs.spec ../e2fsprogs.spec 
-if test -n "$rename_tarball"; then
-    mv $SRCROOT.tar.gz $rename_tarball
-fi
+(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"