Your message dated Fri, 30 Jan 2009 13:32:03 +0000
with message-id <[email protected]>
and subject line Bug#513473: fixed in whohas 0.22-3
has caused the Debian Bug report #513473,
regarding whohas: Please use a Getopt library for parsing command-line arguments
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
513473: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513473
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: whohas
Version: 0.22-2
Severity: wishlist
Tags: patch
Hi Philipp and Jonathan,
Currently whohas is parsing its own command-line options. There's a pair of
standard Perl libraries (Getopt::Std and Getopt::Long) which do it for you.
The main reason I'd like you to use it is because new options can then be
added with just two extra lines around the GetOptions() call.
As the attached patch stands, it also does this:
-n is equivalent to --no-threads
"-d Dist1 -d Dist2" is equivalent to "-d Dist1,Dist2"
There are options for Getopt if "-n" should be reserved for future use.
The patch goes on top of all the Debian 0.22-2 patches. It should also
apply cleanly to (0.22 + abort if given an unsupported distribution).
Cheers,
Steve
commit c37e106c5c302dc803ee464eb39bf23f83e86201
Author: Steve Cotton <[email protected]>
Date: Thu Jan 29 12:26:09 2009 +0000
Parse arguments with Getopt::Long
diff --git a/program/whohas b/program/whohas
index 5e02398..7eb8da7 100755
--- a/program/whohas
+++ b/program/whohas
@@ -61,48 +61,56 @@ my $fedora_bool = 1;
my @thrs;
my $here = 0;
+use Getopt::Long;
+my @option_distro;
+my $option_nothreads;
+GetOptions(
+ "d=s" => \...@option_distro,
+ "no-threads" => \$option_nothreads,
+);
+
if (@ARGV > 1) {
- for (my $i = 0; $i < @ARGV; $i++) {
- if ($ARGV[$i] eq "-d") {
- $arch_bool = 0;
- $debian_bool = 0;
- $fink_bool = 0;
- $freebsd_bool = 0;
- $macports_bool = 0;
- $netbsd_bool = 0;
- $openbsd_bool = 0;
- $opensuse_bool = 0;
- $slack_bool = 0;
- $sourcemage_bool = 0;
- $ubuntu_bool = 0;
- $gentoo_bool = 0;
- $fedora_bool = 0;
- my @parts = split /,/, $ARGV[$i+1];
- for (my $a = 0; $a < @parts; $a++) {
- if ( $parts[$a] =~ /archlinux/i) {
$arch_bool = 1;
- } elsif ( $parts[$a] =~ /debian/i) {
$debian_bool = 1;
- } elsif ( $parts[$a] =~ /fink/i) {
$fink_bool = 1;
- } elsif ( $parts[$a] =~ /freebsd/i) {
$freebsd_bool = 1;
- } elsif ( $parts[$a] =~ /macports/i) {
$macports_bool = 1;
- } elsif ( $parts[$a] =~ /netbsd/i) {
$netbsd_bool = 1;
- } elsif ( $parts[$a] =~ /openbsd/i) {
$openbsd_bool = 1;
- } elsif ( $parts[$a] =~ /opensuse/i) {
$opensuse_bool = 1;
- } elsif ( $parts[$a] =~ /slackware/i) {
$slack_bool = 1;
- } elsif ( $parts[$a] =~ /sourcemage/i) {
$sourcemage_bool = 1;
- } elsif ( $parts[$a] =~ /ubuntu/i) {
$ubuntu_bool = 1;
- } elsif ( $parts[$a] =~ /gentoo/i) {
$gentoo_bool = 1;
- } elsif ( $parts[$a] =~ /fedora/i) {
$fedora_bool = 1;
- } else {
- die "Unsupported distribution
'$parts[$a]'\n";
- }
- }
- splice @ARGV, $i, 2;
- last;
+ die "Error:\tToo many parameters. Usage: $0 [--no-threads] [-d
Dist1[,Dist2[,Dist3...]]] pkgname\n";
+} elsif (@ARGV < 1) {
+ die "Error:\tPlease specify a search term.\n";
+}
+
+if (@option_distro) {
+ $arch_bool = 0;
+ $debian_bool = 0;
+ $fink_bool = 0;
+ $freebsd_bool = 0;
+ $macports_bool = 0;
+ $netbsd_bool = 0;
+ $openbsd_bool = 0;
+ $opensuse_bool = 0;
+ $slack_bool = 0;
+ $sourcemage_bool = 0;
+ $ubuntu_bool = 0;
+ $gentoo_bool = 0;
+ $fedora_bool = 0;
+ @option_distro = split(/,/,join(',',@option_distro));
+ for my $distro (@option_distro) {
+ if ( $distro =~ /archlinux/i) { $arch_bool
= 1;
+ } elsif ( $distro =~ /debian/i) { $debian_bool
= 1;
+ } elsif ( $distro =~ /fink/i) { $fink_bool
= 1;
+ } elsif ( $distro =~ /freebsd/i) { $freebsd_bool
= 1;
+ } elsif ( $distro =~ /macports/i) { $macports_bool
= 1;
+ } elsif ( $distro =~ /netbsd/i) { $netbsd_bool
= 1;
+ } elsif ( $distro =~ /openbsd/i) { $openbsd_bool
= 1;
+ } elsif ( $distro =~ /opensuse/i) { $opensuse_bool
= 1;
+ } elsif ( $distro =~ /slackware/i) { $slack_bool
= 1;
+ } elsif ( $distro =~ /sourcemage/i) {
$sourcemage_bool = 1;
+ } elsif ( $distro =~ /ubuntu/i) { $ubuntu_bool
= 1;
+ } elsif ( $distro =~ /gentoo/i) { $gentoo_bool
= 1;
+ } elsif ( $distro =~ /fedora/i) { $fedora_bool
= 1;
+ } else {
+ die "Unsupported distribution '$distro'\n";
}
}
}
-if (@ARGV == 1) {
+unless ($option_nothreads) {
if ($ARGV[0] eq "whohasme") {
my $motto = "Congratulations. You discovered an Easter egg.
Maybe you can send a quick email to [email protected] to say hello and tell
the developer what you think of the software.\n";
exit;
@@ -153,53 +161,49 @@ if (@ARGV == 1) {
$_->join;
}
}
-} elsif ($ARGV[0] eq "--no-threads") {
+} else {
if ($arch_bool == 1) {
- &arch( $ARGV[1]);
- &aur( $ARGV[1]);
+ &arch( $ARGV[0]);
+ &aur( $ARGV[0]);
}
if ($debian_bool == 1) {
- &debian( $ARGV[1]);
+ &debian( $ARGV[0]);
}
if ($fedora_bool == 1) {
- &fedora( $ARGV[1]);
+ &fedora( $ARGV[0]);
}
if ($fink_bool == 1) {
- &fink( $ARGV[1]);
+ &fink( $ARGV[0]);
}
if ($freebsd_bool == 1) {
- &freebsd( $ARGV[1]);
+ &freebsd( $ARGV[0]);
}
if ($gentoo_bool == 1) {
- &gentoo( $ARGV[1]);
+ &gentoo( $ARGV[0]);
}
if ($macports_bool == 1) {
- &macports( $ARGV[1]);
+ &macports( $ARGV[0]);
}
if ($netbsd_bool == 1) {
-# &netbsd( $ARGV[1]);
- &netbsd_pkgsrc( $ARGV[1]);
+# &netbsd( $ARGV[0]);
+ &netbsd_pkgsrc( $ARGV[0]);
}
if ($openbsd_bool == 1) {
- &openbsd( $ARGV[1]);
+ &openbsd( $ARGV[0]);
}
if ($opensuse_bool == 1) {
- &opensuse( $ARGV[1]);
+ &opensuse( $ARGV[0]);
}
if ($slack_bool == 1) {
- &slack( $ARGV[1]);
- &lp_net( $ARGV[1]);
+ &slack( $ARGV[0]);
+ &lp_net( $ARGV[0]);
}
if ($sourcemage_bool == 1) {
- &sourcemage($ARGV[1]);
+ &sourcemage($ARGV[0]);
}
if ($ubuntu_bool == 1) {
- &ubuntu( $ARGV[1]);
+ &ubuntu( $ARGV[0]);
}
-} elsif (@ARGV != 0) {
- die "Error:\tToo many parameters. Usage: $0 [--no-threads] pkgname\n";
-} else {
- die "Error:\tPlease specify a search term.\n";
}
sub fedora {
--- End Message ---
--- Begin Message ---
Source: whohas
Source-Version: 0.22-3
We believe that the bug you reported is fixed in the latest version of
whohas, which is due to be installed in the Debian FTP archive:
whohas_0.22-3.diff.gz
to pool/main/w/whohas/whohas_0.22-3.diff.gz
whohas_0.22-3.dsc
to pool/main/w/whohas/whohas_0.22-3.dsc
whohas_0.22-3_all.deb
to pool/main/w/whohas/whohas_0.22-3_all.deb
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Jonathan Wiltshire <[email protected]> (supplier of updated whohas
package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.8
Date: Fri, 30 Jan 2009 12:16:07 +0000
Source: whohas
Binary: whohas
Architecture: source all
Version: 0.22-3
Distribution: unstable
Urgency: low
Maintainer: Jonathan Wiltshire <[email protected]>
Changed-By: Jonathan Wiltshire <[email protected]>
Description:
whohas - query multiple distributions' package archives
Closes: 510020 510524 513466 513473 513476
Changes:
whohas (0.22-3) unstable; urgency=low
.
* Removed README.Debian (no longer necessary)
* Patch to include Mandriva repositories (Sylvestre Ledru)
(Closes: #513466)
* Patch to handle parameters with Getopt::Long (Steve Cotton)
(Closes: #513473)
* Patch to handle the --help parameter properly (Steve Cotton)
(Closes: #513476)
* Patch to trim whitespace from package names
* Patch which adds a --strict option to only output exact package
matches (Closes: #510020, #510524)
* Updated supported list to include Mandriva in the long description
Checksums-Sha1:
12316409540a56853f47ba8bc0ae17665cf40b15 1135 whohas_0.22-3.dsc
977df52baac97ac309ca5784cb88ce5846bf30ee 16619 whohas_0.22-3.diff.gz
1a8176aff5f57aad194414052e6804db6140bfa4 188470 whohas_0.22-3_all.deb
Checksums-Sha256:
2dab88945ef582ba6764281bd1fb021b00a43dda8547a063131212c999ab64b7 1135
whohas_0.22-3.dsc
367e17f66542c36233a20483ea93605bdabda53de2f92d23580ab909bc18172c 16619
whohas_0.22-3.diff.gz
c35d64447f1ff7c237bafd191bddf110616ddc1e2a6ac5dceebb7f218059ea63 188470
whohas_0.22-3_all.deb
Files:
7148cb14e3c22dc213b51919d00e5a82 1135 utils extra whohas_0.22-3.dsc
4d6f939129e34151f980660ec46616da 16619 utils extra whohas_0.22-3.diff.gz
75bdc26d2f419cbd8e9d8a6401c1221b 188470 utils extra whohas_0.22-3_all.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkmDAIUACgkQJATtOmqqpWkxegCeNiWdnBpucfc9ZMepFttHLvDR
duQAoKysTKAi6k9hZHwHrlaUyTzaK3NI
=6rKo
-----END PGP SIGNATURE-----
--- End Message ---