@@ -8,14 +8,27 @@ licensehead="$(sed '/^- /,$d' "${licensefile}")"
88tmplicense=" ${rootdir} /~LICENSE.$$ "
99echo " $licensehead " > " $tmplicense "
1010
11+ join_by () {
12+ local d=${1-} f=${2-}
13+ if shift 2; then
14+ printf %s " $f " " ${@/#/ $d } "
15+ fi
16+ }
17+
1118
1219# addlicense <library> <location> <license text>
1320addlicense () {
21+ argv=(" $@ " )
22+ location_count=$( expr $# - 2)
23+ locations=(" ${argv[@]: 1: location_count} " )
24+ location_str=$( join_by " , " ${locations[@]} )
25+
26+ license=(" ${argv[@]: -1: 1} " )
1427
1528 echo "
16- - ${1} , located at ${2 } , is licensed as follows:
29+ - ${1} , located at ${location_str } , is licensed as follows:
1730 \"\"\"
18- $( echo " $3 " | sed -e ' s/^/ /' -e ' s/^ $//' -e ' s/ *$//' | sed -e ' /./,$!d' | sed -e ' /^$/N;/^\n$/D' )
31+ $( echo " $license " | sed -e ' s/^/ /' -e ' s/^ $//' -e ' s/ *$//' | sed -e ' /./,$!d' | sed -e ' /^$/N;/^\n$/D' )
1932 \"\"\"\
2033" >> " $tmplicense "
2134
@@ -83,7 +96,7 @@ addlicense "cpplint.py" "tools/cpplint.py" \
8396 " $( sed -e ' /^$/,$d' -e ' s/^#$//' -e ' s/^# //' " ${rootdir} " /tools/cpplint.py | tail -n +3) "
8497addlicense " ESLint" " tools/node_modules/eslint" " $( cat " ${rootdir} " /tools/node_modules/eslint/LICENSE) "
8598addlicense " Babel" " tools/node_modules/@babel" " $( cat " ${rootdir} " /tools/node_modules/@babel/core/LICENSE) "
86- addlicense " gtest" " test/cctest/gtest" " $( cat " ${rootdir} " /test/cctest/gtest/LICENSE) "
99+ addlicense " gtest" " src/gtest " " test/cctest/gtest" " $( cat " ${rootdir} " /test/cctest/gtest/LICENSE) "
87100
88101# nghttp2
89102addlicense " nghttp2" " deps/nghttp2" " $( cat " ${rootdir} " /deps/nghttp2/COPYING) "
0 commit comments