From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id ED75015808B for ; Sat, 19 Mar 2022 20:22:30 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3F8A1E0877; Sat, 19 Mar 2022 20:22:30 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A5F3EE0877 for ; Sat, 19 Mar 2022 20:22:29 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 930BF343465 for ; Sat, 19 Mar 2022 20:22:28 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C36E3315 for ; Sat, 19 Mar 2022 20:22:26 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1647721332.c921cb304f22ca8dccbdbcea8303d045e47ff04f.sam@gentoo> Subject: [gentoo-commits] proj/qa-scripts:master commit in: / X-VCS-Repository: proj/qa-scripts X-VCS-Files: eapi-usage.sh X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: c921cb304f22ca8dccbdbcea8303d045e47ff04f X-VCS-Branch: master Date: Sat, 19 Mar 2022 20:22:26 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 7910fcda-1f91-4cdd-a05b-66f953e9a2b2 X-Archives-Hash: 3e4802bf84e5de019beb1049a1fd96b0 commit: c921cb304f22ca8dccbdbcea8303d045e47ff04f Author: Sam James gentoo org> AuthorDate: Sat Mar 19 20:22:12 2022 +0000 Commit: Sam James gentoo org> CommitDate: Sat Mar 19 20:22:12 2022 +0000 URL: https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=c921cb30 eapi-usage.sh: write STATS.txt in eapi-usage/ Signed-off-by: Sam James gentoo.org> eapi-usage.sh | 29 +++++++++++++++++++---------- 1 file 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 "
"
 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 "
" > ${stats} -echo -echo "Date generated: $(date -u '+%Y-%m-%d %H:%M:%S %Z')" -echo "" +echo "
" > ${dir}/README.html
+cat ${stats} >> ${dir}/README.html
+echo "
" >> ${dir}/README.html