2018年1月の記事一覧

packagistで使うcomposer.jsonのlicenceに独自ライセンスを設定する

こんにちは、オープンソース・ワークショップの牟田口です。
IT技術ネタです。

packagistが最近になって、composer.jsonのlicenceの書き方を厳密に見るようになったようで、
下記のエラーメールが届きました。

--- 注釈
・packagistは、composerでパッケージバージョン管理してるメインリポジトリです。
・composerは、phpのパッケージバージョン管理ツールです。
・composer.jsonは、composerの設定ファイルです。
---

 

--- エラー内容

「件名」
netcommons/videos failed to update, invalid composer.json data

「本文」
The netcommons/videos package of which you are a maintainer has
failed to update due to invalid data contained in your composer.json.
Please address this as soon as possible since the package stopped updating.

It is recommended that you use `composer validate` to check for errors when you
change your composer.json.

Below is the full update log which should highlight errors as
"Skipped branch ...":

[Composer\Repository\InvalidRepositoryException]: Some branches contained invalid data and were discarded, it is advised to review the log and fix any issues present in branches

Reading composer.json of netcommons/videos (3.1.7)
Importing tag 3.1.7 (3.1.7.0)

(省略)

Reading composer.json of netcommons/videos (master)
Importing branch master (dev-master)
Skipped branch master, Invalid package information:
License "NetCommons License" is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.
If the software is closed-source, you may use "proprietary" as license.


なにやら、composer.jsonのLicense "NetCommons License" は、SPDX license(https://spdx.org/licenses/)に該当してないよ、との事。
NetCommons Licenseは、FreeBSD Licenseを基にした独自のOSSライセンスなんだよなぁ。
という事で、SPDXのライセンスにない場合の書き方を調べました。

 

--- 対応方法

SPDXのライセンスにない場合の書き方をする。
  (composer.jsonの修正例)

"license": "LicenseRef-NetCommons",
"license-ref-net-commons": "https://raw.githubusercontent.com/NetCommons3/NetCommons3/master/license.txt",

 

--- 情報元link

SPDXのライセンスにない場合は、こう書くらしいです。
https://spdx.org/spdx-specification-21-web-version#h.1v1yuxt

issueにもこんなのあがってました。
https://github.com/composer/composer/issues/2152

修正例
https://github.com/NetCommons3/Videos/blob/master/composer.json#L25-L26

 

--- その他の対応方法

メールの修正方法に従う。
 1) SPDX license(https://spdx.org/licenses/)に修正する。
(composer.jsonの修正例)

"license": "BSD-2-Clause-FreeBSD",

 

 2) クローズしたソースなら、ライセンスを"proprietary"にする。
(composer.jsonの修正例)

"license": "proprietary",

 

以上、参考なればうれしい限りです。

0