]> git.wh0rd.org Git - home.git/commitdiff
split out metadata maintainer extraction, and fix it to handle no <herd> tags
authorMike Frysinger <vapier@gentoo.org>
Mon, 28 Nov 2011 20:42:37 +0000 (15:42 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sat, 28 Apr 2012 19:36:41 +0000 (15:36 -0400)
.profile.d/gentoo.sh

index 31e64c5f4307d632072b1e05b7ab76972ded0d98..f8500e2596f99de478e62b938a220668d5eab438 100644 (file)
@@ -138,6 +138,21 @@ arch_emails() {
        printf '%s@gentoo.org ' ${ret//\~}
        echo
 }
+eget_maintainer() {
+       local f=${1:-metadata.xml}
+       local maintainer=$(xml sel -t -v pkgmetadata/herd $f)
+       if [[ ${maintainer:-no-herd} == "no-herd" ]] ; then
+               maintainer=$(xml sel -t -v pkgmetadata/maintainer/email $f)
+       elif [[ -n ${maintainer} ]] ; then
+               maintainer="${maintainer}@gentoo.org"
+       fi
+       if [[ -z ${maintainer} ]] ; then
+               echo "No maintainer found in $f"
+               return 1
+       fi
+       echo "${maintainer}"
+       return 0
+}
 submit_bug_stable() {
        local msg="doit"
        if [[ $1 == "-m" ]] ; then
@@ -148,16 +163,8 @@ submit_bug_stable() {
                echo "Usage: submit_bug_stable <ebuilds>"
                return 1
        fi
-       local maintainer=$(xml sel -t -v pkgmetadata/herd metadata.xml)
-       if [[ ${maintainer} == "no-herd" ]] ; then
-               maintainer=$(xml sel -t -v pkgmetadata/maintainer/email metadata.xml)
-       elif [[ -n ${maintainer} ]] ; then
-               maintainer="${maintainer}@gentoo.org"
-       fi
-       if [[ -z ${maintainer} ]] ; then
-               echo "No maintainer found in metadata.xml"
-               return 1
-       fi
+       local maintainer
+       maintainer=$(eget_maintainer) || return 1
        local cat=$(basename $(dirname $(pwd)))
        local pkg=${1%.ebuild}
        local ebuild=${pkg}.ebuild