[packages/rlocate] - up to 0.5.6, still not ready for recent kernels - updated build patch, added open patch

qboosh qboosh at pld-linux.org
Sun Sep 25 08:57:48 CEST 2016


commit 0a2c45f148dbcdaa14e08c6e8640f553abace2f8
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Sep 25 08:59:34 2016 +0200

    - up to 0.5.6, still not ready for recent kernels
    - updated build patch, added open patch

 rlocate-build.patch |  74 +++++++++++-------------
 rlocate-open.patch  |  11 ++++
 rlocate.spec        | 159 +++++++++++++---------------------------------------
 3 files changed, 83 insertions(+), 161 deletions(-)
---
diff --git a/rlocate.spec b/rlocate.spec
index 6123cc2..d7afb08 100644
--- a/rlocate.spec
+++ b/rlocate.spec
@@ -1,38 +1,33 @@
 # TODO
-# - device: /dev/rlocate (added to module package, but it should be probably in dev?)
-# - conflicts: updatedb manual with slocate
+# - kernel module: doesn't build with Linux 3.x
+# - device: installed with static major, module creates as dynamic => use udev
+# - should provide something like virtual(locate), obsolete other implementations
 # - conflicts: rlocate gid with slocate
-# - it needs rlocated daemon?
 #
 # Conditional build:
-%bcond_without	dist_kernel	# allow non-distribution kernel
 %bcond_without	kernel		# don't build kernel modules
-%bcond_without	smp		# don't build SMP module
 %bcond_without	userspace	# don't build userspace module
 %bcond_with	verbose		# verbose build (V=1)
 
-%if !%{with kernel}
-%undefine	with_dist_kernel
-%endif
 #
 %define		_rel	0.1
 Summary:	Finds files on a system via a central database
 Summary(pl.UTF-8):	Szukanie plików w systemie poprzez centralną bazę danych
 Name:		rlocate
-Version:	0.4.1
+Version:	0.5.6
 Release:	%{_rel}
-License:	GPL
+License:	GPL v2+
 Group:		Base
-Source0:	http://dl.sourceforge.net/rlocate/%{name}-%{version}.tar.gz
-# Source0-md5:	d8a53d1ae0e36157bd43a989fa9cb28d
+Source0:	http://downloads.sourceforge.net/rlocate/%{name}-%{version}.tar.gz
+# Source0-md5:	b834e2b1249fba9138bea29a030de46c
 Patch0:		%{name}-build.patch
+Patch1:		%{name}-open.patch
 URL:		http://rlocate.sourceforge.net/
-BuildRequires:	autoconf
-BuildRequires:	automake
-%if %{with kernel} && %{with dist_kernel}
+BuildRequires:	autoconf >= 2.50
+BuildRequires:	automake >= 1:1.7.1
+%if %{with kernel}
 BuildRequires:	kernel-module-build >= 3:2.6
 %endif
-BuildRequires:	libtool
 BuildRequires:	perl-base
 BuildRequires:	rpmbuild(macros) >= 1.228
 Requires(post,preun):	/sbin/chkconfig
@@ -69,10 +64,8 @@ Summary(pl.UTF-8):	Moduł rlocate dla Linuksa
 Release:	%{_rel}@%{_kernel_ver_str}
 Group:		Base/Kernel
 Requires(post,postun):	/sbin/depmod
-%if %{with dist_kernel}
-%requires_releq_kernel_up
-Requires(postun):	%releq_kernel_up
-%endif
+%requires_releq_kernel
+Requires(postun):	%releq_kernel
 
 %description -n kernel-misc-%{name}
 This package contains rlocate Linux module.
@@ -80,30 +73,13 @@ This package contains rlocate Linux module.
 %description -n kernel-misc-%{name} -l pl.UTF-8
 Ten pakiet zawiera moduł rlocate dla jądra Linuksa.
 
-%package -n kernel-smp-misc-%{name}
-Summary:	rlocate Linux SMP module
-Summary(pl.UTF-8):	Moduł rlocate dla Linuksa SMP
-Release:	%{_rel}@%{_kernel_ver_str}
-Group:		Base/Kernel
-Requires(post,postun):	/sbin/depmod
-%if %{with dist_kernel}
-%requires_releq_kernel_smp
-Requires(postun):	%releq_kernel_smp
-%endif
-
-%description -n kernel-smp-misc-%{name}
-This package contains rlocate Linux SMP module.
-
-%description -n kernel-smp-misc-%{name} -l pl.UTF-8
-Ten pakiet zawiera moduł rlocate dla jądra Linuksa SMP.
-
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
 
 %build
 %if %{with userspace}
-%{__libtoolize}
 %{__aclocal} -I m4
 %{__autoconf}
 %{__autoheader}
