[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

r10324 - /man-cgi/extractor/check-manpages-dist.sh



Author: jfs
Date: Wed Nov  6 20:16:18 2013
New Revision: 10324

URL: http://svn.debian.org/wsvn/?sc=1&rev=10324
Log:
Add new script to check if all the manpages in the archive, for a given release, have been extracted properly

Added:
    man-cgi/extractor/check-manpages-dist.sh   (with props)

Added: man-cgi/extractor/check-manpages-dist.sh
URL: http://svn.debian.org/wsvn/man-cgi/extractor/check-manpages-dist.sh?rev=10324&op=file
==============================================================================
--- man-cgi/extractor/check-manpages-dist.sh	(added)
+++ man-cgi/extractor/check-manpages-dist.sh	Wed Nov  6 20:16:18 2013
@@ -0,0 +1,85 @@
+#!/bin/sh -e
+#
+# Compare the manual pages available for a given distribution (as described
+# in Contents.gz) with the manpages extracted using the extractor scripts
+
+
+# Source the configuration file
+ME=$0
+MYDIR="`dirname $ME`"
+
+. ${MYDIR}/config
+
+usage () {
+	echo "Usage: $0 <distribution>"
+}
+
+# Setup directory for scripts
+[ -z "$EXTRACTORDIR" ] && EXTRACTORDIR=$MYDIR
+
+if [ ! -d "$EXTRACTORDIR" ] ; then
+        echo "ERROR: Cannot find the directory $EXTRACTORDIR with the scripts!" >&2
+        exit 1
+fi
+# We store our results here
+DATADIR="$EXTRACTORDIR/data"
+if [ ! -d "$DATADIR" ] ; then
+        echo "ERROR: $DATADIR does not exist, plase run the list-manpages-dist.sh script first" >&2
+	exit 1
+fi
+
+# Parameter parsing
+dist=$1
+if [ -z "$dist" ] ; then
+	echo "WARN: No distribution given, using 'sid'">&2
+	dist=sid
+fi
+[ -n "$2" ] && ARCH=$2
+[ -n "$ARCH" ] && ARCH="i386"
+[ -n "$REPOS" ] && REPOS="main"
+
+# Last sanity checks
+
+MANPAGES_FILES="${DATADIR}/files_manpages_packages.${dist}.${ARCH}"
+if [ ! -e "$MANPAGES_FILES" ] ; then
+        echo "ERROR: $MANPAGES_FILES does not exist, plase run the list-manpages-dist.sh script first" >&2
+	exit 1
+fi
+EXTRACTED_DIR="${MANDIR}/${dist}/"
+if [ ! -d "$EXTRACTED_DIR" ] ; then
+        echo "ERROR: $EXTRACTED_DIR is not a directory, please run the extractor scripts first" >&2
+	exit 1
+fi
+
+RESULT="$DATADIR/check_manpages.${dist}.${ARCH}"
+>$RESULT
+
+cat $MANPAGES_FILES |
+while read file package; do
+	if [ ! -e "${EXTRACTED_DIR}/${file}" ] ; then
+		if [ -L "${EXTRACTED_DIR}/${file}" ] ; then
+			echo "WARN: manpage ${file} symbolic link exists in ${EXTRACTED_DIR} but points nowhere" >&2
+		else
+			if echo ${file} | grep -q  /man/ ; then
+				echo "ERROR: manpage ${file} has not been extracted" >&2
+			else
+				echo "WARN: (possible) manpage ${file} has not been extracted (false positive?)" >&2
+			fi
+		fi
+		echo $file $package >>$RESULT
+	fi
+done
+
+if [ -s "$RESULT" ]; then
+	manpages_not_found=`cat $RESULT | wc -l`
+	echo "$manpages_not_found possible manpages where not found. Manpages not found belong to the following packages:"
+	echo
+	cat $RESULT | awk '{print $2}' | sort | uniq -c | sort -nr
+	echo 
+	echo "Full details available at $RESULT. Please review for false positives"
+else
+	echo "INFO: All (possible) manpages accounted for. Great!"
+fi
+
+
+exit 0

Propchange: man-cgi/extractor/check-manpages-dist.sh
------------------------------------------------------------------------------
    svn:executable = *


Reply to: