3 export LANG
=C LC_ALL
=C LC_COLLATE
=C
6 raw_git_log
="$(git log)"
7 git_data
="$(echo "$raw_git_log" | grep 'Author:' |
8 sed -e 's/^ *Author://; s/\\//g; s/^ *//; s/ *$//;
9 s/ @ .*//; s/ *[<]/\t/; s/[>]//')"
11 # Name - nick - email correspondence from log and from maintainer list
12 # Also there are a few manual entries
13 maintainers
="$(cat "$
(dirname "$0")/..
/maintainer-list.nix
" |
14 grep '=' | sed -re 's/\\"/''/g
;
15 s
/[ ]*([^
=]*)[ ]*=[ ]*" *(.*[^ ]) *[<](.*)[>] *".
*/\
1\t\
2\t\
3/')"
16 git_lines="$( ( echo "$git_data";
17 cat "$(dirname "$0")/vanity-manual-equalities.txt") | sort |uniq)"
20 ( echo "$maintainers" | cut -f 3; echo "$git_data" | cut -f 2 ) |
21 sort | uniq | grep -E ".+@.+[.].+"
26 echo "$raw_git_log" | grep -B3 "Author: .*[<]$1[>]" | head -n 3 |
27 grep '^commit
' | tail -n 1 | sed -e 's
/^commit
//'
30 curl https://github.com/NixOS/nixpkgs/commit/"$commitid" 2>/dev/null |
31 grep committed -B10 | grep 'href
="/' |
32 sed -re 's@.* href="/@@
; s@
".*@@' |
38 [ -n "$NIXPKGS_GITHUB_NAME_CACHE" ] && {
39 echo "$emails" |
while read email
; do
40 line
="$(grep "$email " "$NIXPKGS_GITHUB_NAME_CACHE")"
42 echo "$email $(fetchGithubName "$email")" >> \
43 "$NIXPKGS_GITHUB_NAME_CACHE"
50 sed -e 's/%/%25/g; s/ /%20/g; s/'\''/%27/g; s/"/%22/g; s/`/%60/g; s/\^/%5e/g; '
54 sed -e 's/%20/ /g; s/%27/'\''/g; s/%22/"/g; s/%60/`/g; s/%5e/^/g; s/%25/%/g;';
57 n3
="$(mktemp --suffix .n3)"
59 # «The same person» relation and a sorting hint
60 # Full name is something with a space
62 echo "$git_lines" |
sed -re 's@(.*)\t(.*)@<my://name/\1> <my://can-be> <my://name/\2>.@'
63 echo "$git_lines" |
sed -re 's@(.*)\t(.*)@<my://name/\2> <my://can-be> <my://name/\1>.@'
64 echo "$maintainers" |
sed -re 's@(.*)\t(.*)\t(.*)@<my://name/\1> <my://can-be> <my://name/\2>.@'
65 echo "$maintainers" |
sed -re 's@(.*)\t(.*)\t(.*)@<my://name/\2> <my://can-be> <my://name/\3>.@'
66 echo "$maintainers" |
sed -re 's@(.*)\t(.*)\t(.*)@<my://name/\3> <my://can-be> <my://name/\1>.@'
67 echo "$git_lines" |
grep ' ' | cut
-f 1 |
sed -e 's@.*@<my://name/&> <my://is-name> <my://0>.@'
68 echo "$git_lines" |
grep -v ' ' | cut
-f 1 |
sed -e 's@.*@<my://name/&> <my://is-name> <my://1>.@'
69 echo "$maintainers" | cut
-f 2 |
sed -e 's@.*@<my://name/&> <my://is-name> <my://0>.@'
70 [ -n "$NIXPKGS_GITHUB_NAME_CACHE" ] && cat "$NIXPKGS_GITHUB_NAME_CACHE" |
72 sed -re 's@(.*)\t(.*)@<my://name/\1> <my://at-github> <my://github/\2>.@'
73 ) | normalize_name |
grep -E '<my://[-a-z]+>' |
sort |
uniq > "$n3"
75 # Get transitive closure
76 sparql
="$(nix-build '<nixpkgs>' -Q -A apache-jena --no-out-link)/bin/sparql"
78 "$sparql" --results=TSV --data="$n3" "
79 select ?x ?y ?g where
{
84 sed -re 's@<my://name/@@g; s@<my://@@g; s@>@@g;' |
88 "$sparql" --results=TSV --data="$n3" "
90 ?x
(<my
://can-be
>+ / <my
://at-github
>) ?y.
93 sed -re 's@<my://(name|github)/@@g; s@<my://@@g; s@>@@g;'
96 # Take first spelling option for every person
97 name_list_canonical
="$(echo "$name_list" | cut -f 1,2 | uniq -f1)"
99 cleaner_script
="$(echo "$name_list_canonical" | denormalize_name |
100 sed -re 's/(.*)\t(.*)/s#^\2$#\1#g/g')"
102 # Add github usernames
103 if [ -n "$NIXPKGS_GITHUB_NAME_CACHE" ]; then
104 github_adder_script
="$(mktemp)"
105 echo "$github_name_list" |
106 grep -E "$(echo "$name_list_canonical" | cut -f 2 |
109 sed -re 's/(.*)\t(.*)/s| \1$| \1\t\2|g;/' |
110 denormalize_name
> "$github_adder_script"
112 github_adder_script
='/dev/null'
115 echo "$name_list" | denormalize_name
119 echo "$git_data" | cut
-f 1 |
120 sed -e "$cleaner_script" |
121 sort |
uniq -c |
sort -k1n |
sed -rf "$github_adder_script" |
122 sed -re 's/^ *([0-9]+) /\1\t/'