2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Zephyr RTOSへのプルリク

2
Posted at

概要

以下の対応をプルリクしてみた

プルリク作成まで

Fork準備

まずは公式をよく読む

次に、
https://github.com/zephyrproject-rtos/zephyr
でFork→Create a new forkをクリックする。
すると

https://github.com/<あなたのGitHub名>/zephyr
でForkが作られる。
GitHubカウントは予め用意しておくこと。

自分のGitHubリポジトリにForkができたら、
ローカルのzephyrのリポジトリで以下のようにremoteを設定する。

git remote rename origin upstream
git remote add origin https://github.com/<あなたのGitHub名>/zephyr.git

git remote -v
origin    https://github.com/<あなた>/zephyr.git
upstream  https://github.com/zephyrproject-rtos/zephyr.git

ブランチ作成からForkへプッシュ

事前にissueを作っていたら、issue番号と機能名などでブランチを作る。

git checkout main
git pull upstream main

git checkout -b issue-xxxxxx-yyyyy

変更内容をaddしてコミットする。
-sはSigned-off-by

git add ...
git commit -s

Forkへpushする。

git push origin issue-xxxxxx-yyyyy

PR作成

自分のGitHubのForkを見ると、
Compare & pull request
が表示されるので、それを押すと、PR作成完了。

今回は以下を作った。

指摘対応

初めてのPRのときは、コントリビューターが色々と指摘してくれる。
今回はエラーチェックの追加提案と、

./scripts/ci/check_compliance.py

の実施だった。

やってみると、以下の指摘が出た。

WARNING : Skipped DevicetreeLinting
WARNING : Skipped DeviceMmioCheck
WARNING : Skipped CMakeStyle
1 check(s) failed
2 check(s) with warnings only
ERROR   : Test Gitlint failed: 
1: UC2 Signed-off-by: must have a full name
WARNING : Test Checkpatch warning: 
LONG_LINE: line length of 102 exceeds 100 columns
File:drivers/pwm/pwm_mc_esp32.c
Line:126
WARNING : Test Checkpatch warning: 
LONG_LINE: line length of 102 exceeds 100 columns
File:drivers/pwm/pwm_mc_esp32.c
Line:190
WARNING : Test ClangFormat warning: 
You may want to run clang-format on this change:
-	uint32_t timer_clk_hz = data->mcpwm_clk_hz / (config->prescale + 1) / (channel->prescale + 1);
+	uint32_t timer_clk_hz =
+		data->mcpwm_clk_hz / (config->prescale + 1) / (channel->prescale + 1);

File:drivers/pwm/pwm_mc_esp32.c
Line:127
WARNING : Test ClangFormat warning: 
You may want to run clang-format on this change:
-	uint32_t timer_clk_hz = data->mcpwm_clk_hz / (config->prescale + 1) / (channel->prescale + 1);
+	uint32_t timer_clk_hz =
+		data->mcpwm_clk_hz / (config->prescale + 1) / (channel->prescale + 1);

File:drivers/pwm/pwm_mc_esp32.c
Line:191

Complete results in compliance.xml

このスクリプトは自分のコミットに対するもの。
指摘を見ていくと、

1: UC2 Signed-off-by: must have a full name

これは、gitのuser.nameやuser.emailが正しくない。

git config user.name "あなたのフルネーム"
git config user.email "GitHubで使用している実メールアドレス"

で直したら、

git commit --amend -s


Signed-off-by: あなたのフルネーム <メールアドレス>
の行があることを確認する。
古いのが残っていたら消して保存する。

コードの指摘修正が終わったらビルド確認。

clang-format --dry-run --Werror drivers/pwm/pwm_mc_esp32.c

でチェックするとフォーマットの修正確認しやすい。
私はタブではなくスペースが入っていたので、指摘が出た。

指摘があったファイルをcommitしてpushする

git add drivers/pwm/pwm_mc_esp32.c
git commit --amend
git push --force-with-lease origin issue-114576-mcpwm

このとき、新しいコミットを作らずにamendすること。
またコミットメッセージは変えないこと。

pushすると、
https://github.com/zephyrproject-rtos/zephyr/pull/115158/changes/77324be0c03f7aaa07d539d9e5eca64bd529f89b
のコミット内容が修正後になっていた。
レビュー待ち。

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?