Sfoglia il codice sorgente

scripts: Use new member set_as_used() instead of ad-hoc code

Use the new member instead of setting and then marking the substvars.
Guillem Jover 14 anni fa
parent
commit
48e27cb350
3 ha cambiato i file con 5 aggiunte e 9 eliminazioni
  1. 1 2
      scripts/Dpkg/Control/Hash.pm
  2. 1 2
      scripts/Dpkg/Substvars.pm
  3. 3 5
      scripts/dpkg-gencontrol.pl

+ 1 - 2
scripts/Dpkg/Control/Hash.pm

@@ -355,8 +355,7 @@ sub apply_substvars {
 
     # Add substvars to refer to other fields
     foreach my $f (keys %$self) {
-        $substvars->set("F:$f", $self->{$f});
-        $substvars->no_warn("F:$f");
+        $substvars->set_as_used("F:$f", $self->{$f});
     }
 
     foreach my $f (keys %$self) {

+ 1 - 2
scripts/Dpkg/Substvars.pm

@@ -201,8 +201,7 @@ This will never be warned about when unused.
 sub set_arch_substvars {
     my ($self) = @_;
 
-    $self->{'vars'}{'Arch'} = get_host_arch();
-    $self->no_warn('Arch');
+    $self->set_as_used('Arch', get_host_arch());
 }
 
 =item $newstring = $s->substvars($string)

+ 3 - 5
scripts/dpkg-gencontrol.pl

@@ -116,8 +116,7 @@ while (@ARGV) {
     } elsif (m/^-U([^\=:]+)$/) {
         $remove{$1}= 1;
     } elsif (m/^-V(\w[-:0-9A-Za-z]*)[=:]/) {
-        $substvars->set($1, $');
-	$substvars->no_warn($1);
+        $substvars->set_as_used($1, $');
     } elsif (m/^-T(.*)$/) {
 	$substvars->load($1) if -e $1;
 	$substvars_loaded = 1;
@@ -316,16 +315,15 @@ if (!defined($substvars->get('Installed-Size'))) {
     $? && subprocerr(_g("du in \`%s'"), $packagebuilddir);
     $duo =~ m/^(\d+)\s+\.$/ ||
         error(_g("du gave unexpected output \`%s'"), $duo);
-    $substvars->set('Installed-Size', $1);
+    $substvars->set_as_used('Installed-Size', $1);
 }
 if (defined($substvars->get('Extra-Size'))) {
     my $size = $substvars->get('Extra-Size') + $substvars->get('Installed-Size');
-    $substvars->set('Installed-Size', $size);
+    $substvars->set_as_used('Installed-Size', $size);
 }
 if (defined($substvars->get('Installed-Size'))) {
     $fields->{'Installed-Size'} = $substvars->get('Installed-Size');
 }
-$substvars->no_warn('Installed-Size');
 
 for my $f (keys %override) {
     $fields->{$f} = $override{$f};