From: Paul Varner Date: Wed, 20 Jun 2012 17:11:44 +0000 (-0500) Subject: Add support for the md5-cache metadata format. (Bug 422675) X-Git-Tag: gentoolkit-0.3.0.7~17 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6b94fbd3b74471cf9740a35d669963e0b6c84eac;p=gentoolkit.git Add support for the md5-cache metadata format. (Bug 422675) The gentoo tree is moving to the md5-cache format instead of pms. This add support for reading the md5-cache metadata format. --- diff --git a/bin/euse b/bin/euse index 85ff924..3b7556f 100755 --- a/bin/euse +++ b/bin/euse @@ -385,6 +385,7 @@ get_useflaglist() { # get_useflaglist_ebuild() { local known=$(echo "${ACTIVE_FLAGS[5]}" | egrep "^${1}") + local cacheformat if [[ -n $known ]]; then # No need to recache return @@ -400,23 +401,34 @@ get_useflaglist_ebuild() { fi # Open the ebuild file and retrieve defined USE flags [[ ! -d "$portdir/${1}" ]] && continue - if [[ ! -d "$portdir/metadata/cache" ]]; then + cacheformat="unknown" + [[ -d "$portdir/metadata/cache" ]] && cacheformat="cache" # format is pms + [[ -d "$portdir/metadata/md5-cache" ]] && cacheformat="md5-cache" # format is md5-cache + if [[ "$cacheformat" == "unknown" ]]; then echo "!!! Metadata cache not found. You need to run " >&2 echo "!!! 'egencache --repo=$overlay --update'" >&2 echo "!!! to generate metadata for your overlays" >&2 return 1 fi - append=$(set +f; ls $portdir/metadata/cache/${1}-* \ + append=$(set +f; ls ${portdir}/metadata/${cacheformat}/${1}-* \ | egrep "${1}-[0-9.]+" \ - | sed -e "s:$portdir/metadata/cache/${1}-::g" \ + | sed -e "s:${portdir}/metadata/${cacheformat}/${1}-::g" \ | while read -d $'\n' version; do IFS=$'\n' - if [[ ! -e "$portdir/metadata/cache/${1}-$version" ]]; then + if [[ ! -e "${portdir}/metadata/${cacheformat}/${1}-$version" ]]; then # Repo does not have this particular package continue fi - iuse=$(head -11 "$portdir/metadata/cache/${1}-$version"|tail -1) - slot=$(head -3 "$portdir/metadata/cache/${1}-$version"|tail -1) + if [[ "${cacheformat}" == "cache" ]]; then + iuse=$(head -n 11 "${portdir}/metadata/${cacheformat}/${1}-$version"|tail -n 1) + slot=$(head -n 3 "${portdir}/metadata/${cacheformat}/${1}-$version"|tail -n 1) + elif [[ "${cacheformat}" == "md5-cache" ]]; then + iuse=$(grep "^IUSE=" "${portdir}/metadata/${cacheformat}/${1}-$version" | sed 's/^IUSE=//') + slot=$(grep "^SLOT=" "${portdir}/metadata/${cacheformat}/${1}-$version" | sed 's/^SLOT=//') + else + # This is a bug, we should have already returned + return 1 + fi echo "${1};${version};${slot};${iuse};${overlay}" done )