Package awstats: Specfile

%define apache_addon %_sysconfdir/httpd/conf/addon-modules.d
%define awstats_user awstats
%define awstats_group awstats
%define apache_group apache
%define awstats_home %_localstatedir/%name

Name: awstats
Version: 6.9
Release: alt0.b2008.11.30.M51.1

Summary: Real-time logfile analyzer to get advanced web statistics
Summary(ru_RU.KOI8-R):	\xe1\xce\xc1\xcc\xc9\xda\xc1\xd4\xcf\xd2 \xcc\xcf\xc7\xcf\xd7 Web-\xd3\xc5\xd2\xd7\xc5\xd2\xc1 \xd7 \xd2\xc5\xd6\xc9\xcd\xc5 \xd2\xc5\xc1\xcc\xd8\xce\xcf\xc7\xcf \xd7\xd2\xc5\xcd\xc5\xce\xc9
License: GPL
Group: Monitoring

Url: http://awstats.sourceforge.net
BuildArch: noarch

Source: %name-%version.tar.gz
Source2: awstats.cron
Source3: awstats.apache

Patch0: awstats-6.9-alt-conf.patch
Patch1: awstats-6.9-alt-perl.patch

# Automatically added by buildreq on Wed Oct 22 2003 (-bi)
BuildRequires: perl-HTML-Parser perl-HTML-Tagset perl-URI perl-libwww-perl perl-Encode
BuildRequires(pre): dos2unix

Requires: perl-Encode
Requires: webserver

%description
AWStats is a short for Advanced Web Statistics. It's a free tool that generates
advanced web (but also ftp, syslog or mail) server access statistics
graphically. This log analyzer works as a CGI or from command line and shows
you all possible information your log contains, in few graphical web pages. It
uses a partial information file to be able to process large log files, often
and quickly. It can analyze log files from IIS (W3C log format), Apache log
files (NCSA combined/XLF/ELF log format or common/CLF log format), WebStar and
most of all web, proxy, wap, streaming servers (and even syslog, ftp servers or
mail logs).

%description -l ru_RU.KOI8-R
AWStats \xdc\xd4\xcf \xd3\xcf\xcb\xd2\xc1\xdd\xc5\xce\xc9\xc5 \xcf\xd4 Advanced Web Statistics (\xd2\xc1\xd3\xdb\xc9\xd2\xc5\xce\xc1\xd1 \xf7\xc5\xc2-\xd3\xd4\xc1\xd4\xc9\xd3\xd4\xc9\xcb\xc1).
\xfc\xd4\xcf \xc2\xc5\xd3\xd0\xcc\xc1\xd4\xce\xd9\xca \xc9\xce\xd3\xd4\xd2\xd5\xcd\xc5\xce\xd4 \xc4\xcc\xd1 \xc7\xc5\xce\xc5\xd2\xc1\xc3\xc9\xc9 \xd2\xc1\xd3\xdb\xc9\xd2\xc5\xce\xcf\xca \xd3\xd4\xc1\xd4\xc9\xd3\xd4\xc9\xcb\xc9 \xc7\xd2\xc1\xc6\xc9\xcb\xcf\xd7 \xcf \xd2\xc1\xc2\xcf\xd4\xc5
http (\xc1 \xd4\xc1\xcb \xd6\xc5 ftp, syslog \xc9\xcc\xc9 mail) \xd3\xc5\xd2\xd7\xc9\xd3\xcf\xd7. \xe4\xc1\xce\xce\xd9\xca \xc1\xce\xc1\xcc\xc9\xda\xc1\xd4\xcf\xd2 \xd2\xc1\xc2\xcf\xd4\xc1\xc5\xd4 \xcb\xc1\xcb
\xc9\xda \xcb\xcf\xcd\xc1\xce\xc4\xce\xcf\xca \xd3\xd4\xd2\xcf\xcb\xc9 \xd4\xc1\xcb \xc9 \xd7 \xd7\xc9\xc4\xc5 CGI-\xd3\xcb\xd2\xc9\xd0\xd4\xc1.

