File findutils.spec of Package findutils

# spec file for package findutils (Version 4.4.2)
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           findutils
License:        GPLv3+
Group:          Productivity/File utilities
Version:        4.4.2
Release:        9
Summary:        The GNU versions of find utilities (find and xargs)
# retreived from
Source:         findutils-%{version}.tar.bz2
Source1:        sysconfig.locate
Source2:        cron.daily.updatedb
# Use /proc/mounts instead of /etc/mtab as autofs entries are only
# listed in the kernels >= 2.6.32
Patch0:         findutils-use_proc_mounts.patch
# adds a new option -xautofs to find to not descend into directories on autofs file systems
Patch1:         findutils-4.4.2-xautofs.patch
# patch accepted by gnulib upstream - rhbz#538536
Patch2:         findutils-4.4.2-fts-remount.patch
# gnulib based SELinux patch adding a new search predicate -context and
# a new -printf conversion %Z
Patch3:         findutils-4.4.2-selinux.patch
# once the selinux-at module appears on the list within import-gnulib.config
# the following patch will be no longer needed
Patch4:         findutils-4.4.2-selinux-gnulib.patch
Patch5:         findutils-4.4.2-updatedb.patch
Patch6:         findutils-prune_unknown.patch
Patch7:         findutils-updatedb_ignore_nfsv4.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1100
BuildRequires:  libselinux-devel
Provides:       find = %{version}
Obsoletes:      find < %{version}
Requires(post):  %{install_info_prereq}
Requires(preun): %{install_info_prereq}

The findutils package contains programs which will help you locate
files on your system.  The find utility searches through a hierarchy
of directories looking for files which match a certain set of criteria
(such as a file name pattern).  The xargs utility builds and executes
command lines from standard input arguments (usually lists of file
names generated by the find command).

You should install findutils because it includes tools that are very
useful for finding things on your system.

%package locate
License:        GPLv3+
Summary:        Tool for Locating Files (findutils subpackage)
Group:          Productivity/File utilities
Provides:       findutils:/usr/bin/locate
PreReq:         %{fillup_prereq}
Requires:       cron

%description locate
This package contains the locate program which is part of the GNU
findutils software suite.

You can find files fast using locate.  On installing findutils-locate
an additional daily cron job will be added to the cron system. This
job will update the files database every night or shortly after
switching on the computer.

%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1

%ifarch %arm armv5tel armv7l armv7el armv5el
# this is a workaround for a qemu-user bug, we hit. A qemu patch is being discussed, but for now ...
export DEFAULT_ARG_SIZE="(31u * 1024u)"
%configure \
  --libexecdir=%{_libdir}/find \
  --localstatedir=/var/lib \
  --without-included-regex \
  --without-fts \
make %{?_smp_mflags}

make check

install -D -m 644 %{SOURCE1} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.locate
install -D -m 755 %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.daily/suse-updatedb
rm -f $RPM_BUILD_ROOT%{_bindir}/oldfind
rm -f $RPM_BUILD_ROOT%{_bindir}/ftsfind
rm -f $RPM_BUILD_ROOT%{_infodir}/find-maint*
%find_lang %{name}
# move find to /bin/find
mkdir -p $RPM_BUILD_ROOT/bin
mv $RPM_BUILD_ROOT{%{_bindir},/bin}/find
# create /usr/bin/find -> /bin/find symlink
ln -sf ../../bin/find $RPM_BUILD_ROOT%{_bindir}


%post locate
%{fillup_only -n locate}

%install_info --info-dir=%{_infodir} %{_infodir}/

%install_info_delete --info-dir=%{_infodir} %{_infodir}/

%doc %{_infodir}/*.gz
%doc %{_mandir}/man1/find.1.gz
%doc %{_mandir}/man1/xargs.1.gz

%files lang -f %{name}.lang

%files locate
%doc %{_mandir}/man1/locate.1.gz
%doc %{_mandir}/man1/updatedb.1.gz
%doc %{_mandir}/man5/locatedb.5.gz