summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2012-04-29 13:37:25 (GMT)
committerHéctor Orón Martínez <hector.oron@collabora.co.uk>2014-02-17 13:33:31 (GMT)
commitd3a8983d09c43c4afcb2eeca6f204abac17aef13 (patch)
treedf98b7c309f5d76fbeb3608bf0a758bcf0113bee
parentc44039bd38335c97f9058e29836ad6d39779e40b (diff)
downloadobs-build-d3a8983d09c43c4afcb2eeca6f204abac17aef13.tar.gz
obs-build-d3a8983d09c43c4afcb2eeca6f204abac17aef13.tar.xz
Parse the architecture field in the dsc
Signed-off-by: Héctor Orón Martínez <hector.oron@collabora.co.uk>
-rw-r--r--Build/Deb.pm44
1 files changed, 38 insertions, 6 deletions
diff --git a/Build/Deb.pm b/Build/Deb.pm
index ddf5ffc..49510de 100644
--- a/Build/Deb.pm
+++ b/Build/Deb.pm
@@ -9,6 +9,36 @@ eval {
$have_zlib = 1;
};
+my %obs2debian = (
+ "i486" => "i386",
+ "i586" => "i386",
+ "i686" => "i386",
+ "ppc" => "powerpc",
+ "x86_64" => "amd64",
+ "armv4l" => "armel",
+ "armv5l" => "armel",
+ "armv6l" => "armel",
+ "armv7l" => "armel",
+ "armv7hl" => "armhf"
+);
+
+sub get_debian_arch {
+ my ($arch, ) = @_;
+ return 'all' if !defined($arch) || $arch eq 'noarch';
+ return $obs2debian{$arch};
+}
+
+sub get_obs_archs {
+ my ($arch, ) = @_;
+ my @ret = [];
+
+ while (my ($key, $value) = each(%obs2debian) ) {
+ push (@ret, $key) if $value eq $arch;
+ }
+
+ return @ret;
+}
+
sub parse {
my ($bconf, $fn) = @_;
my $ret;
@@ -22,12 +52,7 @@ sub parse {
}
# map to debian names
$os = 'linux' if !defined($os);
- $arch = 'all' if !defined($arch) || $arch eq 'noarch';
- $arch = 'i386' if $arch =~ /^i[456]86$/;
- $arch = 'powerpc' if $arch eq 'ppc';
- $arch = 'amd64' if $arch eq 'x86_64';
- $arch = 'armel' if $arch =~ /^armv[4567]l$/;
- $arch = 'armhf' if $arch eq 'armv7hl';
+ $arch = get_debian_arch($arch);
if (ref($fn) eq 'ARRAY') {
@control = @$fn;
@@ -45,6 +70,7 @@ sub parse {
my $name;
my $version;
my @deps;
+ my @exclarch;
while (@control) {
my $c = shift @control;
last if $c eq ''; # new paragraph
@@ -59,6 +85,11 @@ sub parse {
if ($tag eq 'VERSION') {
$version = $data;
$version =~ s/-[^-]+$//;
+ } elsif ($tag eq 'ARCHITECTURE') {
+ my @archs = split('\s+', $data);
+ map { s/$os-// } @archs;
+ next if grep { $_ eq "any" || $_ eq "all" } @archs;
+ @exclarch = map { get_obs_archs($_) } @archs;
} elsif ($tag eq 'SOURCE') {
$name = $data;
} elsif ($tag eq 'BUILD-DEPENDS' || $tag eq 'BUILD-CONFLICTS' || $tag eq 'BUILD-IGNORE' || $tag eq 'BUILD-DEPENDS-INDEP') {
@@ -106,6 +137,7 @@ sub parse {
$ret->{'name'} = $name;
$ret->{'version'} = $version;
$ret->{'deps'} = \@deps;
+ $ret->{'exclarch'} = \@exclarch if (@exclarch);
return $ret;
}