Package: whohas
Version: 0.24-2
Severity: wishlist
Tags: patch

Dear all,

please bear with me for putting to discussion a matter that
Upstream will have to decide in the end. The difficulty of
keeping the hard coded setting for 'whohas' is problematic,
to say the least.

As a point of departure I came up with the following slight
alteration in order to have configuration mechanism allowing
version selection of distributions, as well as a personal
selection of which distributions to query at all.

Best regards,
  Mats Erik Andersson, DM
From 48e3d29856bbe84c238a3a76dd3f19c46a71018e Mon Sep 17 00:00:00 2001
From: Mats Erik Andersson <g...@gisladisker.se>
Date: Thu, 7 Jul 2011 16:17:57 +0200
Subject: [PATCH] Implement a configuration for distro selection.

---
 whohas    |   59 +++++++++++++++++++++++++++++++++++------------------------
 whohas.cf |   40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 24 deletions(-)
 create mode 100644 whohas.cf

diff --git a/whohas b/whohas
index 66dcad9..b21423f 100755
--- a/whohas
+++ b/whohas
@@ -47,32 +47,33 @@ unless (-d $confdir) {
 
 my @columns = (11,38,18,4,10,25);
 my $cols = 6;
-
-my $fedora_release		 =  14			;
-my $ubuntu_current_release	 = "all"		;
-#my $opensuse_rel_string		= "112"		;
-my $opensuse_major		 = "11"			;
-my $opensuse_minor		 = "3"			;
-my $mandrivaVersion		 = "2010.0"		;
-my $openbsd_release		 = "4.6"		;
-my $slackware_version_for_lp_net = "13.0"		;
-
-my $arch_bool		= 1;
-my $cygwin_bool		= 1;
-my $debian_bool		= 1;
-my $fink_bool		= 1;
-my $freebsd_bool	= 1;
-my $macports_bool	= 1;
-my $mandriva_bool	= 1;
-my $netbsd_bool		= 1;
-my $openbsd_bool	= 1;
-my $opensuse_bool	= 1;
-my $slack_bool		= 1;
-my $sourcemage_bool	= 1;
-my $ubuntu_bool		= 1;
-my $gentoo_bool		= 1;
-my $fedora_bool		= 1;
-my $opkg_bool		= 1;
+my $conffile = "whohas.cf";
+
+our $fedora_release		 =  14			;
+our $ubuntu_current_release	 = "all"		;
+#our $opensuse_rel_string		= "112"		;
+our $opensuse_major		 = "11"			;
+our $opensuse_minor		 = "3"			;
+our $mandrivaVersion		 = "2010.0"		;
+our $openbsd_release		 = "4.6"		;
+our $slackware_version_for_lp_net = "13.0"		;
+
+our $arch_bool		= 1;
+our $cygwin_bool	= 1;
+our $debian_bool	= 1;
+our $fink_bool		= 1;
+our $freebsd_bool	= 1;
+our $macports_bool	= 1;
+our $mandriva_bool	= 1;
+our $netbsd_bool	= 1;
+our $openbsd_bool	= 1;
+our $opensuse_bool	= 1;
+our $slack_bool		= 1;
+our $sourcemage_bool	= 1;
+our $ubuntu_bool	= 1;
+our $gentoo_bool	= 1;
+our $fedora_bool	= 1;
+our $opkg_bool		= 1;
 
 my @thrs;
 my $here = 0;
@@ -86,6 +87,16 @@ my $option_shallow;
 my $option_help;
 my $option_strict;
 
+if ( -s "$confdir/$conffile" ) {
+	eval {
+		do "$confdir/$conffile";
+	};
+	if ($@) {
+		print STDERR 'Eval of configuration caused errors. Aborting.\n';
+		exit;
+	}
+}
+
 GetOptions(
 	"d=s" => \@option_distro,
 	"no-threads" => \$option_nothreads,
diff --git a/whohas.cf b/whohas.cf
new file mode 100644
index 0000000..c49e3b1
--- /dev/null
+++ b/whohas.cf
@@ -0,0 +1,40 @@
+#
+# ~/.whohas/whohas.cf
+#
+# Override select variables for whohas.
+#
+
+#
+# Versioning information.
+#
+
+$fedora_release		 = "15";
+# $ubuntu_current_release	 = "all";
+$opensuse_rel_string	 = "114";
+$opensuse_major		 = "11";
+$opensuse_minor		 = "4";
+$mandrivaVersion	 = "2010.2";
+# $openbsd_release	 = "4.9";
+# $slackware_version_for_lp_net = "13.0";
+
+#
+# Inclusion of distributions.
+#
+$arch_bool	= 1;
+$cygwin_bool	= 1;
+$debian_bool	= 1;
+$fink_bool	= 1;
+$freebsd_bool	= 1;
+$macports_bool	= 0;
+$mandriva_bool	= 0;
+$netbsd_bool	= 1;
+$openbsd_bool	= 1;
+$opensuse_bool	= 1;
+$slack_bool	= 0;
+$sourcemage_bool = 1;
+$ubuntu_bool	= 1;
+$gentoo_bool	= 0;
+$fedora_bool	= 0;
+$opkg_bool	= 0;
+
+1;
-- 
1.7.5.4

Attachment: signature.asc
Description: Digital signature

Reply via email to