瀏覽代碼

dpkg-gencontrol: Split substvars pass from actual printing

This will allow to switch the code to use a new Dpkg::Dist::Files
module.
Guillem Jover 12 年之前
父節點
當前提交
545662b030
共有 1 個文件被更改,包括 4 次插入5 次删除
  1. 4 5
      scripts/dpkg-gencontrol.pl

+ 4 - 5
scripts/dpkg-gencontrol.pl

@@ -373,6 +373,9 @@ my $sversion = $fields->{'Version'};
 $sversion =~ s/^\d+://;
 $forcefilename //= sprintf('%s_%s_%s.%s', $oppackage, $sversion,
                            $fields->{'Architecture'} || '', $pkg_type);
+$forcefilename = $substvars->substvars($forcefilename);
+my $section = $substvars->substvars($fields->{'Section'} || '-');
+my $priority = $substvars->substvars($fields->{'Priority'} || '-');
 
 # Obtain a lock on debian/control to avoid simultaneous updates
 # of debian/files when parallel building is in use
@@ -404,11 +407,7 @@ if (open(my $fileslist_fh, '<', $fileslistfile)) {
     syserr(_g('read old files list file'));
 }
 
-print { $fileslistnew_fh }
-      $substvars->substvars(sprintf("%s %s %s\n",
-                                    $forcefilename,
-                                    $fields->{'Section'} || '-',
-                                    $fields->{'Priority'} || '-'))
+printf { $fileslistnew_fh } "%s %s %s\n", $forcefilename, $section, $priority
     or syserr(_g('write new entry to new files list file'));
 close($fileslistnew_fh) or syserr(_g('close new files list file'));
 rename("$fileslistfile.new", $fileslistfile)