[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH 3/4] Implement support for pkg:arch syntax in dpkg-dev



Currently, disallow any values for 'arch' besides the special value 'any'.
This should only be relaxed once we have a policy for cross-arch
dependencies (probably after the squeeze release)
---
 scripts/Dpkg/Deps.pm |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm
index e4afd88..c610e88 100644
--- a/scripts/Dpkg/Deps.pm
+++ b/scripts/Dpkg/Deps.pm
@@ -544,6 +544,10 @@ sub parse {
             /^\s*                           # skip leading whitespace
               ([a-zA-Z0-9][a-zA-Z0-9+.-]*)  # package name
               (?:                           # start of optional part
+                :                           # colon for architecture
+                (any)                       # architecture name
+              )?                            # end of optional part
+              (?:                           # start of optional part
                 \s* \(                      # open parenthesis for version part
                 \s* (<<|<=|=|>=|>>|<|>)     # relation part
                 \s* (.*?)                   # do not attempt to parse version
@@ -557,10 +561,11 @@ sub parse {
 	      \s*$			    # trailing spaces at end
             /x;
     $self->{package} = $1;
-    $self->{relation} = $2;
-    $self->{version} = $3;
-    if (defined($4)) {
-	$self->{arches} = [ split(/\s+/, $4) ];
+    $self->{arch} = $2;
+    $self->{relation} = $3;
+    $self->{version} = $4;
+    if (defined($5)) {
+	$self->{arches} = [ split(/\s+/, $5) ];
     }
     # Standardize relation field
     if (defined($self->{relation})) {
@@ -572,6 +577,9 @@ sub parse {
 sub dump {
     my $self = shift;
     my $res = $self->{package};
+    if (defined($self->{arch})) {
+	$res .= ":" . $self->{arch};
+    }
     if (defined($self->{relation})) {
 	$res .= " (" . $self->{relation} . " " . $self->{version} .  ")";
     }
-- 
1.6.3.3


-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek@ubuntu.com                                     vorlon@debian.org

Attachment: signature.asc
Description: Digital signature


Reply to: