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

[PATCH] dpkg-source: Add --checksum option



* scripts/dpkg-source.pl: Allow using another
checksum program. Set source format to 3.0 in
that case. This will currently prevent dpkg-source
from extracting such a package, but until 3.0
is actually defined, we have no other choice.
* man/dpkg-source.1: Document new option.
---
 man/dpkg-source.1      |    6 ++++++
 scripts/dpkg-source.pl |   10 +++++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/man/dpkg-source.1 b/man/dpkg-source.1
index 1b06d1b..e539e8a 100644
--- a/man/dpkg-source.1
+++ b/man/dpkg-source.1
@@ -122,6 +122,12 @@ files. Supported values are:
 .IR 1 " to " 9 ", " best ", and " fast .
 \fI9\fP is the default.
 .TP
+.BI \-\-checksum= "checksum program"
+Specify which checksum to use in the files list in the generated .dsc
+file. Supported values are:
+.IR md5sum ", " sha1sum ", and " sha256sum .
+\fImd5sum\fP is the default.
+.TP
 .BR \-i [\fIregexp\fP]
 You may specify a perl regular expression to match files you want
 filtered out of the list of files for the diff. (This list is
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index afe97cd..28c436a 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -188,6 +188,8 @@ Build options:
                              supported are: %s).
   -z<level>                compression level to use (defaults to '9',
                              supported are: '1'-'9', 'best', 'fast')
+  --checksum=<program>     program to use to generate checksums (defaults
+                             to 'md5sum', supported are: %s).
 
 Extract options:
   -sp (default)            leave orig source packed in current dir.
@@ -200,7 +202,8 @@ General options:
 "), $progname,
     $diff_ignore_default_regexp,
     join('', map { " -I$_" } @tar_ignore_default_pattern),
-    "@comp_supported" ;
+    "@comp_supported",
+    "@check_supported";
 }
 
 sub handleformat {
@@ -228,6 +231,10 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
 	$comp_level = $POSTMATCH;
 	usageerr(_g("%s is not a compression level"), $comp_level)
 	    unless $comp_level =~ /^([1-9]|fast|best)$/;
+    } elsif (m/^--checksum=/) {
+	$checksum = $POSTMATCH;
+	usageerr(_g("%s is not a supported checksum"), $checksum)
+	    unless $check_supported{$checksum};
     } elsif (m/^-s([akpursnAKPUR])$/) {
 	warning(_g("-s%s option overrides earlier -s%s option"), $1, $sourcestyle)
 	    if $sourcestyle ne 'X';
@@ -300,6 +307,7 @@ if ($opmode eq 'build') {
     my $fields = Dpkg::Fields::Object->new();
 
     $fields->{"Format"} = $compression eq 'gzip' ? $def_dscformat : '2.0';
+    $fields->{"Format"} = $checksum eq 'md5sum' ? $def_dscformat : '3.0';
 
     my @sourcearch;
     my %archadded;
-- 
1.5.3.8


Reply to: