Fix broken squidanalyzer.spec and adjust Makefile.PL to have files at the right place.

A packaging/README file is added to explain how to use rpmbuild.
Thanks to NuxRo for the report.
This commit is contained in:
Gilles Darold 2019-01-02 23:37:00 +01:00
parent 1bd61f726d
commit 070c5f94ad
3 changed files with 52 additions and 20 deletions

View File

@ -31,7 +31,7 @@ my $BASEURL = $ENV{BASEURL} || '/squidreport';
my $DOCDIR = $ENV{DOCDIR} || '';
my $MANDIR = $ENV{MANDIR} || '/usr/local/man/man3';
my $DESTDIR = $ENV{DESTDIR} || '';
$ENV{INSTALLDIRS} ||= 'site';
my $INSTALLDIRS = $ENV{INSTALLDIRS} ||= 'site';
unless(open(INST, ">install_all.sh")) {
print "\nError: can't write post install file install_all.sh, $!\n";
@ -156,8 +156,8 @@ WriteMakefile(
'ABSTRACT' => 'Squid log analyzer',
'EXE_FILES' => [ qw(squid-analyzer) ],
'MAN3PODS' => { 'doc/SquidAnalyzer.pod' => 'blib/man3/SquidAnalyzer.3pm' },
'DESTDIR' => $ENV{DESTDIR},
'INSTALLDIRS' => $ENV{INSTALLDIRS},
'DESTDIR' => $DESTDIR,
'INSTALLDIRS' => $INSTALLDIRS,
'clean' => { FILES => "install_all.sh lib/blib/ squid-analyzer.3" },
'META_MERGE' => {
resources => {

25
packaging/README Normal file
View File

@ -0,0 +1,25 @@
RPM/
Holds squidanalyzer.spec need to build an RPM package for RH/CentOs/Fedora.
It may also be usable for other RPM based distribution.
Copy the squidanalyzer source tarball under:
~/rpmbuild/SOURCES/
Then create the RPM binary package as follow:
rpmbuild -bb squidanalyzer.spec
The binary package may be found here:
~/rpmbuild/RPMS/noarch/squidanalyzer-6.6-1.noarch.rpm
To check which file will be installed and where:
rpm -qlp ~/rpmbuild/RPMS/noarch/squidanalyzer-6.6-1.el7.noarch.rpm
To install run:
rpm -i ~/rpmbuild/RPMS/noarch/squidanalyzer-6.6-1.noarch.rpm

View File

@ -1,11 +1,11 @@
%define contentdir /var/www
%define webdir /var/www
Summary: Squid proxy log analyzer and report generator
Name: squidanalyzer
Version: 6.6
Release: 1%{?dist}
License: GPLv3+
Group: Monitoring
Group: Applications/Internet
URL: http://squidanalyzer.darold.net/
Source: http://prdownloads.sourceforge.net/squid-report/%{name}-%{version}.tar.gz
BuildRequires: perl
@ -31,26 +31,32 @@ or more often with heavy proxy usage.
%setup -q
%build
%{__perl} Makefile.PL DESTDIR=%{buildroot} LOGFILE=%{_logdir}/squid/access.log BINDIR=%{_bindir} HTMLDIR=%{contentdir}/%{name} BASEURL=/%{name} MANDIR=%{_mandir}/man3 QUIET=yes
# Build Makefile for SquidAnalyzer
%{__perl} Makefile.PL INSTALLDIRS=vendor DESTDIR=%{buildroot} LOGFILE=/var/log/squid/access.log BINDIR=%{_bindir} HTMLDIR=%{webdir}/%{name} BASEURL=/%{name} MANDIR=%{_mandir}/man3 QUIET=yes
# Compile
make
%install
%{__rm} -rf %{buildroot}
# Clear buildroot from previous build
%{__rm} -rf %{buildroot}/
%{__make} install DESTDIR=%{buildroot}
install etc/* %{buildroot}%{_sysconfdir}/%{name}/
install -d %{buildroot}%{_sysconfdir}/cron.daily
echo -e "#!/bin/sh\n%{_bindir}/squid-analyzer" > %{buildroot}%{_sysconfdir}/cron.daily/0%{name}
# Make install distrib files
%{__make} install
# Remove unpackaged files.
# Remove .packlist file (per rpmlint)
%{__rm} -f %{buildroot}/%perl_vendorarch/auto/SquidAnalyzer/.packlist
%{__rm} -f `find %{buildroot}/%{_libdir}/perl*/ -name .packlist -type f`
%{__rm} -f `find %{buildroot}/%{_libdir}/perl*/ -name perllocal.pod -type f`
# Install cron
%{__install} -d %{buildroot}/%{_sysconfdir}/cron.daily
echo -e "#!/bin/sh\n%{_bindir}/squid-analyzer" > %{buildroot}/%{_sysconfdir}/cron.daily/0%{name}
%files
%defattr(-, root, root, 0755)
%doc README ChangeLog
%{_mandir}/man3/*
%{_mandir}/man3/squid-analyzer.3.gz
%{_mandir}/man3/SquidAnalyzer.3pm.gz
%{perl_vendorlib}/SquidAnalyzer.pm
%attr(0755,root,root) %{_bindir}/squid-analyzer
%attr(0755,root,root) %dir %{_sysconfdir}/%{name}
@ -59,15 +65,16 @@ echo -e "#!/bin/sh\n%{_bindir}/squid-analyzer" > %{buildroot}%{_sysconfdir}/cron
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/%{name}/included
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/%{name}/network-aliases
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/%{name}/user-aliases
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/%{name}/url-aliases
%config(noreplace) %attr(0754,root,root) %{_sysconfdir}/cron.daily/0%{name}
%attr(0755,root,root) %dir %{_sysconfdir}/%{name}/lang
%{_sysconfdir}/%{name}/lang/*
%attr(0755,root,root) %dir %{contentdir}/%{name}
%{contentdir}/%{name}/flotr2.js
%{contentdir}/%{name}/sorttable.js
%{contentdir}/%{name}/%{name}.css
%attr(0755,root,root) %dir %{contentdir}/%{name}/images
%{contentdir}/%{name}/images/*.png
%attr(0755,root,root) %dir %{webdir}/%{name}
%{webdir}/%{name}/flotr2.js
%{webdir}/%{name}/sorttable.js
%{webdir}/%{name}/%{name}.css
%attr(0755,root,root) %dir %{webdir}/%{name}/images
%{webdir}/%{name}/images/*.png
%clean
%{__rm} -rf %{buildroot}