[packages/rpm-build-macros] 1.658: %py_postclean -x FILE1,FILE2 support

glen glen at pld-linux.org
Tue Apr 9 21:18:49 CEST 2013


commit 6454da068ba2904fb522c89de46c5e61b15a3994
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Tue Apr 9 22:18:11 2013 +0300

    1.658: %py_postclean -x FILE1,FILE2 support

 rpm-build-macros.spec |  4 ++--
 rpm.macros            | 15 ++++++++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/rpm-build-macros.spec b/rpm-build-macros.spec
index 2ccd3ac..ac8d27a 100644
--- a/rpm-build-macros.spec
+++ b/rpm-build-macros.spec
@@ -1,10 +1,10 @@
-%define		rpm_macros_rev	1.657
+%define		rpm_macros_rev	1.658
 %define		find_lang_rev	1.36
 Summary:	PLD Linux RPM build macros
 Summary(pl.UTF-8):	Makra do budowania pakietów RPM dla Linuksa PLD
 Name:		rpm-build-macros
 Version:	%{rpm_macros_rev}
-Release:	2
+Release:	1
 License:	GPL
 Group:		Development/Building
 Source0:	rpm.macros
diff --git a/rpm.macros b/rpm.macros
index 61da454..7b005d6 100644
--- a/rpm.macros
+++ b/rpm.macros
@@ -1093,10 +1093,19 @@ if [ -d "$RPM_BUILD_ROOT" ]; then \
 fi; \
 }; __spec_install_post_py_hardlink } }
 
-# remove python sources, so that check-files won't complain
-%py_postclean() \
+# Remove Python 2.x sources,
+# PLD Linux policy is to package only compiled .py[co] for Python 2.x libraries.
+# Author: Elan Ruusamäe <glen at pld-linux.org>
+#
+# Usage:
+# %py_postclean /usr/share/extra -x keepme.py,keeptoo.py
+# Options:
+# -x - comma separated of file basenames to preserve
+# ARGS - extra directories to clean for .py sources
+#
+%py_postclean(x:) \
 for d in %{py_sitescriptdir} %{py_sitedir} %*; do \
- [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 | xargs -0r -l512 rm;\
+	[ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 %{-x:| grep -ZzvE '/(%(echo '%{-x*}' | tr ',' '|'))$'} | xargs -0r -l512 rm;\
 done \
 %{nil}
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-macros.git/commitdiff/6454da068ba2904fb522c89de46c5e61b15a3994



More information about the pld-cvs-commit mailing list