From: joeyh Date: Sat, 24 Nov 2007 21:43:56 +0000 (+0000) Subject: * Allow the delta file to be read or written from stdio. X-Git-Tag: 0.4~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1bed572f62fec391f2df57fa3883184341320373;p=tools%2Fpristine-tar.git * Allow the delta file to be read or written from stdio. * Fix man page synopses formatting. --- diff --git a/debian/changelog b/debian/changelog index 32f612b..e5943de 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +pristine-tar (0.4) UNRELEASED; urgency=low + + * Allow the delta file to be read or written from stdio. + * Fix man page synopses formatting. + + -- Joey Hess Sat, 24 Nov 2007 16:36:57 -0500 + pristine-tar (0.3) unstable; urgency=low * pristine-tar sometimes got confused about tarballs that did not unpack diff --git a/pristine-gz b/pristine-gz index 281656f..3602763 100755 --- a/pristine-gz +++ b/pristine-gz @@ -7,6 +7,7 @@ pristine-gz - regenerate pristine gz files =head1 SYNOPSIS B [-vdk] gengz delta file + B [-vdk] gendelta file.gz delta =head1 DESCRIPTION @@ -36,6 +37,8 @@ no delta will be generated. One example of a case it cannot currently support is a gz file that has been produced by appending together multiple gz files. +If the delta filename is "-", pristine-gz reads or writes it to stdio. + =head1 OPTIONS =over 4 @@ -304,6 +307,15 @@ sub gengz { my $file=shift; my $tempdir=tempdir(); + + if ($delta eq "-") { + $delta="$tempdir/in"; + open (OUT, ">", $delta) || die "$delta: $!"; + while () { + print OUT $_; + } + close OUT; + } doit("tar", "xf", File::Spec->rel2abs($delta), "-C", $tempdir); if (! -e "$tempdir/type") { @@ -366,6 +378,13 @@ sub gendelta { my $delta=shift; my $tempdir=tempdir(); + + my $stdout=0; + if ($delta eq "-") { + $stdout=1; + $delta="$tempdir/out"; + } + my @files=qw(version type params filename timestamp); doit("cp", $gzfile, "$tempdir/test.gz"); @@ -389,6 +408,10 @@ sub gendelta { close OUT; doit("tar", "czf", $delta, "-C", $tempdir, @files); + + if ($stdout) { + doit("cat", $delta); + } } Getopt::Long::Configure("bundling"); diff --git a/pristine-tar b/pristine-tar index a60dd0e..90d80ae 100755 --- a/pristine-tar +++ b/pristine-tar @@ -7,6 +7,7 @@ pristine-tar - regenerate pristine tarballs =head1 SYNOPSIS B [-vdk] gentar delta tarball + B [-vdk] gendelta tarball delta =head1 DESCRIPTION @@ -28,6 +29,8 @@ revison control. pristine-tar supports compressed tarballs, calling out to pristine-gz(1) to produce the pristine gzip files. +If the delta filename is "-", pristine-tar reads or writes it to stdio. + =head1 OPTIONS =over 4 @@ -212,6 +215,15 @@ sub gentar { my $tempdir=tempdir(); + if ($delta eq "-") { + $delta="$tempdir/in"; + open (OUT, ">", $delta) || die "$delta: $!"; + while () { + print OUT $_; + } + close OUT; + } + doit("tar", "xf", File::Spec->rel2abs($delta), "-C", $tempdir); if (! -e "$tempdir/type") { die "failed to gentar delta $delta\n"; @@ -251,6 +263,13 @@ sub gendelta { my $delta=shift; my $tempdir=tempdir(); + + my $stdout=0; + if ($delta eq "-") { + $stdout=1; + $delta="$tempdir/out"; + } + my @files=qw(delta manifest version type); # Check to see if it's compressed. @@ -307,6 +326,10 @@ sub gendelta { close OUT; doit("tar", "czf", $delta, "-C", $tempdir, @files); + + if ($stdout) { + doit("cat", $delta); + } } Getopt::Long::Configure("bundling");