]> git.pld-linux.org Git - packages/rpm.git/commitdiff
- added %%py_postclean (idea and implementation by glen)
authorArtur Frysiak <artur@frysiak.net>
Tue, 15 Feb 2005 13:30:40 +0000 (13:30 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- added %%__spec_install_post_py_hardlink (idea by glen, simplified by me)

Changed files:
    rpm.macros -> 1.189
    rpm.platform -> 1.5

rpm.macros
rpm.platform

index dcf1f4b15c96fdbc813f863c938cc48e05fb1f23..2a876ebcaeb9dab11c2f8b44e927e879f3596c80 100644 (file)
@@ -429,6 +429,27 @@ echo "Compress kernel modules if any."; \
 # Software written in Python language require Python with main version
 %pyrequires_eq() Requires:     python(bytecode) = %py_ver %1
 
+
+# Hardlink binary identical .pyc and .pyo files
+# (idea by glen <at> pld-linux <dot> org)
+%__spec_install_post_py_hardlink {\
+%{!?no_install_post_py_hardlink:
+[ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \
+       b="$(echo $a|sed -e 's/.pyc$/.pyo/')"; \
+       if cmp -s "$a" "$b"; then \
+               ln -f "$a" "$b"; \
+       fi; \
+done \
+} }
+
+# remove python sources, so that check-files won't complain                                                                
+# (idea by glen <at> pld-linux <dot> org)
+%py_postclean() \
+for d in %{py_sitescriptdir} %{py_sitedir}; do \
+ [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -exec rm {} \; ;\
+done \
+%{nil}
+
 # depmod macro
 %depmod() { \
 umask 022; \
index b3c9dde732ccd17fe0b38fd4ab4de7e17fe3bf32..cdfe1b21acd16c8504a082f5c69637ed006c1821 100644 (file)
@@ -20,6 +20,7 @@
 %{__spec_install_post_chrpath}\
 %{__spec_install_post_compress_docs}\
 %{__spec_install_post_compress_modules}\
+%{__spec_install_post_py_hardlink}\
 %{__arch_install_post}\
 %{nil}
 
This page took 0.04096 seconds and 4 git commands to generate.