From: Mike Frysinger Date: Mon, 28 Nov 2011 20:42:37 +0000 (-0500) Subject: split out metadata maintainer extraction, and fix it to handle no tags X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=036bd91483a7eb4ed9725d61e3eed66978052756;p=home.git split out metadata maintainer extraction, and fix it to handle no tags --- diff --git a/.profile.d/gentoo.sh b/.profile.d/gentoo.sh index 31e64c5..f8500e2 100644 --- a/.profile.d/gentoo.sh +++ b/.profile.d/gentoo.sh @@ -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 " 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