]> git.pld-linux.org Git - packages/rpm.git/commitdiff
- some stats when hardlinking .py[co] files
authorElan Ruusamäe <glen@pld-linux.org>
Wed, 5 Nov 2008 21:29:54 +0000 (21:29 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    rpm.macros -> 1.491

rpm.macros

index 07e3606e7ea80bed305687787428cd958f0225f3..145641f1b4867f9e0ba18b11bcc5a76a08eab7e6 100644 (file)
@@ -772,19 +772,25 @@ fi \
 %pyrequires_eq() Requires:     %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: __spec_install_post_py_hardlink() { \
-[ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \
-       b="${a%.pyc}.pyo"; \
-       if cmp -s "$a" "$b"; then \
-               ln -f "$a" "$b"; \
-       fi; \
-done \
+local a b c=0 t=0; \
+if [ -d "$RPM_BUILD_ROOT" ]; then \
+       find "$RPM_BUILD_ROOT" -name '*.pyc' > __rpm_pyc; \
+       while read a; do \
+               b="${a%.pyc}.pyo"; \
+               if cmp -s "$a" "$b"; then \
+                       ln -f "$a" "$b"; \
+                       c=$((c + 1)); \
+               fi; \
+               t=$((t + 1)); \
+       done < __rpm_pyc; \
+       [ $t -gt 0 ] && printf "Hardlink Python files: %d/%d files hardlinked\n" $c $t; \
+       rm -f __rpm_pyc; \
+fi; \
 }; __spec_install_post_py_hardlink } }
 
 # 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' -print0 | xargs -0r -l512 rm;\
This page took 0.04119 seconds and 4 git commands to generate.