From: Graydon, Tracy Date: Wed, 10 Oct 2012 23:03:03 +0000 (-0700) Subject: Initial commit X-Git-Tag: 1.0_branch X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Ftags%2F1.0_branch;p=profile%2Fivi%2Ffontpackages.git Initial commit --- 316c4c44740fd09cc9b2f1d4998739559a2a3572 diff --git a/bin/compare-repo-font-audit b/bin/compare-repo-font-audit new file mode 100755 index 0000000..9d5df66 --- /dev/null +++ b/bin/compare-repo-font-audit @@ -0,0 +1,324 @@ +#!/bin/sh +# Compares the output of two repo-font-audit runs and print test score changes + +DATADIR="$(dirname $0)/../private" + +usage() { +cat >&2 << EOF_USAGE +Usage: $0 +: “Extracted data” archive produced by repo-font-audit + +Example: +$0 repo-font-audit-fedora-12-20091121T110127Z.tar.xz repo-font-audit-rawhide-20091121T110127Z.tar.xz +EOF_USAGE +exit 1 +} + + +find_package_changes() { +awk -F '|' ' + FNR==1 { + filenames = filenames FILENAME "|" + } + (FNR>1) && ($15!="") { + rpm[$3] = rpm[$3] FILENAME "|" $1 "|" $2 "|" $7 "|" $10 "|" $11 "|" $12 "|" $15 "#" + } + END { + sub("\\|$","",filenames) + split(filenames,filenamest,"|") + + print "B. Font package changes:" + nr = asorti(rpm,rpms) + for ( r = 1 ; r <= nr ; r++ ) { + sub("#$","",rpm[rpms[r]]) + na = split(rpm[rpms[r]],rpma,"#") + delete rpmv + for ( a = 1 ; a <= na ; a++ ) { + if (rpmv[rpma[a]]) { + delete rpma[a] + } + else { + rpmv[rpma[a]] = 1 + } + } + for (i in minus) { + delete minus[i] + } + for (i in plus) { + delete plus[i] + } + for (i in changed) { + delete changed[i] + } + infom = "" + infop = "" + na = asort(rpma) + for ( a = 1 ; a <= na ; a++ ) { + ni = split(rpma[a],rpmi,"|") + if ( rpmi[1] == filenamest[1] ) { + infom = rpmi[2] "|" rpmi[3] "|" rpmi[4] + minus[rpmi[5]] = rpmi[6] "|" rpmi[7] "|" rpmi[8] + } + if ( rpmi[1] == filenamest[2] ) { + infop = rpmi[2] "|" rpmi[3] "|" rpmi[4] + plus[rpmi[5]] = rpmi[6] "|" rpmi[7] "|" rpmi[8] + } + } + for ( file in minus ) { + if ( plus[file] == minus[file] ) { + delete plus[file] + delete minus[file] + } + else { + changed[file] = 1 + if ( plus[file] == "" ) { + delete plus[file] + } + } + } + for ( file in plus ) { + changed[file] = 1 + } + change = 0 + if ( length(minus) > 0 ) { + change = 1 + } + if ( length(plus) > 0 ) { + change = change + 2 + } + if ( change > 0 ) { + split(infom, infomt, "|") + split(infop, infopt, "|") + if ( infomt[3] == "M" ) { + infomt[3] = ", M" + } + if ( infopt[3] == "M" ) { + infopt[3] = ", M" + } + if ( change == 1 ) { + print "— " rpms[r] ".rpm (" infomt[2] ".src.rpm , " infomt[1] infomt[3] ")" + rpmcount = rpmcount - 1 + } + if ( change == 2 ) { + print "+ " rpms[r] ".rpm (" infopt[2] ".src.rpm, " infopt[1] infopt[3] ")" + rpmcount = rpmcount + 1 + } + if ( change == 3 ) { + print "= " rpms[r] ".rpm (" infomt[2] ".src.rpm, " infomt[1] infomt[3] ")" + print " ⇒ " infopt[2] ".src.rpm, " infopt[1] infopt[3] + } + nc = asorti(changed) + for (i in out) { + delete out[i] + } + for ( c = 1 ; c <= nc ; c++ ) { + if ( minus[changed[c]] ) { + split(minus[changed[c]], infoc, "|") + sig = infoc[1] ", " infoc[2] + out[sig] = out [sig] infoc[3] "|−|" changed[c] "#" + formatcount[infoc[3]] = formatcount[infoc[3]] - 1 + maintcount[infomt[1]] = maintcount[infomt[1]] - 1 + } + if ( plus[changed[c]] ) { + split(plus[changed[c]], infoc, "|") + sig = infoc[1] ", " infoc[2] + out[sig] = out [sig] infoc[3] "|+|" changed[c] "#" + formatcount[infoc[3]] = formatcount[infoc[3]] + 1 + maintcount[infopt[1]] = maintcount[infopt[1]] + 1 + } + } + no = asorti(out, outs) + for ( o = 1 ; o <= no ; o++ ) { + font = outs[o] + sub("#$", "", out[font]) + nf = split(out[font],fs, "#") + asort(fs) + for ( f = 1 ; f <= nf ; f++ ) { + split(fs[f], oi, "|") + print " " oi[2] " " font ", " oi[1] "\t" oi[3] + } + } + } + } + nf = asorti (formatcount, fcs) + for ( f = 1 ; f <= nf ; f++ ) { + if ( formatcount[fcs[f]] > 0 ) { + total = total "+" formatcount[fcs[f]] " " fcs[f] ", " + } + if ( formatcount[fcs[f]] < 0 ) { + total = total formatcount[fcs[f]] " " fcs[f] ", " + } + } + sub(", $", ".", total) + if ( total == "" ) { + total = "—" + } + print "" + print "C. Font count changes: " total + print "" + print "D. Packager activity: " + for ( m in maintcount ) { + score = maintcount[m] + if ( score < 0 ) { score = - score } + score = score / 10000 + rmaintcount[score] = rmaintcount[score] m "|" + } + nc = asorti(rmaintcount, rmcs) + for ( c = nc ; c >= 1 ; c-- ) { + sub("\\|$", "", rmaintcount[rmcs[c]]) + split(rmaintcount[rmcs[c]], maint, "|") + nm = asort(maint) + for ( m = 1 ; m <= nm ; m++ ) { + print maint[m] + } + } + }' "$1" "$2" +} + +compare_tests() { + +awk -F '|' ' + BEGIN { + lh = 7 + } + FNR==1 { + filenames = filenames FILENAME "|" + for (i = lh ; i <= NF ; i++) { + testid[ FILENAME "|" i ] = $i + } + } + FNR>1 { + for (i = lh ; i <= NF ; i++) { + score[ FILENAME "|" $1 "|" $2 "|" $3 "|" i ] += $i + } + } + END { + sub("\\|$","",filenames) + split(filenames,filenamest,"|") + for ( sig in score ) { + split(sig,sigt,"|") + nsig = sigt[2] "|" sigt[3] "|" sigt[4] "|" testid[ sigt[1] "|" sigt[5] ] + if ( sigt[1] == filenamest[1] ) { + total_score[nsig] = total_score[nsig] - score[sig] + } + if ( sigt[1] == filenamest[2] ) { + total_score[nsig] = total_score[nsig] + score[sig] + } + } + for ( sig in total_score ) { + split(sig,sigt,"|") + if ( total_score[sig] != 0 ) { + test_diff[ sigt[4] ] = 1 + pk_diff[ sigt[1] "|" sigt[2] "|" sigt[3] ] = 1 + total_score_diff[sig] = total_score[sig] + } + } + line = "Maintainer|SRPM|RPM|" + nt = asorti(test_diff) + for ( t = 1 ; t <= nt ; t++ ) { + line = line test_diff[t] "|" + } + sub("\\|$","",line) + print line + np = asorti(pk_diff) + for ( p = 1 ; p <= np ; p++ ) { + line = pk_diff[p] "|" + for ( t = 1 ; t <= nt ; t++ ) { + line = line total_score_diff[ pk_diff[p] "|" test_diff[t] ] "|" + } + sub("\\|$","",line) + print line + } + }' "$1" "$2" +} + + +pretty_print() { +awk -F '|' ' + BEGIN { + lh = 4 + } + NR==1 { + max = NF + headline = "P#" + for ( i = lh ; i < max ; i++ ) { + headline = headline "|t" i+1-lh + } + print headline + } + NR>1 { + line = NR - 1 + for ( i = lh ; i < max ; i++ ) { + if ( $i ) { line = line "|" $i } + else { line = line "|‧" } + total[i] = total[i] + $i + } + print line + } + END { + totalline = "Balance" + for ( i = lh ; i < max ; i++ ) { + totalline = totalline "|" total[i] + } + print totalline + }' "$1" | column -t -s '|' + + echo "" + +awk -F '|' ' + BEGIN { + lh = 4 + } + NR==1 { + print "P#|Maintainer|RPM|SRPM" + } + NR>1 { + line = NR - 1 + for ( i = 1 ; i < lh ; i++ ) { + if ( $i ) { line = line "|" $i } + else { line = line "| " } + } + print line + }' "$1" | column -t -s '|' + + echo "" + + awk -F '|' ' + BEGIN { lh = 4 } + NR==1 { + for ( i = lh ; i < NF ; i++ ) { + print "t" i+1-lh "|" $i + } + }' "$1" \ + | while read line ; do + testnumber=$(echo $line | cut -d "|" -f 1) + testid=$(echo $line | cut -d "|" -f 2) + echo -n "$testnumber. " + "$DATADIR/test-info" $testid title + done +} + +[ "$#" -lt "2" ] && usage + +TIMESTAMP=$(date -u +%Y%m%dT%H%M%SZ) + +FL="consolidated-data.csv" +TSUM="test-summary.csv" + +TMPDIR=$(mktemp -d --tmpdir=/tmp "$(basename $0)-$TIMESTAMP-XXXXXXXXXX") + +tar xf "$1" "*/$TSUM" -O > "$TMPDIR/1-$TSUM" +tar xf "$1" "*/$FL" -O > "$TMPDIR/1-$FL" +tar xf "$2" "*/$TSUM" -O > "$TMPDIR/2-$TSUM" +tar xf "$2" "*/$FL" -O > "$TMPDIR/2-$FL" + +echo "A. Test result changes:" +echo "" + +compare_tests "$TMPDIR/1-$TSUM" "$TMPDIR/2-$TSUM" > "$TMPDIR/D-$TSUM" +[ $(cat "$TMPDIR/D-$TSUM" | wc -l) -gt 1 ] && pretty_print "$TMPDIR/D-$TSUM" + +echo "" +find_package_changes "$TMPDIR/1-$FL" "$TMPDIR/2-$FL" + +rm -fr "$TMPDIR" diff --git a/bin/filter-fontlint b/bin/filter-fontlint new file mode 100755 index 0000000..fd46616 --- /dev/null +++ b/bin/filter-fontlint @@ -0,0 +1,31 @@ +#!/bin/sh +# Try to filter useless fontlint messages + +awk -F "|" ' + NR==4 { result = $0 } + NR>4 && $1 !~ /^ / { result = result "\n" $0 } + NR>4 && $1 ~ /^ / { gsub("^ ", "|",$1) + result = result $0 } + END { print result }' \ + | awk -F "|" ' + $1 ~ /Validation/ { + l=2 + while (l<=NF) { + print $l + l++ + } + } + $1 !~ /Validation/ { print }' \ + | awk -F "|" ' + NR==1 { result = $0 } + NR>1 && $1 !~ /^ / { result = result "\n" $0 } + NR>1 && $1 ~ /^ / { gsub("^ ", "|",$1) + result = result $0 } + END { if (result != "") { print result } }' \ + | grep -v -e "^The following table(s) in the font have been ignored by FontForge" \ + -e "^The glyph named .* is mapped to .*But its name indicates it should be mapped to .*." \ + -e "^A glyph uses at least one, but not all, anchor classes in a subtable" \ + -e "^This font contains both a .* table and a .* table." \ + -e "^Missing Points at Extrema" \ + -e "^Self Intersecting Glyph" \ + -e "^Wrong Direction" diff --git a/bin/filter-langcover b/bin/filter-langcover new file mode 100755 index 0000000..8500597 --- /dev/null +++ b/bin/filter-langcover @@ -0,0 +1,4 @@ +#!/bin/sh +# Filter the output of fc-query in debug mode to keep only lang coverage + +grep '^[a-z]\{1,4\}\(-[a-z]\{1,4\}\)\?([1-9]) \+{ \+\([a-f0-9]\{4\} \)\+}' diff --git a/bin/filter-unicover b/bin/filter-unicover new file mode 100755 index 0000000..e51c093 --- /dev/null +++ b/bin/filter-unicover @@ -0,0 +1,6 @@ +#!/bin/sh +# Filter unicover output to keep only blocks with less than 10 missing glyphs +# (as fc-query does for lang coverage + +sed 's=^\([^\:]*\):\( *\)\([0-9]\+\)/\([0-9]\+\)\( *\)(\([0-9.]\+\)%)$=\1|\3|\4|\6='\ + | awk -F '|' '($3-$2 > 0) && ($3-$2 < 10) { print $1 ": " $3-$2 }' diff --git a/bin/fix-font-naming b/bin/fix-font-naming new file mode 100755 index 0000000..8f4dcb2 --- /dev/null +++ b/bin/fix-font-naming @@ -0,0 +1,184 @@ +#!/bin/sh +# Implements a font name cleanup heuristic similar to the one described in +# http://blogs.msdn.com/text/attachment/2249036.ashx + +usage() { +cat >&2 << EOF_USAGE +Usage: $0