Subject: pkg/33514: www/awstats: fix some hard-coded paths
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <ykomatsu@akaumigame.org>
List: pkgsrc-bugs
Date: 05/19/2006 13:30:00
>Number:         33514
>Category:       pkg
>Synopsis:       www/awstats: fix some hard-coded paths
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri May 19 13:30:00 +0000 2006
>Originator:     Yoshito Komatsu
>Release:        NetBSD 3.99.19
>Organization:
>Environment:
System: NetBSD c10.ln.akaumigame.org 3.99.19 NetBSD 3.99.19 (XENU) #0: Wed May 10 01:50:55 JST 2006 root@c8.ln.akaumigame.org:/usr/obj/sys/arch/i386/compile/XENU i386
Architecture: i386
Machine: i386
>Description:
	Some Perl scripts in www/awstats contains hard-coded paths
	like /usr/local/*, /etc/*.
	So these scripts cannot work without options that tell right paths.
>How-To-Repeat:
	# /usr/pkg/awstats/bin/awstats_updateall.pl now
>Fix:
	I think the following patch fix this problem.

diff -uNr www/awstats.orig/Makefile www/awstats/Makefile
--- www/awstats.orig/Makefile	2006-05-19 07:03:10.000000000 +0900
+++ www/awstats/Makefile	2006-05-19 08:04:46.000000000 +0900
@@ -25,13 +25,14 @@
 SUBST_CLASSES+=		conf
 SUBST_STAGE.conf=	post-patch
 SUBST_FILES.conf=	tools/awstats_configure.pl \
+			tools/awstats_buildstaticpages.pl \
+			tools/awstats_updateall.pl \
 			wwwroot/cgi-bin/awstats.model.conf \
 			wwwroot/cgi-bin/awstats.pl
 SUBST_SED.conf=		-e "s|@PREFIX@|${PREFIX}|g"
 SUBST_SED.conf+=	-e "s|@VARBASE@|${VARBASE}|g"
 SUBST_SED.conf+=	-e "s|@PKG_SYSCONFDIR@|${PKG_SYSCONFDIR}|g"
 SUBST_SED.conf+=	-e "s|/var/log/httpd/mylog.log|${VARBASE}/log/httpd/access_log|g"
-SUBST_SED.conf+=	-e "s|\"/etc/opt/awstats\"|\"/etc/opt/awstats\",\"${PKG_SYSCONFDIR}\"|g"
 SUBST_MESSAGE.conf=	Fixing configuration files and scripts.
 
 CONF_FILES+=	${PREFIX}/share/examples/awstats/awstats.conf \
diff -uNr www/awstats.orig/distinfo www/awstats/distinfo
--- www/awstats.orig/distinfo	2006-05-19 07:03:10.000000000 +0900
+++ www/awstats/distinfo	2006-05-19 08:06:56.000000000 +0900
@@ -3,4 +3,7 @@
 SHA1 (awstats-6.6.tar.gz) = bc873ca91ee82905fdb37e83349e4007f1042c81
 RMD160 (awstats-6.6.tar.gz) = 0b5e4e2ff718943065cdff81577ae9ca4f50a74d
 Size (awstats-6.6.tar.gz) = 1059148 bytes
-SHA1 (patch-ab) = e740af99580d2cb5d68e99ca4f8e08e71a46d9d9
+SHA1 (patch-aa) = 8c75e35a06e414caac04a664ce5882b3447fa755
+SHA1 (patch-ab) = 187a94fb036773c40131dc38ef387a1e5ae0b410
+SHA1 (patch-ac) = 968e9e6c02be84f6cd48d28ad8837359ae15ccb2
+SHA1 (patch-ad) = 12cb614f3e0c6f5cfd0b9b0bdfb6bc9205f370d3
diff -uNr www/awstats.orig/patches/patch-aa www/awstats/patches/patch-aa
--- www/awstats.orig/patches/patch-aa	1970-01-01 09:00:00.000000000 +0900
+++ www/awstats/patches/patch-aa	2006-05-19 08:06:51.000000000 +0900
@@ -0,0 +1,29 @@
+$NetBSD$
+
+--- tools/awstats_buildstaticpages.pl.orig	2006-02-09 06:26:14.000000000 +0900
++++ tools/awstats_buildstaticpages.pl
+@@ -129,11 +129,12 @@ sub Read_Config {
+ 	# Standard, Mandrake and Debian package :	"/etc/awstats"
+ 	# Other possible directories :				"/usr/local/etc/awstats", "/etc"
+ 	# FHS standard, Suse package : 				"/etc/opt/awstats"
++	# pkgsrc :						"@PKG_SYSCONFDIR@"
+ 	my $configdir=shift;
+ 	my @PossibleConfigDir=();
+ 
+ 	if ($configdir) { @PossibleConfigDir=("$configdir"); }
+-	else { @PossibleConfigDir=("$AwstatsDir","$DIR","/etc/awstats","/usr/local/etc/awstats","/etc","/etc/opt/awstats"); }
++	else { @PossibleConfigDir=("$AwstatsDir","$DIR","/etc/awstats","/usr/local/etc/awstats","/etc","/etc/opt/awstats","@PKG_SYSCONFDIR@"); }
+ 
+ 	# Open config file
+ 	$FileConfig=$FileSuffix='';
+@@ -293,8 +294,8 @@ my $retour;
+ # Check if AWSTATS prog is found
+ my $AwstatsFound=0;
+ if (-s "$Awstats") { $AwstatsFound=1; }
+-elsif (-s "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl") {
+-	$Awstats="/usr/local/awstats/wwwroot/cgi-bin/awstats.pl";
++elsif (-s "@PREFIX@/awstats/cgi-bin/awstats.pl") {
++	$Awstats="@PREFIX@/awstats/cgi-bin/awstats.pl";
+ 	$AwstatsFound=1;
+ }
+ if (! $AwstatsFound) {
diff -uNr www/awstats.orig/patches/patch-ab www/awstats/patches/patch-ab
--- www/awstats.orig/patches/patch-ab	2006-05-19 07:03:10.000000000 +0900
+++ www/awstats/patches/patch-ab	2006-05-19 07:52:08.000000000 +0900
@@ -1,6 +1,6 @@
-$NetBSD: patch-ab,v 1.4 2006/05/16 18:13:55 minskim Exp $
+$NetBSD$
 
---- tools/awstats_configure.pl.orig	2006-02-08 13:26:14.000000000 -0800
+--- tools/awstats_configure.pl.orig	2006-02-09 06:26:14.000000000 +0900
 +++ tools/awstats_configure.pl
 @@ -29,12 +29,12 @@ $AWSTATS_MODEL_CONFIG
  $AWSTATS_DIRDATA_PATH
diff -uNr www/awstats.orig/patches/patch-ac www/awstats/patches/patch-ac
--- www/awstats.orig/patches/patch-ac	1970-01-01 09:00:00.000000000 +0900
+++ www/awstats/patches/patch-ac	2006-05-19 08:00:08.000000000 +0900
@@ -0,0 +1,20 @@
+$NetBSD$
+
+--- tools/awstats_updateall.pl.orig	2006-02-09 06:26:14.000000000 +0900
++++ tools/awstats_updateall.pl
+@@ -14,5 +14,5 @@ my $VERSION="1.0 (build $REVISION)";
+ 
+ # Default value of DIRCONFIG
+-my $DIRCONFIG = "/etc/awstats";
++my $DIRCONFIG = "@PKG_SYSCONFDIR@";
+ 
+ my $Debug=0;
+@@ -122,6 +122,6 @@ if (@files) {
+ 	my $AwstatsFound=0;
+ 	if (-s "$Awstats") { $AwstatsFound=1; }
+-	elsif (-s "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl") {
+-		$Awstats="/usr/local/awstats/wwwroot/cgi-bin/awstats.pl";
++	elsif (-s "@PREFIX@/awstats/cgi-bin/awstats.pl") {
++		$Awstats="@PREFIX@/awstats/cgi-bin/awstats.pl";
+ 		$AwstatsFound=1;
+ 	}
diff -uNr www/awstats.orig/patches/patch-ad www/awstats/patches/patch-ad
--- www/awstats.orig/patches/patch-ad	1970-01-01 09:00:00.000000000 +0900
+++ www/awstats/patches/patch-ad	2006-05-19 07:55:02.000000000 +0900
@@ -0,0 +1,21 @@
+$NetBSD$
+
+--- wwwroot/cgi-bin/awstats.pl.orig	2006-05-06 11:42:26.000000000 +0900
++++ wwwroot/cgi-bin/awstats.pl
+@@ -1128,6 +1128,7 @@ sub Read_Config {
+ 	# Standard, Mandrake and Debian package :	"/etc/awstats"
+ 	# Other possible directories :				"/usr/local/etc/awstats", "/etc"
+ 	# FHS standard, Suse package : 				"/etc/opt/awstats"
++	# pkgsrc : 						"@PKG_SYSCONFDIR@"
+ 	my $configdir=shift;
+ 	my @PossibleConfigDir=();
+ 
+@@ -1143,7 +1144,7 @@ sub Read_Config {
+ 			@PossibleConfigDir=("$configdir");
+ 		#}
+ 	}
+-	else { @PossibleConfigDir=("$DIR","/etc/awstats","/usr/local/etc/awstats","/etc","/etc/opt/awstats"); }
++	else { @PossibleConfigDir=("$DIR","/etc/awstats","/usr/local/etc/awstats","/etc","/etc/opt/awstats","@PKG_SYSCONFDIR@"); }
+ 
+ 	# Open config file
+ 	$FileConfig=$FileSuffix='';