Sfoglia il codice sorgente

Dpkg::Source::Package::V3::quilt: check debian/patches{,series} before build

Before accepting to build a 3.0 (quilt) source packages, ensure that
debian/patches is a directory (or non-existing) and that
debian/patches/series is a file (or non-existing).
Raphaël Hertzog 16 anni fa
parent
commit
e1b5e94395
2 ha cambiato i file con 21 aggiunte e 0 eliminazioni
  1. 3 0
      debian/changelog
  2. 18 0
      scripts/Dpkg/Source/Package/V3/quilt.pm

+ 3 - 0
debian/changelog

@@ -13,6 +13,9 @@ dpkg (1.15.5.3) UNRELEASED; urgency=low
   * When building "3.0 (quilt)" source packages, use QUILT_PATCH_OPTS="-t -F 0
     -N -u -V never -g0" so that quilt is as strict as dpkg-source's internal
     implementation of quilt. Closes: #557664
+  * Before accepting to build a 3.0 (quilt) source packages, ensure that
+    debian/patches is a directory (or non-existing) and that
+    debian/patches/series is a file (or non-existing). Closes: #557618
 
   [ Guillem Jover ]
   * Verify that the alternative used in update-alternatives --set has been

+ 18 - 0
scripts/Dpkg/Source/Package/V3/quilt.pm

@@ -55,6 +55,24 @@ sub parse_cmdline_option {
     return 0;
 }
 
+sub can_build {
+    my ($self, $dir) = @_;
+    my ($code, $msg) = $self->SUPER::can_build($dir);
+    return ($code, $msg) if $code eq 0;
+    my $pd = File::Spec->catdir($dir, "debian", "patches");
+    if (-e $pd and not -d _) {
+        return (0, sprintf(_g("%s should be a directory or non-existing"), $pd));
+    }
+    my $series_vendor = $self->get_series_file($dir);
+    my $series_main = File::Spec->catfile($pd, "series");
+    foreach my $series ($series_vendor, $series_main) {
+        if (defined($series) and -e $series and not -f _) {
+            return (0, sprintf(_g("%s should be a file or non-existing"), $series));
+        }
+    }
+    return (1, "");
+}
+
 sub get_autopatch_name {
     my ($self) = @_;
     return "debian-changes-" . $self->{'fields'}{'Version'};