The following commit has been merged in the master branch:
commit 1d87eba012dacd8c2d1441a8017028c18af5d43a
Author: Raphaël Hertzog <[email protected]>
Date:   Tue Sep 15 01:20:14 2009 +0200

    Get rid of Dpkg::Deps @src_dep_fields @pkg_dep_fields and %dep_field_type
    
    Update all modules and scripts to not use those variables of Dpkg::Deps
    but instead the two functions field_list_(pkg|src)_dep() of
    Dpkg::Control::Fields.

diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm
index e4afd88..3162d97 100644
--- a/scripts/Dpkg/Deps.pm
+++ b/scripts/Dpkg/Deps.pm
@@ -36,29 +36,6 @@ The Dpkg::Deps module provides one generic 
Dpkg::Deps::parse() function
 to turn a dependency line in a set of Dpkg::Deps::{Simple,AND,OR,Union}
 objects depending on the case.
 
-It also provides some constants:
-
-=over 4
-
-=item @pkg_dep_fields
-
-List of fields that contains dependency-like information in a binary
-Debian package. The fields that express real dependencies are sorted from
-the stronger to the weaker.
-
-=item @src_dep_fields
-
-List of fields that contains dependencies-like information in a binary
-Debian package.
-
-=item %dep_field_type
-
-Associate to each field a type, either "normal" for a real dependency field
-(Pre-Depends, Depends, ...) or "union" for other relation fields sharing
-the same syntax (Conflicts, Breaks, etc.).
-
-=back
-
 =head1 FUNCTIONS
 
 =over 4
@@ -74,30 +51,9 @@ use Dpkg::ErrorHandling;
 use Dpkg::Gettext;
 
 use base qw(Exporter);
-our @EXPORT_OK = qw(@pkg_dep_fields @src_dep_fields %dep_field_type
-                   %relation_ordering);
+our @EXPORT_OK = qw(%relation_ordering);
 
 # Some generic variables
-our @pkg_dep_fields = qw(Pre-Depends Depends Recommends Suggests Enhances
-                         Conflicts Breaks Replaces Provides);
-our @src_dep_fields = qw(Build-Depends Build-Depends-Indep
-                         Build-Conflicts Build-Conflicts-Indep);
-our %dep_field_type = (
-       'Pre-Depends' => 'normal',
-       'Depends' => 'normal',
-       'Recommends' => 'normal',
-       'Suggests' => 'normal',
-       'Enhances' => 'union',
-       'Conflicts' => 'union',
-       'Breaks' => 'union',
-       'Replaces' => 'union',
-       'Provides' => 'union',
-       'Build-Depends' => 'normal',
-       'Build-Depends-Indep' => 'normal',
-       'Build-Conflicts' => 'union',
-       'Build-Conflicts-Indep' => 'union',
-);
-
 our %relation_ordering = (
        'undef' => 0,
        '>=' => 1,
@@ -292,8 +248,7 @@ current architecture.
 =item union (defaults to 0)
 
 If set to 1, returns a Dpkg::Deps::Union instead of a Dpkg::Deps::AND. Use
-this when parsing non-dependency fields like Conflicts (see
-%dep_field_type).
+this when parsing non-dependency fields like Conflicts.
 
 =back
 
diff --git a/scripts/Dpkg/Fields.pm b/scripts/Dpkg/Fields.pm
index 658a5b3..8aa5cc3 100644
--- a/scripts/Dpkg/Fields.pm
+++ b/scripts/Dpkg/Fields.pm
@@ -6,7 +6,7 @@ use warnings;
 use base qw(Exporter);
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
-use Dpkg::Deps qw(@src_dep_fields @pkg_dep_fields);
+use Dpkg::Control::Fields;
 
 our @EXPORT_OK = qw(capit unknown %control_src_fields %control_pkg_fields
     $control_src_field_regex $control_pkg_field_regex);
@@ -20,11 +20,11 @@ $control_src_fields{$_} = 1 foreach (qw(Bugs 
Dm-Upload-Allowed
     Homepage Origin Maintainer Priority Section Source Standards-Version
     Uploaders Vcs-Browser Vcs-Arch Vcs-Bzr Vcs-Cvs Vcs-Darcs Vcs-Git Vcs-Hg
     Vcs-Mtn Vcs-Svn));
-$control_src_fields{$_} = 1 foreach (@src_dep_fields);
+$control_src_fields{$_} = 1 foreach (field_list_src_dep());
 $control_pkg_fields{$_} = 1 foreach (qw(Architecture Bugs Description Essential
     Homepage Installer-Menu-Item Kernel-Version Package Package-Type
     Priority Section Subarchitecture Tag Multi-Arch));
-$control_pkg_fields{$_} = 1 foreach (@pkg_dep_fields);
+$control_pkg_fields{$_} = 1 foreach (field_list_pkg_dep());
 
 our $control_src_field_regex = "(?:" . join("|", keys %control_src_fields) . 
")";
 our $control_pkg_field_regex = "(?:" . join("|", keys %control_pkg_fields) . 
")";
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index b934f83..6b41fb8 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -24,7 +24,6 @@ use Dpkg::ErrorHandling;
 use Dpkg::Control;
 use Dpkg::Checksums;
 use Dpkg::Version qw(parseversion check_version);
-use Dpkg::Deps qw(@src_dep_fields);
 use Dpkg::Compression;
 use Dpkg::Exit;
 use Dpkg::Path qw(check_files_are_the_same);
@@ -87,14 +86,6 @@ _darcs
 {arch}
 );
 