%package docs
Summary: AWStats documentation set
Group: Monitoring

%description docs
AWStats is a short for Advanced Web Statistics. It's a free tool that generates
advanced web (but also ftp, syslog or mail) server access statistics
graphically. This log analyzer works as a CGI or from command line and shows
you all possible information your log contains, in few graphical web pages. It
uses a partial information file to be able to process large log files, often
and quickly. It can analyze log files from IIS (W3C log format), Apache log
files (NCSA combined/XLF/ELF log format or common/CLF log format), WebStar and
most of all web, proxy, wap, streaming servers (and even syslog, ftp servers or
mail logs).

%prep
%setup
%patch0 -p2
%patch1 -p2

for dir in tools wwwroot/{cgi-bin,classes/src,css,js}; do
  find "$dir" -type f -exec dos2unix -U {} \;
done

%build

%install
mkdir -p %buildroot%awstats_home
mkdir -p %buildroot%_datadir/%name
mkdir -p %buildroot%_sysconfdir/{%name,cron.d}
mkdir -p %buildroot%apache_addon

install -m644 $RPM_BUILD_DIR/%name-%version/wwwroot/cgi-bin/awstats.model.conf \
	%buildroot/%_sysconfdir/%name/awstats.model.conf.tmpl

install -m644 %SOURCE2 %buildroot/%_sysconfdir/cron.d/%name
install -m644 %SOURCE3 %buildroot/%apache_addon/%name.conf

cp -r $RPM_BUILD_DIR/%name-%version/{tools,wwwroot} \
	%buildroot%_datadir/%name/

find %buildroot%_datadir/%name -type f -a ! -name \*.pl | xargs chmod 0644
find %buildroot%_datadir/%name -name \*.pl | xargs chmod 0755

# Excluded for requirements of commercial product
##rm %buildroot%_datadir/%name/wwwroot/cgi-bin/plugins/geoip.pm
# Remove broken example plugin
rm %buildroot%_datadir/%name/wwwroot/cgi-bin/plugins/example/example.pm
# Remove configs
rm %buildroot%_datadir/%name/wwwroot/cgi-bin/*.conf
# Remove old httpd_conf example
rm %buildroot%_datadir/%name/tools/httpd_conf

%pre
/usr/sbin/groupadd -r %awstats_group
/usr/sbin/useradd -g %awstats_group -c 'WWW server logs analyzer' \
	-d %awstats_home -s '/dev/null' -r %awstats_user 2>/dev/null || :
/usr/sbin/usermod -g %awstats_group -G %apache_group %awstats_user

%files
%config(noreplace) %_sysconfdir/cron.d/%name
%_sysconfdir/%name/
%_datadir/%name/
%config(noreplace) %apache_addon/%name.conf
%dir %attr(1775,root,%awstats_group) %awstats_home

%files docs
%doc README.TXT docs

%changelog
* Wed Dec 02 2009 Vladimir V. Kamarzin <vvk@altlinux.org> 6.9-alt0.b2008.11.30.M51.1
- Rebuild for 5.1.

* Wed Dec 02 2009 Vladimir V. Kamarzin <vvk@altlinux.org> 6.9-alt1.b2008.11.30
- Add dependency on perl-Encode.
- Prevent unneeded unix -> dos conversion (add "-U" to dos2unix call).
- Reduce macro abuse in specfile.

* Sun Dec 07 2008 L.A. Kostis <lakostis@altlinux.ru> 6.9-alt0.b2008.11.30
- new unstable beta snapshot (2008-11-30).
- re-apply browser list.
- update buildreq: add perl-Encode.

* Fri Sep 05 2008 L.A. Kostis <lakostis@altlinux.ru> 6.9-alt0.b2008.08.05
- new unstable beta version (2008-08-05 shapshot).
- sync browsers list w/ forum.mozilla-russia.org detection code.
- fix file mode for cron.d file.

* Thu Nov 29 2007 L.A. Kostis <lakostis@altlinux.ru> 6.8-alt0.b2007.11.24
- NMU.
- new unstable version (2007-11-24 6.8 beta release).

* Wed Apr 25 2007 Igor Muratov <migor@altlinux.org> 6.6-alt2
- bugfix #11609

* Sun Jan 14 2007 Igor Muratov <migor@altlinux.org> 6.6-alt1
- nev version

* Tue Oct 03 2006 Igor Muratov <migor@altlinux.org> 6.5-alt2
- patch for seamonkey detection (thanks to lakostis@)

* Tue May 28 2006 Igor Muratov <migor@altlinux.org> 6.5-alt1
- New version

* Tue Aug 16 2005 Igor Muratov <migor@altlinux.org> 6.4-alt2
- Fix for package requires

* Mon Mar 21 2005 Igor Muratov <migor@altlinux.org> 6.4-alt1
- new version with security fixes

* Sat Feb 26 2005 Igor Muratov <migor@altlinux.org> 6.3-alt4
- play with geoip plugin

* Mon Feb 14 2005 Igor Muratov <migor@altlinux.org> 6.3-alt3
- Security fix CAN-2005-0116

* Tue Feb 08 2005 Igor Muratov <migor@altlinux.org> 6.3-alt2
- Fix permissions for /var/log/httpd

* Sun Jan 30 2005 Igor Muratov <migor@altlinux.org> 6.3-alt1
- New version

* Wed Nov 10 2004 Igor Muratov <migor@altlinux.org> 6.2-alt1
- New version
- Remove mail config template

* Tue May 25 2004 Igor Muratov <migor@altlinux.org> 6.1-alt1
- New version
- Spec cleanup
- Move all files to %_datadir/%name

* Fri Jan 23 2004 Igor Muratov <migor@altlinux.ru> 6.0-alt1
- New version

* Wed Oct 22 2003 Igor Muratov <migor@altlinux.ru> 5.9-alt1
- New version
- Fix for perl syntax error in plugins
- Move documentation to awstats-docs package

* Mon Jul  7 2003 Igor Muratov <migor@altlinux.ru> 5.6-alt1
Fixes:
- Domain with no pages hits were always reported as other in domain chart.
- percent for other in full list of "links for internet search engines"
  has been fixed.
New features/improvments:
- Report compression ratios with mod_deflate feature (Apache 2).
- A better browser detection.
- Can add regex values for a lot of list parameters (HostAliases,
  SkipDNSLookupFor, ...)
- StyleSheet parameter works completely now and sample of CSS files are
  provided.
- Add meta tags robots noindex,nofollow to avoid indexing of stats pages by
  compliant robots.
- Added a "Miscellanous chart" to report ratio of Browsers that support:
  Java, Flash, Real reader, Quicktime reader, WMA reader, PDF reader.
- "Miscellanous chart" also report the "Add to favourites" (must remove the
  "robots.txt" and "favicon.ico" entries off your SkipFiles parameter in your
  config file to have this feature working.
- Update process now try a direct access at last updated record when a new
  update is ran. If it fails (file changed or wrong checksum of record), then
  it does a scan from the beginning of file until a new date has been
  reached (This was the only way of working on older version). So now update
  process is very much faster for thoose who don't purge/rotate their log
  file between two update process (direct access is faster than full scan).
- Better look for report pages on Netscape/Mozilla browsers.
Other/Documentation:
- Updated documentation.
- Update wap/imode browser list.
Note 1:
  You should remove the "robots.txt" and "favicon.ico" entries in the SkipFiles
  parameter in your config files after updgrading to 5.6.

Version 5.5
Fixes:
- Summary robots list was limited to MaxNbOfLoginShown instead of being
  limited to MaxNbOfRobotShown value.
- Fixed a bug when using HBL codes in ShowRobotsStats parameter.
- AllowAccessFromWebToFollowingAuthenticatedUsers now works for users with
  space in name.
- Bug 730996. When URLWithQueryWithoutFollowingParameters was used with a
  value and another parameter was ended with this value, the wrong parameter
  was truncated from URL.
New features/improvments:
- Added a 'Screen Size' report.
- Group OS by families. Added a detailed OS version chart.
- Better 404 errors management. URLs are always cleaned from their parameter
  to build '404 not found' URLs list (because parameters are not interesting
  as they can't have effect as page is not found). Referrer URLs list for '404
  not found' URLs are kept with parameters only if URLReferrerWithQuery is set
  to 1. This make this report more useful.
- Added 'geoipfree' plugin (same than 'geoip' plugin but using the free
  Perl module Geo::IPfree).
- 'geoip' plugin can works with Perl module Geo::IP but also with Perl module
  Geo::IP::PurePerl).
- Added 'userinfo' plugin to add information from a text file (like lastname,
  office department,...) in authenticated user chart.
- month parameter can accept format -month=D, not only -month=DD
- Optimized code size.
- Optimized HTML output report size.
- Added plugin ipv6 to fully support IPv6 (included reverse DNS lookup).
- Split month summary chart and days of month chart in two different charts in
  main page. This also means that ShowDaysOfMonthStats and
  AddDataArrayShowDaysOfMonthStats parameters were added.
- Added -staticlinksext to build static pages with another extension than
  default .html
- Added QMail support and better working support for Postfix and Sendmail (SMA
  preprocessor was replaced by maillogconv.pl).
Other/Documentation:
- AWStats default install directory is /usr/local/awstats for unix like OS.
- Added Isle of Man, Monserat, and Palestinian flag icon.
- Added "local network host" and "Satellite access host" in label of possible
  countries and icons (They appears when using geoip plugins).
- Better management of parsed lines counting. The last line number is also
  stored in history file, for a future use.
- Removed LogFormat=5 option for ISA log file because I am fed up of
  supporting bugged and non standard MS products. Sorry but this takes me too
  many times. To use AWStats with an ISA server, just use now a preprocessor
  tool to convert into a W3C log file.
- Added estonian, serban and icelandic language files.
- Updated documentation.

* Wed Mar  5 2003 Igor Muratov <migor@altlinux.ru> 5.4-alt1
Fixes:
- File name with space inside were not correctly reported when doing FTP log
  server analysis.
- Problem in Wy tag for ten first weeks of year (coded on 1 char instead
  of 2: First week should be "00" instead of "0").
- Tooltips now works correctly with Netscape (>= 5.0).
- Better parsing of parameters (Solved bug 635962).
- Users did not appear in Authenticated users list if hits on pages were 0.
- Value of title "Top x" for domains chart was not always correct.
- Fixed bug 620040 that prevented to use "#" char in HTMLHeadSection.
- Whois link did not work for jp, au, uk and nz domains.
- WhoIs link did not work if host name contained a "-" char.
- Fixed a bug in mod_gzip stats when only ratio was given in log.
New features/improvments:
- Lang parameter accepts 'auto' value (Choose first available language
  accepted by browser).
- Little support for realmedia server.
- Added urlaliasbuilder.pl tool.
- Added URL in possible values for ExtraSection first column.
- New parameter: URLWithAnchor (set to 0 by default).
- Export tooltips features in a plugin (plugin tooltips disabled by default).
- Added average session length in Visit Duration report.
- Added percentage in Visit Duration report.
- logresolvemerge.pl can read .gz or .bz2 files.
- Added icons and Mime label for file types report.
- Added parameters AddDataArrayMonthDayStats, AddDataArrayShowDaysOfWeekStats,
  and AddDataArrayShowHoursStats.
- Added the Whois info in a centered popup window.
- Cosmetic change of browsers reports (group by family and add bar in
  browserdetail).
- Other minor cosmetic change (remove ShowHeader parameter).
- Authenticated user field in log file can contain space with LogFormat=1,
  and they are purged of " with Logformat=6 (Lotus Notes/Domino).
- The AWSTATS_CURRENT_CONFIG environment variable is now always defined
  into AWStats environment with value of config (Can be used inside config
  file like other environment variables).
- Added offset of last log line read and a signature of line into the
  history file after the LastLine date.
- Better error report in load of plugins.
Other/Documentation:
- AWSTATS_CONFIG environment variable renamed into AWSTATS_FORCE_CONFIG.
- Replaced -month=year option by -month=all.
- Added an error message if a -migrate is done on an history file with
  wrong file name.
- GeoIP memory cache code is now stored inside plugin code.
- Added list of loaded plugins in AWStats copyright string.
- Added European and Sao Tome And Principe country flag.
- Added Safari browser icon.
- Updated documentation.
Note 1:
  Old deprecated values for -lang option (-lang=0, -lang=1...) has been
  removed. Use -lang=code_language instead (-lang=en, -lang=fr, ...).
Note 2:
  Old deprecated -month=year option must be replaced by -month=all when
  used on command line.

* Tue Feb 11 2003 Igor Muratov <migor@altlinux.ru> 5.3-alt1
- Fixed: Bad documentation for use of ExtraSection.
- Fixed: Bug in ValidSMTPCodes parameter.
- Fixed: Remove AWStats header on left frame if ShowHeader=0.
- Fixed: 29th february 2004 will be correctly handled.
- Fixed: Another try to fix the #include not working correctly.
- Fixed: Columns not aligned in unknownip view when not all fields are
  choosed.
- Fixed: Columns not aligned in allhosts and lasthosts view when not all
  fields are choosed.
- Added awstats_exportlib.pl tool.
- Added 'Full list' view for Domains/Country report.
- Added 'Full list' and 'Last visits' for email senders/receivers chart.
- Added a memory cache for GeoIP plugin resolution (geoip is faster).
- New parameter: Added AuthenticatedUsersNotCaseSensitive.
- Speed increased when ExtraSection is used.
- Updates to AWStats robots, os, browsers, search_engines databases.
- Added awstats_logo3.png
- Added X11 as Unknown Unix OS, and Atari OS.
- Change way of reading -output= parameter to prepare build of several output
  with same running process.
- Updated documentation.

* Mon Dec 16 2002 Igor Muratov <migor@altlinux.ru> 5.2-alt1
- First build for ALT.
- Added urlalias plugin to replace URL values in URL reports by a text.
- Added geoip plugin to track countries from IP location instead of domain
  value.
- Support for postfix mail log.
- Added total and average row at bottom of day data array.
- Added dynamic filter in Host and Referer pages when used as CGI like
  in Url report.
- Removed "Bytes" text when values is 0.
- Reduced main page size.
- New parameter: Added OnlyHosts parameter.
- New parameter: Added ErrorMessages to use a personalized error message.
- New parameter: Added DebugMessages to not allow debug messages.
- New parameter: Added URLQuerySeparators parameter.
- New parameter: Added UseHTTPSLinkForUrl parameter.
- Report for robots accept codes like others charts ('HBL').
- Can use "char+" instead of "char" for LogSeparator.
- Records with bad http code for Microsoft Index Servers (on 1 digit instead
  of 3) are no more reported as corrupted records.
- Little support for IPv6.
- Static string changed from "string" to 'string'.
- Fixed: Fix a bug when using IIS and query or cs-query-string tag in
  LogFormat and URLWithQuery=1.
- Fixed: #include now works correctly.
- Added Albanian, Bulgarian and Welsh language.
- Added Seychelles flag.