目的
AGL(Automotive Grade Linux)の公開ブランチに、ソースコードをcommitするまでの備忘録です。
AGLについては以下のWEBサイトをご参照下さい。
前回はAGLの公開バイナリをRaspberryPiで起動しましたが、
今回はソースコードのcommitを試みました。
(2021/1/10追記)
一部リンクが更新されていたので、更新版の記事を書きました。
準備
AGLのソースコードは公開されており、誰でもContributorになることが出来ます。
まず、上記Guideline記載の通り以下を実施します。
1.linuxfoundation.orgのアカウント作成
2.メーリングリスト加入
3.Gerritアカウント作成
Prerequisites
1. Create an account on identity.linuxfoundation.org to get started.
2. Join the mailing list.
3. Setup your Gerrit account, as described in the Gerrit Tutorial from mediawiki
次に、ソースコードを以下の通り取得して、色々と内容を読まさせて頂きます。
いきなりの機能追加は大変なので、期限切れリンクの修正や、ビルドワーニング修正で何か貢献できないか、という観点で確認します。
以下でもCommitのための、Easy Wayが紹介されています。
Use-Regression-Testing-to-Make-AGL-Better
Easy Way I:
• Update outdated documents.
Easy Way II:
• Remove build error and warning.
AGL-REGRESSION-TEST-TEMPLATE
コード取得
以下を参考にrepo syncします。
ソースコードをrepo syncする
以下3stepでソースコード取得できました。
(※変更になる可能性があり、必ず詳細は上記リンク先を参照下さい)
1. Define Your Top-Level Directory
$ export AGL_TOP=$HOME/workspace_agl
$ mkdir -p $AGL_TOP
2. Download the repo Tool and Set Permissions
$ mkdir -p ~/bin
$ export PATH=~/bin:$PATH
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
3. Download the AGL Source Files:
$ cd $AGL_TOP
$ repo init -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo
$ repo sync
commit用コード作成
いきなりの機能追加は大変なので、期限切れリンクの修正や、ビルドワーニング修正で何か貢献できないか、という観点で確認します。
例えば、期限切れリンク修正をする場合の例としては以下1.〜2.がありそうです。
1.URLリンク切れ確認用のスクリプトを用意します。
2.以下のようにソースコード上のテキストファイルから、httpsで始まる文字列を取得して、
リンクが切れていないか確認する。等でリンク切れが見つかるかもしれません。
$ cd agl-halibut-8.0.1
$ grep -rn "https:" * > out.txt
$ cat out.txt | cut -d '=' -f 2 | cut -d ' ' -f 2 | cut -d '"' -f 2 | grep "https" | grep -v "meta" | grep -v "]" > out2.txt
commitのための前準備
AGLのコードリリースの際、
CIATという継続的インテグレーションの評価システムにcommitすることになります。
CIATについては以下が詳しいです。
Building and testing an automotive platform
How to Write Tests for the AGL HW Test Infra
20161210_第8回jenkins勉強会
Gerrit Serverは以下URLからアクセスすることが可能です。
gerrit.automotivelinux.org
Building AGL with the Yocto Project - A Crashcourse -
Gerritはレビューシステムであり、commitは最終的にExpert Memberの承認を受けてMergeされます。
また、自動評価も実行されます。Gerrit上は以下の通り記載されています。
CR : Code review
V : Verified
CIB : ci-image-build
CIBT : ci-image-boot-test
commit手順
Contributor Guidelines記載の通り、以下を参照して、差分コードのcommitを進めます。
- Contributor Guidelines記載のPrepare to push changes in Gerritの章
- Contributor Guidelines記載のPush changes for review to Gerritの章
- Gerrit/Tutorial
SSH key生成
Set_Up_SSH_Keys_in_Gerritを参照
Public keyをgerrit.automotivelinux.orgへ登録する
SSH keys
New SSH key
add New SSH key
SSH Config設定する
.ssh/config に以下を追記
Host gerrit.automotivelinux.org
User XXXMyNameXXX
git commit時の名前を設定する
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
差分をcommitする
mod
git add (修正ファイル)
git commit --signoff
> Please sign you commit before you submit the change (otherwise it will not be accepted by gerrit): git commit --signoff
git review -s
git review
コミットメッセージのフォーマットは以下ルールを参照(要は内容、JIRA番号、を記述する)
Contributor Guidelines
Push changes for review to Gerrit
無事にcommitを承認いただけました
簡単なURLリンク修正をcommitさせて頂いたところ、
無事にレビューを終え、Merged Statusになりました。
Commit message
相手にどんな変更点かを伝える手段であるCommit メッセージを分かりやすく書く事は重要です。
特に、リモートで直接対話したことがない相手に対して意図を伝えるために尚更重要となります。
How to Write a Git Commit Message
感想
AGLのコードは広く公開されている一方、品質面もしっかりレビューするシステムが整っているのは素晴らしいと思います。
また、AGLのコードに限らずオープンソースにコミットすることは自身の見識を広げるのに役立ちます。
まずは可能な部分から徐々に貢献していければよいのではないでしょうか。
Error対策
We don't know where your gerrit is. Please manually create a remote
gerrit public key, ssh config
To ssh://gerrit.automotivelinux.org:29418/AGL/meta-agl-devel
! [remote rejected] HEAD -> refs/publish/master (commit dc81699: not Signed-off-by author/committer/uploader in message footer)
error: failed to push some refs to
gerrit.automotivelinux.orgへの公開鍵登録が必要です。
また、git commit signed offしてないとgit review時にエラーになるのでご注意下さい。
git commit signed off
参考
automotivelinux.org
2019/8/22にリリース発表されたAGL UCB 8.0.0をRaspberryPi3B+で起動する
Contributor Guidelines
Want to Contribute?
Use-Regression-Testing-to-Make-AGL-Better
AGL-REGRESSION-TEST-TEMPLATE
workflow-download-sw
指定したURLのリンクが有効かどうかをチェックするpythonスクリプトを作成
Building and testing an automotive platform
How to Write Tests for the AGL HW Test Infra
20161210_第8回jenkins勉強会
gerrit.automotivelinux.org
Building AGL with the Yocto Project - A Crashcourse -
tar.gz や tar.bz2 の展開は tar xf でOKです。
PL2303_64bit_Installer.exe
[agl-discussions] Help with SSH password
How to Write a Git Commit Message
Automotive Grade Linuxことはじめ
意外ととっつきやすいOSS開発参加方法まとめ
OSSは“別世界“。その思い込みは、自らのPull Requestで変わった。