Selaa lähdekoodia

dpkg-architecture: Add long command and option names for all short options

Guillem Jover 11 vuotta sitten
vanhempi
commit
b91283794a
3 muutettua tiedostoa jossa 89 lisäystä ja 79 poistoa
  1. 1 0
      debian/changelog
  2. 34 28
      man/dpkg-architecture.1
  3. 54 51
      scripts/dpkg-architecture.pl

+ 1 - 0
debian/changelog

@@ -27,6 +27,7 @@ dpkg (1.17.17) UNRELEASED; urgency=low
     which is not being set at all when querying for DEB_TARGET_ variables.
   * Normalize dpkg-architecture command-line parsing, so that «--option=value»
     «--option value», «-ovalue» and «-o value» will all be accepted.
+  * Add long option names for all dpkg-architecture short options.
 
   [ Updated programs translations ]
   * German (Sven Joachim).

+ 34 - 28
man/dpkg-architecture.1

@@ -36,53 +36,56 @@ The build architecture is always determined by an external call to
 \fBdpkg\fP(1), and can not be set at the command line.
 .PP
 You can specify the host architecture by providing one or both of the options
-\fB\-a\fR and \fB\-t\fR. The default is determined by an external call to
+\fB\-\-host\-arch\fR and \fB\-\-host\-type\fR. The default is determined by
+an external call to
 .BR gcc (1),
 or the same as the build architecture if \fBCC\fP or gcc are both not
-available. One out of \fB\-a\fR and \fB\-t\fR is sufficient, the value of the
+available. One out of \fB\-host\-arch\fR and \fB\-\-host\-type\fR is
+sufficient, the value of the
 other will be set to a usable default. Indeed, it is often better to only
 specify one, because \fBdpkg\-architecture\fP will warn you if your choice
 does not match the default.
 .
 .SH COMMANDS
 .TP
-.B \-l
+.BR \-l ", " \-\-list
 Print the environment variables, one each line, in the format
 \fIVARIABLE=value\fP. This is the default action.
 .TP
-.BI \-e debian-architecture
+.BR \-e ", " \-\-equal " \fIarchitecture\fP"
 Check for equality of architecture (since dpkg 1.13.13).
 It compares the current or specified Debian host architecture against
-\fIdebian-architecture\fP, to check if they are equal.
+\fIarchitecture\fP, to check if they are equal.
 This action will not expand the architecture wildcards.
 Command finishes with an exit status of 0 if matched, 1 if not matched.
 
 .TP
-.BI \-i architecture-wildcard
+.BR \-i ", " \-\-is " \fIarchitecture-wildcard\fP"
 Check for identity of architecture (since dpkg 1.13.13).
 It compares the current or specified Debian host architecture against
 \fIarchitecture-wildcard\fP after having expanded it as an architecture
 wildcard, to check if they match.
 Command finishes with an exit status of 0 if matched, 1 if not matched.
 .TP
-.BI \-q variable-name
+.BR \-q ", " \-\-query " \fIvariable-name\fP"
 Print the value of a single variable.
 .TP
-.B \-s
+.BR \-s ", " \-\-print\-set
 Print an export command. This can be used to set the environment variables
 using eval.
 .TP
-.B \-u
-Print a similar command to \fB\-s\fP but to unset all variables.
+.BR \-u ", " \-\-print\-unset
+Print a similar command to \fB\-\-print\-unset\fP but to unset all variables.
 .TP
-.BI \-c " command"
+.BR \-c ", " \-\-command " \fIcommand\fP"
 Execute a \fIcommand\fP in an environment which has all variables set to
 the determined value.
 .TP
-.B \-L
+.BR \-L ", " \-\-list\-known
 Print a list of valid architecture names.
-Possibly restricted by one or more of the matching options \fB\-W\fP,
-\fB\-B\fP or \fB\-E\fP (since dpkg 1.17.14).
+Possibly restricted by one or more of the matching options
+\fB\-\-match\-wildcard\fP, \fB\-\-match\-bits\fP or \fB\-\-match\-endian\fP
+(since dpkg 1.17.14).
 .TP
 .BR \-? ", " \-\-help
 Show the usage message and exit.
@@ -92,33 +95,33 @@ Show the version and exit.
 .
 .SH OPTIONS
 .TP
-.BI \-a debian-architecture
+.BR \-a ", " \-\-host\-arch " \fIarchitecture\fP"
 Set the host Debian architecture.
 .TP
-.BI \-t gnu-system-type
+.BR \-t ", " \-\-host\-type " \fIgnu-system-type\fP"
 Set the host GNU system type.
 .TP
-.BI \-A debian-architecture
+.BR \-A ", " \-\-target\-arch " \fIarchitecture\fP"
 Set the target Debian architecture. This is only needed when building a
 cross-toolchain, one that will be built on the build architecture, to be
 run on the host architecture, and to build code for the target architecture.
 .TP
-.BI \-T gnu-system-type
+.BR \-T ", " \-\-target\-type " \fIgnu-system-type\fP"
 Set the target GNU system type.
 .TP
-.BI \-W architecture-wildcard
-Restrict the architectures listed by \fB\-L\fP to ones matching the specified
-architecture wildcard (since dpkg 1.17.14).
+.BR \-W ", " \-\-match\-wildcard " \fIarchitecture-wildcard\fP"
+Restrict the architectures listed by \fB\-\-list\-known\fP to ones matching
+the specified architecture wildcard (since dpkg 1.17.14).
 .TP
-.BI \-B architecture-bits
-Restrict the architectures listed by \fB\-L\fP to ones with the specified
-CPU bits (since dpkg 1.17.14). Either \fB32\fP or \fB64\fP.
+.BR \-B ", " \-\-match\-bits " \fIarchitecture-bits\fP"
+Restrict the architectures listed by \fB\-\-list\-known\fP to ones with the
+specified CPU bits (since dpkg 1.17.14). Either \fB32\fP or \fB64\fP.
 .TP
-.BI \-E architecture-endianness
-Restrict the architectures listed by \fB\-L\fP to ones with the specified
-endianness (since dpkg 1.17.14). Either \fBlittle\fP or \fBbig\fP.
+.BR \-E ", " \-\-match\-endian " \fIarchitecture-endianness\fP"
+Restrict the architectures listed by \fB\-\-list\-known\fP to ones with the
+specified endianness (since dpkg 1.17.14). Either \fBlittle\fP or \fBbig\fP.
 .TP
-.B \-f
+.BR \-f ", " \-\-force
 Values set by existing environment variables with the same name as used by
 the scripts are honored (i.e. used by \fBdpkg\-architecture\fP), except if
 this force flag is present. This allows the user
@@ -304,6 +307,9 @@ endif
 In any case, you should never use \fBdpkg \-\-print\-architecture\fP to get
 architecture information during a package build.
 .
+.SH NOTES
+All long command and option names available only since dpkg 1.17.17.
+.
 .SH SEE ALSO
 .BR dpkg\-buildpackage (1),
 .BR dpkg\-cross (1).

+ 54 - 51
scripts/dpkg-architecture.pl

@@ -48,26 +48,29 @@ sub usage {
 'Usage: %s [<option>...] [<command>]')
     . "\n\n" . _g(
 'Commands:
-  -l                 list variables (default).
-  -L                 list valid architectures (matching some criteria).
-  -e<debian-arch>    compare with host Debian architecture.
-  -i<arch-wildcard>  check if host Debian architecture is <arch-wildcard>.
-  -q<variable>       prints only the value of <variable>.
-  -s                 print command to set environment variables.
-  -u                 print command to unset environment variables.
-  -c <command>       set environment and run the command in it.
-  -?, --help         show this help message.
-      --version      show the version.')
+  -l, --list                list variables (default).
+  -L, --list-known          list valid architectures (matching some criteria).
+  -e, --equal <arch>        compare with host Debian architecture.
+  -i, --is <arch-wildcard>  match against host Debian architecture.
+  -q, --query <variable>    prints only the value of <variable>.
+  -s, --print-set           print command to set environment variables.
+  -u, --print-unset         print command to unset environment variables.
+  -c, --command <command>   set environment and run the command in it.
+  -?, --help                show this help message.
+      --version             show the version.')
     . "\n\n" . _g(
 'Options:
-  -a<debian-arch>    set host Debian architecture.
-  -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).')
+  -a, --host-arch <arch>    set host Debian architecture.
+  -t, --host-type <type>    set host GNU system type.
+  -A, --target-arch <arch>  set target Debian architecture.
+  -T, --target-type <type>  set target GNU system type.
+  -W, --match-wildcard <arch-wildcard>
+                            restrict architecture list matching <arch-wildcard>.
+  -B, --match-bits <arch-bits>
+                            restrict architecture list matching <arch-bits>.
+  -E, --match-endian <arch-endian>
+                            restrict architecture list matching <arch-endian>.
+  -f, --force               force flag (override variables set in environment).')
     . "\n", $Dpkg::PROGNAME;
 }
 
@@ -159,7 +162,7 @@ my $req_match_wildcard = '';
 my $req_match_bits = '';
 my $req_match_endian = '';
 my $req_variable_to_print;
-my $action = 'l';
+my $action = 'list';
 my $force = 0;
 
 sub action_needs($) {
@@ -172,50 +175,50 @@ sub action_needs($) {
 while (@ARGV) {
     my $arg = shift;
 
-    if ($arg eq '-a') {
+    if ($arg eq '-a' or $arg eq '--host-arch') {
 	$req_host_arch = shift;
-    } elsif ($arg eq '-t') {
+    } elsif ($arg eq '-t' or $arg eq '--host-type') {
 	$req_host_gnu_type = shift;
-    } elsif ($arg eq '-A') {
+    } elsif ($arg eq '-A' or $arg eq '--target-arch') {
 	$req_target_arch = shift;
-    } elsif ($arg eq '-T') {
+    } elsif ($arg eq '-T' or $arg eq '--target-type') {
 	$req_target_gnu_type = shift;
-    } elsif ($arg eq '-W') {
+    } elsif ($arg eq '-W' or $arg eq '--match-wildcard') {
 	$req_match_wildcard = shift;
-    } elsif ($arg eq '-B') {
+    } elsif ($arg eq '-B' or $arg eq '--match-bits') {
 	$req_match_bits = shift;
-    } elsif ($arg eq '-E') {
+    } elsif ($arg eq '-E' or $arg eq '--match-endian') {
 	$req_match_endian = shift;
-    } elsif ($arg eq '-e') {
+    } elsif ($arg eq '-e' or $arg eq '--equal') {
 	$req_eq_arch = shift;
 	$req_vars = $arch_vars{DEB_HOST_ARCH};
-	$action = 'e';
-    } elsif ($arg eq '-i') {
+	$action = 'equal';
+    } elsif ($arg eq '-i' or $arg eq '--is') {
 	$req_is_arch = shift;
 	$req_vars = $arch_vars{DEB_HOST_ARCH};
-	$action = 'i';
-    } elsif ($arg eq '-u') {
+	$action = 'is';
+    } elsif ($arg eq '-u' or $arg eq '--print-unset') {
 	$req_vars = DEB_NONE;
-	$action = 'u';
-    } elsif ($arg eq '-l') {
-	$action = 'l';
-    } elsif ($arg eq '-s') {
-	$action = 's';
-    } elsif ($arg eq '-f') {
+	$action = 'print-unset';
+    } elsif ($arg eq '-l' or $arg eq '--list') {
+	$action = 'list';
+    } elsif ($arg eq '-s' or $arg eq '--print-set') {
+	$action = 'print-set';
+    } elsif ($arg eq '-f' or $arg eq '--force') {
         $force=1;
-    } elsif ($arg eq '-q') {
+    } elsif ($arg eq '-q' or $arg eq '--query') {
 	my $varname = shift;
 	error(_g('%s is not a supported variable name'), $varname)
 	    unless (exists $arch_vars{$varname});
 	$req_variable_to_print = "$varname";
 	$req_vars = $arch_vars{$varname};
-        $action = 'q';
-    } elsif ($arg eq '-c') {
-       $action = 'c';
+        $action = 'query';
+    } elsif ($arg eq '-c' or $arg eq '--command') {
+       $action = 'command';
        last;
-    } elsif ($arg eq '-L') {
+    } elsif ($arg eq '-L' or $arg eq '--list-known') {
         $req_vars = 0;
-        $action = 'L';
+        $action = 'list-known';
     } elsif ($arg eq '-?' or $arg eq '--help') {
         usage();
        exit 0;
@@ -319,27 +322,27 @@ for my $k (keys %arch_vars) {
     $v{$k} = $ENV{$k} if (length $ENV{$k} && !$force);
 }
 
-if ($action eq 'l') {
+if ($action eq 'list') {
     foreach my $k (sort keys %arch_vars) {
 	print "$k=$v{$k}\n";
     }
-} elsif ($action eq 's') {
+} elsif ($action eq 'print-set') {
     foreach my $k (sort keys %arch_vars) {
 	print "$k=$v{$k}; ";
     }
     print 'export ' . join(' ', sort keys %arch_vars) . "\n";
-} elsif ($action eq 'u') {
+} elsif ($action eq 'print-unset') {
     print 'unset ' . join(' ', sort keys %arch_vars) . "\n";
-} elsif ($action eq 'e') {
+} elsif ($action eq 'equal') {
     exit !debarch_eq($v{DEB_HOST_ARCH}, $req_eq_arch);
-} elsif ($action eq 'i') {
+} elsif ($action eq 'is') {
     exit !debarch_is($v{DEB_HOST_ARCH}, $req_is_arch);
-} elsif ($action eq 'c') {
+} elsif ($action eq 'command') {
     @ENV{keys %v} = values %v;
     exec @ARGV;
-} elsif ($action eq 'q') {
+} elsif ($action eq 'query') {
     print "$v{$req_variable_to_print}\n";
-} elsif ($action eq 'L') {
+} elsif ($action eq 'list-known') {
     foreach my $arch (get_valid_arches()) {
         my ($bits, $endian) = debarch_to_cpuattrs($arch);