# # - Logfile::Rotate - # This spec file was automatically generated by cpan2rpm [ver: 2.028] # The following arguments were used: # --keep-pipes Logfile::Rotate 2>&1 # For more information on cpan2rpm please visit: http://perl.arix.com/ # %define pkgname Logfile-Rotate %define filelist %{pkgname}-%{version}-filelist %define NVR %{pkgname}-%{version}-%{release} %define maketest 1 name: perl-Logfile-Rotate summary: Logfile-Rotate - Perl module to rotate logfiles. version: 1.05 release: 1 vendor: Paul Gampe packager: Arix International license: Artistic group: Applications/CPAN url: http://www.cpan.org buildroot: %{_tmppath}/%{name}-%{version}-%(id -u -n) buildarch: noarch prefix: %(echo %{_prefix}) source: http://search.cpan.org//CPAN/authors/id/P/PA/PAULG/Logfile-Rotate-1.04.tar.gz %description I have used the name space of the Logfile::Base manpage package by *Ulrich Pfeifer*, as the use of this module closely relates to the processing logfiles. =over 4 =item new `new' accepts the following arguments, `File', `Count', `Gzip', `Pre', `Post', `Flock' and `Dir' with only `File' being mandatory. `new' will open and lock the file, so you may co-ordinate the processing of the file with rotating it. The file is closed and unlocked when the object is destroyed, so you can do this explicitly by `undef''ing the object. The `Pre'/`Post' arguments allow you to pass function references to this method, which you may use as a callback for any processing you want before or after the rotation. For example, you may notify the process writing to the file that it has been rotated. The `Pre' function is passed the current filename to be rotated as an argument and the `Post' function is passed the current filename that was rotated and that file's new filename including any extension added by compression previously. Both the `Pre' and `Post' function references you provide are executed within an `eval' statement inside the `rotate' method. If the `eval' returns an error then the `rotate' method will croak at that point. The `Signal' argument is deprecated by the `Post' argument. The `Flock' argument allows you to specify whether the perl function `flock' is used to lock the file during the rotation operation. Apparently flock causes problems on some platforms and this option has been added to allow you to control the programs behaviour. By default the file will be locked using `flock'. The `Persist' argument allows you to control whether the program will try and set the current log file ownership and permissions on any new files that may be created by the rotation. In some circumstances the program doing the file rotation may not have sufficient permission to `chown' on the file. By default the program will try and preserve ownership and permissions. =item rotate() This method will copy the file passed in `new' to a file of the same name, with a numeric extension and truncate the original file to zero length. The numeric extension will range from 1 up to the value specified by Count, or 7 if none is defined, with 1 being the most recent file. When Count is reached, the older file is discarded in a FIFO (first in, first out) fashion. If the argument `Dir' was given, all old files will be placed in the specified directory. The `Post' function is the last step executed by the rotate method so the return code of rotate will be the return code of the function you proved, or 1 by default. The copy function is implemented by using the the File::Copy manpage package, but I have had a few people suggest that they would prefer the File::Move manpage. I'm still not decided on this as you would loose data if the move should fail. =back # # This package was generated automatically with the cpan2rpm # utility. To get this software or for more information # please visit: http://perl.arix.com/ # %prep %setup -q -n %{pkgname}-1.04 chmod -R u+w %{_builddir}/%{pkgname}-1.04 %build grep -rsl '^#!.*perl' . | grep -v '.bak$' |xargs --no-run-if-empty \ %__perl -MExtUtils::MakeMaker -e 'MY->fixin(@ARGV)' CFLAGS="$RPM_OPT_FLAGS" %{__perl} Makefile.PL `%{__perl} -MExtUtils::MakeMaker -e ' print qq|PREFIX=%{buildroot}%{_prefix}| if \$ExtUtils::MakeMaker::VERSION =~ /5\.9[1-6]|6\.0[0-5]/ '` %{__make} %if %maketest %{__make} test %endif %install [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} %{makeinstall} `%{__perl} -MExtUtils::MakeMaker -e ' print \$ExtUtils::MakeMaker::VERSION <= 6.05 ? qq|PREFIX=%{buildroot}%{_prefix}| : qq|DESTDIR=%{buildroot}| '` cmd=/usr/share/spec-helper/compress_files [ -x $cmd ] || cmd=/usr/lib/rpm/brp-compress [ -x $cmd ] && $cmd # SuSE Linux if [ -e /etc/SuSE-release -o -e /etc/UnitedLinux-release ] then %{__mkdir_p} %{buildroot}/var/adm/perl-modules %{__cat} `find %{buildroot} -name "perllocal.pod"` \ | %{__sed} -e s+%{buildroot}++g \ > %{buildroot}/var/adm/perl-modules/%{name} fi # remove special files find %{buildroot} -name "perllocal.pod" \ -o -name ".packlist" \ -o -name "*.bs" \ |xargs -i rm -f {} # no empty directories find %{buildroot}%{_prefix} \ -type d -depth \ -exec rmdir {} \; 2>/dev/null %{__perl} -MFile::Find -le ' find({ wanted => \&wanted, no_chdir => 1}, "%{buildroot}"); print "%doc TODO Logfile-Rotate.man.html Changes README"; for my $x (sort @dirs, @files) { push @ret, $x unless indirs($x); } print join "\n", sort @ret; sub wanted { return if /auto$/; local $_ = $File::Find::name; my $f = $_; s|^\Q%{buildroot}\E||; return unless length; return $files[@files] = $_ if -f $f; $d = $_; /\Q$d\E/ && return for reverse sort @INC; $d =~ /\Q$_\E/ && return for qw|/etc %_prefix/man %_prefix/bin %_prefix/share|; $dirs[@dirs] = $_; } sub indirs { my $x = shift; $x =~ /^\Q$_\E\// && $x ne $_ && return 1 for @dirs; } ' > %filelist [ -z %filelist ] && { echo "ERROR: empty %files listing" exit -1 } %clean [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} %files -f %filelist %defattr(-,root,root) %changelog * Fri Mar 2 2012 rpm@janus.arix.com - Initial build.