LoginSignup
33
23

More than 3 years have passed since last update.

GitHubのOSSライセンスシェアの調査結果

Last updated at Posted at 2019-03-16

概要

調査の結果は以下の通り。ほぼMIT系とGPL系で8割を占める。

Gitub License Share

注) MIT系はMIT,ISC、GPL系はagpl-3.0, gpl, gpl-2.0, gpl-3.0, lgpl, lgpl-2.1, lgpl-3.0

調査方法

以下の流れでシェアを取得する。

  1. GitHub公式検索APIで各ライセンスを含むリポジトリを検索し、検索結果のJSONを取得。
  2. JSONをjqコマンドでパースして件数を取得。
  3. ライセンス名と件数をcsvファイルに格納。

上記の手順を実行するスクリプトは以下。

search.sh
#!/bin/bash

LICENSE_FILE=license.dat
RESULT_FILE=license.csv

rm -rf $RESULT_FILE
for line in `cat $LICENSE_FILE`
do
  license=$line
  count=`curl https://api.github.com/search/repositories?q=license:$license | jq '.total_count'`
  echo $license,$count >> $RESULT_FILE
  sleep 5s
done
license.dat
afl-3.0
apache-2.0
artistic-2.0
bsl-1.0
bsd-2-clause
bsd-3-clause
bsd-3-clause-clear
cc
cc0-1.0
cc-by-4.0
cc-by-sa-4.0
wtfpl
ecl-2.0
epl-1.0
eupl-1.1
agpl-3.0
gpl
gpl-2.0
gpl-3.0
lgpl
lgpl-2.1
lgpl-3.0
isc
lppl-1.3c
ms-pl
mit
mpl-2.0
osl-3.0
postgresql
ofl-1.1
ncsa
unlicense
zlib

調査結果

前述のスクリプトの実行結果を以下に示す。

license.csv
afl-3.0,524
apache-2.0,1054686
artistic-2.0,9821
bsl-1.0,2936
bsd-2-clause,49442
bsd-3-clause,138909
bsd-3-clause-clear,350
cc,51178
cc0-1.0,37751
cc-by-4.0,7120
cc-by-sa-4.0,6307
wtfpl,13963
ecl-2.0,376
epl-1.0,37935
eupl-1.1,677
agpl-3.0,72216
gpl,1311057
gpl-2.0,377582
gpl-3.0,926225
lgpl,95372
lgpl-2.1,25430
lgpl-3.0,69943
isc,28624
lppl-1.3c,390
ms-pl,1467
mit,3799119
mpl-2.0,37123
osl-3.0,2409
postgresql,60
ofl-1.1,2774
ncsa,9
unlicense,107055
zlib,3162
33
23
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
33
23