Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 70996 - new ebuild for awstats 6.2
Summary: new ebuild for awstats 6.2
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo Web Application Packages Maintainers
URL:
Whiteboard:
Keywords: EBUILD
: 75248 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-11-12 12:25 UTC by Tom Hosiawa
Modified: 2005-01-24 06:48 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
awstats-6.2.ebuild (awstats-6.2.ebuild,2.57 KB, text/plain)
2004-11-12 12:26 UTC, Tom Hosiawa
Details
postinstall-en.txt (postinstall-en.txt,368 bytes, text/plain)
2004-11-12 12:26 UTC, Tom Hosiawa
Details
awstats-6.2.diff (awstats-6.2.diff,572 bytes, text/plain)
2004-11-12 13:03 UTC, Tom Hosiawa
Details
awstats-6.2.ebuild (awstats-6.2.ebuild,2.54 KB, text/plain)
2004-11-12 13:12 UTC, Tom Hosiawa
Details
awstats-6.2.ebuild (awstats-6.2.ebuild,2.55 KB, text/plain)
2004-12-02 18:34 UTC, Tom Hosiawa
Details
awstats-6.2.ebuild (awstats-6.2.ebuild,2.62 KB, text/plain)
2004-12-11 08:15 UTC, Tom Hosiawa
Details
awstats-6.2.diff (awstats-6.2.diff,949 bytes, patch)
2004-12-11 08:16 UTC, Tom Hosiawa
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Hosiawa 2004-11-12 12:25:22 UTC
I've made a new ebuild for awstats 6.2 based on the 6.1 ebuild. This should fix all the problems in bugs #63197, #63198, #63200

List of changes:
* inherited webapp-apache
* using postinstall-en.txt for instructions on what to put in apache config, not http_conf
* there's no cvs files in 6.2 to remove
* created /var/lib/awstats
* fixed directory, files permissions
* added instructions to build the initial statistics and to add a cron job to update them
* added missing webapp_pkg_postinst to pkg_postinst

One problem I have though is:
* to use APACHEVER in src_unpack, I inherited webapp-apache and called webapp-detect

But now when I try to install awstats, I'm getting the following errors:
    /usr/lib/portage/bin/ebuild.sh: line 1: webapp-apache_pkg_setup: command not  found
and
    * This ebuild did not call webapp_src_install() at the end
    * of the src_install() function

Are webapp and webapp-apache not supposed to be used together?

Reproducible: Always
Steps to Reproduce:
Comment 1 Tom Hosiawa 2004-11-12 12:26:08 UTC
Created attachment 43810 [details]
awstats-6.2.ebuild
Comment 2 Tom Hosiawa 2004-11-12 12:26:36 UTC
Created attachment 43811 [details]
postinstall-en.txt
Comment 3 Tom Hosiawa 2004-11-12 13:03:47 UTC
Created attachment 43813 [details]
awstats-6.2.diff
Comment 4 Tom Hosiawa 2004-11-12 13:12:30 UTC
Created attachment 43821 [details]
awstats-6.2.ebuild

Hmmm, APACHEVER seems to be working for me now without webapp-apache. 

So I removed the inherit to webapp-apache in this new ebuild, and all appears
to be working. But I'd still like to know why I was having the problem before
if anybody knows?
Comment 5 Tom Hosiawa 2004-12-02 18:34:09 UTC
Created attachment 45183 [details]
awstats-6.2.ebuild

Updated the ebuild to move the directories from cgi-bin to
/var/www/localhost/htdocs/awstats.

So now, only the perl scripts are in the cgi-bin
Comment 6 steveb 2004-12-11 04:29:55 UTC
In awstats-6.2.diff I see you using apche2 commands, but the ebuild only requires apache and not apache2. Can you change that to be maybe something like this?

