Selaa lähdekoodia

Dpkg::Source::Package: Error out on sources w/o any strong digest

This is used by dpkg-source --extract, which can still be disabled with
--no-check.
Guillem Jover 10 vuotta sitten
vanhempi
commit
040973c7a1
2 muutettua tiedostoa jossa 9 lisäystä ja 1 poistoa
  1. 3 0
      debian/changelog
  2. 6 1
      scripts/Dpkg/Source/Package.pm

+ 3 - 0
debian/changelog

@@ -76,6 +76,9 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
     - Add new functions to validate and parse architecture names in Dpkg::Arch.
     - Add new functions to validate and parse architecture names in Dpkg::Arch.
     - Make the dependency parser more strict in Dpkg::Deps. Closes: #784806
     - Make the dependency parser more strict in Dpkg::Deps. Closes: #784806
     - Add strong digest marking support to Dpkg::Checksums.
     - Add strong digest marking support to Dpkg::Checksums.
+    - Error out on source packages without any strong digests in
+      Dpkg::Source::Package, used by dpkg-source --extract, which can still
+      be disabled with --no-check.
   * Build system:
   * Build system:
     - Fix building development documentation.
     - Fix building development documentation.
     - Remove unused UA_LIBS variable.
     - Remove unused UA_LIBS variable.

+ 6 - 1
scripts/Dpkg/Source/Package.pm

@@ -328,15 +328,20 @@ sub get_files {
 
 
 Verify the checksums embedded in the DSC file. It requires the presence of
 Verify the checksums embedded in the DSC file. It requires the presence of
 the other files constituting the source package. If any inconsistency is
 the other files constituting the source package. If any inconsistency is
-discovered, it immediately errors out.
+discovered, it immediately errors out. It will make sure at least one strong
+checksum is present.
 
 
 =cut
 =cut
 
 
 sub check_checksums {
 sub check_checksums {
     my $self = shift;
     my $self = shift;
     my $checksums = $self->{checksums};
     my $checksums = $self->{checksums};
+
     # add_from_file verify the checksums if they are already existing
     # add_from_file verify the checksums if they are already existing
     foreach my $file ($checksums->get_files()) {
     foreach my $file ($checksums->get_files()) {
+        if (not $checksums->has_strong_checksums($file)) {
+            error(g_('source package uses only weak checksums'));
+        }
 	$checksums->add_from_file($self->{basedir} . $file, key => $file);
 	$checksums->add_from_file($self->{basedir} . $file, key => $file);
     }
     }
 }
 }