nextcloudにプルリクを出す際、DCOの署名で引っかかったので、内容の確認と解決方法について調査しました。以下はその時の備忘録です。
プロジェクトによって「Signed-off」利用の定義が異なります。nextcloudはDCOのために利用されていますが、全部が全部そうとは限りませんので、コントリビュート前に必ずご確認をお願いします。
DCOとは?
DCOは「Developer’s Certificate of Origin」の略で、”このコードを取り込んでも法的に問題ないですよ”とコミッターが宣言することを言います。背景としては、Linuxに使われているソースコードが剽窃(ひょうせつ)されたものだと訴訟を起こされたことがきっかけみたいです。
DCOの内容
「https://developercertificate.org/」に原文が記載されています。
翻訳は以下ページから引用しました。https://ja.osdn.net/projects/linuxjf/wiki/SubmittingPatches/attach/SubmittingPatches.txt
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
>本寄与は私が全体又は一部作成したものであり、
>私がそのファイル中に明示されたオープンソースライセンスの下で公開する権利を持っている。もしくは、
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
>本寄与は、私が知る限り、適切なオープンソースライセンスでカバーされている既存の作品を元にしている。
>同時に、私はそのライセンスの下で、私が全体又は一部作成した修正物を、
>ファイル中で示される同一のオープンソースライセンスで
>(異なるライセンスの下で投稿することが許可されている場合を除いて)投稿する権利を持っている。もしくは、
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
>本寄与は(a)、(b)、(c)を証明する第3者から私へ直接提供されたものであり、私はそれに変更を加えていない。
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
>私はこのプロジェクトと本寄与が公のものであることに理解及び同意する。
>同時に、関与した記録(投稿の際の全ての個人情報と sign-off を含む)が無期限に保全されることと、
>当該プロジェクト又は関連するオープンソースライセンスに沿った形で再配布されることに理解及び同意する。
nextcloudでの取り扱い
githubにコントリビュートに関する記載があり、内容を要約すると以下のとおりです。
ちなみにnextcloudはCLA適用はないようです。
- ソースコードの担保のために「Developer Certificate of Origin (DCO) 」を利用している。
- コミットするソースコードが法的に問題ないと証明できる場合は、コミットメッセージで署名する。
- 署名は実名で行うこと。
署名方法
そこまで難しいことはありません。gitのコミットメッセージに次の行を追加するだけです。
Signed-off-by: Random J Developer <[email protected]>
これから記載する「1」と「2」の方法で追加する場合、Signed-off-byにはgitに登録してあるユーザ名、メールアドレスが自動セットされます。
1.gitコマンド利用の場合
「git commit –signoff」を実行するとエディタが表示されますので、「Signed-off-by」より前にコミットメッセージを入力すればOKです。
hgoto@vm:~/git/dco-test$ git add .
hgoto@vm:~/git/dco-test$ git commit --signoff
#ここにコミットメッセージを入力する#
Signed-off-by: Random J Developer <[email protected]>
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is up to date with 'origin/master'.
#
# Changes to be committed:
# modified: test.txt
#
2.Sourcetree利用の場合
こちらはコミットメッセージ入力画面の右上に表示される「オプションのコミット」で「署名」を選択するだけでOKです。(チェックが入っていれば有効になっています)
コミット後にメッセージを確認すると自動挿入されていることが確認できます。
補足
GitHub ActionでPR作成時にDCOをチェックしてくれるAppsが公開されています。いきなりSigned-offするのは怖い方はプライベートリポジトリで一度試してみると良いかもしれません。