File perl-Filesys-Df.spec of Package perl-Filesys-Df

#
#   - Filesys::Df -
#

%define real_name Filesys-Df
%define perl_vendorlib %(eval "`perl -V:installvendorlib`"; echo $installvendorlib)
%define perl_vendorarch %(eval "`perl -V:installvendorarch`"; echo $installvendorarch)
%define perl_archlib %(eval "`perl -V:archlib`"; echo $archlib)
%define perl_privlib %(eval "`perl -V:privlib`"; echo $privlib)
%define maketest 1

Name:           perl-%{real_name}
summary:   	Filesys-Df - Perl extension for filesystem disk space information.
version:   	0.92
release:   	1
vendor:    	Ian Guthrie <IGuthrie@aol.com>
packager:  	Holger Manthey <holger.manthey@bertelsmann.de>
license:   	Artistic
group:     	Applications/CPAN
url:       	http://www.cpan.org
buildroot: 	%{_tmppath}/%{name}-%{version}-%(id -u -n)
source:    	http://search.cpan.org//CPAN/authors/id/I/IG/IGUTHRIE/%{real_name}-%{version}.tar.gz


%if 0%{?suse_version}
%if 0%{?suse_version} < 1300
BuildRequires:  perl(ExtUtils::MakeMaker)
%endif
%else
BuildRequires:  perl(ExtUtils::MakeMaker)
#!BuildIgnore:  perl(VMS::Filespec)
%endif

%if 0%{?fedora_version} || 0%{?centos_version} >= 600 || 0%{?rhel_version} >= 600
BuildRequires:  perl-devel
%endif


%description
This module provides a way to obtain filesystem disk space
information. This is a Unix only distribution. If you want to
gather this information for Unix and Windows, use C<Filesys::DfPortable>.
The only major benefit of using C<Filesys::Df> over C<Filesys::DfPortable>,
is that C<Filesys::Df> supports the use of open filehandles as arguments.

The module should work with all flavors of Unix that implement the
C<statvfs()> and C<fstatvfs()> calls, or the C<statfs()> and C<fstatfs()> calls.
This would include Linux, *BSD, HP-UX, AIX, Solaris, Mac OS X, Irix,
Cygwin, etc ...

C<df()> requires a argument that represents the filesystem you want to
query. The argument can be either a scalar directory/file name or a
open filehandle. There is also an optional block size argument so 
you can tailor the size of the values returned. The default block 
size is 1024. This will cause the function to return the values in 1k
blocks. If you want bytes, set the block size to 1.

C<df()> returns a reference to a hash. The keys available in 
the hash are as follows:

C<{blocks}> = Total blocks on the filesystem.

C<{bfree}> = Total blocks free on the filesystem.

C<{bavail}> = Total blocks available to the user executing the Perl 
application. This can be different than C<{bfree}> if you have per-user 
quotas on the filesystem, or if the super user has a reserved amount.
C<{bavail}> can also be a negative value because of this. For instance
if there is more space being used then you have available to you.

C<{used}> = Total blocks used on the filesystem.

C<{per}> = Percent of disk space used. This is based on the disk space
available to the user executing the application. In other words, if
the filesystem has 10% of its space reserved for the superuser, then
the percent used can go up to 110%.

You can obtain inode information through the module as well, but you
must call C<exists()> on the C<{files}> key first, to make sure the information 
is available. Some filesystems may not return inode information, for example
some NFS filesystems.

Here are the available inode keys:

C<{files}> = Total inodes on the filesystem.

C<{ffree}> = Total inodes free on the filesystem.

C<{favail}> = Total inodes available to the user executing the application.
See the rules for the C<{bavail}> key.

C<{fused}> = Total inodes used on the filesystem.

C<{fper}> = Percent of inodes used on the filesystem. See rules for the C<{per}>
key.

There are some undocumented keys that are defined to maintain backwards
compatibilty: C<{su_blocks}>, C<{user_blocks}>, etc ...

If the C<df()> call fails for any reason, it will return
undef. This will probably happen if you do anything crazy like try
to get information for /proc, or if you pass an invalid filesystem name,
or if there is an internal error. C<df()> will C<croak()> if you pass
it a undefined value.

Requirements:
Your system must contain C<statvfs()> and C<fstatvfs()>, or C<statfs()> and C<fstatfs()>
You must be running Perl 5.6 or higher.

#
# 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 %{real_name}-%{version} 
chmod -R u+w %{_builddir}/%{real_name}-%{version}


%build
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}


%check
%if %maketest
%{__make} test
%endif


%install
%if 0%{?suse_version}
%perl_make_install
%perl_process_packlist
%else
make DESTDIR=$RPM_BUILD_ROOT install_vendor
find $RPM_BUILD_ROOT/usr -type f -name perllocal.pod |xargs -i rm -f {}
find $RPM_BUILD_ROOT/usr -type d -depth -exec rmdir {} \; 2>/dev/null
%endif
find %{buildroot} -name "perllocal.pod" -o -name ".packlist" -o -name "*.bs" |xargs -i rm -f {}
rm -f %{buildroot}/var/adm/perl-modules/%{name}


%clean
rm -rf %buildroot


%files
%defattr(-, root, root, 0755)
%doc Changes README
%doc %{_mandir}/man?/*
%dir %{perl_vendorarch}/Filesys
%dir %{perl_vendorarch}/auto/Filesys
%{perl_vendorarch}/Filesys
%{perl_vendorarch}/auto/Filesys


%changelog
* Mon Oct 17 2016 Holger Manthey <holger.manthey@bertelsmann.de>
- fix redhat and sles12 build
* Thu Jun 16 2011 Holger Manthey <holger.manthey@bertelsmann.de>
- add rhel 6 support
* Sun Apr 26 2009 Holger Manthey <holger.manthey@bertelsmann.de>
- build for suse 11.x
* Sat Jul 26 2008 Holger Manthey <holger.manthey@bertelsmann.de>
- Initial build.
openSUSE Build Service is sponsored by