@@ -112,85 +88,31 @@ Ten pakiet zawiera moduł rlocate dla jądra Linuksa SMP.
 	--localstatedir=/var/lib
 
 %{__make}
-%{__make} -C rlocate-daemon
 %endif
 
 %if %{with kernel}
+echo "EXTRA_CFLAGS:= -DRL_VERSION=\\\"%{version}\\\" -DRLOCATE_UPDATES" > src/rlocate-module/Makefile
+echo "obj-m:= rlocate.o" >> src/rlocate-module/Makefile
 
-%if !%{with dist_kernel}
-cat 2>&1 <<'EOF'
-WARNING:
-- CONFIG_SECURITY must be enabled in the kernel config,
-- Capabilities must be built as a module or disabled in the kernel config,
-for nondist kernel build to work.
-EOF
-%endif
-
-# kernel module(s)
-cd rlocate-module
-for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
-	if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
-		exit 1
-	fi
-	rm -rf include
-	install -d include/{linux,config}
-	ln -sf %{_kernelsrcdir}/config-$cfg .config
-	ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h
-	ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm
-	ln -sf %{_kernelsrcdir}/Module.symvers-$cfg Module.symvers
-	touch include/config/MARKER
-
-	echo "EXTRA_CFLAGS:= -DRL_VERSION=\\\"%{version}\\\" -DRLOCATE_UPDATES" > Makefile
-	echo "obj-m:= rlocate.o" >> Makefile
-
-	%{__make} -C %{_kernelsrcdir} clean \
-		RCS_FIND_IGNORE="-name '*.ko' -o" \
-		M=$PWD O=$PWD \
-		%{?with_verbose:V=1}
-	%{__make} -C %{_kernelsrcdir} modules \
-		CC="%{__cc}" CPP="%{__cpp}" \
-		M=$PWD O=$PWD \
-		%{?with_verbose:V=1}
-
-	mv rlocate{,-$cfg}.ko
-done
-cd ..
+%build_kernel_modules -m rlocate -C src/rlocate-module
 %endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
 
-install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
-install -d $RPM_BUILD_ROOT/etc/cron.daily
-install -d $RPM_BUILD_ROOT%{_sbindir}
-install -d $RPM_BUILD_ROOT%{_bindir}
-install -d $RPM_BUILD_ROOT%{_mandir}/man1
-install contrib/rlocate.redhat $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
-install rlocate.cron $RPM_BUILD_ROOT/etc/cron.daily/rlocate
-install rlocate-daemon/rlocated $RPM_BUILD_ROOT%{_sbindir}/rlocated
-install rlocate-scripts/rlocate-checkpoint $RPM_BUILD_ROOT%{_bindir}/rlocate-checkpoint
-install doc/man/{rlocate,rlocated,rlocate-checkpoint,updatedb}.1 $RPM_BUILD_ROOT%{_mandir}/man1
-
 %if %{with userspace}
+install -d $RPM_BUILD_ROOT{/dev,/etc/rc.d/init.d,%{_sysconfdir}/%{name}}
+
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
-install -d $RPM_BUILD_ROOT{/var/lib/rlocate,%{_sysconfdir}/%{name}}
-install debian/updatedb.conf $RPM_BUILD_ROOT%{_sysconfdir}
-> $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/module.cfg
+cp -p contrib/rlocate.redhat $RPM_BUILD_ROOT/etc/rc.d/init.d/rlocate
+cp -p debian/updatedb.conf $RPM_BUILD_ROOT%{_sysconfdir}
+:> $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/module.cfg
 %endif
 
 %if %{with kernel}
-install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc
-cd rlocate-module
-install rlocate-%{?with_dist_kernel:up}%{!?with_dist_kernel:nondist}.ko \
-	$RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/rlocate.ko
-%if %{with smp} && %{with dist_kernel}
-install rlocate-smp.ko \
-	$RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/rlocate.ko
-%endif
-cd ..
-install -d $RPM_BUILD_ROOT/dev
+%install_kernel_modules -m src/rlocate-module/rlocate -d misc
 %endif
 
 %clean
@@ -215,41 +137,36 @@ if [ "$1" = "0" ]; then
         /sbin/chkconfig --del %{name}
 fi
 
