[man-pages-pl] - remove links to nothing

Ivana Varekova varekova at fedoraproject.org
Mon Aug 16 07:58:24 UTC 2010


commit f7784943b3e56611849037658d120e3792dbfff9
Author: Ivana Hutarova Varekova <varekova at redhat.com>
Date:   Mon Aug 16 10:01:37 2010 +0200

    - remove links to nothing

 man-pages-pl.spec |    9 ++++++++-
 rm_bogus_links    |   18 ++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/man-pages-pl.spec b/man-pages-pl.spec
index b3ab3d2..5c39b3a 100644
--- a/man-pages-pl.spec
+++ b/man-pages-pl.spec
@@ -2,12 +2,13 @@
 Summary: Polish man pages from the Linux Documentation Project
 Name: man-pages-pl
 Version: 0.24
-Release: 10%{?dist}
+Release: 11%{?dist}
 # No clear versioning.
 License: GPL+
 Group: Documentation
 # the source is not available on any public mirror now
 Source: man-PL%{releasedate}.tar.gz
+Source1: rm_bogus_links
 Patch1: man-pages-pl-0.24-pidof.patch
 Requires: man-pages-reader
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -20,8 +21,11 @@ Polish.
 %prep
 %setup -q -n pl_PL
 %patch1 -p1
+cp %{SOURCE1} ./
 
 %build
+# remove man-pages links which link to nothing
+./rm_bogus_links
 
 %install
 rm -fr $RPM_BUILD_ROOT
@@ -61,6 +65,9 @@ rm -fr $RPM_BUILD_ROOT
 %{_mandir}/pl/man*/*
 
 %changelog
+* Mon Aug 16 2010 Ivana Hutarova Varekova <varekova at redhat.com> - 0.24-11
+- remove links to nothing
+
 * Fri Apr 16 2010 Ivana Hutarova Varekova <varekova at redhat.com> - 0.24-10
 - add man-pages-reader dependence
 
diff --git a/rm_bogus_links b/rm_bogus_links
new file mode 100755
index 0000000..0511551
--- /dev/null
+++ b/rm_bogus_links
@@ -0,0 +1,18 @@
+#!/bin/bash
+# Remove broken MAN-PAGES links
+for dir in man[1-8]; do
+	for mp in `ls $dir/`; do
+		# if it is a directory, continue
+		if [ -d $dir/$mp ]; then
+			continue;
+		fi
+		link=`head -n1 $dir/$mp | grep "^.so"`;
+		# if the man-page is link to nonexisting file,
+		# remove it
+		if [[ "x$link" != "x" ]]; then 
+			if [[ ! -f $dir/$link ]] && [[ ! -f $link ]]; then
+				rm $dir/$mp
+			fi
+		fi
+	done
+done


More information about the scm-commits mailing list