-# Private stuff
-my @dsc_fields = (qw(Format Source Binary Architecture Version Origin
-                    Maintainer Uploaders Dm-Upload-Allowed Homepage
-                    Standards-Version Vcs-Browser Vcs-Arch Vcs-Bzr
-                    Vcs-Cvs Vcs-Darcs Vcs-Git Vcs-Hg Vcs-Mtn Vcs-Svn),
-                  @src_dep_fields,
-                  qw(Checksums-Md5 Checksums-Sha1 Checksums-Sha256 Files));
-
 # Object methods
 sub new {
     my ($this, %args) = @_;
@@ -462,7 +453,6 @@ sub write_dsc {
     open(DSC, ">", $filename) || syserr(_g("cannot write %s"), $filename);
 
     delete $fields->{'Checksums-Md5'}; # identical with Files field
-    $fields->set_output_order(@dsc_fields);
     $fields->apply_substvars($opts{'substvars'});
     $fields->output(\*DSC);
     close(DSC);
diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl
index 13ae423..8a37153 100755
--- a/scripts/dpkg-gencontrol.pl
+++ b/scripts/dpkg-gencontrol.pl
@@ -9,7 +9,7 @@ use Dpkg;
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Arch qw(get_host_arch debarch_eq debarch_is);
-use Dpkg::Deps qw(@pkg_dep_fields %dep_field_type);
+use Dpkg::Deps;
 use Dpkg::Fields qw(:list unknown);
 use Dpkg::Control;
 use Dpkg::Control::Info;
@@ -19,6 +19,7 @@ use Dpkg::Changelog qw(parse_changelog);
 
 textdomain("dpkg-dev");
 
+my @pkg_dep_fields = field_list_pkg_dep();
 my @control_fields = (qw(Package Package-Type Source Version Kernel-Version
                          Architecture Subarchitecture Installer-Menu-Item
                          Essential Origin Bugs Maintainer Installed-Size),
@@ -241,14 +242,14 @@ foreach my $field (@pkg_dep_fields) {
     if (exists $pkg->{$field}) {
        my $dep;
        my $field_value = $substvars->substvars($pkg->{$field});
-       if ($dep_field_type{$field} eq 'normal') {
+       if (field_get_dep_type($field) eq 'normal') {
            $dep = Dpkg::Deps::parse($field_value, use_arch => 1,
                                      reduce_arch => 1);
            error(_g("error occurred while parsing %s field: %s"), $field,
                   $field_value) unless defined $dep;
            $dep->simplify_deps($facts, @seen_deps);
            # Remember normal deps to simplify even further weaker deps
-           push @seen_deps, $dep if $dep_field_type{$field} eq 'normal';
+           push @seen_deps, $dep;
        } else {
            $dep = Dpkg::Deps::parse($field_value, use_arch => 1,
                                      reduce_arch => 1, union => 1);
diff --git a/scripts/dpkg-scanpackages.pl b/scripts/dpkg-scanpackages.pl
index 67603ab..65b6d66 100755
--- a/scripts/dpkg-scanpackages.pl
+++ b/scripts/dpkg-scanpackages.pl
@@ -8,7 +8,7 @@ use IO::File;
 use Dpkg;
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
-use Dpkg::Deps qw(@pkg_dep_fields);
+use Dpkg::Control::Fields;
 use Dpkg::Version qw(compare_versions);
 use Dpkg::Checksums;
 
@@ -31,7 +31,7 @@ foreach (@check_supported) {
 my @fieldpri = (qw(Package Package-Type Source Version Kernel-Version
                    Architecture Subarchitecture Essential Origin Bugs
                    Maintainer Installed-Size Installer-Menu-Item),
-                @pkg_dep_fields, qw(Filename Size), @sums,
+                field_list_pkg_dep(), qw(Filename Size), @sums,
                 qw(Section Priority Homepage Description Tag Task));
 
 # This maps the fields into the proper case
diff --git a/scripts/dpkg-scansources.pl b/scripts/dpkg-scansources.pl
index cf1e000..00d376c 100755
--- a/scripts/dpkg-scansources.pl
+++ b/scripts/dpkg-scansources.pl
@@ -32,6 +32,7 @@ use Dpkg;
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Control;
+use Dpkg::Control::Fields;
 use Dpkg::Checksums;
 
 textdomain("dpkg-dev");
@@ -332,12 +333,11 @@ sub process_dsc {
 }
 
 # FIXME: Try to reuse from Dpkg::Source::Package
-use Dpkg::Deps qw(@src_dep_fields);
 my @src_fields = (qw(Format Package Binary Architecture Version Origin
                      Maintainer Uploaders Dm-Upload-Allowed Homepage
                      Standards-Version Vcs-Browser Vcs-Arch Vcs-Bzr
                      Vcs-Cvs Vcs-Darcs Vcs-Git Vcs-Hg Vcs-Mtn Vcs-Svn),
-                  @src_dep_fields,
+                  field_list_src_dep(),
                   qw(Directory Files Checksums-Md5 Checksums-Sha1 
Checksums-Sha256));
 
 sub main {
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index 0feeb79..b4af220 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -8,7 +8,7 @@ use Dpkg;
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Arch qw(debarch_eq);
-use Dpkg::Deps qw(@src_dep_fields %dep_field_type);
+use Dpkg::Deps;
 use Dpkg::Fields qw(:list unknown);
 use Dpkg::Compression;
 use Dpkg::Control::Info;
@@ -171,7 +171,7 @@ if ($options{'opmode'} eq 'build') {
            ($fields->{$_} = $v) =~ s/[\r\n]//g; # Merge in a single-line
        } elsif (m/^Build-(Depends|Conflicts)(-Indep)?$/i) {
            my $dep;
-           my $type = $dep_field_type{field_capitalize($_)};
+           my $type = field_get_dep_type($_);
            $dep = Dpkg::Deps::parse($v, union => $type eq 'union');
            error(_g("error occurred while parsing %s"), $_) unless defined 
$dep;
            my $facts = Dpkg::Deps::KnownFacts->new();

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to