aboutsummaryrefslogtreecommitdiff
blob: 3e72883a74f89020c4c6c8eaa757ffba2bb988c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

# Boring 'script' that just uses pkgcore's pinspect command. Someday it would be
# nice to graph this output, or maybe keep some running history?

#[[ $(type pinspect 2> /dev/null) ]] || exit 1
#
#pinspect eapi_usage /usr/portage

find /usr/portage/metadata/md5-cache -type f -exec awk '
    BEGINFILE { found=0 }
    /^EAPI=/ { sub("EAPI=",""); eapi[$1]++; found=1; nextfile }
    ENDFILE { if (!found) eapi[0]++ }
    END { for (i in eapi) print i,eapi[i] }
  ' '{}' '+' | awk '
    { eapi[$1]+=$2; total+=$2 }
    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"#"
        printf "EAPI %s: %7d ebuilds (%5.02f%%)  %s\n",
               i, eapi[i], eapi[i]*100.0/total, s
       }
       printf "total:  %7d ebuilds\n", total
    }'

echo
echo "Date generated: $(date)"