-%if %{with kernel}
-%files -n kernel-misc-%{name}
-%defattr(644,root,root,755)
-/lib/modules/%{_kernel_ver}/misc/*.ko*
-%dev(c,254,0) /dev/rlocate
-
-%if %{with smp} && %{with dist_kernel}
-%files -n kernel-smp-misc-%{name}
-%defattr(644,root,root,755)
-/lib/modules/%{_kernel_ver}smp/misc/*.ko*
-%dev(c,254,0) /dev/rlocate
-%endif
-%endif
-
 %if %{with userspace}
 %files
 %defattr(644,root,root,755)
+%doc AUTHORS ChangeLog README
 %attr(700,root,root) %dir %{_sysconfdir}/%{name}
-%attr(0,root,root) %ghost %{_sysconfdir}/%{name}/module.cfg
+%attr(600,root,root) %ghost %{_sysconfdir}/%{name}/module.cfg
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/updatedb.conf
 %attr(755,root,root) /etc/cron.daily/rlocate
+%attr(754,root,root) /etc/rc.d/init.d/rlocate
 
 %attr(2755,root,rlocate) %{_bindir}/rlocate
 %attr(2755,root,rlocate) %{_bindir}/rlocate-checkpoint
-%attr(2755,root,rlocate) %{_sbindir}/rlocated
+%attr(755,root,root) %{_sbindir}/rlocated
 
 # symlinks
 %attr(755,root,root) %{_bindir}/updatedb
 %attr(755,root,root) %{_bindir}/locate
 
-%{_mandir}/man1/rlocate*
-%{_mandir}/man1/updatedb.*
-%{_mandir}/man1/rlocate-checkpoint.*
+%{_mandir}/man1/rlocate.1*
+%{_mandir}/man1/rlocate-checkpoint.1*
+%{_mandir}/man1/rlocated.1*
+%{_mandir}/man1/updatedb.1*
 
+# FIXME: use udev to get proper major
+%attr(400,root,root) %dev(c,254,0) /dev/rlocate
 %dir %attr(750,root,rlocate) /var/lib/rlocate
 %endif
 
-%attr(754,root,root) /etc/rc.d/init.d/%{name}
+%if %{with kernel}
+%files -n kernel-misc-%{name}
+%defattr(644,root,root,755)
+/lib/modules/%{_kernel_ver}/misc/rlocate.ko*
+%endif
diff --git a/rlocate-build.patch b/rlocate-build.patch
index 57f53d0..1cc0815 100644
--- a/rlocate-build.patch
+++ b/rlocate-build.patch
@@ -1,30 +1,28 @@
-diff -ur rlocate-0.4.1/Makefile.am rlocate-0.4.1.new/Makefile.am
---- rlocate-0.4.1/Makefile.am	2006-01-19 09:04:52.000000000 +0000
-+++ rlocate-0.4.1.new/Makefile.am	2006-01-19 09:58:36.000000000 +0000
-@@ -22,7 +22,7 @@
- bin_PROGRAMS = rlocate
- rlocate_SOURCES = pidfile.h pidfile.c main.c link.c misc.c link.h misc.h \
-                   rlocate.h rlocate.c
--SUBDIRS = doc rlocate-daemon rlocate-module rlocate-scripts
-+UBDIRS = doc rlocate-daemon rlocate-scripts
- EXTRA_DIST = rlocate.cron debian rlocate-scripts autogen.sh \
-              contrib install-cron.sh.in ChangeLog.slocate
+--- rlocate-0.5.6/src/Makefile.am.orig	2007-08-15 10:57:33.000000000 +0200
++++ rlocate-0.5.6/src/Makefile.am	2016-09-24 20:24:27.153185828 +0200
+@@ -28,7 +28,7 @@
+ rlocate_SOURCES = pidfile.h pidfile.c slocate.c slocate.h \
+ 		  rlocate.h rlocate.c cmds.c cmds.h conf.c conf.h utils.c \
+ 	   	  utils.h
+-SUBDIRS = rlocate-daemon rlocate-module rlocate-scripts
++SUBDIRS = rlocate-daemon rlocate-scripts
+ EXTRA_DIST = rlocate.cron rlocate-scripts install-cron.sh.in
  
-@@ -41,10 +41,6 @@
- # 	-/usr/sbin/groupadd rlocate
- # endif	
+ INSTALL = install -c
+@@ -36,10 +36,6 @@
+ 
+ install-exec-hook:
  	$(INSTALL) -d $(RLOCATE_DB_DIR)
--	chown root:$(rlocate_group) $(DESTDIR)$(bindir)/$(rlocate)
--	chown root:$(rlocate_group) $(RLOCATE_DB_DIR)
+-	chown $(root_uid):$(rlocate_group) $(DESTDIR)$(bindir)/$(rlocate)
+-	chown $(root_uid):$(rlocate_group) $(RLOCATE_DB_DIR)
 -	chmod 2755 $(DESTDIR)$(bindir)/$(rlocate)
 -	chmod 0750 $(RLOCATE_DB_DIR)
  	-$(LN_S) -f $(rlocate) $(DESTDIR)$(bindir)/$(updatedb)
  	-$(LN_S) -f $(rlocate) $(DESTDIR)$(bindir)/$(locate)
  if CRON
-diff -ur rlocate-0.4.1/configure.ac rlocate-0.4.1.new/configure.ac
---- rlocate-0.4.1/configure.ac	2006-01-19 09:04:52.000000000 +0000
-+++ rlocate-0.4.1.new/configure.ac	2006-01-19 09:59:11.000000000 +0000
-@@ -30,12 +30,8 @@
+--- rlocate-0.5.6/configure.ac.orig	2016-09-24 20:17:46.859857059 +0200
++++ rlocate-0.5.6/configure.ac	2016-09-24 20:29:03.723182677 +0200
+@@ -30,13 +30,9 @@
  # rlocate
  #
  AC_ENABLE_UPDATES
@@ -33,33 +31,29 @@ diff -ur rlocate-0.4.1/configure.ac rlocate-0.4.1.new/configure.ac
  AC_SANDBOXED
 -AC_MAJOR_NUMBER
  AC_RLOCATE_GROUP
+ AC_UPDATEDB_CONF
 -AC_PATH_DEV
+ AC_PATH_STATUS
  AC_CHECK_PERL
  
- # Check if we are on a FreeBSD system
-@@ -92,7 +88,6 @@
- 
+@@ -81,7 +77,6 @@
  AC_CONFIG_FILES([Makefile
-           rlocate-daemon/Makefile
--          rlocate-module/Makefile
+           src/Makefile
+           src/rlocate-daemon/Makefile
+-          src/rlocate-module/Makefile
+           src/rlocate-scripts/rlocate-checkpoint
+           src/rlocate-scripts/Makefile
            doc/Makefile
-           doc/man/Makefile
-           rlocate-scripts/rlocate-checkpoint
-diff -ur rlocate-0.4.1/rlocate-scripts/Makefile.am rlocate-0.4.1.new/rlocate-scripts/Makefile.am
---- rlocate-0.4.1/rlocate-scripts/Makefile.am	2006-01-19 09:04:52.000000000 +0000
-+++ rlocate-0.4.1.new/rlocate-scripts/Makefile.am	2006-01-19 09:57:37.000000000 +0000
-@@ -17,14 +17,6 @@
+--- rlocate-0.5.6/src/rlocate-scripts/Makefile.am.orig	2016-09-24 20:29:26.019849182 +0200
++++ rlocate-0.5.6/src/rlocate-scripts/Makefile.am	2016-09-24 20:31:18.149848053 +0200
+@@ -17,10 +17,3 @@
+ 	cp $(srcdir)/rlocate-checkpoint.temp $(srcdir)/rlocate-checkpoint
  	rm $(srcdir)/rlocate-checkpoint.temp
  
- install-exec-hook:
--if FREEBSD
--	-/usr/sbin/pw groupadd $(rlocate_group)
--else
+-install-exec-hook:
 -	-/usr/sbin/groupadd $(rlocate_group)
--endif
--	chown root:$(rlocate_group) $(DESTDIR)$(bindir)/rlocate-checkpoint
+-	chown $(root_uid):$(rlocate_group) $(DESTDIR)$(bindir)/rlocate-checkpoint
 -	chmod 2755 $(DESTDIR)$(bindir)/rlocate-checkpoint
 -
- uninstall-hook:
- if FREEBSD
- 	-/usr/sbin/pw groupdel $(rlocate_group)
+-uninstall-hook:
+-	-/usr/sbin/groupdel $(rlocate_group)
diff --git a/rlocate-open.patch b/rlocate-open.patch
new file mode 100644
index 0000000..970524e
--- /dev/null
+++ b/rlocate-open.patch
@@ -0,0 +1,11 @@
+--- rlocate-0.5.6/src/rlocate.c.orig	2016-09-24 20:34:29.666512273 +0200
++++ rlocate-0.5.6/src/rlocate.c	2016-09-24 20:34:33.569845572 +0200
+@@ -349,7 +349,7 @@
+         LOCK_FILE = get_lock_name(g_data->output_db);
+ 
+         fl.l_pid = getpid();
+-        if ( (LOCK_FD = open(LOCK_FILE, O_CREAT|O_WRONLY)) < 0 ) {
++        if ( (LOCK_FD = open(LOCK_FILE, O_CREAT|O_WRONLY, 0600)) < 0 ) {
+ 		printf("error: cannot open lock file: %s: %s\n", 
+ 			LOCK_FILE, strerror(errno));
+ 		LOCK_FD = -1;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rlocate.git/commitdiff/0a2c45f148dbcdaa14e08c6e8640f553abace2f8



More information about the pld-cvs-commit mailing list