On 2020-06-24 16:08, Michał Górny wrote:
> 
> $ git grep -l mgo...@gentoo.org '**/metadata.xml' | cut -d/ -f1-2 |
> xargs gpy-py2 2>/dev/null
> 

The big problem with this is that it misses any aliases (like graphics@)
that you're a member of. But let's golf; this is POSIX sh, doesn't use
grep to parse XML, and takes the maintainer's email address as an argument:

REPO=/var/db/repos/gentoo
XPATH="/pkgmetadata/maintainer/email[normalize-space(text()) = '${1}']"

find -L "${REPO}" \
  -mindepth 3 \
  -maxdepth 3 \
  -name 'metadata.xml' \
  -exec sh -c "
    for f in \"\${@}\"; do
      xmllint --xpath \"${XPATH}\" \"\${f}\" >/dev/null 2>&1 && \
        echo \"\$(dirname -- \"\${f}\")\" | sed \"s:${REPO%/}/::\"
    done
  " - {} +

Reply via email to