SPECS: FHS.spec - rpm 4.4.9+ compatible %clean

glen glen at pld-linux.org
Fri Feb 8 22:18:52 CET 2008


Author: glen                         Date: Fri Feb  8 21:18:52 2008 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- rpm 4.4.9+ compatible %clean

---- Files affected:
SPECS:
   FHS.spec (1.129 -> 1.130) 

---- Diffs:

================================================================
Index: SPECS/FHS.spec
diff -u SPECS/FHS.spec:1.129 SPECS/FHS.spec:1.130
--- SPECS/FHS.spec:1.129	Thu Jan 24 23:39:02 2008
+++ SPECS/FHS.spec	Fri Feb  8 22:18:47 2008
@@ -1,5 +1,9 @@
 # $Revision$, $Date$
-# NOTE: don't use %{_*dir} macros for paths defined by FHS
+# NOTE
+# - don't use %{_*dir} macros for paths defined by FHS
+
+# avoid rpm 4.4.9 adding rm -rf buildroot, we need the dirs to check consistency
+%define		__spec_clean_body	%{nil}
 Summary:	Basic FHS 2.3 filesystem layout
 Summary(de.UTF-8):	Grundlegende Dateisystemstruktur
 Summary(fr.UTF-8):	Arborescence de base du système de fichiers
@@ -11,11 +15,13 @@
 License:	GPL
 Group:		Base
 URL:		http://www.pathname.com/fhs/
+BuildRequires:	mktemp
 BuildRequires:	rpmbuild(macros) >= 1.213
 Requires:	setup >= 2.4.6-4
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define		_locmandir	/usr/local/man
+
 # doesn't contain any files, but we're not noarch package
 %define 	no_install_post_strip	1
 %define 	no_install_post_chrpath	1
@@ -80,19 +86,23 @@
 %clean
 cd $RPM_BUILD_ROOT
 
-# %{_rpmfilename} is not expanded, so use
-# %{name}-%{version}-%{release}.%{buildarch}.rpm
-RPMFILE=%{name}-%{version}-%{release}.%{_target_cpu}.rpm
-TMPFILE=%{name}-%{version}.tmp$$
-find . | sed -e 's|^\.||g' -e 's|^$||g' | sort | grep -v $TMPFILE > $TMPFILE
-
-# find finds also '.', so use option -B for diff
-if rpm -qpl %{_rpmdir}/$RPMFILE | grep -v '^/$' | sort | diff -uB $TMPFILE - ; then
-	rm -rf $RPM_BUILD_ROOT
-else
-	echo -e "\nNot so good, some directories are not included in package\n"
-	exit 1;
-fi
+check_filesystem_dirs() {
+	# %{_rpmfilename} is not expanded, so use
+	# %{name}-%{version}-%{release}.%{buildarch}.rpm
+	RPMFILE=%{name}-%{version}-%{release}.%{_target_cpu}.rpm
+	TMPFILE=$(mktemp)
+	find . | sed -e 's|^\.||g' -e 's|^$||g' | LC_ALL=C sort > $TMPFILE
+
+	# find finds also '.', so use option -B for diff
+	if rpm -qpl %{_rpmdir}/$RPMFILE | grep -v '^/$' | LC_ALL=C sort | diff -uB $TMPFILE - ; then
+		rm -rf $RPM_BUILD_ROOT
+	else
+		echo -e "\nNot so good, some directories are not included in package\n"
+		exit 1
+	fi
+	rm -f $TMPFILE
+}
+check_filesystem_dirs
 
 %files
 %defattr(644,root,root,755)
@@ -207,6 +217,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.130  2008-02-08 21:18:47  glen
+- rpm 4.4.9+ compatible %clean
+
 Revision 1.129  2008-01-24 22:39:02  glen
 - reason why no_install_post_{strip,chrpat,compress_modules} are used, however these could as well not be here
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/FHS.spec?r1=1.129&r2=1.130&f=u



More information about the pld-cvs-commit mailing list