[awstats] don't use Switch module, awstats-7.0-4.fc17
Petr Lautrbach
plautrba at fedoraproject.org
Wed Aug 10 11:51:11 UTC 2011
commit 939c350f0f525eb6fa2cda9b7b89234199a5a119
Author: Petr Lautrbach <plautrba at redhat.com>
Date: Wed Aug 10 13:50:41 2011 +0200
don't use Switch module, awstats-7.0-4.fc17
awstats.spec | 9 ++++-
use-if-instead-of-switch-statement.patch | 58 ++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+), 2 deletions(-)
---
diff --git a/awstats.spec b/awstats.spec
index 8e30227..be3f89f 100644
--- a/awstats.spec
+++ b/awstats.spec
@@ -1,16 +1,17 @@
Name: awstats
Version: 7.0
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Advanced Web Statistics
License: GPLv2
Group: Applications/Internet
URL: http://awstats.sourceforge.net
Source0: http://downloads.sourceforge.net/project/awstats/AWStats/%{version}/awstats-%{version}.tar.gz
+Patch0: use-if-instead-of-switch-statement.patch
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: recode
-Requires: perl
+Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Requires(post): perl
Requires(postun): /sbin/service
@@ -38,6 +39,7 @@ http://localhost/awstats/awstats.pl
%prep
%setup -q
+%patch0 -p 1
# Fix style sheets.
perl -pi -e 's,/icon,/awstatsicons,g' wwwroot/css/*
# Fix some bad file permissions here for convenience.
@@ -157,6 +159,9 @@ fi
%changelog
+* Wed Aug 10 2011 Petr Lautrbach <plautrba at redhat.com> 7.0-4
+- don't use Switch module
+
* Tue Feb 15 2011 Petr Lautrbach <plautrba at redhat.com> 7.0-3
- update to upstream 7.0 version
diff --git a/use-if-instead-of-switch-statement.patch b/use-if-instead-of-switch-statement.patch
new file mode 100644
index 0000000..20b9c17
--- /dev/null
+++ b/use-if-instead-of-switch-statement.patch
@@ -0,0 +1,58 @@
+diff --git a/tools/geoip_generator.pl b/tools/geoip_generator.pl
+index 4b9c02d..2ca3e3f 100644
+--- a/tools/geoip_generator.pl
++++ b/tools/geoip_generator.pl
+@@ -8,7 +8,6 @@
+ # $Revision: 1.1 $ - $Author: eldy $ - $Date: 2010/04/17 17:57:58 $
+
+ use strict; no strict "refs";
+-use Switch;
+
+ #------------------------------------------------------------------------------
+ # Defines
+@@ -447,24 +446,28 @@ while ($start <= $end){
+ # clean start and end quotes
+ if ($f =~ m/^"/) {$f = substr($f, 1);}
+
+- # build the fields by switching on the dbtype
+- switch (lc($DBType)){
+- case "geoip" {$f .= $Values[1]; }
+- case "geoipfree" {$f .= $Values[1]; }
+- case "geoipcity" {
+- $f .= $Values[1].",".$Values[2].",\"".$Values[3]."\",\"";
+- $f .= $Values[4]."\",".$Values[5].",".$Values[6].",\"";
+- $f .= $Values[7]."\",\"".$Values[8]."\"";
+- }
+- case "geoipcitylite" {
+- $f .= $Values[1].",".$Values[2].",\"".$Values[3]."\",\"";
+- $f .= $Values[4]."\",".$Values[5].",".$Values[6].",\"";
+- $f .= $Values[7]."\",\"".$Values[8]."\"";
+- }
+- case "geoipregion" {$f .= "\"".$Values[2]."\""; }
+- case "geoiporg" {$f .= "\"".$Values[9]."\""; }
+- case "geoipasn" {$f .= "\"".$Values[10]." ".$Values[9]."\""}
++ # build the fields based on the dbtype
++ my $lc_DBType = lc($DBType);
++ if ($lc_DBType eq "geoip") {$f .= $Values[1]; }
++ if ($lc_DBType eq "geoipfree") {$f .= $Values[1]; }
++ if ($lc_DBType eq "geoipcity") {
++ $f .= $Values[1].",".$Values[2].",\"".$Values[3]."\",\"";
++ $f .= $Values[4]."\",".$Values[5].",".$Values[6].",\"";
++ $f .= $Values[7]."\",\"".$Values[8]."\"";
+ }
++ if ($lc_DBType eq "geoipcitylite") {
++ $f .= $Values[1].",".$Values[2].",\"".$Values[3]."\",\"";
++ $f .= $Values[4]."\",".$Values[5].",".$Values[6].",\"";
++ $f .= $Values[7]."\",\"".$Values[8]."\"";
++ }
++ if ($lc_DBType eq "geoipcitylite") {
++ $f .= $Values[1].",".$Values[2].",\"".$Values[3]."\",\"";
++ $f .= $Values[4]."\",".$Values[5].",".$Values[6].",\"";
++ $f .= $Values[7]."\",\"".$Values[8]."\"";
++ }
++ if ($lc_DBType eq "geoipregion") {$f .= "\"".$Values[2]."\""; }
++ if ($lc_DBType eq "geoiporg") {$f .= "\"".$Values[9]."\""; }
++ if ($lc_DBType eq "geoipasn") {$f .= "\"".$Values[10]." ".$Values[9]."\""}
+
+ $temp{num_to_addr($start)} = $f;
+ debug("Generating: ".num_to_addr($start)."$f",2);
More information about the scm-commits
mailing list