diff options
author | Sam James <sam@gentoo.org> | 2022-03-19 20:22:12 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2022-03-19 20:22:12 +0000 |
commit | c921cb304f22ca8dccbdbcea8303d045e47ff04f (patch) | |
tree | 74f0f5ceffbd934f033d9794fe9f22c15108843a | |
parent | eapi-usage.sh: cleanup old EAPI results (diff) | |
download | qa-scripts-c921cb304f22ca8dccbdbcea8303d045e47ff04f.tar.gz qa-scripts-c921cb304f22ca8dccbdbcea8303d045e47ff04f.tar.bz2 qa-scripts-c921cb304f22ca8dccbdbcea8303d045e47ff04f.zip |
eapi-usage.sh: write STATS.txt in eapi-usage/
Signed-off-by: Sam James <sam@gentoo.org>
-rwxr-xr-x | eapi-usage.sh | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/eapi-usage.sh b/eapi-usage.sh index e6fa711..75aa5d4 100755 --- a/eapi-usage.sh +++ b/eapi-usage.sh @@ -1,10 +1,14 @@ #!/bin/bash # This script respects EINFO_QUIET=1 etc to silence stdout +# Always puts a summary in $1/README.html. # Arguments: # $1: output directory. Defaults to eapi-usage. - +# $2: file to place stats in within $1. +set -x . /lib/gentoo/functions.sh + dir=${1} + if [[ -n ${1} && -e ${dir} && ! -d ${dir} ]] ; then eerror "Output directory given (${dir}) is not a directory! Exiting." exit 1 @@ -13,14 +17,15 @@ elif [[ -z ${dir} ]] ; then dir=eapi-usage fi -REPO_PATH=$(portageq get_repo_path ${EROOT:-/} gentoo || exit 1) - -shopt -s nullglob +stats=${2:-$dir/STATS.txt} mkdir -p ${dir} || exit 1 +REPO_PATH=$(portageq get_repo_path ${EROOT:-/} gentoo || exit 1) TMPDIR="$(mktemp -d || exit 1)" +shopt -s nullglob + einfo "Working in TMPDIR=${TMPDIR}" pushd "${TMPDIR}" &>/dev/null || exit 1 mkdir -p eapi-usage || exit 1 @@ -45,7 +50,8 @@ done || { eend $? || exit 1; } eend $? popd &>/dev/null || exit 1 -rm ${dir}/*.txt || exit 1 +# No exit here because it's fine if we removed nothing +rm ${dir}/*.txt mv ${TMPDIR}/eapi-usage/*.txt ${dir}/ || exit 1 rm -r "${TMPDIR}" || exit 1 @@ -57,7 +63,6 @@ rm -r "${TMPDIR}" || exit 1 #[[ $(type pinspect 2> /dev/null) ]] || exit 1 # #pinspect eapi_usage /usr/portage -echo "<pre>" find "${REPO_PATH}"/metadata/md5-cache -type f ! -name '*.gz' \ -exec grep -h '^EAPI=' '{}' + \ | awk ' @@ -70,8 +75,12 @@ find "${REPO_PATH}"/metadata/md5-cache -type f ! -name '*.gz' \ i, eapi[i], eapi[i]*100.0/NR, s } printf "total: %7d ebuilds\n", NR - }' + }' > ${stats} + +echo > ${stats} +echo "Date generated: $(date -u '+%Y-%m-%d %H:%M:%S %Z')" > ${stats} +echo "</pre>" > ${stats} -echo -echo "Date generated: $(date -u '+%Y-%m-%d %H:%M:%S %Z')" -echo "</pre>" +echo "<pre>" > ${dir}/README.html +cat ${stats} >> ${dir}/README.html +echo "</pre>" >> ${dir}/README.html |