X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=rpm.macros;h=2a876ebcaeb9dab11c2f8b44e927e879f3596c80;hb=2065c1cd3bde4d2ed1dc516be8a845b9e8bb7e8d;hp=cb082f394c35ada0297153cb084e626b4659dde3;hpb=c1775bee81e2522b82a3542c7ae5226828b070c6;p=packages%2Frpm.git diff --git a/rpm.macros b/rpm.macros index cb082f3..2a876eb 100644 --- a/rpm.macros +++ b/rpm.macros @@ -312,7 +312,7 @@ unset DISPLAY ||:\ %{?verbose:set -x;} \ if [ -d "$RPM_BUILD_ROOT" ]; then \ echo "Remove RPATH from executable binaries and shared object files."; \ -find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*%{_libdir}/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \ +find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \ awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \ while read file ; do \ rpath= ; \ @@ -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 pld-linux 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 pld-linux 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; \