Re: Enable timestamps in diff.gz?
On Thu, Jul 17, 2003 at 12:51:26PM -0500, Adam Heath wrote:
> On Thu, 17 Jul 2003, Marcin Owsiany wrote:
>
> > What do you think of modifying dpkg-source to include the timestamp
> > information in the diff files and invoking patch with -Z ?
>
> older dpkg-source's can't handle diffs with timestamps(it verifies the sanity
> of the diff before applying). This bug needs to be fixed, before we can
> enable timestamps.
>
> Or, we can juse have a whole new source format, where this isn't a problem.
> This is the plan for dpkg 2.0.
I do not see your point, how could a format change be less intrusive than
adding timestamps?
Here is a patch to let dpkg-source honor timestamps, in case it generates
such diff.gz one day.
Denis
Index: dpkg-source.pl
===================================================================
RCS file: /cvs/dpkg/dpkg/scripts/dpkg-source.pl,v
retrieving revision 1.33
diff -u -r1.33 dpkg-source.pl
--- dpkg-source.pl 30 Aug 2002 00:36:44 -0000 1.33
+++ dpkg-source.pl 19 Jul 2003 22:37:27 -0000
@@ -573,6 +573,7 @@
s/\n$// or &error("diff is missing trailing newline");
/^--- / or &error("expected ^--- in line $. of diff");
$fn= $';
+ $fn=~ s/\s.*//;
substr($fn,0,length($expectprefix)+1) eq "$expectprefix/" ||
&error("diff patches file ($fn) not in expected subdirectory");
$fn =~ m/\.dpkg-orig$/ &&
@@ -585,7 +586,8 @@
&error("diff patches something which is not a plain file");
$_= <GZIP>; s/\n$// ||
&error("diff finishes in middle of ---/+++ (line $.)");
- $_ eq '+++ '.$newdirectory.substr($fn,length($expectprefix)) ||
+ my $expectedline = '+++ '.$newdirectory.substr($fn,length($expectprefix));
+ $_ =~ m/^\Q$expectedline\E(\s.*)?$/ ||
&error("line after --- for file $fn isn't as expected");
$filepatched{$fn}++ && &error("diff patches file $fn twice");
# read hunks
@@ -690,7 +692,7 @@
chdir($newdirectory) || &syserr("chdir to $newdirectory for patch");
$ENV{'LC_ALL'}= 'C';
$ENV{'LANG'}= 'C';
- exec('patch','-s','-t','-F','0','-N','-p1','-u',
+ exec('patch','-s','-t','-F','0','-N','-p1','-u','-Z',
'-V','never','-g0','-b','-z','.dpkg-orig');
&syserr("exec patch");
}
Reply to: