[devscripts] 01/01: manpage-alert: improve unknown_package output

Osamu Aoki osamu at moszumanska.debian.org
Fri Mar 11 22:55:49 UTC 2016


This is an automated email from the git hooks/post-receive script.

osamu pushed a commit to branch master
in repository devscripts.

commit dc3b7ecb64dc7403106e4a447b7651ccf6b69ef2
Author: Osamu Aoki <osamu at debian.org>
Date:   Sat Mar 12 07:51:29 2016 +0900

    manpage-alert: improve unknown_package output
    
    Produce better listing of -p option for unknown_package cases
    which are symlinks pointing to files in known packages.
---
 scripts/manpage-alert.sh | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/scripts/manpage-alert.sh b/scripts/manpage-alert.sh
index 5e8b3d8..70ddb48 100755
--- a/scripts/manpage-alert.sh
+++ b/scripts/manpage-alert.sh
@@ -48,17 +48,21 @@ EOF
 }
 
 showpackage() {
-    F="$1"
-    PKGNAME="$(LANG=C dpkg-query -S "$F" 2> /dev/null || true )"
+    F1="$1"
+    P1="$(LANG=C dpkg-query -S "$F1" 2> /dev/null || true )"
+    P1="$(echo "$P1" | sed -e 's/diversion by \(.+\) to:/\1/')"
     # symlink may be created by postinst script for alternatives etc.,
-    if [ -z "$PKGNAME" ]; then
-        F=$(readlink -f "$F")
-        PKGNAME="$(LANG=C dpkg-query -S "$F" 2> /dev/null || true )"
+    if [ -z "$P1" ] && [ -L "$F1" ]; then
+        F2=$(readlink -f "$F1")
+        P2="$(LANG=C dpkg-query -S "$F2" 2> /dev/null || true )"
+        P2="$(echo "$P2" | sed -e 's/diversion by \(.+\) to:/\1/')"
     fi
-    if [ -n "$PKGNAME" ]; then
-        echo "$PKGNAME" | sed -e 's/diversion by \(.+\) to:/\1/'
+    if [ -n "$P1" ]; then
+        echo "$P1"
+    elif [ -n "$P2" ]; then
+        echo "unknown_package: $F1 -> $P2"
     else
-        echo "unknown_package: $F"
+        echo "unknown_package: $F1"
     fi
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list