Основные возможности:
-
Позволяет собрать исходный и бинарный пакеты rpm Free-SA версии 1.6.2 в openSUSE 10.3-11.2.
Описание файла спецификации, сборка и установка.
Spec файл
free-sa.spec разработан для сборки rpm пакета
Free-SA (http://sourceforge.net/projects/free-sa).
Описание:
Для корректной сборки пакета частично используются файлы для
Free-SA версии 1.5.1:
- free-sa-1.5.1.report (скрипт для создания отчета по дням, неделям и месяцам)
- free-sa-1.5.1.report.README (описание для скрипта создания отчета по дням, неделям и месяцам)
- free-sa-1.5.1.report.conf (файл конфигурации для создания отчетов)
- free-sa-1.5.1.theme (скрипт управления темами)
- free-sa-1.5.1.theme.README (описание для скрипта управления темами)
И следующие новые файлы:
- free-sa-1.6.2.tar.gz (исходный код http://sourceforge.net/projects/free-sa)
- free-sa.sysconfig (настройки sysconfig для скрипта создания отчетов)
- free-sa-1.6.2-opensuse-native-gcc4.mk
- free-sa-report2-2.1 (оптимизированный скрипт free-sa-report2 для создания отчета по дням, неделям и месяцам)
- free-sa.logrotate (настройки для logrotate)
- free-sa-report2.cron (файл для запуска из cron)
- free-sa-1.6.2.patch (патч)
- free-sa.spec (файл спецификации)
Сборка:
-
Поместить free-sa.spec в /usr/src/packages/SPECS
-
Остальные файлы - в /usr/src/packages/SOURCES
-
Выполнить сборку, установку и настройку аналогично инструкции для
Free-SA версии 1.5.1
Примеры файлов для сборки rpm пакета Free-SA версии 1.6.2 в openSUSE 10.3-11.2:
(Скачать комплект можно будет
здесь. ЗЫ Не тыкать! Жать правой кнопкой: сохранить ссылку как...)
Примечание: исходный код free-sa-1.6.2.tar.gz не включен в архив, можно взять с официального сайта проекта
http://sourceforge.net/projects/free-sa
Условия:
Условия аналогичны изложенным для
Free-SA версии 1.5.1
Текст спецификации free-sa.spec:
Name: free-sa
# List of additional build dependencies
BuildRequires: gcc make patch
Version: 1.6.2
%define oversion 1.5.1
Release: 1
License: GPL v3
Source0: %{name}-%{version}.tar.gz
Source1: %{name}-%{oversion}.theme
Source2: %{name}-%{oversion}.theme.README
Source3: %{name}-%{oversion}.report
Source4: %{name}-%{oversion}.report.conf
Source5: %{name}-%{oversion}.report.README
Source6: %{name}.sysconfig
Source7: %{name}-%{version}-opensuse-native-gcc4.mk
Source8: %{name}-report2-2.1
Source9: %{name}.logrotate
Source10: %{name}-report2.cron
Patch: %{name}-%{version}.patch
Group: Productivity/Networking/Web/Utilities
Summary: Free-SA - statistic analyzer
Requires: httpd, http_proxy
PreReq: %fillup_prereq
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Free-SA is statistic analyzer for daemons log files similar to SARG.
Its main advantages over SARG are much better speed (7x-20x times),
more reports support, crossplatform work and W3C compliance of
generated HTML/CSS reports code.
%prep
%setup -q
%patch -p0
%__cp -pf %SOURCE7 configs/opensuse-native-gcc4.mk
%build
export ADDCFLAGS="$RPM_OPT_FLAGS"
make
%install
make DESTDIR=%{buildroot} install
%__rm -f %{buildroot}%{_datadir}/%{name}/wwwroot/themes/default
%__rm -f %{buildroot}%{_datadir}/%{name}/wwwroot/*.png
%__rm -f %{buildroot}%{_datadir}/%{name}/wwwroot/*.css
%__rm -f %{buildroot}%{_datadir}/%{name}/wwwroot/sa.js
%__rm -rf %{buildroot}%{_datadir}/%{name}/wwwroot/cgi-bin
%__mkdir_p -m 0755 %{buildroot}%{_sbindir}
%__mkdir_p -m 0755 %{buildroot}/srv/www/htdocs/%{name}/cgi-bin
%__mkdir_p -m 0755 %{buildroot}/var/adm/fillup-templates
%__mkdir_p -m 0755 %{buildroot}%{_sysconfdir}/logrotate.d
%__mkdir_p -m 0755 %{buildroot}%{_sysconfdir}/cron.d
%__install -m 0755 %{_sourcedir}/%{name}-%{oversion}.theme %{buildroot}%{_sbindir}/%{name}-theme
%__install -m 0755 %{_sourcedir}/%{name}-%{oversion}.report %{buildroot}%{_sbindir}/%{name}-report
%__install -m 0755 %{_sourcedir}/%{name}-report2-2.1 %{buildroot}%{_sbindir}/%{name}-report2
%__install -m 0644 %{_sourcedir}/%{name}-%{oversion}.theme.README %{buildroot}%{_docdir}/%{name}/theme.README
%__install -m 0644 %{_sourcedir}/%{name}-%{oversion}.report.conf %{buildroot}%{_datadir}/%{name}/%{name}-report.conf
%__install -m 0644 %{_sourcedir}/%{name}-%{oversion}.report.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
%__install -m 0644 %{_sourcedir}/%{name}-%{oversion}.report.README %{buildroot}%{_docdir}/%{name}/report.README
%__install -m 0644 %{_sourcedir}/%{name}.sysconfig %{buildroot}/var/adm/fillup-templates/sysconfig.%{name}
%__install -m 0644 %{_sourcedir}/%{name}.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
%__install -m 0644 %{_sourcedir}/%{name}-report2.cron %{buildroot}%{_sysconfdir}/cron.d/%{name}-report2
%__install -m 0644 themes/rbsec/* %{buildroot}/srv/www/htdocs/%{name}
%__install -m 0644 themes/sa.js %{buildroot}/srv/www/htdocs/%{name}
%__install -m 0755 src/%{name}.cgi %{buildroot}/srv/www/htdocs/%{name}/cgi-bin
%clean
rm -rf %{buildroot}
%post
%{fillup_only -n free-sa}
%files
%defattr(-,root,root)
%dir %{_sysconfdir}/%{name}
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/languages
%dir %{_datadir}/%{name}/wwwroot
%dir %{_datadir}/%{name}/wwwroot/themes
%dir %{_datadir}/%{name}/wwwroot/themes/blues
%dir %{_datadir}/%{name}/wwwroot/themes/qbiq
%dir %{_datadir}/%{name}/wwwroot/themes/rbsec
%dir %{_datadir}/%{name}/wwwroot/themes/sarg
%dir %{_datadir}/%{name}/wwwroot/themes/silver
%dir %attr(-,squid,root) /srv/www/htdocs/%{name}
%dir /srv/www/htdocs/%{name}/cgi-bin
%dir %{_docdir}/%{name}
%dir %attr(0750,squid,root) %{_localstatedir}/cache/%{name}
%{_bindir}/%{name}
%{_sbindir}/%{name}-report
%{_sbindir}/%{name}-report2
%{_sbindir}/%{name}-theme
%config(noreplace) %{_sysconfdir}/%{name}/*
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/cron.d/%{name}-report2
/var/adm/fillup-templates/sysconfig.%{name}
%{_datadir}/%{name}/%{name}-report.conf
%{_datadir}/%{name}/languages/*
%{_datadir}/%{name}/wwwroot/themes/sa.js
%{_datadir}/%{name}/wwwroot/themes/blues/*
%{_datadir}/%{name}/wwwroot/themes/qbiq/*
%{_datadir}/%{name}/wwwroot/themes/rbsec/*
%{_datadir}/%{name}/wwwroot/themes/sarg/*
%{_datadir}/%{name}/wwwroot/themes/silver/*
/srv/www/htdocs/%{name}/*.*
/srv/www/htdocs/%{name}/cgi-bin/%{name}.cgi
%doc %{_docdir}/%{name}/*
%doc %{_mandir}/man1/*
%doc %{_mandir}/man5/*
%changelog
* Wed Nov 18 2009 Konstantin Nadezhdin <w.homenki.ru>
- added free-sa-report2.cron
* Thu Sep 24 2009 Konstantin Nadezhdin <w.homenki.ru>
- added free-sa.logrotate
* Mon Sep 21 2009 Konstantin Nadezhdin <w.homenki.ru>
- changed free-sa-report2 to version 2.1
* Thu May 14 2009 Konstantin Nadezhdin <w.homenki.ru>
- added free-sa-report2
* Tue Apr 21 2009 Konstantin Nadezhdin <w.homenki.ru>
- updated for free-sa 1.6.2
* Thu Mar 26 2009 Konstantin Nadezhdin <w.homenki.ru>
- updated for free-sa 1.6.0
- added opensuse-native-gcc4.mk
- replaced free-sa-1.5.1.patch by free-sa-1.6.0.patch
* Tue Mar 3 2009 Konstantin Nadezhdin <w.homenki.ru>
- changed free-sa-report to version 1.1
* Tue Feb 17 2009 Konstantin Nadezhdin <w.homenki.ru>
- added report.README
* Wed Feb 11 2009 <w.homenki.ru>
- packaged free-sa version 1.5.1 using the buildservice spec file wizard
- renamed free-satheme.sh to free-sa-theme
- replaced free-sa-1.5.1-global.mk.patch by free-sa-1.5.1.patch
- added theme.README and free-sa-report
* Tue Jan 13 2009 Konstantin Nadezhdin <w.homenki.ru>
- added free-sa-1.5.1-global.mk.patch
- added free-satheme.sh theme switching script
Текст free-sa.sysconfig:
## Path: Applications/Free-SA
## Description: Configuration of free-sa
## Type: yesno
## Default: no
#
# Should free-sa-report be enabled to start by cron ("yes" or "no").
# Read /usr/share/doc/packages/free-sa/report.README before add
# free-sa-report to crontab.
#
USE_FREE_SA_REPORT="yes"
## Type: string
## Default: "/var/log/squid/access.log"
#
# Path to squid access.log
#
ACCESSLOGS="/var/log/squid/access.log"
## Type: string
## Default: "/srv/www/htdocs/free-sa"
#
# Where free-sa should save reports
#
HTMLOUTDIR="/srv/www/htdocs/free-sa"
## Type: string
## Default: "/usr/share/free-sa/free-sa-report.conf"
#
# Path to default free-sa-report configuration file
#
FREE_SA_CONF="/usr/share/free-sa/free-sa-report.conf"
## Type: string
## Default: "/var/cache/free-sa"
#
# Where free-sa-report should create temp configuration
# files for day, week and month reports
#
TMPDIR="/var/cache/free-sa"
## Type: yesno
## Default: no
#
# Should free-sa-report be verbose.
#
VERBOSE="yes"
Текст free-sa-1.6.2-opensuse-native-gcc4.mk:
PREFIX = $(DESTDIR)/usr
ETCDIR = $(DESTDIR)/etc/$(PROGLNAME)
WWWDIR = $(PREFIX)/share/$(PROGLNAME)/wwwroot
TMPDIR = $(DESTDIR)/var/cache/$(PROGLNAME)
LOCDIR = $(PREFIX)/share/$(PROGLNAME)/languages
DOCDIR = $(PREFIX)/share/doc/packages/$(PROGLNAME)
LOGFILE = /var/log/squid/access.log
CC = gcc
SORT = /bin/sort
INSTALL = /usr/bin/install
LARGEFILE = yes
SATSEP = '
# CPU (allowed by gcc '-march' option: native, i486, pentium3, athlon, nocona, k8 ...)
#SARCH = native
#ADDCFLAGS = \
# -O2 -pipe \
# -std=c99 \
# -W -Wall -Wextra -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
# -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
# -Wreturn-type -Wswitch -Wshadow -Wcast-align -Wuninitialized \
# -Wchar-subscripts -Wuninitialized -Wbad-function-cast -Wwrite-strings
ADDLDFLAGS = --relax -mrelax
Текст free-sa.logrotate:
# /etc/logrotate.d/free-sa
# $Id$
/srv/www/htdocs/free-sa/*/archive/free-sa.tar.bz2 {
daily
rotate 7
missingok
nocreate
sharedscripts
postrotate
endscript
}
Текст free-sa-report2.cron:
MAILTO=root
0 21 * * * squid /usr/sbin/free-sa-report2
Текст патча free-sa-1.6.2.patch:
--- global.mk.orig 2009-03-23 01:39:59.000000000 +0300
+++ global.mk 2009-03-26 12:26:12.000000000 +0300
@@ -1,5 +1,6 @@
# Operating system profile
-OSTYPE = generic-any-cc
+OSTYPE = opensuse-native-gcc4
+#OSTYPE = generic-any-cc
#OSTYPE = altlinux-i586-gcc4
#OSTYPE = cygwin-native-gcc3
#OSTYPE = freebsd-i386-gcc3
@@ -45,8 +46,8 @@
INSTALLODR = $(INSTALL) -m 0700 -v -d
# All text files variable->value replacer
-SEDREPLACE = sed -e 's|LOGFILE|$(LOGFILE)|g' -e 's|TMPDIR|$(TMPDIR)|g' -e 's|ETCDIR|$(ETCDIR)|g' \
- -e 's|WWWDIR|$(WWWDIR)|g' -e 's|PREFIX|$(PREFIX)|g' \
+SEDREPLACE = sed -e 's|LOGFILE|$(LOGFILE)|g' -e 's|TMPDIR|/var/cache/$(PROGLNAME)|g' -e 's|ETCDIR|/etc/$(PROGLNAME)|g' \
+ -e 's|WWWDIR|/srv/www/htdocs/$(PROGLNAME)|g' -e 's|PREFIX|/usr|g' \
-e 's|PROGNAME|$(PROGNAME)|g' -e 's|PROGVERSION|$(PROGVERSION)|g' \
-e 's|PROGURL|$(PROGURL)|g' -e 's|PROGLNAME|$(PROGLNAME)|g' \
-e 's|PROGCOPYRIGHT|$(PROGCOPYRIGHT)|g'
--- man/Makefile.orig 2009-03-09 01:16:02.000000000 +0300
+++ man/Makefile 2009-03-26 12:35:24.000000000 +0300
@@ -15,8 +15,8 @@
install: all
@( \
- $(INSTALLDIR) $(PREFIX)/man/man1; \
- $(INSTALLDIR) $(PREFIX)/man/man5; \
- $(INSTALLFIL) ./.libs/$(PROGLNAME).1 $(PREFIX)/man/man1; \
- $(INSTALLFIL) ./.libs/$(PROGLNAME).conf.5 $(PREFIX)/man/man5; \
+ $(INSTALLDIR) $(PREFIX)/share/man/man1; \
+ $(INSTALLDIR) $(PREFIX)/share/man/man5; \
+ $(INSTALLFIL) ./.libs/$(PROGLNAME).1 $(PREFIX)/share/man/man1; \
+ $(INSTALLFIL) ./.libs/$(PROGLNAME).conf.5 $(PREFIX)/share/man/man5; \
)