From: Markus Lehtonen Date: Mon, 3 Jun 2013 11:00:29 +0000 (+0300) Subject: Use 'posix' tar format and implement tar format guessing X-Git-Tag: tizen/1.30-20140227~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5bce1938e7765812765bf77d2d45559fd2e35600;p=tools%2Fpristine-tar.git Use 'posix' tar format and implement tar format guessing Fixes bug #998. Change-Id: I54e7ab56bd80cf87e11be5c45e88a1bd50b60d17 Signed-off-by: Markus Lehtonen --- diff --git a/debian/changelog b/debian/changelog index 455dadf..8e9e43f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +pristine-tar (1.28-1) unstable; urgency=low + + * Fixes Bug #998 + - Mangle PAX headers when using posix tar format + - Use posix tar format by default + - implement tar format guessing + * change format to 3.0 (quilt) + + -- Markus Lehtonen Mon, 10 Jun 2013 11:26:45 +0300 + pristine-tar (1.28-0) unstable; urgency=low * Change to non-native: add RPM packaging files diff --git a/debian/patches/0005-pristine-gz-obey-the-XDELTA_PROGRAM-build-parameter.patch b/debian/patches/0005-pristine-gz-obey-the-XDELTA_PROGRAM-build-parameter.patch new file mode 100644 index 0000000..b3bbab9 --- /dev/null +++ b/debian/patches/0005-pristine-gz-obey-the-XDELTA_PROGRAM-build-parameter.patch @@ -0,0 +1,44 @@ +From: Markus Lehtonen +Date: Fri, 31 May 2013 11:01:05 +0300 +Subject: pristine-gz: obey the XDELTA_PROGRAM build parameter + +Change-Id: I571466bacc8b50a7b2d2c7681b4d7ab1083508ad +Signed-off-by: Markus Lehtonen +--- + pristine-gz | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/pristine-gz b/pristine-gz +index 3668256..00c0055 100755 +--- a/pristine-gz ++++ b/pristine-gz +@@ -96,6 +96,11 @@ use File::Basename qw/basename/; + + delete $ENV{GZIP}; + ++# The following assignment is potentially munged during the ++# build process to hold the value of XDELTA_PROGRAM ++# parameter as given to Makefile.PL. ++my $xdelta_program = "xdelta"; ++ + dispatch( + commands => { + usage => [\&usage], +@@ -234,7 +239,7 @@ sub reproducegz { + else { + # generate a binary delta and see if this is the + # best variant so far +- my $ret=system("xdelta delta -0 --pristine $tempout $orig $tempdir/tmpdelta 2>/dev/null") >> 8; ++ my $ret=system("$xdelta_program delta -0 --pristine $tempout $orig $tempdir/tmpdelta 2>/dev/null") >> 8; + # xdelta exits 1 on success + if ($ret == 1) { + my $size=(stat("$tempdir/tmpdelta"))[7]; +@@ -297,7 +302,7 @@ sub gengz { + my $tempdir=tempdir(); + my $tfile="$tempdir/".basename($file).".gz"; + doit_redir($file, $tfile, @zgz); +- doit("xdelta", "patch", "--pristine", $delta->{delta}, $tfile, "$file.gz"); ++ doit("$xdelta_program", "patch", "--pristine", $delta->{delta}, $tfile, "$file.gz"); + } + else { + doit_redir("$file", "$file.gz", @zgz); diff --git a/debian/patches/0007-implement-tar-format-guessing.patch b/debian/patches/0007-implement-tar-format-guessing.patch new file mode 100644 index 0000000..028d02b --- /dev/null +++ b/debian/patches/0007-implement-tar-format-guessing.patch @@ -0,0 +1,60 @@ +From: Markus Lehtonen +Date: Fri, 31 May 2013 12:45:51 +0300 +Subject: implement tar format guessing + +Try "posix" and "gnu" formats if tarball re-creation with the default +tar format fails. + +Makes pristine-tar more compatible accross different Linux distributions +as the default format used by tar varies. + +Change-Id: I3c345a632f8b02b723a6151b08dc36521fe5646b +Signed-off-by: Markus Lehtonen +--- + pristine-tar | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +diff --git a/pristine-tar b/pristine-tar +index 14bac15..1c321d4 100755 +--- a/pristine-tar ++++ b/pristine-tar +@@ -343,18 +343,23 @@ sub recreatetarball { + + delete $ENV{TAR_LONGLINK_100}; + $recreatetarball_tempdir=$tempdir; +- return recreatetarball_helper(); ++ return recreatetarball_helper(%options); + } + + sub recreatetarball_helper { ++ my %options=@_; + my $tempdir=$recreatetarball_tempdir; + + my $ret="$tempdir/recreatetarball"; ++ my @cmd=($tar_program, "cf", $ret, "--owner", 0, "--group", 0, ++ "--numeric-owner", "-C", "$tempdir/workdir", ++ "--no-recursion", "--mode", "0644", ++ "--files-from", "$tempdir/manifest"); ++ if (exists $options{tar_format}) { ++ push @cmd, ("-H", $options{tar_format}); ++ } + +- doit($tar_program, "cf", $ret, "--owner", 0, "--group", 0, +- "--numeric-owner", "-C", "$tempdir/workdir", +- "--no-recursion", "--mode", "0644", +- "--files-from", "$tempdir/manifest"); ++ doit(@cmd); + + return $ret; + } +@@ -393,6 +398,10 @@ sub gentar { + push @try, sub { recreatetarball($delta->{manifest}, getcwd, + clobber_source => 0, %opts) }; + push @try, \&recreatetarball_longlink_100; ++ push @try, sub { recreatetarball($delta->{manifest}, getcwd, ++ clobber_source => 0, tar_format => "gnu", %opts) }; ++ push @try, sub { recreatetarball($delta->{manifest}, getcwd, ++ clobber_source => 0, tar_format => "posix", %opts) }; + + my $ok; + foreach my $variant (@try) { diff --git a/debian/patches/0008-Use-posix-tar-format-by-default.patch b/debian/patches/0008-Use-posix-tar-format-by-default.patch new file mode 100644 index 0000000..cf712c1 --- /dev/null +++ b/debian/patches/0008-Use-posix-tar-format-by-default.patch @@ -0,0 +1,54 @@ +From: Markus Lehtonen +Date: Fri, 31 May 2013 13:51:40 +0300 +Subject: Use posix tar format by default + +Should lead to smaller deltas as e.g. git-archive produces tarballs in +posix format. + +The tar format guessing makes sure that pristine-tar commits generated +with "gnu" tar format also are usable. + +Change-Id: I52c20b81c4b02ec22d3744d49b64415af14e0ab4 +Signed-off-by: Markus Lehtonen +--- + pristine-tar | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/pristine-tar b/pristine-tar +index 1c321d4..f1fae98 100755 +--- a/pristine-tar ++++ b/pristine-tar +@@ -396,12 +396,10 @@ sub gentar { + + my @try; + push @try, sub { recreatetarball($delta->{manifest}, getcwd, +- clobber_source => 0, %opts) }; +- push @try, \&recreatetarball_longlink_100; ++ clobber_source => 0, tar_format => "posix", %opts) }; + push @try, sub { recreatetarball($delta->{manifest}, getcwd, + clobber_source => 0, tar_format => "gnu", %opts) }; +- push @try, sub { recreatetarball($delta->{manifest}, getcwd, +- clobber_source => 0, tar_format => "posix", %opts) }; ++ push @try, \&recreatetarball_longlink_100; + + my $ok; + foreach my $variant (@try) { +@@ -511,7 +509,8 @@ sub gendelta { + if ($#out == 0 && -d $out[0]) { + $sourcedir=$out[0]; + } +- $recreatetarball=recreatetarball("$tempdir/manifest", $sourcedir, clobber_source => 1); ++ $recreatetarball=recreatetarball("$tempdir/manifest", $sourcedir, ++ clobber_source => 1, tar_format => "posix"); + } + else { + $recreatetarball=$opts{recreatetarball}; +@@ -778,7 +777,7 @@ sub commit { + my ($sourcedir, $id)=export($upstream); + genmanifest($tarball, "$tempdir/manifest"); + my $recreatetarball=recreatetarball("$tempdir/manifest", $sourcedir, +- clobber_source => 1, create_missing => 1); ++ clobber_source => 1, create_missing => 1, tar_format => "posix"); + my $pid = open(GENDELTA, "-|"); + if (! $pid) { + # child diff --git a/debian/patches/0009-Mangle-PAX-headers-when-using-posix-tar-format.patch b/debian/patches/0009-Mangle-PAX-headers-when-using-posix-tar-format.patch new file mode 100644 index 0000000..bb2b418 --- /dev/null +++ b/debian/patches/0009-Mangle-PAX-headers-when-using-posix-tar-format.patch @@ -0,0 +1,28 @@ +From: Markus Lehtonen +Date: Thu, 6 Jun 2013 14:31:25 +0300 +Subject: Mangle PAX headers when using posix tar format + +Mangle tar PAX headers in order to guarantee that created tarballs are +always identical so that the delta can be applied cleanly. + +Signed-off-by: Markus Lehtonen +--- + pristine-tar | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/pristine-tar b/pristine-tar +index f1fae98..3e92a74 100755 +--- a/pristine-tar ++++ b/pristine-tar +@@ -357,6 +357,11 @@ sub recreatetarball_helper { + "--files-from", "$tempdir/manifest"); + if (exists $options{tar_format}) { + push @cmd, ("-H", $options{tar_format}); ++ if ($options{tar_format} eq 'posix') { ++ # Mangle PAX headers so that created tarballs are always identical ++ # so that delta can be successfully applied ++ push @cmd, ('--pax-option=exthdr.name=%d/PaxHeaders/%f,ctime:=0'); ++ } + } + + doit(@cmd); diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..c034b74 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,4 @@ +0005-pristine-gz-obey-the-XDELTA_PROGRAM-build-parameter.patch +0007-implement-tar-format-guessing.patch +0008-Use-posix-tar-format-by-default.patch +0009-Mangle-PAX-headers-when-using-posix-tar-format.patch diff --git a/packaging/0001-Fix-libbz2.so-version-numbers.patch b/packaging/0001-Fix-libbz2.so-version-numbers.patch index 3dac84a..c2a83e4 100644 --- a/packaging/0001-Fix-libbz2.so-version-numbers.patch +++ b/packaging/0001-Fix-libbz2.so-version-numbers.patch @@ -5,9 +5,11 @@ Subject: Fix libbz2.so version numbers Fixes the .so version number for the suse-bzip2. Otherwise we may get an error from the dynamic linker when trying to run bzip2 from suse-bzip2. +Gbp: Ignore + Signed-off-by: Markus Lehtonen --- - pit/suse-bzip2/Makefile | 4 ++-- + pit/suse-bzip2/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pit/suse-bzip2/Makefile b/pit/suse-bzip2/Makefile diff --git a/packaging/0003-openSUSE-HACK-modify-Makefile-in-upstream-bzip2.patch b/packaging/0003-openSUSE-HACK-modify-Makefile-in-upstream-bzip2.patch index 6aa4c70..45e30a1 100644 --- a/packaging/0003-openSUSE-HACK-modify-Makefile-in-upstream-bzip2.patch +++ b/packaging/0003-openSUSE-HACK-modify-Makefile-in-upstream-bzip2.patch @@ -10,7 +10,7 @@ Gbp: Ignore Change-Id: Id74e43aa3d913d0cb52f3866d5434d5ff92f2aaf Signed-off-by: Markus Lehtonen --- - pit/upstream-bzip2/Makefile | 3 +-- + pit/upstream-bzip2/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pit/upstream-bzip2/Makefile b/pit/upstream-bzip2/Makefile diff --git a/packaging/0004-openSUSE-HACK-enable-special-upstream-bzip2.patch b/packaging/0004-openSUSE-HACK-enable-special-upstream-bzip2.patch index c54d587..ab47a57 100644 --- a/packaging/0004-openSUSE-HACK-enable-special-upstream-bzip2.patch +++ b/packaging/0004-openSUSE-HACK-enable-special-upstream-bzip2.patch @@ -13,8 +13,8 @@ Gbp: Ignore Change-Id: Icfcbee5207e65820248172152623a4dbf4440131 Signed-off-by: Markus Lehtonen --- - Makefile.PL | 5 +++++ - pristine-bz2 | 4 +++- + Makefile.PL | 5 +++++ + pristine-bz2 | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile.PL b/Makefile.PL diff --git a/packaging/0005-pristine-gz-obey-the-XDELTA_PROGRAM-build-parameter.patch b/packaging/0005-pristine-gz-obey-the-XDELTA_PROGRAM-build-parameter.patch index 5a2148e..b3bbab9 100644 --- a/packaging/0005-pristine-gz-obey-the-XDELTA_PROGRAM-build-parameter.patch +++ b/packaging/0005-pristine-gz-obey-the-XDELTA_PROGRAM-build-parameter.patch @@ -5,7 +5,7 @@ Subject: pristine-gz: obey the XDELTA_PROGRAM build parameter Change-Id: I571466bacc8b50a7b2d2c7681b4d7ab1083508ad Signed-off-by: Markus Lehtonen --- - pristine-gz | 9 +++++++-- + pristine-gz | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pristine-gz b/pristine-gz diff --git a/packaging/0006-Add-.gbp.conf.patch b/packaging/0006-Add-.gbp.conf.patch new file mode 100644 index 0000000..3a0c918 --- /dev/null +++ b/packaging/0006-Add-.gbp.conf.patch @@ -0,0 +1,30 @@ +From: Markus Lehtonen +Date: Mon, 13 May 2013 10:36:39 +0300 +Subject: Add .gbp.conf + +Needed for gbp-pq-rpm tool. + +Gbp: Ignore + +Change-Id: Idb1677653b08de7763ccaf7fe001267c06ff3109 +Signed-off-by: Markus Lehtonen +--- + .gbp.conf | 9 +++++++++ + 1 file changed, 9 insertions(+) + create mode 100644 .gbp.conf + +diff --git a/.gbp.conf b/.gbp.conf +new file mode 100644 +index 0000000..361c0ec +--- /dev/null ++++ b/.gbp.conf +@@ -0,0 +1,9 @@ ++[DEFAULT] ++upstream-tag = %(upstreamversion)s ++packaging-dir = packaging ++ ++[git-buildpackage] ++upstream-tag = %(version)s ++ ++[gbp-pq-rpm] ++pq-branch = patch-queue/%(branch)s diff --git a/packaging/0007-implement-tar-format-guessing.patch b/packaging/0007-implement-tar-format-guessing.patch new file mode 100644 index 0000000..028d02b --- /dev/null +++ b/packaging/0007-implement-tar-format-guessing.patch @@ -0,0 +1,60 @@ +From: Markus Lehtonen +Date: Fri, 31 May 2013 12:45:51 +0300 +Subject: implement tar format guessing + +Try "posix" and "gnu" formats if tarball re-creation with the default +tar format fails. + +Makes pristine-tar more compatible accross different Linux distributions +as the default format used by tar varies. + +Change-Id: I3c345a632f8b02b723a6151b08dc36521fe5646b +Signed-off-by: Markus Lehtonen +--- + pristine-tar | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +diff --git a/pristine-tar b/pristine-tar +index 14bac15..1c321d4 100755 +--- a/pristine-tar ++++ b/pristine-tar +@@ -343,18 +343,23 @@ sub recreatetarball { + + delete $ENV{TAR_LONGLINK_100}; + $recreatetarball_tempdir=$tempdir; +- return recreatetarball_helper(); ++ return recreatetarball_helper(%options); + } + + sub recreatetarball_helper { ++ my %options=@_; + my $tempdir=$recreatetarball_tempdir; + + my $ret="$tempdir/recreatetarball"; ++ my @cmd=($tar_program, "cf", $ret, "--owner", 0, "--group", 0, ++ "--numeric-owner", "-C", "$tempdir/workdir", ++ "--no-recursion", "--mode", "0644", ++ "--files-from", "$tempdir/manifest"); ++ if (exists $options{tar_format}) { ++ push @cmd, ("-H", $options{tar_format}); ++ } + +- doit($tar_program, "cf", $ret, "--owner", 0, "--group", 0, +- "--numeric-owner", "-C", "$tempdir/workdir", +- "--no-recursion", "--mode", "0644", +- "--files-from", "$tempdir/manifest"); ++ doit(@cmd); + + return $ret; + } +@@ -393,6 +398,10 @@ sub gentar { + push @try, sub { recreatetarball($delta->{manifest}, getcwd, + clobber_source => 0, %opts) }; + push @try, \&recreatetarball_longlink_100; ++ push @try, sub { recreatetarball($delta->{manifest}, getcwd, ++ clobber_source => 0, tar_format => "gnu", %opts) }; ++ push @try, sub { recreatetarball($delta->{manifest}, getcwd, ++ clobber_source => 0, tar_format => "posix", %opts) }; + + my $ok; + foreach my $variant (@try) { diff --git a/packaging/0008-Use-posix-tar-format-by-default.patch b/packaging/0008-Use-posix-tar-format-by-default.patch new file mode 100644 index 0000000..cf712c1 --- /dev/null +++ b/packaging/0008-Use-posix-tar-format-by-default.patch @@ -0,0 +1,54 @@ +From: Markus Lehtonen +Date: Fri, 31 May 2013 13:51:40 +0300 +Subject: Use posix tar format by default + +Should lead to smaller deltas as e.g. git-archive produces tarballs in +posix format. + +The tar format guessing makes sure that pristine-tar commits generated +with "gnu" tar format also are usable. + +Change-Id: I52c20b81c4b02ec22d3744d49b64415af14e0ab4 +Signed-off-by: Markus Lehtonen +--- + pristine-tar | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/pristine-tar b/pristine-tar +index 1c321d4..f1fae98 100755 +--- a/pristine-tar ++++ b/pristine-tar +@@ -396,12 +396,10 @@ sub gentar { + + my @try; + push @try, sub { recreatetarball($delta->{manifest}, getcwd, +- clobber_source => 0, %opts) }; +- push @try, \&recreatetarball_longlink_100; ++ clobber_source => 0, tar_format => "posix", %opts) }; + push @try, sub { recreatetarball($delta->{manifest}, getcwd, + clobber_source => 0, tar_format => "gnu", %opts) }; +- push @try, sub { recreatetarball($delta->{manifest}, getcwd, +- clobber_source => 0, tar_format => "posix", %opts) }; ++ push @try, \&recreatetarball_longlink_100; + + my $ok; + foreach my $variant (@try) { +@@ -511,7 +509,8 @@ sub gendelta { + if ($#out == 0 && -d $out[0]) { + $sourcedir=$out[0]; + } +- $recreatetarball=recreatetarball("$tempdir/manifest", $sourcedir, clobber_source => 1); ++ $recreatetarball=recreatetarball("$tempdir/manifest", $sourcedir, ++ clobber_source => 1, tar_format => "posix"); + } + else { + $recreatetarball=$opts{recreatetarball}; +@@ -778,7 +777,7 @@ sub commit { + my ($sourcedir, $id)=export($upstream); + genmanifest($tarball, "$tempdir/manifest"); + my $recreatetarball=recreatetarball("$tempdir/manifest", $sourcedir, +- clobber_source => 1, create_missing => 1); ++ clobber_source => 1, create_missing => 1, tar_format => "posix"); + my $pid = open(GENDELTA, "-|"); + if (! $pid) { + # child diff --git a/packaging/0009-Mangle-PAX-headers-when-using-posix-tar-format.patch b/packaging/0009-Mangle-PAX-headers-when-using-posix-tar-format.patch new file mode 100644 index 0000000..bb2b418 --- /dev/null +++ b/packaging/0009-Mangle-PAX-headers-when-using-posix-tar-format.patch @@ -0,0 +1,28 @@ +From: Markus Lehtonen +Date: Thu, 6 Jun 2013 14:31:25 +0300 +Subject: Mangle PAX headers when using posix tar format + +Mangle tar PAX headers in order to guarantee that created tarballs are +always identical so that the delta can be applied cleanly. + +Signed-off-by: Markus Lehtonen +--- + pristine-tar | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/pristine-tar b/pristine-tar +index f1fae98..3e92a74 100755 +--- a/pristine-tar ++++ b/pristine-tar +@@ -357,6 +357,11 @@ sub recreatetarball_helper { + "--files-from", "$tempdir/manifest"); + if (exists $options{tar_format}) { + push @cmd, ("-H", $options{tar_format}); ++ if ($options{tar_format} eq 'posix') { ++ # Mangle PAX headers so that created tarballs are always identical ++ # so that delta can be successfully applied ++ push @cmd, ('--pax-option=exthdr.name=%d/PaxHeaders/%f,ctime:=0'); ++ } + } + + doit(@cmd); diff --git a/packaging/pristine-tar.changes b/packaging/pristine-tar.changes index 068de9f..66bfbb5 100644 --- a/packaging/pristine-tar.changes +++ b/packaging/pristine-tar.changes @@ -1,3 +1,9 @@ +* Mon Jun 03 2013 Markus Lehtonen 1.28 +- Fixes Bug #998 + * Mangle PAX headers when using posix tar format + * Use posix tar format by default + * implement tar format guessing + * Mon May 13 2013 Markus Lehtonen 1.28 - Version bump to 1.28 diff --git a/packaging/pristine-tar.spec b/packaging/pristine-tar.spec index 21e016f..0f72e66 100644 --- a/packaging/pristine-tar.spec +++ b/packaging/pristine-tar.spec @@ -12,6 +12,10 @@ Patch1: 0002-openSUSE-HACK-add-upstream-bzip2-v1.0.6-sources.patch Patch2: 0003-openSUSE-HACK-modify-Makefile-in-upstream-bzip2.patch Patch3: 0004-openSUSE-HACK-enable-special-upstream-bzip2.patch Patch4: 0005-pristine-gz-obey-the-XDELTA_PROGRAM-build-parameter.patch +Patch5: 0006-Add-.gbp.conf.patch +Patch6: 0007-implement-tar-format-guessing.patch +Patch7: 0008-Use-posix-tar-format-by-default.patch +Patch8: 0009-Mangle-PAX-headers-when-using-posix-tar-format.patch Requires: gzip Requires: bzip2 %if 0%{?suse_version} >= 1210 @@ -77,6 +81,14 @@ control. %endif # 0005-pristine-gz-obey-the-XDELTA_PROGRAM-build-parameter.patch %patch4 -p1 +# 0006-Add-.gbp.conf.patch +%patch5 -p1 +# 0007-implement-tar-format-guessing.patch +%patch6 -p1 +# 0008-Use-posix-tar-format-by-default.patch +%patch7 -p1 +# 0009-Mangle-PAX-headers-when-using-posix-tar-format.patch +%patch8 -p1 %build %if 0%{?fedora}