aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2018-08-18 00:06:40 -0400
committerTheodore Ts'o <tytso@mit.edu>2018-08-18 00:06:40 -0400
commit748d60575c6ed9f0c8bafd124477b10212186cb0 (patch)
treeb51b786f259d4b124950e0845fe1db8fdb139dea /util
parent80a55276b3738e94581c9e92dc45a0358c81f67c (diff)
downloade2fsprogs-748d60575c6ed9f0c8bafd124477b10212186cb0.tar.gz
gen-tarball: handle symlinks correctly in the created the tar file
Now that we use a symlink for the top-level RELEASE-NOTES file, the previous strategy of using a symlink to force the prefix in the tar file and then using tar -h won't work. So change how we generate the tar file to take advantage of GNU tar's --transform option. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'util')
-rw-r--r--util/gen-tarball.in26
1 files changed, 12 insertions, 14 deletions
diff --git a/util/gen-tarball.in b/util/gen-tarball.in
index 6b90acb6..e87f287a 100644
--- a/util/gen-tarball.in
+++ b/util/gen-tarball.in
@@ -7,7 +7,7 @@ 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
+exclude=/tmp/exclude$$
GZIP=gzip
#
@@ -21,15 +21,17 @@ deb_pkgver=`echo @E2FSPROGS_PKGVER@ | sed -e 's/~/-/g'`
case $1 in
debian|ubuntu)
SRCROOT="e2fsprogs-$deb_pkgver"
- rename_tarball="e2fsprogs_@E2FSPROGS_PKGVER@.orig.tar.gz"
+ tarout="e2fsprogs_@E2FSPROGS_PKGVER@.orig.tar.gz"
list=all
;;
subset)
SRCROOT="e2fsprogs-libs-$base_ver"
+ tarout="$SRCROOT.tar.gz"
list=subset
;;
all|*)
SRCROOT="e2fsprogs-$base_ver"
+ tarout="$SRCROOT.tar.gz"
list=all
;;
esac
@@ -44,19 +46,15 @@ mv ../e2fsprogs.spec $top_srcdir/e2fsprogs.spec
-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
-
-(cd $top_srcdir/.. ; rm -f $SRCROOT ; ln -sf $base_e2fsprogs $SRCROOT)
+ -print) > $exclude
+sed -e "s;^;$base_e2fsprogs/;" < $srcdir/$list.exclude >> $exclude
(cd $top_srcdir/.. ; \
- tar -c -h -f - -X $exclude --sort=name --owner=0 --group=0 \
- --numeric-owner --mtime="@${SOURCE_DATE_EPOCH}" $SRCROOT) \
- | $GZIP -9n -c > $SRCROOT.tar.gz
-$GZIP -l $SRCROOT.tar.gz
+ 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"
-(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