[packages/php-pear] redo installtion: run pear in build, check all files/dirs

glen glen at pld-linux.org
Fri Jul 11 10:36:39 CEST 2014


commit 1d54684032ec04ac923c9494e7838f7f35986b72
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Fri Jul 11 11:29:27 2014 +0300

    redo installtion: run pear in build, check all files/dirs

 php-pear.spec | 44 ++++++++++++++++++++++++++++++--------------
 1 file changed, 30 insertions(+), 14 deletions(-)
---
diff --git a/php-pear.spec b/php-pear.spec
index a7f436e..bc1dfa5 100644
--- a/php-pear.spec
+++ b/php-pear.spec
@@ -66,16 +66,20 @@ php-pear-* (php-pear-PEAR, php-pear-Archive_Tar, itp).
 %prep
 %setup -qcT
 
-%install
-rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{php_pear_dir}/{.registry,bin,data,tests}
+%build
+rm -rf pear
+install -d pear
 
 # add extra channels
-%{__pear} -c pearrc config-set php_dir $RPM_BUILD_ROOT%{php_pear_dir}
+%{__pear} -c pearrc config-set php_dir pear
 for xml in $(awk '/^Source[0-9]+:.+channel-.+.xml$/ {print $NF}' %{_specdir}/%{name}.spec); do
 	%{__pear} -c pearrc channel-add %{_sourcedir}/$xml
 done
 
+%install
+install -d $RPM_BUILD_ROOT%{php_pear_dir}/{.registry,bin,data,tests}
+cp -a pear/.??* $RPM_BUILD_ROOT%{php_pear_dir}
+
 while read dir; do
 	install -d $RPM_BUILD_ROOT$dir
 done <<EOF
@@ -131,22 +135,34 @@ done <<EOF
 EOF
 
 %clean
-cd $RPM_BUILD_ROOT%{php_pear_dir}
-
 check_channel_dirs() {
-	RPMFILE=%{name}-%{version}-%{release}.%{_target_cpu}.rpm
-	TMPFILE=$(mktemp)
-	find .channels .registry -type d | LC_ALL=C sort > $TMPFILE
+	local RPMFILE=%{name}-%{version}-%{release}.%{_target_cpu}.rpm
+	local installed=$(mktemp -t instXXXXXX.tmp)
+	local rpmfiles=$(mktemp -t rpmXXXXXX.tmp)
+	local rc diff=$(mktemp -t diffXXXXXX.tmp)
+
+	find $RPM_BUILD_ROOT%{php_pear_dir} | LC_ALL=C sort > $installed
+	sed -i -re "s#^$RPM_BUILD_ROOT%{php_pear_dir}/?##" $installed
+
+	rpm -qpl %{_rpmdir}/$RPMFILE |  LC_ALL=C sort > $rpmfiles
+	sed -i -re "s#^%{php_pear_dir}/?##" $rpmfiles
 
 	# find finds also '.', so use option -B for diff
-	if rpm -qplv %{_rpmdir}/$RPMFILE | sed -ne '/^d/s,^.*%{php_pear_dir}/\.,.,p' | LC_ALL=C sort | diff -uB $TMPFILE - ; then
-		rm -rf $RPM_BUILD_ROOT
-	else
-		echo -e "\nNot so good, some channel directories are not included in package\n"
+	if ! diff -uB $installed $rpmfiles > $diff; then
+		cat <<-EOF
+
+		ERROR: some files/directories are not included in package:
+
+		$(%{__sed} -ne '/^-[^-]/ s#^-#%%{php_pear_dir}/#p' $diff)
+
+		EOF
+
 		exit 1
 	fi
-	rm -f $TMPFILE
+	rm -rf $RPM_BUILD_ROOT
+	rm -f $installed $rpmfiles $diff
 }
+
 check_channel_dirs
 
 %files
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/php-pear.git/commitdiff/7e5dea506b0b8ed4933f2dc9ae51a514655a6a3d



More information about the pld-cvs-commit mailing list