]> git.pld-linux.org Git - packages/rpm-build-macros.git/blobdiff - rpm.macros
- fix syntax error when bulding with "-debug"
[packages/rpm-build-macros.git] / rpm.macros
index 3b02732f27b78fcbf0bb9633b69bcbe2b9a18bd3..e9d596d0d4f1a5675801841da77a26b188f59f4e 100644 (file)
@@ -503,16 +503,29 @@ CXXFLAGS="%{rpmcxxflags}" \
 #%no_install_post_compress_docs        1
 %__spec_install_post_compress_docs { \
 %{!?no_install_post_compress_docs:__spec_install_post_compress_docs() { \
+       %{!?debug:set +x;} \
        for i in /usr/share/man /usr/X11R6/man; do \
                if [ -d "$RPM_BUILD_ROOT$i" ]; then \
                        echo "Compress man pages: $i"; \
                        find "$RPM_BUILD_ROOT$i" -name '*.bz2' -print | xargs -r %{__bzip2} -df; \
                        find "$RPM_BUILD_ROOT$i" -name '*.gz' -print | xargs -r %{__gzip} -dnf; \
                        find $RPM_BUILD_ROOT$i -type l | while read a; do \
-                               m=$(readlink $a); \
+                               m=$(readlink "$a"); \
+                               if [[ "$m" = */* ]]; then \
+                                       # handle links to different man section \
+                                       l=$(readlink -f "$a"); \
+                                       # full/relative paths that resolve symlink \
+                                       l=${l#$RPM_BUILD_ROOT/usr/share/man/}; \
+                                       l=${l#$RPM_BUILD_ROOT/usr/X11R6/man/}; \
+                                       # full paths that do not resolve symlink \
+                                       l=${l#/usr/share/man/}; \
+                                       l=${l#/usr/X11R6/man/}; \
+                               else \
+                                       l=$m; \
+                               fi; \
                                rm -f $a; \
-                               echo .so ${m##*/} > $a; \
-                               echo >&2 "Converted ${a#$RPM_BUILD_ROOT} from symlink to man link: ${m##*/}"; \
+                               echo ".so $l" > $a; \
+                               echo >&2 "Converted ${a#$RPM_BUILD_ROOT} from symlink to man link: $l"; \
                        done; \
                        find "$RPM_BUILD_ROOT$i" -type f -size +%{_min_compress_bytes}c -print | xargs -r %{__gzip} -9nf; \
                fi; \
@@ -539,6 +552,7 @@ CXXFLAGS="%{rpmcxxflags}" \
 #
 %__spec_install_post_strip {%{!?debug: \
 %{!?no_install_post_strip:__spec_install_post_strip() { \
+%{!?debug:set +x;} \
 if [ -d "$RPM_BUILD_ROOT" ]; then \
        if [ -d $RPM_BUILD_ROOT/lib/modules ]; then \
                modulelist=$(find $RPM_BUILD_ROOT/lib/modules -name '*o' -type f -print); \
@@ -558,20 +572,20 @@ if [ -d "$RPM_BUILD_ROOT" ]; then \
                archiveslist=`echo "$filetypes" | awk -F: '/current ar archive/ {print $1}'`; \
                if [ -n "$elfexelist" ]; then \
                        printf "Stripping %d ELF executables..." $(echo "$elfexelist" | wc -l); \
-                       chmod u+w $elfexelist; \
-                       %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \
+                       echo "$elfexelist" | xargs -r -d'\n' chmod u+w; \
+                       echo "$elfexelist" | xargs -r -d'\n' %{__strip} --remove-section=.note --remove-section=.comment; \
                        echo "DONE"; \
                fi; \
                if [ -n "$elfsharedlist" ]; then \
                        printf "Stripping %d ELF shared libraries..." $(echo "$elfsharedlist" | wc -l); \
-                       chmod u+w $elfsharedlist; \
-                       %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
+                       echo "$elfsharedlist" | xargs -r -d'\n' chmod u+w; \
+                       echo "$elfsharedlist" | xargs -r -d'\n' %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment; \
                        echo "DONE"; \
                fi; \
                if [ -n "$archiveslist" ]; then \
                        printf "Stripping %d ar archives..." $(echo "$archiveslist" | wc -l); \
-                       chmod u+w $archiveslist; \
-                       %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $archiveslist; \
+                       echo "$archiveslist" | xargs -r -d'\n' chmod u+w; \
+                       echo "$archiveslist" | xargs -r -d'\n' %{__strip} --strip-debug --remove-section=.note --remove-section=.comment; \
                        echo "DONE"; \
                fi; \
        fi; \
@@ -609,6 +623,7 @@ fi; }; __spec_install_post_strip } } }
 #
 %__spec_install_post_chrpath {%{!?debug: \
 %{!?no_install_post_chrpath: __spec_install_post_chrpath() { \
+%{!?debug:set +x;} \
 if [ -d "$RPM_BUILD_ROOT" ]; then \
        files=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" ! -regex ".*/lib/modules/.*" ! -regex ".*%{_docdir}/.*" ! -regex ".*%{_includedir}/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"}`; \
        if [ -n "$files" ]; then \
@@ -661,6 +676,7 @@ fi; }; __spec_install_post_chrpath } } }
 #
 %__spec_install_post_check_so { \
 __spec_install_post_check_so() { \
+%{!?debug:set +x;} \
        fail=0; \
        printf "Searching for shared objects with unresolved symbols..."; \
        for f in $(find $RPM_BUILD_ROOT -type f -name '*.so.*' -print); do \
@@ -678,6 +694,7 @@ __spec_install_post_check_so() { \
 #%no_install_post_compress_modules     1
 %__spec_install_post_compress_modules { \
 %{!?no_install_post_compress_modules: __spec_install_post_compress_modules() { \
+%{!?debug:set +x;} \
        if [ -d $RPM_BUILD_ROOT/lib/modules ]; then \
                q=$(find $RPM_BUILD_ROOT/lib/modules -name '*o' -type f -print); \
                if [ "$q" ]; then \
@@ -974,11 +991,11 @@ fi \
 
 # directories
 %py3_prefix            %{expand:%%global py3_prefix %(%{__python3} -c "import sys; print(sys.prefix)" 2>/dev/null || echo ERROR)}%py3_prefix
-%py3_libdir            %{py3_prefix}/%{_lib}/python%{py3_ver}
+%py3_libdir            %{expand:%%global py3_libdir %(%{__python3} -c "import sysconfig; print(sysconfig.get_path('platstdlib'))" 2>/dev/null || echo ERROR)}%py3_libdir
+%py3_incdir            %{expand:%%global py3_incdir %(%{__python3} -c "import sysconfig; print(sysconfig.get_path('include'))" 2>/dev/null || echo ERROR)}%py3_incdir
+%py3_sitedir           %{expand:%%global py3_sitedir %(%{__python3} -c "import sysconfig; print(sysconfig.get_path('platlib'))" 2>/dev/null || echo ERROR)}%py3_sitedir
+%py3_sitescriptdir             %{expand:%%global py3_sitescriptdir %(%{__python3} -c "import sysconfig; print(sysconfig.get_path('purelib'))" 2>/dev/null || echo ERROR)}%py3_sitescriptdir
 %py3_scriptdir %{py3_prefix}/share/python%{py3_ver}
-%py3_incdir            /usr/include/python%{py3_ver}
-%py3_sitedir           %{py3_libdir}/site-packages
-%py3_sitescriptdir %{py3_scriptdir}/site-packages
 %py3_dyndir            %{py3_libdir}/lib-dynload
 
 # pure python modules compilation
@@ -990,6 +1007,7 @@ fi \
 # Hardlink binary identical .pyc and .pyo files
 %__spec_install_post_py_hardlink {\
 %{!?no_install_post_py_hardlink: __spec_install_post_py_hardlink() { \
+%{!?debug:set +x;} \
 local a b c=0 t=0; \
 if [ -d "$RPM_BUILD_ROOT" ]; then \
        find "$RPM_BUILD_ROOT" -name '*.pyc' > __rpm_pyc; \
@@ -1013,12 +1031,6 @@ for d in %{py_sitescriptdir} %{py_sitedir} %*; do \
 done \
 %{nil}
 
-%py3_postclean() \
-for d in %{py3_sitescriptdir} %{py3_sitedir} %*; do \
- [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 | xargs -0r -l512 rm;\
-done \
-%{nil}
-
 # depmod macro
 %depmod() { \
 umask 022; \
@@ -1682,6 +1694,7 @@ compile %{*}\
 %define ModprobeD $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/%{_kernel_ver} \
                                                                                                                                        \
 __install_kernel_modules() {                                                                           \
+%{!?debug:set +x;} \
 local cfgs='%{?with_dist_kernel:%{?with_smp: smp}%{?with_up: up}}%{!?with_dist_kernel: nondist}' \
                                                                                                                                        \
 for MODULE in {%{-m*},}; do                                                                                    \
@@ -1862,6 +1875,7 @@ io.open("/etc/shells", "w"):write(s)\
 
 %py_lint() \
 __py_lint() { \
+%{!?debug:set +x;} \
 find "$@" -type f -name '*.py' | python -c ' \
 import sys \
 import compiler \
This page took 0.403636 seconds and 4 git commands to generate.