[packages/rpm-build-macros] validate that man links point to something resolveable

glen glen at pld-linux.org
Tue Mar 5 00:06:12 CET 2013


commit b012dc654b555d36b557416b2d78f3a98e5c22b9
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Tue Mar 5 01:05:40 2013 +0200

    validate that man links point to something resolveable
    
    for now, links to "outside" current package are not allowed

 rpm.macros | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/rpm.macros b/rpm.macros
index d45501c..d7063b0 100644
--- a/rpm.macros
+++ b/rpm.macros
@@ -534,6 +534,14 @@ Provides: %{1} = %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release}
 				echo ".so $l" > $a; \
 				echo >&2 "Converted ${a#$RPM_BUILD_ROOT} from symlink to man link: $l"; \
 			done; \
+			# verify that .so links point to existing files (not allowed to point to "other package")
+			err=$(grep -rl '^\.so ' "$RPM_BUILD_ROOT$i" | while read doc; do \
+				l=$(cat "$doc"); \
+				l=${l#.so }; \
+				# TODO: iterate over all man dirs, but in Th there's only one true man dir \
+				test -e $RPM_BUILD_ROOT$i/$l || echo "  ${doc#$RPM_BUILD_ROOT} points to inexistent manpage: $l"; \
+			done); \
+			test "$err" != "" && { echo >&2 "Man page link errors:"; echo >&2 "$err"; exit 1; }; \
 			find "$RPM_BUILD_ROOT$i" -type f -size +%{_min_compress_bytes}c -print | xargs -r %{__gzip} -9nf; \
 		fi; \
 	done; \
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list