commit: 8a87de18707ceffbda8bb11bad8d3048e6a0d408
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 19 23:03:58 2018 +0000
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Mon Mar 19 23:03:58 2018 +0000
URL: https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=8a87de18
eapi_usage.sh: Replace first awk by grep.
This should make it slightly more robust.
Don't exclude files names Manifest* as it may be a valid package name.
eapi_usage.sh | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/eapi_usage.sh b/eapi_usage.sh
index 9ed0819..29c3831 100755
--- a/eapi_usage.sh
+++ b/eapi_usage.sh
@@ -7,20 +7,18 @@
#
#pinspect eapi_usage /usr/portage
-find /usr/portage/metadata/md5-cache -type f \
- ! -name '*.gz' ! -name 'Manifest*' -exec awk '
- /^EAPI=/ { sub("EAPI=",""); eapi[$1]++; nextfile }
- END { for (i in eapi) print i,eapi[i] }
- ' '{}' '+' | awk '
- { eapi[$1]+=$2; total+=$2 }
+find /usr/portage/metadata/md5-cache -type f ! -name '*.gz' \
+ -exec grep -h '^EAPI=' '{}' + \
+ | awk '
+ { sub("EAPI=",""); eapi[$1]++ }
END {
PROCINFO["sorted_in"]="@val_num_desc"
for (i in eapi) {
- s=""; for (j=1; j<eapi[i]*50./total+0.5; j++) s=s"#"
+ s=""; for (j=1; j<eapi[i]*50./NR+0.5; j++) s=s"#"
printf "EAPI %s: %7d ebuilds (%5.02f%%) %s\n",
- i, eapi[i], eapi[i]*100.0/total, s
+ i, eapi[i], eapi[i]*100.0/NR, s
}
- printf "total: %7d ebuilds\n", total
+ printf "total: %7d ebuilds\n", NR
}'
echo