+2007-04-11 Guillem Jover <guillem@debian.org>
+
+ * scripts/controllib.pl (@pkg_dep_fields): Reorder fields by
+ importance.
+ (set_field_importance): New function.
+ (sort_field_by_importance): Likewise.
+ (outputclose): Use sort_field_by_importance instead of direct sorting.
+ * scripts/changelog/debian.pl (%fieldimps): Do not set directly, use
+ set_field_importance instead.
+ * scripts/dpkg-genchanges.pl: Likewise.
+ * scripts/dpkg-gencontrol.pl: Likewise.
+ * scripts/dpkg-source.pl: Likewise.
+ * scripts/changelog/debian.pl (@changelog_fields): New variable.
+ * scripts/dpkg-genchanges.pl (@changes_fields): New variable.
+ * scripts/dpkg-gencontrol.pl (@control_fields): New variable.
+ * scripts/dpkg-source.pl (@dsc_fields): New variable.
+ * scripts/dpkg-scanpackages.pl: Require 'controllib.pl'.
+ (@pkg_dep_fields): Declare as 'our'.
+ (@fieldpri): Reorder fields, use '@pkg_dep_fields' instead of
+ hardcoded list.
+
2007-04-05 Guillem Jover <guillem@debian.org>
* scripts/controllib.pl (get_host_arch): New function.
* Fix typo in German dpkg man page. Closes: #416167
Thanks to Martin Weis.
* Properly sort Uploaders field in generated .dsc files.
+ * Reorder a bit fields in output files.
[ Updated dpkg translations ]
* Romanian (Eddy Petrișor).
$since='';
+my @changelog_fields = qw(Source Version Distribution Urgency Maintainer
+ Date Closes Changes));
+
+
sub version {
printf _g("Debian %s version %s.\n"), $progname, $version;
}
%mapkv=(); # for future use
-$i=100;grep($fieldimps{$_}=$i--,
- qw(Source Version Distribution Urgency Maintainer Date Closes
- Changes));
$i=1;grep($urgencies{$_}=$i++,
qw(low medium high critical emergency));
}
$f{'Closes'} = join(' ',sort { $a <=> $b} @closes);
+set_field_importance(@changelog_fields);
outputclose();
sub clerror
$parsechangelog= 'dpkg-parsechangelog';
-@pkg_dep_fields = qw(Replaces Provides Depends Pre-Depends Recommends Suggests
- Conflicts Enhances);
+@pkg_dep_fields = qw(Pre-Depends Depends Recommends Suggests Enhances
+ Conflicts Replaces Provides);
@src_dep_fields = qw(Build-Depends Build-Depends-Indep
Build-Conflicts Build-Conflicts-Indep);
return $v;
}
+sub set_field_importance(@)
+{
+ my @fields = @_;
+ my $i = 1;
+
+ grep($fieldimps{$_} = $i++, @fields);
+}
+
+sub sort_field_by_importance($$)
+{
+ my ($a, $b) = @_;
+
+ if (defined $fieldimps{$a} && defined $fieldimps{$b}) {
+ $fieldimps{$a} <=> $fieldimps{$b};
+ } elsif (defined($fieldimps{$a})) {
+ -1;
+ } elsif (defined($fieldimps{$b})) {
+ 1;
+ } else {
+ $a cmp $b;
+ }
+}
+
sub outputclose {
my ($varlistfile) = @_;
&parsesubstvars($varlistfile) if (defined($varlistfile));
- for $f (sort { $fieldimps{$b} <=> $fieldimps{$a} } keys %f) {
+ for $f (sort sort_field_by_importance keys %f) {
$v= $f{$f};
if (defined($varlistfile)) {
$v= &substvars($v);
require 'dpkg-gettext.pl';
textdomain("dpkg-dev");
+my @changes_fields = qw(Format Date Source Binary Architecture Version
+ Distribution Urgency Maintainer Changed-By
+ Description Closes Changes Files);
+
+
sub version {
printf _g("Debian %s version %s.\n"), $progname, $version;
"), $progname;
}
-$i=100;grep($fieldimps{$_}=$i--,
- qw(Format Date Source Binary Architecture Version
- Distribution Urgency Maintainer Changed-By Description
- Closes Changes Files));
while (@ARGV) {
$_=shift(@ARGV);
for $f (keys %override) { $f{&capit($f)}= $override{$f}; }
for $f (keys %remove) { delete $f{&capit($f)}; }
+set_field_importance(@changes_fields);
outputclose();
require 'dpkg-gettext.pl';
textdomain("dpkg-dev");
+my @control_fields = (qw(Package Source Version Architecture Essential Origin
+ Bugs Maintainer Installed-Size), @pkg_dep_fields,
+ qw(Section Priority Description));
+
+
sub version {
printf _g("Debian %s version %s.\n"), $progname, $version;
"), $progname;
}
-$i=100;grep($fieldimps{$_}=$i--,
- qw(Package Version Section Priority Architecture Essential
- Pre-Depends Depends Recommends Suggests Enhances Optional
- Conflicts Replaces Provides Installed-Size Origin Maintainer
- Bugs Source Description Build-Depends Build-Depends-Indep
- Build-Conflicts Build-Conflicts-Indep ));
while (@ARGV) {
$_=shift(@ARGV);
binmode(STDOUT);
}
+set_field_importance(@control_fields);
outputclose($varlistfile);
if (!$stdout) {
($0) = $0 =~ m:.*/(.+):;
push(@INC,$dpkglibdir);
+require 'controllib.pl';
require 'dpkg-gettext.pl';
textdomain("dpkg-dev");
+our @pkg_dep_fields;
+
my (@samemaint, @changedmaint);
my %packages;
my %overridden;
package_revision => 'revision',
);
-my @fieldpri= ('Package',
- 'Source',
- 'Version',
- 'Priority',
- 'Section',
- 'Essential',
- 'Maintainer',
- 'Pre-Depends',
- 'Depends',
- 'Recommends',
- 'Suggests',
- 'Conflicts',
- 'Provides',
- 'Replaces',
- 'Enhances',
- 'Architecture',
- 'Filename',
- 'Size',
- 'Installed-Size',
- 'MD5sum',
- 'Description',
- 'Origin',
- 'Bugs'
- );
+my @fieldpri = (qw(Package Source Version Architecture Essential Origin Bugs
+ Maintainer Installed-Size), @pkg_dep_fields, qw(Filename
+ Size MD5sum Section Priority Description));
# This maps the fields into the proper case
my %field_case;
require 'dpkg-gettext.pl';
textdomain("dpkg-dev");
+my @dsc_fields = (qw(Format Source Binary Architecture Version Origin
+ Maintainer Uploaders Standards-Version), @src_dep_fields);
+
+
# Make sure patch doesn't get any funny ideas
delete $ENV{'POSIXLY_CORRECT'};
}
-$i = 100;
-grep ($fieldimps {$_} = $i--,
- qw(Format Source Version Binary Origin Maintainer Uploaders Architecture
- Standards-Version Build-Depends Build-Depends-Indep Build-Conflicts
- Build-Conflicts-Indep));
-
while (@ARGV && $ARGV[0] =~ m/^-/) {
$_=shift(@ARGV);
if (m/^-b$/) {
|| &syserr(_g("write building message"));
open(STDOUT,"> $basenamerev.dsc") || &syserr(sprintf(_g("create %s"), "$basenamerev.dsc"));
+ set_field_importance(@dsc_fields);
outputclose($varlistfile);
if ($ur) {