summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2014-09-25 01:44:32 +0200
committerGuillem Jover <guillem@debian.org>2014-10-06 02:08:03 +0200
commit1987e8e3e18537aae6d259aca16f78a69b576527 (patch)
treead078cb0fe396308f6153b2e7ab206a395bdb39c /scripts
parentac00888ad6b66c913e99718816730c942056feef (diff)
downloaddpkg-1987e8e3e18537aae6d259aca16f78a69b576527.tar.gz
dpkg-architecture: Add architecture restriction options for -L
This allows to select specific subsets of all valid known architectures, matching by wildcard (-W), endianness (-E) or bits (-B). The restricting options can be combined, or omitted altogether. Closes: #762635
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dpkg-architecture.pl22
1 files changed, 20 insertions, 2 deletions
diff --git a/scripts/dpkg-architecture.pl b/scripts/dpkg-architecture.pl
index 20738239a..cdeb3968c 100755
--- a/scripts/dpkg-architecture.pl
+++ b/scripts/dpkg-architecture.pl
@@ -48,7 +48,7 @@ sub usage {
. "\n\n" . _g(
'Commands:
-l list variables (default).
- -L list valid architectures.
+ -L list valid architectures (matching some criteria).
-e<debian-arch> compare with host Debian architecture.
-i<arch-alias> check if host Debian architecture is <arch-alias>.
-q<variable> prints only the value of <variable>.
@@ -63,6 +63,9 @@ sub usage {
-t<gnu-system> set host GNU system type.
-A<debian-arch> set target Debian architecture.
-T<gnu-system> set target GNU system type.
+ -W<arch-wildcard> restrict listed architectures matching <arch-wildcard>.
+ -B<arch-bits> restrict listed architectures matching <arch-bits>.
+ -E<arch-endian> restrict listed architectures matching <arch-endian>.
-f force flag (override variables set in environment).')
. "\n", $Dpkg::PROGNAME;
}
@@ -151,6 +154,9 @@ my $req_target_arch = '';
my $req_target_gnu_type = '';
my $req_eq_arch = '';
my $req_is_arch = '';
+my $req_match_wildcard = '';
+my $req_match_bits = '';
+my $req_match_endian = '';
my $req_variable_to_print;
my $action = 'l';
my $force = 0;
@@ -170,6 +176,12 @@ while (@ARGV) {
$req_target_arch = ${^POSTMATCH};
} elsif (m/^-T/p) {
$req_target_gnu_type = ${^POSTMATCH};
+ } elsif (m/^-W/p) {
+ $req_match_wildcard = ${^POSTMATCH};
+ } elsif (m/^-B/p) {
+ $req_match_bits = ${^POSTMATCH};
+ } elsif (m/^-E/p) {
+ $req_match_endian = ${^POSTMATCH};
} elsif (m/^-e/p) {
$req_eq_arch = ${^POSTMATCH};
$req_vars = $arch_vars{DEB_HOST_ARCH};
@@ -334,6 +346,12 @@ if ($action eq 'l') {
print "$v{$req_variable_to_print}\n";
} elsif ($action eq 'L') {
foreach my $arch (get_valid_arches()) {
- print "$arch\n";
+ my ($bits, $endian) = debarch_to_cpuattrs($arch);
+
+ next if $req_match_endian and $endian ne $req_match_endian;
+ next if $req_match_bits and $bits ne $req_match_bits;
+ next if $req_match_wildcard and not debarch_is($arch, $req_match_wildcard);
+
+ print "$arch\n";
}
}