if (-e "/usr/sbin/apache2ctl") { 
  print "\n-----> Restart Web server graceful with '/usr/sbin/apache2ctl graceful'\n";
  my $ret=`/usr/sbin/apache2ctl graceful`;
} elsif (-e "/usr/sbin/apachectl") {
  print "\n-----> Restart Web server graceful with '/usr/sbin/apachectl graceful'\n";
  my $ret=`/usr/sbin/apachectl graceful`;
} else
  print "\n-----> Error restarting Web server'\n";
}




I see that you use the command "find", "sed" and "cp" but you have no dependency to it in the ebuild. Maybe adding something like this would be not a bad thing?
RDEPEND=">=dev-lang/perl-5.6.1
        >=media-libs/libpng-1.2
        dev-perl/Time-Local
        net-www/apache"
DEPEND="${RDEPEND}
        >=sys-apps/sed-4
        sys-apps/findutils
        sys-apps/coreutils"



cheers

Steve
Comment 7 Tom Hosiawa 2004-12-11 08:15:52 UTC
Created attachment 45740 [details]
awstats-6.2.ebuild

I was told on #gentoo-bugs if a command is part of the supported arch's system
profile, their's no need to include it in DEPEND.

But anyway, here's the fix.
Comment 8 Tom Hosiawa 2004-12-11 08:16:33 UTC
Created attachment 45741 [details, diff]
awstats-6.2.diff
Comment 9 steveb 2004-12-11 08:57:25 UTC
to be honest: the awstats_configure.pl will always jump into the else statement. the reason is that /sbin/service does not exist on gentoo linux. the patch would probably need to look like this:
--- awstats-6.2.orig/tools/awstats_configure.pl 2004-12-11 06:33:00.069716000 -0500
+++ awstats-6.2/tools/awstats_configure.pl 2004-12-11 06:43:32.885513744 -0500
@@ -654,9 +654,15 @@
  if ($OS eq 'linux')  {
-      my $command="/sbin/service";
-      if (-x $command) {
-    		print "\n-----> Restart Web server with '/sbin/service httpd restart'\n";
-	 	    my $ret=`/sbin/service httpd restart`;
-	 	    print "$ret";
+		if (-x "/usr/sbin/apache2ctl")
+		{
+			print "\n-----> Restart Web server graceful with '/usr/sbin/apache2ctl graceful'\n";
+		   		my $ret=`/usr/sbin/apache2ctl graceful`;
+  }
+  elsif (-x "/usr/sbin/apachectl")
+  {
+   print "\n-----> Restart Web server graceful with '/usr/sbin/apachectl graceful'\n";
+   my $ret=`/usr/sbin/apachectl graceful`;
    }
    else {
   print "\n-----> Don't forget to restart manually your web server\n";


what do you think?

cheers

SteveB
Comment 10 Tom Hosiawa 2004-12-11 09:11:08 UTC
Your right, also their's no need for that last else statement in their. How about this:

--- awstats-6.2.orig/tools/awstats_configure.pl 2004-12-11 06:33:00.000000000 -0500
+++ awstats-6.2/tools/awstats_configure.pl      2004-12-11 07:49:59.341480320 -0500
@@ -652,15 +652,15 @@
 # ----------------------------------
 if ($WebServerChanged) {
        if ($OS eq 'linux')     {
-               my $command="/sbin/service";
-               if (-x $command) {
-               print "\n-----> Restart Web server with '/sbin/service httpd restart'\n";
-                   my $ret=`/sbin/service httpd restart`;
-                   print "$ret";
-               }
-               else {
-               print "\n-----> Don't forget to restart manually your web server\n";
-               }
+               if (-e "/usr/sbin/apache2ctl") {
+                       print "\n-----> Restart Web server graceful with '/usr/sbin/apache2ctl graceful'\n";
+                       my $ret=`/usr/sbin/apache2ctl graceful`;
+               } elsif (-e "/usr/sbin/apachectl") {
+                       print "\n-----> Restart Web server graceful with '/usr/sbin/apachectl graceful'\n";
+                       my $ret=`/usr/sbin/apachectl graceful`;
+               } else
+                       print "\n-----> Error restarting Web server'\n";
+               }
        }
        elsif ($OS eq 'macosx') {
                print "\n-----> Restart Web server with '/usr/sbin/apachectl restart'\n";
Comment 11 steveb 2004-12-11 10:09:11 UTC
The last else statement is not bad. In your else statement you print a error, but in real there was no error at all. Why don't you leave the old else statement? It only shows the user that he needs to restart the web server, witch is not a bad thing.
Comment 12 Tom Hosiawa 2004-12-11 10:33:19 UTC
It doesn't really matter. It's just semantics I guess, either one is fine.

My thinking was just, if apachectl and apache2ctl doesn't exist on your system, than something is broke on your system.

Mostly likely you won't be able to restart your server.

Comment 13 Paul Querna 2004-12-11 13:14:43 UTC
Re: Comment #12

Why would your system be broken if those files didn't exist?
Because Gentoo only supports two web servers, Apache 1 or Apache 2?
Comment 14 Tom Hosiawa 2004-12-11 19:54:11 UTC
Because apache is a dependency, so it has to be on the system for the ebuild to work.
Comment 15 steveb 2004-12-24 06:27:21 UTC
Hi Tom

what do you think about adding some thing like this at the top of src_install?

        # Change apache configuration
        local MY_APACHE_VER
        if [[ -f "${ROOT}/etc/apache2/conf/apache2.conf" ]]
        then
                MY_APACHE_VER="2"
        elif [[ -f "${ROOT}/etc/apache/conf/apache.conf" ]]
        then
                MY_APACHE_VER=""
        fi
        if [[ -f "${ROOT}/etc/apache${MY_APACHE_VER}/conf/apache${MY_APACHE_VER}.conf" ]]
        then
                sed -e "s:^\(Alias.*awstats/\)[0-9\.]*\(/.*\)$:\1${PV}\2:g" \
                -e "s:^\([ \t]*ScriptAlias.*awstats/\)[0-9\.]*\(/.*\)$:\1${PV}\2:gI" \
                -e "s:^\([ \t]*<Directory.*awstats/\)[0-9\.]*\(/.*\)$:\1${PV}\2:gI" \
                -e "s:^\([ \t]*<Directory.*awstats/\)[0-9\.]*\(/.*\)$:\1${PV}\2:gI" \
                -e "s:^\([ \t]*AuthUserFile.*awstats/\)[0-9\.]*\(/.*\)$:\1${PV}\2:gI" \
                ${ROOT}/etc/apache${MY_APACHE_VER}/conf/apache${MY_APACHE_VER}.conf \
                > ${T}/apache${MY_APACHE_VER}.conf
                dodir /etc/apache${MY_APACHE_VER}/conf
                insinto /etc/apache${MY_APACHE_VER}/conf
                doins ${T}/apache${MY_APACHE_VER}.conf
        fi




It would help some users to maintain their apache configuration up to date.


cheers

SteveB
Comment 16 Tom Hosiawa 2004-12-24 08:30:40 UTC
My experience with regular expressions is limited, but I'm guessing yours make the necessary updates to apache2.conf to deal with the moving of directories from the cgi-bin to htdocs?

Also, I don't have enough experience with this, so I'm not sure if ebuilds should be trying to update the apache config file itself. I know you'd still need to run etc-update, but I haven't seen anything else do that, so I'm not sure?

Lastly, since those directories are being moved to htdocs. I guess a warning message should be printed that the layout of the package has been changed, you updating the apache config file is necessary?
Comment 17 Paul Querna 2004-12-24 11:58:25 UTC
*** Bug 75248 has been marked as a duplicate of this bug. ***
Comment 18 steveb 2004-12-26 02:24:45 UTC
Hi Tom

the update to the apache configuration is not necessary at all. It just helps do deploy/maintain awstats.

cheers

SteveB
Comment 19 steveb 2005-01-24 04:13:37 UTC
Can we include the following patch into awstats-6.2.diff (see bug http://bugs.gentoo.org/show_bug.cgi?id=77963):
--- awstats-6.2.org/tools/awstats_buildstaticpages.pl   2004-01-25 16:19:48.000000000 +0100
+++ awstats-6.2/tools/awstats_buildstaticpages.pl       2005-01-20 18:47:13.881813728 +0100
@@ -240,7 +240,7 @@
 if ($QueryString =~ /(^|-|&)month=(year)/i) { error("month=year is a deprecated option. Use month=all instead."); }

 if ($QueryString =~ /(^|-|&)debug=(\d+)/i)                     { $Debug=$2; }
-if ($QueryString =~ /(^|-|&)configdir=([^&]+)/i)       { $DirConfig="$2"; }
+if ($QueryString =~ /(^|-|&)configdir=([^&]+)/i)       { $DirConfig="$2";$DirConfig=~tr/a-z0-9_\-\/\./a-z0-9_\-\/\./cd; }
 if ($QueryString =~ /(^|-|&)config=([^&]+)/i)          { $SiteConfig="$2"; }
 if ($QueryString =~ /(^|-|&)awstatsprog=([^&]+)/i)     { $Awstats="$2"; }
 if ($QueryString =~ /(^|-|&)buildpdf/i)                        { $BuildPDF=1; }
--- awstats-6.2.org/wwwroot/cgi-bin/awstats.pl  2004-10-30 20:02:24.000000000 +0200
+++ awstats-6.2/wwwroot/cgi-bin/awstats.pl      2005-01-20 18:46:52.280097688 +0100
@@ -5334,7 +5334,7 @@
        if ($QueryString =~ /config=([^&]+)/i)                          { $SiteConfig=&DecodeEncodedString("$1"); }
        if ($QueryString =~ /diricons=([^&]+)/i)                        { $DirIcons=&DecodeEncodedString("$1"); }
        if ($QueryString =~ /pluginmode=([^&]+)/i)                      { $PluginMode=&DecodeEncodedString("$1"); }
-       if ($QueryString =~ /configdir=([^&]+)/i)                       { $DirConfig=&DecodeEncodedString("$1"); }
+       if ($QueryString =~ /configdir=([^&]+)/i)                       { $DirConfig=&DecodeEncodedString("$1");$DirConfig=~tr/a-z0-9_\-\/\./a-z0-9_\-\/\./cd; }
        # All filters
        if ($QueryString =~ /hostfilter=([^&]+)/i)                      { $FilterIn{'host'}=&DecodeEncodedString("$1"); }         # Filter on host list can also be defined with hostfilter=filter
        if ($QueryString =~ /hostfilterex=([^&]+)/i)            { $FilterEx{'host'}=&DecodeEncodedString("$1"); }                 #
@@ -5382,7 +5382,7 @@
        if ($QueryString =~ /config=([^&]+)/i)                          { $SiteConfig="$1"; }
        if ($QueryString =~ /diricons=([^&]+)/i)                        { $DirIcons="$1"; }
        if ($QueryString =~ /pluginmode=([^&]+)/i)                      { $PluginMode="$1"; }
-       if ($QueryString =~ /configdir=([^&]+)/i)                       { $DirConfig="$1"; }
+       if ($QueryString =~ /configdir=([^&]+)/i)                       { $DirConfig="$1";$DirConfig=~tr/a-z0-9_\-\/\./a-z0-9_\-\/\./cd; }
        # All filters
        if ($QueryString =~ /hostfilter=([^&]+)/i)                      { $FilterIn{'host'}="$1"; }                     # Filter on host list can also be defined with hostfilter=filter
        if ($QueryString =~ /hostfilterex=([^&]+)/i)            { $FilterEx{'host'}="$1"; }                     #


Comment 20 Aaron Walker (RETIRED) gentoo-dev 2005-01-24 06:48:03 UTC
6.3 is in CVS and fixes security bug #77963.

For any other stuff you have posted here, please open separate bugs.