Ubuntu Pastebin

Paste from Nish at Wed, 4 Oct 2017 23:12:10 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index a4316fbb3..9d16e642f 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -272,6 +272,34 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
        }
     }
 
+    # Select the format to use
+    if (not defined $build_format) {
+       if (-e "$dir/debian/source/format") {
+           open(my $format_fh, '<', "$dir/debian/source/format")
+               or syserr(g_('cannot read %s'), "$dir/debian/source/format");
+           $build_format = <$format_fh>;
+           chomp($build_format) if defined $build_format;
+           error(g_('%s is empty'), "$dir/debian/source/format")
+               unless defined $build_format and length $build_format;
+           close($format_fh);
+       } else {
+           warning(g_('no source format specified in %s, ' .
+                      'see dpkg-source(1)'), 'debian/source/format')
+               if $options{opmode} eq 'build';
+           $build_format = '1.0';
+       }
+    }
+    $fields->{'Format'} = $build_format;
+    $srcpkg->upgrade_object_type(); # Fails if format is unsupported
+    # Parse command line options
+    $srcpkg->init_options();
+    $srcpkg->parse_cmdline_options(@cmdline_options);
+
+    if ($options{opmode} eq 'print-format') {
+       print $fields->{'Format'} . "\n";
+       exit(0);
+    }
+
     # Scan control info of binary packages
     my @pkglist;
     foreach my $pkg ($control->get_packages()) {
@@ -394,33 +422,7 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
        $fields->{'Binary'} =~ s/(.{0,980}), ?/$1,\n/g;
     }
 
-    # Select the format to use
-    if (not defined $build_format) {
-       if (-e "$dir/debian/source/format") {
-           open(my $format_fh, '<', "$dir/debian/source/format")
-               or syserr(g_('cannot read %s'), "$dir/debian/source/format");
-           $build_format = <$format_fh>;
-           chomp($build_format) if defined $build_format;
-           error(g_('%s is empty'), "$dir/debian/source/format")
-               unless defined $build_format and length $build_format;
-           close($format_fh);
-       } else {
-           warning(g_('no source format specified in %s, ' .
-                      'see dpkg-source(1)'), 'debian/source/format')
-               if $options{opmode} eq 'build';
-           $build_format = '1.0';
-       }
-    }
-    $fields->{'Format'} = $build_format;
-    $srcpkg->upgrade_object_type(); # Fails if format is unsupported
-    # Parse command line options
-    $srcpkg->init_options();
-    $srcpkg->parse_cmdline_options(@cmdline_options);
-
-    if ($options{opmode} eq 'print-format') {
-       print $fields->{'Format'} . "\n";
-       exit(0);
-    } elsif ($options{opmode} eq 'before-build') {
+    if ($options{opmode} eq 'before-build') {
        $srcpkg->before_build($dir);
        exit(0);
     } elsif ($options{opmode} eq 'after-build') {
Download as text