diff options
author | Pino Toscano <pino@debian.org> | 2014-02-15 16:39:09 +0100 |
---|---|---|
committer | Pino Toscano <pino@debian.org> | 2014-02-15 16:39:09 +0100 |
commit | 4662406a46fa3626938bf1e02780ab3b83b44ee0 (patch) | |
tree | 231a8ea2cf1315a48556e1a5ee6e1765340d466f /cmake | |
parent | 90e17e13231bdc3022396aa24a214de27cfab272 (diff) | |
download | pkg-kde-tools-4662406a46fa3626938bf1e02780ab3b83b44ee0.tar.gz |
debcontrol2cmake.pl: filter out binaries not belonging to build arch
Diffstat (limited to 'cmake')
-rwxr-xr-x | cmake/debcontrol2cmake.pl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cmake/debcontrol2cmake.pl b/cmake/debcontrol2cmake.pl index fc160de..5496342 100755 --- a/cmake/debcontrol2cmake.pl +++ b/cmake/debcontrol2cmake.pl @@ -20,6 +20,20 @@ use warnings; use Dpkg::Control::Info; use Dpkg::Control; +use Dpkg::Arch; + +sub samearch { + my $arch = shift; + my @archlist = split(/\s+/, shift); + + foreach my $a (@archlist) { + if (system("dpkg-architecture", "-a$arch", "-i$a") == 0) { + return 1; + } + } + + return 0; +} # Parse command line arguments my @fields; @@ -36,11 +50,14 @@ for (my $i = 0; $i < @ARGV; $i++) { } } +my $arch = Dpkg::Arch::get_build_arch(); + # Retrieve requested fields and generate set statements my $control = Dpkg::Control::Info->new("debian/control"); foreach my $pkg ($control->{source}, @{$control->{packages}}) { my $pkgok; my $pkgname = ($pkg->get_type() == CTRL_INFO_SRC) ? "Source" : $pkg->{Package}; + next if $pkg->get_type() == CTRL_INFO_PKG && !samearch($arch, $pkg->{"Architecture"}); foreach my $field (@fields) { my $val; if (exists $pkg->{$field}) { |