[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Perl expert wanted to solve dpkg-source bug#16415, please



On Mon, Jan 11, 1999 at 10:57:40PM +0000, Oliver Elphick wrote:
> I need a solution to this dpkg-source bug, because it is preventing
> one of my packages from being extracted.

Damnit, scratch the last patch. It works but doesn't take errors into
account as well as it should. This is the "better" one. :)

sorry for not testing it as much as i should have.

--
-----    -- - -------- --------- ----  -------  -----  - - ---   --------
Ben Collins <b.m.collins@larc.nasa.gov>                  Debian GNU/Linux
UnixGroup Admin - Jordan Systems Inc.                 bcollins@debian.org
------ -- ----- - - -------   ------- -- The Choice of the GNU Generation
--- /usr/bin/dpkg-source	Sun Nov  1 12:50:44 1998
+++ dpkg-source	Mon Jan 11 20:03:25 1999
@@ -511,7 +511,31 @@
         $/="\n";
         while (<GZIP>) {
             s/\n$// || &error("diff is missing trailing newline");
-            if (/^--- /) {
+	    if (/^\@\@ .* \@\@$/) {
+		@patch_args = split(' ', $_);
+		($dump, $after_lines) = split(',', $patch_args[2]);
+		if ($after_lines eq "") { $after_lines = $dump; }
+		($dump, $before_lines) = split(',', $patch_args[1]);
+		$count_before = 0;
+		$count_after = 0;
+		while ($after_lines > $count_after || $before_lines > $count_before) {
+		    $_= <GZIP>; s/\n$// ||
+			&error("diff finishes in middle of file patch (line $.)");
+		    if (/^\+/) {
+			$count_after++;
+		    } elsif (/^-/) {
+			$count_before++;
+		    } elsif (/^ /) {
+			$count_after++;
+			$count_before++;
+		    } elsif (/^@/) {
+			&error("premature finish to file patch (line $.)");
+		    } elsif (/^\\ No newline at end of file$/) {
+		    } else {
+			&error ("diff contains unknown line \`$_'");
+		    }
+		}
+	    } elsif (/^--- /) {
                 $fn= $';
                 substr($fn,0,length($expectprefix)+1) eq "$expectprefix/" ||
                     &error("diff patches file ($fn) not in expected subdirectory");
@@ -529,9 +553,8 @@
                     &error("line after --- for file $fn isn't as expected");
                 $filepatched{$fn}++ && &error("diff patches file $fn twice");
             } elsif (/^\\ No newline at end of file$/) {
-            } elsif (/^[-+ \@]/) {
 	    } else {
-                &error ("diff contains unknown line \`$_'");
+                &error ("diff contains unknown line \`$_' (line $.)");
             }
         }
         close(GZIP);

Attachment: pgp5Ms7WCLnS3.pgp
Description: PGP signature


Reply to: