From f4ea09d9c91df7ada0463834bb54d046951d242c Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 03:38:21 +0900 Subject: [PATCH 01/21] Update README.md --- code-generator/README.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/code-generator/README.md b/code-generator/README.md index 26610d521..6a63a39ca 100644 --- a/code-generator/README.md +++ b/code-generator/README.md @@ -16,13 +16,15 @@ $ python GenerateC2ACode.py ## 設定 実行時のパスと同じディレクトリに `settings.json` を置いて設定する. -`is_main_obc` は,MOBC(地上局と通信するOBC.2nd OBCのtlm/cmdを取りまとめる)かそれ以外のOBC(2nd OBC.MOBCと通信するOBC)かを制御する. -`1` とした場合,MOBCを意図したコードが生成され,加えて以下が生成される. -- 2nd_obc_command_definitions.h -- 2nd_obc_telemetry_definitions.h -- 2nd_obc_telemetry_buffer.c -- 2nd_obc_telemetry_buffer.h -- 2nd_obc_telemetry_data_definitions.h +`is_main_obc` は,MOBC(地上局と通信するOBC.sub OBCのtlm/cmdを取りまとめる)かそれ以外のOBC(sub OBC.MOBCと通信するOBC)かを制御する. +`1` とした場合,MOBC用のコードに加えて以下が生成される. +- sub_obc_command_definitions.h +- sub_obc_telemetry_definitions.h +- sub_obc_telemetry_buffer.c +- sub_obc_telemetry_buffer.h +- sub_obc_telemetry_data_definitions.h + +なお,MOBC の場合でも, `0` にすることで, sub OBC のコードを生成せず, MOBC のコードのみを生成することができる 設定の記述例(JSON としては invalid だがコメント付き) ``` @@ -42,7 +44,8 @@ $ python GenerateC2ACode.py # 出力ファイルのエンコーディング "output_file_encoding" : "utf-8", # MOBCか?(他のOBCのtlm/cmdを取りまとめるか?) 0/1 - # 2nd OBCのコードを生成するときなどは 0 にする + # sub OBCのコードを生成するときなどは 0 にする + # MOBC の場合でも, 0 にすることで, sub OBC のコードを生成せず, MOBC のコードのみを生成することができる # 0 の場合,以後のパラメタは無効 "is_main_obc" : 1, "other_obc_data" : [ @@ -97,4 +100,4 @@ $ pip install -r requirements.txt ## その他 - [settings_mobc.json](./settings_mobc.json), [settings_subobc.json](./settings_subobc.json) は c2a-core example user での設定 -- MOBCと2nd OBCのC2A間通信の例は (TBA). +- MOBCとsub OBCのC2A間通信の例は (TBA). From 9fb80a22200fc46efdc35ac02cad68051c6d6292 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 03:42:03 +0900 Subject: [PATCH 02/21] fix file doxygen space --- code-generator/my_mod/cmd_def.py | 16 ++++++++-------- code-generator/my_mod/tlm_buffer.py | 12 ++++++------ code-generator/my_mod/tlm_def.py | 12 ++++++------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/code-generator/my_mod/cmd_def.py b/code-generator/my_mod/cmd_def.py index e02fca40b..ac117c78a 100644 --- a/code-generator/my_mod/cmd_def.py +++ b/code-generator/my_mod/cmd_def.py @@ -188,8 +188,8 @@ def OutputCmdDefC_(file_path, body, settings): #pragma section REPRO /** * @file - * @brief コマンド定義 - * @note このコードは自動生成されています! + * @brief コマンド定義 + * @note このコードは自動生成されています! */ #include #include "command_definitions.h" @@ -220,8 +220,8 @@ def OutputCmdDefH_(file_path, body, settings): output += """ /** * @file - * @brief コマンド定義 - * @note このコードは自動生成されています! + * @brief コマンド定義 + * @note このコードは自動生成されています! */ #ifndef COMMAND_DEFINITIONS_H_ #define COMMAND_DEFINITIONS_H_ @@ -253,8 +253,8 @@ def OutputBctDef_(file_path, body, settings): output += """ /** * @file - * @brief ブロックコマンド定義 - * @note このコードは自動生成されています! + * @brief ブロックコマンド定義 + * @note このコードは自動生成されています! */ #ifndef BLOCK_COMMAND_DEFINITIONS_H_ #define BLOCK_COMMAND_DEFINITIONS_H_ @@ -293,8 +293,8 @@ def OutputOtherObcCmdDefH_(file_path, name, body, settings): output += """ /** * @file - * @brief コマンド定義 - * @note このコードは自動生成されています! + * @brief コマンド定義 + * @note このコードは自動生成されています! */ #ifndef {_obc_name_upper}_COMMAND_DEFINITIONS_H_ #define {_obc_name_upper}_COMMAND_DEFINITIONS_H_ diff --git a/code-generator/my_mod/tlm_buffer.py b/code-generator/my_mod/tlm_buffer.py index 69a048dbb..dc6b6ecfa 100644 --- a/code-generator/my_mod/tlm_buffer.py +++ b/code-generator/my_mod/tlm_buffer.py @@ -365,8 +365,8 @@ def OutputTlmBufferC_(file_path, name, body, settings): #pragma section REPRO /** * @file - * @brief テレメトリバッファー(テレメ中継) - * @note このコードは自動生成されています! + * @brief テレメトリバッファー(テレメ中継) + * @note このコードは自動生成されています! */ #include #include "./{_obc_name_lower}_telemetry_definitions.h" @@ -403,8 +403,8 @@ def OutputTlmBufferH_(file_path, name, body, settings): output += """ /** * @file - * @brief テレメトリバッファー(テレメ中継) - * @note このコードは自動生成されています! + * @brief テレメトリバッファー(テレメ中継) + * @note このコードは自動生成されています! */ #ifndef {_obc_name_upper}_TELEMETRY_BUFFER_H_ #define {_obc_name_upper}_TELEMETRY_BUFFER_H_ @@ -444,8 +444,8 @@ def OutputTlmDataDefH_(file_path, name, body, settings): output += """ /** * @file - * @brief バッファリングされているテレメをパースしてMOBC内でかんたんに利用できるようにするためのテレメデータ構造体定義 - * @note このコードは自動生成されています! + * @brief バッファリングされているテレメをパースしてMOBC内でかんたんに利用できるようにするためのテレメデータ構造体定義 + * @note このコードは自動生成されています! */ #ifndef {_obc_name_upper}_TELEMETRY_DATA_DEFINITIONS_H_ #define {_obc_name_upper}_TELEMETRY_DATA_DEFINITIONS_H_ diff --git a/code-generator/my_mod/tlm_def.py b/code-generator/my_mod/tlm_def.py index 651c3a387..80738b49e 100644 --- a/code-generator/my_mod/tlm_def.py +++ b/code-generator/my_mod/tlm_def.py @@ -152,8 +152,8 @@ def OutputTlmDefC_(file_path, body, settings): #pragma section REPRO /** * @file - * @brief テレメトリ定義 - * @note このコードは自動生成されています! + * @brief テレメトリ定義 + * @note このコードは自動生成されています! */ #include #include "telemetry_definitions.h" @@ -181,8 +181,8 @@ def OutputTlmDefH_(file_path, body, settings): output += """ /** * @file - * @brief テレメトリ定義 - * @note このコードは自動生成されています! + * @brief テレメトリ定義 + * @note このコードは自動生成されています! */ #ifndef TELEMETRY_DEFINITIONS_H_ #define TELEMETRY_DEFINITIONS_H_ @@ -218,8 +218,8 @@ def OutputOtherObcTlmDefH(file_path, name, body, settings): output += """ /** * @file - * @brief テレメトリ定義 - * @note このコードは自動生成されています! + * @brief テレメトリ定義 + * @note このコードは自動生成されています! */ #ifndef {_obc_name_upper}_TELEMETRY_DEFINITIONS_H_ #define {_obc_name_upper}_TELEMETRY_DEFINITIONS_H_ From ec4ce770d07fb3fa6824f36bd8d5253895174240 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 03:44:37 +0900 Subject: [PATCH 03/21] generate to del double space --- .../src_user/component_driver/aocs/aobc_command_definitions.h | 4 ++-- .../src_user/component_driver/aocs/aobc_telemetry_buffer.c | 4 ++-- .../src_user/component_driver/aocs/aobc_telemetry_buffer.h | 4 ++-- .../component_driver/aocs/aobc_telemetry_data_definitions.h | 4 ++-- .../component_driver/aocs/aobc_telemetry_definitions.h | 4 ++-- .../mobc/src/src_user/tlm_cmd/block_command_definitions.h | 4 ++-- examples/mobc/src/src_user/tlm_cmd/command_definitions.c | 4 ++-- examples/mobc/src/src_user/tlm_cmd/command_definitions.h | 4 ++-- examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c | 4 ++-- examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h | 4 ++-- .../subobc/src/src_user/tlm_cmd/block_command_definitions.h | 4 ++-- examples/subobc/src/src_user/tlm_cmd/command_definitions.c | 4 ++-- examples/subobc/src/src_user/tlm_cmd/command_definitions.h | 4 ++-- examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c | 4 ++-- examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h | 4 ++-- 15 files changed, 30 insertions(+), 30 deletions(-) diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h index 1500ca89a..104ec73fd 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h @@ -1,7 +1,7 @@ /** * @file - * @brief コマンド定義 - * @note このコードは自動生成されています! + * @brief コマンド定義 + * @note このコードは自動生成されています! */ #ifndef AOBC_COMMAND_DEFINITIONS_H_ #define AOBC_COMMAND_DEFINITIONS_H_ diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c index 2bd6d45e6..06574e398 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c @@ -1,8 +1,8 @@ #pragma section REPRO /** * @file - * @brief テレメトリバッファー(テレメ中継) - * @note このコードは自動生成されています! + * @brief テレメトリバッファー(テレメ中継) + * @note このコードは自動生成されています! */ #include #include "./aobc_telemetry_definitions.h" diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h index fe5317042..2e466bdf5 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h @@ -1,7 +1,7 @@ /** * @file - * @brief テレメトリバッファー(テレメ中継) - * @note このコードは自動生成されています! + * @brief テレメトリバッファー(テレメ中継) + * @note このコードは自動生成されています! */ #ifndef AOBC_TELEMETRY_BUFFER_H_ #define AOBC_TELEMETRY_BUFFER_H_ diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h index ec28581fe..3b67b14a1 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h @@ -1,7 +1,7 @@ /** * @file - * @brief バッファリングされているテレメをパースしてMOBC内でかんたんに利用できるようにするためのテレメデータ構造体定義 - * @note このコードは自動生成されています! + * @brief バッファリングされているテレメをパースしてMOBC内でかんたんに利用できるようにするためのテレメデータ構造体定義 + * @note このコードは自動生成されています! */ #ifndef AOBC_TELEMETRY_DATA_DEFINITIONS_H_ #define AOBC_TELEMETRY_DATA_DEFINITIONS_H_ diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h index 291cd2d7e..d96c60ab5 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h @@ -1,7 +1,7 @@ /** * @file - * @brief テレメトリ定義 - * @note このコードは自動生成されています! + * @brief テレメトリ定義 + * @note このコードは自動生成されています! */ #ifndef AOBC_TELEMETRY_DEFINITIONS_H_ #define AOBC_TELEMETRY_DEFINITIONS_H_ diff --git a/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h b/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h index 15416af0a..ad263b5c8 100644 --- a/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h @@ -1,7 +1,7 @@ /** * @file - * @brief ブロックコマンド定義 - * @note このコードは自動生成されています! + * @brief ブロックコマンド定義 + * @note このコードは自動生成されています! */ #ifndef BLOCK_COMMAND_DEFINITIONS_H_ #define BLOCK_COMMAND_DEFINITIONS_H_ diff --git a/examples/mobc/src/src_user/tlm_cmd/command_definitions.c b/examples/mobc/src/src_user/tlm_cmd/command_definitions.c index 9806a68e3..2b29271d8 100644 --- a/examples/mobc/src/src_user/tlm_cmd/command_definitions.c +++ b/examples/mobc/src/src_user/tlm_cmd/command_definitions.c @@ -1,8 +1,8 @@ #pragma section REPRO /** * @file - * @brief コマンド定義 - * @note このコードは自動生成されています! + * @brief コマンド定義 + * @note このコードは自動生成されています! */ #include #include "command_definitions.h" diff --git a/examples/mobc/src/src_user/tlm_cmd/command_definitions.h b/examples/mobc/src/src_user/tlm_cmd/command_definitions.h index db3476553..d2f5a940c 100644 --- a/examples/mobc/src/src_user/tlm_cmd/command_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/command_definitions.h @@ -1,7 +1,7 @@ /** * @file - * @brief コマンド定義 - * @note このコードは自動生成されています! + * @brief コマンド定義 + * @note このコードは自動生成されています! */ #ifndef COMMAND_DEFINITIONS_H_ #define COMMAND_DEFINITIONS_H_ diff --git a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c index d5e1c3b9f..e8e1a6a01 100644 --- a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c +++ b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c @@ -1,8 +1,8 @@ #pragma section REPRO /** * @file - * @brief テレメトリ定義 - * @note このコードは自動生成されています! + * @brief テレメトリ定義 + * @note このコードは自動生成されています! */ #include #include "telemetry_definitions.h" diff --git a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h index ebc588358..eda2d4427 100644 --- a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h @@ -1,7 +1,7 @@ /** * @file - * @brief テレメトリ定義 - * @note このコードは自動生成されています! + * @brief テレメトリ定義 + * @note このコードは自動生成されています! */ #ifndef TELEMETRY_DEFINITIONS_H_ #define TELEMETRY_DEFINITIONS_H_ diff --git a/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h b/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h index 2df48ec2c..c5e597668 100644 --- a/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h @@ -1,7 +1,7 @@ /** * @file - * @brief ブロックコマンド定義 - * @note このコードは自動生成されています! + * @brief ブロックコマンド定義 + * @note このコードは自動生成されています! */ #ifndef BLOCK_COMMAND_DEFINITIONS_H_ #define BLOCK_COMMAND_DEFINITIONS_H_ diff --git a/examples/subobc/src/src_user/tlm_cmd/command_definitions.c b/examples/subobc/src/src_user/tlm_cmd/command_definitions.c index 5dbf363f5..f9a59a3a8 100644 --- a/examples/subobc/src/src_user/tlm_cmd/command_definitions.c +++ b/examples/subobc/src/src_user/tlm_cmd/command_definitions.c @@ -1,8 +1,8 @@ #pragma section REPRO /** * @file - * @brief コマンド定義 - * @note このコードは自動生成されています! + * @brief コマンド定義 + * @note このコードは自動生成されています! */ #include #include "command_definitions.h" diff --git a/examples/subobc/src/src_user/tlm_cmd/command_definitions.h b/examples/subobc/src/src_user/tlm_cmd/command_definitions.h index a8bb826dd..600759df9 100644 --- a/examples/subobc/src/src_user/tlm_cmd/command_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/command_definitions.h @@ -1,7 +1,7 @@ /** * @file - * @brief コマンド定義 - * @note このコードは自動生成されています! + * @brief コマンド定義 + * @note このコードは自動生成されています! */ #ifndef COMMAND_DEFINITIONS_H_ #define COMMAND_DEFINITIONS_H_ diff --git a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c index 4ac27ee76..94d849852 100644 --- a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c +++ b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c @@ -1,8 +1,8 @@ #pragma section REPRO /** * @file - * @brief テレメトリ定義 - * @note このコードは自動生成されています! + * @brief テレメトリ定義 + * @note このコードは自動生成されています! */ #include #include "telemetry_definitions.h" diff --git a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h index 49e1de069..01cd5c4b8 100644 --- a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h @@ -1,7 +1,7 @@ /** * @file - * @brief テレメトリ定義 - * @note このコードは自動生成されています! + * @brief テレメトリ定義 + * @note このコードは自動生成されています! */ #ifndef TELEMETRY_DEFINITIONS_H_ #define TELEMETRY_DEFINITIONS_H_ From 530f8eb4d604af9a60e5b36fec5e0ce330b34b30 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 04:20:30 +0900 Subject: [PATCH 04/21] add meta data to generated code note --- code-generator/my_mod/cmd_def.py | 37 +++++++++-- code-generator/my_mod/tlm_buffer.py | 36 ++++++++--- code-generator/my_mod/tlm_def.py | 29 +++++++-- code-generator/my_mod/util.py | 95 +++++++++++++++++++++++++++++ 4 files changed, 178 insertions(+), 19 deletions(-) create mode 100644 code-generator/my_mod/util.py diff --git a/code-generator/my_mod/cmd_def.py b/code-generator/my_mod/cmd_def.py index ac117c78a..464c21d19 100644 --- a/code-generator/my_mod/cmd_def.py +++ b/code-generator/my_mod/cmd_def.py @@ -4,6 +4,7 @@ """ import sys +import my_mod.util # import pprint @@ -170,7 +171,7 @@ def GenerateOtherObcCmdDef(settings, other_obc_dbs): + name_lower + "_command_definitions.h" ) - OutputOtherObcCmdDefH_(output_file_path, obc_name, body_h, settings) + OutputOtherObcCmdDefH_(output_file_path, obc_name, body_h, settings, i) def GetCmdNameAndCmdCode_(name, is_cmd_prefixed_in_db): @@ -189,7 +190,13 @@ def OutputCmdDefC_(file_path, body, settings): /** * @file * @brief コマンド定義 - * @note このコードは自動生成されています! +"""[ + 1: + ] # 最初の改行を除く + + output += my_mod.util.GenerateSettingNote(settings) + + output += """ */ #include #include "command_definitions.h" @@ -221,7 +228,13 @@ def OutputCmdDefH_(file_path, body, settings): /** * @file * @brief コマンド定義 - * @note このコードは自動生成されています! +"""[ + 1: + ] # 最初の改行を除く + + output += my_mod.util.GenerateSettingNote(settings) + + output += """ */ #ifndef COMMAND_DEFINITIONS_H_ #define COMMAND_DEFINITIONS_H_ @@ -254,7 +267,13 @@ def OutputBctDef_(file_path, body, settings): /** * @file * @brief ブロックコマンド定義 - * @note このコードは自動生成されています! +"""[ + 1: + ] # 最初の改行を除く + + output += my_mod.util.GenerateSettingNote(settings) + + output += """ */ #ifndef BLOCK_COMMAND_DEFINITIONS_H_ #define BLOCK_COMMAND_DEFINITIONS_H_ @@ -284,7 +303,7 @@ def OutputBctDef_(file_path, body, settings): fh.write(output) -def OutputOtherObcCmdDefH_(file_path, name, body, settings): +def OutputOtherObcCmdDefH_(file_path, name, body, settings, obc_idx): name_upper = name.upper() name_lower = name.lower() name_capit = name.capitalize() @@ -294,7 +313,13 @@ def OutputOtherObcCmdDefH_(file_path, name, body, settings): /** * @file * @brief コマンド定義 - * @note このコードは自動生成されています! +"""[ + 1: + ] # 最初の改行を除く + + output += my_mod.util.GenerateSubObcSettingNote(settings, obc_idx) + + output += """ */ #ifndef {_obc_name_upper}_COMMAND_DEFINITIONS_H_ #define {_obc_name_upper}_COMMAND_DEFINITIONS_H_ diff --git a/code-generator/my_mod/tlm_buffer.py b/code-generator/my_mod/tlm_buffer.py index dc6b6ecfa..6e656dfe7 100644 --- a/code-generator/my_mod/tlm_buffer.py +++ b/code-generator/my_mod/tlm_buffer.py @@ -4,6 +4,7 @@ """ import sys +import my_mod.util # from collections import OrderedDict # import pprint @@ -342,20 +343,21 @@ def GenerateTlmBuffer(settings, other_obc_dbs): + settings["other_obc_data"][i]["driver_path"] ) OutputTlmBufferC_( - output_file_path + obc_name.lower() + "_telemetry_buffer.c", obc_name, body_c, settings + output_file_path + obc_name.lower() + "_telemetry_buffer.c", obc_name, body_c, settings, i ) OutputTlmBufferH_( - output_file_path + obc_name.lower() + "_telemetry_buffer.h", obc_name, body_h, settings + output_file_path + obc_name.lower() + "_telemetry_buffer.h", obc_name, body_h, settings, i ) OutputTlmDataDefH_( output_file_path + obc_name.lower() + "_telemetry_data_definitions.h", obc_name, tlmdef_body_h, settings, + i ) -def OutputTlmBufferC_(file_path, name, body, settings): +def OutputTlmBufferC_(file_path, name, body, settings, obc_idx): name_upper = name.upper() name_lower = name.lower() name_capit = name.capitalize() @@ -366,7 +368,13 @@ def OutputTlmBufferC_(file_path, name, body, settings): /** * @file * @brief テレメトリバッファー(テレメ中継) - * @note このコードは自動生成されています! +"""[ + 1: + ] # 最初の改行を除く + + output += my_mod.util.GenerateSubObcSettingNote(settings, obc_idx) + + output += """ */ #include #include "./{_obc_name_lower}_telemetry_definitions.h" @@ -394,7 +402,7 @@ def OutputTlmBufferC_(file_path, name, body, settings): ) -def OutputTlmBufferH_(file_path, name, body, settings): +def OutputTlmBufferH_(file_path, name, body, settings, obc_idx): name_upper = name.upper() name_lower = name.lower() name_capit = name.capitalize() @@ -404,7 +412,13 @@ def OutputTlmBufferH_(file_path, name, body, settings): /** * @file * @brief テレメトリバッファー(テレメ中継) - * @note このコードは自動生成されています! +"""[ + 1: + ] # 最初の改行を除く + + output += my_mod.util.GenerateSubObcSettingNote(settings, obc_idx) + + output += """ */ #ifndef {_obc_name_upper}_TELEMETRY_BUFFER_H_ #define {_obc_name_upper}_TELEMETRY_BUFFER_H_ @@ -435,7 +449,7 @@ def OutputTlmBufferH_(file_path, name, body, settings): ) -def OutputTlmDataDefH_(file_path, name, body, settings): +def OutputTlmDataDefH_(file_path, name, body, settings, obc_idx): name_upper = name.upper() name_lower = name.lower() name_capit = name.capitalize() @@ -445,7 +459,13 @@ def OutputTlmDataDefH_(file_path, name, body, settings): /** * @file * @brief バッファリングされているテレメをパースしてMOBC内でかんたんに利用できるようにするためのテレメデータ構造体定義 - * @note このコードは自動生成されています! +"""[ + 1: + ] # 最初の改行を除く + + output += my_mod.util.GenerateSubObcSettingNote(settings, obc_idx) + + output += """ */ #ifndef {_obc_name_upper}_TELEMETRY_DATA_DEFINITIONS_H_ #define {_obc_name_upper}_TELEMETRY_DATA_DEFINITIONS_H_ diff --git a/code-generator/my_mod/tlm_def.py b/code-generator/my_mod/tlm_def.py index 80738b49e..8e32f2ec8 100644 --- a/code-generator/my_mod/tlm_def.py +++ b/code-generator/my_mod/tlm_def.py @@ -4,6 +4,7 @@ """ import sys +import my_mod.util def GenerateTlmDef(settings, tlm_db): @@ -143,7 +144,7 @@ def GenerateOtherObcTlmDef(settings, other_obc_dbs): + obc_name.lower() + "_telemetry_definitions.h" ) - OutputOtherObcTlmDefH(output_file_path, obc_name, body_h, settings) + OutputOtherObcTlmDefH(output_file_path, obc_name, body_h, settings, i) def OutputTlmDefC_(file_path, body, settings): @@ -153,7 +154,13 @@ def OutputTlmDefC_(file_path, body, settings): /** * @file * @brief テレメトリ定義 - * @note このコードは自動生成されています! +"""[ + 1: + ] # 最初の改行を除く + + output += my_mod.util.GenerateSettingNote(settings) + + output += """ */ #include #include "telemetry_definitions.h" @@ -182,7 +189,13 @@ def OutputTlmDefH_(file_path, body, settings): /** * @file * @brief テレメトリ定義 - * @note このコードは自動生成されています! +"""[ + 1: + ] # 最初の改行を除く + + output += my_mod.util.GenerateSettingNote(settings) + + output += """ */ #ifndef TELEMETRY_DEFINITIONS_H_ #define TELEMETRY_DEFINITIONS_H_ @@ -209,7 +222,7 @@ def OutputTlmDefH_(file_path, body, settings): fh.write(output) -def OutputOtherObcTlmDefH(file_path, name, body, settings): +def OutputOtherObcTlmDefH(file_path, name, body, settings, obc_idx): name_upper = name.upper() name_lower = name.lower() name_capit = name.capitalize() @@ -219,7 +232,13 @@ def OutputOtherObcTlmDefH(file_path, name, body, settings): /** * @file * @brief テレメトリ定義 - * @note このコードは自動生成されています! +"""[ + 1: + ] # 最初の改行を除く + + output += my_mod.util.GenerateSubObcSettingNote(settings, obc_idx) + + output += """ */ #ifndef {_obc_name_upper}_TELEMETRY_DEFINITIONS_H_ #define {_obc_name_upper}_TELEMETRY_DEFINITIONS_H_ diff --git a/code-generator/my_mod/util.py b/code-generator/my_mod/util.py new file mode 100644 index 000000000..373b9ef9a --- /dev/null +++ b/code-generator/my_mod/util.py @@ -0,0 +1,95 @@ +# coding: UTF-8 +""" +util +""" + +import subprocess + + +def GenerateSettingNote(settings): + note = "" + note += " * @note このコードは自動生成されています!\n" + note += " * @note コード生成 db commit hash: " + note += GetCommitHash_(settings["path_to_db"]) + note += "\n" + note += " * @note コード生成パラメータ:\n" + note += " * path_to_src: " + note += settings["path_to_src"] + note += "\n" + note += " * path_to_db: " + note += settings["path_to_db"] + note += "\n" + note += " * db_prefix: " + note += settings["db_prefix"] + note += "\n" + note += " * tlm_id_range: [" + note += settings["tlm_id_range"][0] + ", " + settings["tlm_id_range"][1] + "]" + note += "\n" + note += " * is_cmd_prefixed_in_db: " + note += str(settings["is_cmd_prefixed_in_db"]) + note += "\n" + note += " * input_file_encoding: " + note += settings["input_file_encoding"] + note += "\n" + note += " * output_file_encoding: " + note += settings["output_file_encoding"] + note += "\n" + # is_main_obc については,生成状況によって異なるので出力しない + + return note + + +def GenerateSubObcSettingNote(settings, obc_idx): + sub_obc_settings = settings["other_obc_data"][obc_idx] + + note = "" + note += " * @note このコードは自動生成されています!\n" + note += " * @note コード生成 db commit hash: " + note += GetCommitHash_(sub_obc_settings["path_to_db"]) + note += "\n" + note += " * @note コード生成パラメータ:\n" + note += " * name: " + note += sub_obc_settings["name"] + note += "\n" + note += " * db_prefix: " + note += sub_obc_settings["db_prefix"] + note += "\n" + note += " * tlm_id_range: " + note += sub_obc_settings["tlm_id_range"][0] + ", " + sub_obc_settings["tlm_id_range"][1] + "]" + note += "\n" + note += " * is_cmd_prefixed_in_db: " + note += str(sub_obc_settings["is_cmd_prefixed_in_db"]) + note += "\n" + note += " * input_file_encoding: " + note += sub_obc_settings["input_file_encoding"] + note += "\n" + note += " * path_to_db: " + note += sub_obc_settings["path_to_db"] + note += "\n" + note += " * max_tlm_num: " + note += str(sub_obc_settings["max_tlm_num"]) + note += "\n" + note += " * driver_path: " + note += sub_obc_settings["driver_path"] + note += "\n" + note += " * driver_type: " + note += sub_obc_settings["driver_type"] + note += "\n" + note += " * driver_name: " + note += sub_obc_settings["driver_name"] + note += "\n" + note += " * code_when_tlm_not_found: " + note += sub_obc_settings["code_when_tlm_not_found"] + note += "\n" + + return note + + +def GetCommitHash_(path): + try: + result = subprocess.run( + ["git", "rev-parse", "HEAD"], cwd=path, text=True, capture_output=True, check=True + ) + return result.stdout.strip() + except subprocess.CalledProcessError as e: + return "0000000000000000000000000000000000000000" From a026d9975422856b130cbc57447dcb10ce344aac Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 04:20:35 +0900 Subject: [PATCH 05/21] generate --- .../aocs/aobc_command_definitions.h | 13 +++++++++++++ .../component_driver/aocs/aobc_telemetry_buffer.c | 13 +++++++++++++ .../component_driver/aocs/aobc_telemetry_buffer.h | 13 +++++++++++++ .../aocs/aobc_telemetry_data_definitions.h | 13 +++++++++++++ .../aocs/aobc_telemetry_definitions.h | 13 +++++++++++++ .../src_user/tlm_cmd/block_command_definitions.h | 9 +++++++++ .../mobc/src/src_user/tlm_cmd/command_definitions.c | 9 +++++++++ .../mobc/src/src_user/tlm_cmd/command_definitions.h | 9 +++++++++ .../src/src_user/tlm_cmd/telemetry_definitions.c | 9 +++++++++ .../src/src_user/tlm_cmd/telemetry_definitions.h | 9 +++++++++ .../src_user/tlm_cmd/block_command_definitions.h | 9 +++++++++ .../src/src_user/tlm_cmd/command_definitions.c | 9 +++++++++ .../src/src_user/tlm_cmd/command_definitions.h | 9 +++++++++ .../src/src_user/tlm_cmd/telemetry_definitions.c | 9 +++++++++ .../src/src_user/tlm_cmd/telemetry_definitions.h | 9 +++++++++ 15 files changed, 155 insertions(+) diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h index 104ec73fd..4a0ad7242 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h @@ -2,6 +2,19 @@ * @file * @brief コマンド定義 * @note このコードは自動生成されています! + * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成パラメータ: + * name: AOBC + * db_prefix: SAMPLE_AOBC + * tlm_id_range: 0x90, 0xc0] + * is_cmd_prefixed_in_db: 0 + * input_file_encoding: utf-8 + * path_to_db: ../examples/subobc/tlm-cmd-db/ + * max_tlm_num: 256 + * driver_path: aocs/ + * driver_type: AOBC_Driver + * driver_name: aobc_driver + * code_when_tlm_not_found: aobc_driver->info.comm.rx_err_code = AOBC_RX_ERR_CODE_TLM_NOT_FOUND; */ #ifndef AOBC_COMMAND_DEFINITIONS_H_ #define AOBC_COMMAND_DEFINITIONS_H_ diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c index 06574e398..adffa9488 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c @@ -3,6 +3,19 @@ * @file * @brief テレメトリバッファー(テレメ中継) * @note このコードは自動生成されています! + * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成パラメータ: + * name: AOBC + * db_prefix: SAMPLE_AOBC + * tlm_id_range: 0x90, 0xc0] + * is_cmd_prefixed_in_db: 0 + * input_file_encoding: utf-8 + * path_to_db: ../examples/subobc/tlm-cmd-db/ + * max_tlm_num: 256 + * driver_path: aocs/ + * driver_type: AOBC_Driver + * driver_name: aobc_driver + * code_when_tlm_not_found: aobc_driver->info.comm.rx_err_code = AOBC_RX_ERR_CODE_TLM_NOT_FOUND; */ #include #include "./aobc_telemetry_definitions.h" diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h index 2e466bdf5..cbaf5fac9 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h @@ -2,6 +2,19 @@ * @file * @brief テレメトリバッファー(テレメ中継) * @note このコードは自動生成されています! + * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成パラメータ: + * name: AOBC + * db_prefix: SAMPLE_AOBC + * tlm_id_range: 0x90, 0xc0] + * is_cmd_prefixed_in_db: 0 + * input_file_encoding: utf-8 + * path_to_db: ../examples/subobc/tlm-cmd-db/ + * max_tlm_num: 256 + * driver_path: aocs/ + * driver_type: AOBC_Driver + * driver_name: aobc_driver + * code_when_tlm_not_found: aobc_driver->info.comm.rx_err_code = AOBC_RX_ERR_CODE_TLM_NOT_FOUND; */ #ifndef AOBC_TELEMETRY_BUFFER_H_ #define AOBC_TELEMETRY_BUFFER_H_ diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h index 3b67b14a1..c19f149d9 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h @@ -2,6 +2,19 @@ * @file * @brief バッファリングされているテレメをパースしてMOBC内でかんたんに利用できるようにするためのテレメデータ構造体定義 * @note このコードは自動生成されています! + * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成パラメータ: + * name: AOBC + * db_prefix: SAMPLE_AOBC + * tlm_id_range: 0x90, 0xc0] + * is_cmd_prefixed_in_db: 0 + * input_file_encoding: utf-8 + * path_to_db: ../examples/subobc/tlm-cmd-db/ + * max_tlm_num: 256 + * driver_path: aocs/ + * driver_type: AOBC_Driver + * driver_name: aobc_driver + * code_when_tlm_not_found: aobc_driver->info.comm.rx_err_code = AOBC_RX_ERR_CODE_TLM_NOT_FOUND; */ #ifndef AOBC_TELEMETRY_DATA_DEFINITIONS_H_ #define AOBC_TELEMETRY_DATA_DEFINITIONS_H_ diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h index d96c60ab5..af3261e02 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h @@ -2,6 +2,19 @@ * @file * @brief テレメトリ定義 * @note このコードは自動生成されています! + * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成パラメータ: + * name: AOBC + * db_prefix: SAMPLE_AOBC + * tlm_id_range: 0x90, 0xc0] + * is_cmd_prefixed_in_db: 0 + * input_file_encoding: utf-8 + * path_to_db: ../examples/subobc/tlm-cmd-db/ + * max_tlm_num: 256 + * driver_path: aocs/ + * driver_type: AOBC_Driver + * driver_name: aobc_driver + * code_when_tlm_not_found: aobc_driver->info.comm.rx_err_code = AOBC_RX_ERR_CODE_TLM_NOT_FOUND; */ #ifndef AOBC_TELEMETRY_DEFINITIONS_H_ #define AOBC_TELEMETRY_DEFINITIONS_H_ diff --git a/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h b/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h index ad263b5c8..310c4f0a1 100644 --- a/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h @@ -2,6 +2,15 @@ * @file * @brief ブロックコマンド定義 * @note このコードは自動生成されています! + * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成パラメータ: + * path_to_src: ../examples/mobc/src/ + * path_to_db: ../examples/mobc/tlm-cmd-db/ + * db_prefix: SAMPLE_MOBC + * tlm_id_range: [0x00, 0x100] + * is_cmd_prefixed_in_db: 0 + * input_file_encoding: utf-8 + * output_file_encoding: utf-8 */ #ifndef BLOCK_COMMAND_DEFINITIONS_H_ #define BLOCK_COMMAND_DEFINITIONS_H_ diff --git a/examples/mobc/src/src_user/tlm_cmd/command_definitions.c b/examples/mobc/src/src_user/tlm_cmd/command_definitions.c index 2b29271d8..7a05ee48b 100644 --- a/examples/mobc/src/src_user/tlm_cmd/command_definitions.c +++ b/examples/mobc/src/src_user/tlm_cmd/command_definitions.c @@ -3,6 +3,15 @@ * @file * @brief コマンド定義 * @note このコードは自動生成されています! + * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成パラメータ: + * path_to_src: ../examples/mobc/src/ + * path_to_db: ../examples/mobc/tlm-cmd-db/ + * db_prefix: SAMPLE_MOBC + * tlm_id_range: [0x00, 0x100] + * is_cmd_prefixed_in_db: 0 + * input_file_encoding: utf-8 + * output_file_encoding: utf-8 */ #include #include "command_definitions.h" diff --git a/examples/mobc/src/src_user/tlm_cmd/command_definitions.h b/examples/mobc/src/src_user/tlm_cmd/command_definitions.h index d2f5a940c..8cf16afff 100644 --- a/examples/mobc/src/src_user/tlm_cmd/command_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/command_definitions.h @@ -2,6 +2,15 @@ * @file * @brief コマンド定義 * @note このコードは自動生成されています! + * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成パラメータ: + * path_to_src: ../examples/mobc/src/ + * path_to_db: ../examples/mobc/tlm-cmd-db/ + * db_prefix: SAMPLE_MOBC + * tlm_id_range: [0x00, 0x100] + * is_cmd_prefixed_in_db: 0 + * input_file_encoding: utf-8 + * output_file_encoding: utf-8 */ #ifndef COMMAND_DEFINITIONS_H_ #define COMMAND_DEFINITIONS_H_ diff --git a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c index e8e1a6a01..e7ab96a49 100644 --- a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c +++ b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c @@ -3,6 +3,15 @@ * @file * @brief テレメトリ定義 * @note このコードは自動生成されています! + * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成パラメータ: + * path_to_src: ../examples/mobc/src/ + * path_to_db: ../examples/mobc/tlm-cmd-db/ + * db_prefix: SAMPLE_MOBC + * tlm_id_range: [0x00, 0x100] + * is_cmd_prefixed_in_db: 0 + * input_file_encoding: utf-8 + * output_file_encoding: utf-8 */ #include #include "telemetry_definitions.h" diff --git a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h index eda2d4427..61823cf16 100644 --- a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h @@ -2,6 +2,15 @@ * @file * @brief テレメトリ定義 * @note このコードは自動生成されています! + * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成パラメータ: + * path_to_src: ../examples/mobc/src/ + * path_to_db: ../examples/mobc/tlm-cmd-db/ + * db_prefix: SAMPLE_MOBC + * tlm_id_range: [0x00, 0x100] + * is_cmd_prefixed_in_db: 0 + * input_file_encoding: utf-8 + * output_file_encoding: utf-8 */ #ifndef TELEMETRY_DEFINITIONS_H_ #define TELEMETRY_DEFINITIONS_H_ diff --git a/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h b/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h index c5e597668..686e07c62 100644 --- a/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h @@ -2,6 +2,15 @@ * @file * @brief ブロックコマンド定義 * @note このコードは自動生成されています! + * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成パラメータ: + * path_to_src: ../examples/subobc/src/ + * path_to_db: ../examples/subobc/tlm-cmd-db/ + * db_prefix: SAMPLE_AOBC + * tlm_id_range: [0x00, 0x100] + * is_cmd_prefixed_in_db: 0 + * input_file_encoding: utf-8 + * output_file_encoding: utf-8 */ #ifndef BLOCK_COMMAND_DEFINITIONS_H_ #define BLOCK_COMMAND_DEFINITIONS_H_ diff --git a/examples/subobc/src/src_user/tlm_cmd/command_definitions.c b/examples/subobc/src/src_user/tlm_cmd/command_definitions.c index f9a59a3a8..0a9c622eb 100644 --- a/examples/subobc/src/src_user/tlm_cmd/command_definitions.c +++ b/examples/subobc/src/src_user/tlm_cmd/command_definitions.c @@ -3,6 +3,15 @@ * @file * @brief コマンド定義 * @note このコードは自動生成されています! + * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成パラメータ: + * path_to_src: ../examples/subobc/src/ + * path_to_db: ../examples/subobc/tlm-cmd-db/ + * db_prefix: SAMPLE_AOBC + * tlm_id_range: [0x00, 0x100] + * is_cmd_prefixed_in_db: 0 + * input_file_encoding: utf-8 + * output_file_encoding: utf-8 */ #include #include "command_definitions.h" diff --git a/examples/subobc/src/src_user/tlm_cmd/command_definitions.h b/examples/subobc/src/src_user/tlm_cmd/command_definitions.h index 600759df9..0e06cec56 100644 --- a/examples/subobc/src/src_user/tlm_cmd/command_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/command_definitions.h @@ -2,6 +2,15 @@ * @file * @brief コマンド定義 * @note このコードは自動生成されています! + * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成パラメータ: + * path_to_src: ../examples/subobc/src/ + * path_to_db: ../examples/subobc/tlm-cmd-db/ + * db_prefix: SAMPLE_AOBC + * tlm_id_range: [0x00, 0x100] + * is_cmd_prefixed_in_db: 0 + * input_file_encoding: utf-8 + * output_file_encoding: utf-8 */ #ifndef COMMAND_DEFINITIONS_H_ #define COMMAND_DEFINITIONS_H_ diff --git a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c index 94d849852..2c474880f 100644 --- a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c +++ b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c @@ -3,6 +3,15 @@ * @file * @brief テレメトリ定義 * @note このコードは自動生成されています! + * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成パラメータ: + * path_to_src: ../examples/subobc/src/ + * path_to_db: ../examples/subobc/tlm-cmd-db/ + * db_prefix: SAMPLE_AOBC + * tlm_id_range: [0x00, 0x100] + * is_cmd_prefixed_in_db: 0 + * input_file_encoding: utf-8 + * output_file_encoding: utf-8 */ #include #include "telemetry_definitions.h" diff --git a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h index 01cd5c4b8..091e84d9e 100644 --- a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h @@ -2,6 +2,15 @@ * @file * @brief テレメトリ定義 * @note このコードは自動生成されています! + * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成パラメータ: + * path_to_src: ../examples/subobc/src/ + * path_to_db: ../examples/subobc/tlm-cmd-db/ + * db_prefix: SAMPLE_AOBC + * tlm_id_range: [0x00, 0x100] + * is_cmd_prefixed_in_db: 0 + * input_file_encoding: utf-8 + * output_file_encoding: utf-8 */ #ifndef TELEMETRY_DEFINITIONS_H_ #define TELEMETRY_DEFINITIONS_H_ From d602c7fecdb9e6c34cc97840ab953af4041a9133 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 04:22:52 +0900 Subject: [PATCH 06/21] Update util.py --- code-generator/my_mod/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code-generator/my_mod/util.py b/code-generator/my_mod/util.py index 373b9ef9a..fff269297 100644 --- a/code-generator/my_mod/util.py +++ b/code-generator/my_mod/util.py @@ -91,5 +91,5 @@ def GetCommitHash_(path): ["git", "rev-parse", "HEAD"], cwd=path, text=True, capture_output=True, check=True ) return result.stdout.strip() - except subprocess.CalledProcessError as e: + except subprocess.CalledProcessError: return "0000000000000000000000000000000000000000" From 03665b0ca239350067aa78d028a78eb24b05b010 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 04:26:14 +0900 Subject: [PATCH 07/21] apply black --- code-generator/my_mod/tlm_buffer.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/code-generator/my_mod/tlm_buffer.py b/code-generator/my_mod/tlm_buffer.py index 6e656dfe7..0fe2f1df1 100644 --- a/code-generator/my_mod/tlm_buffer.py +++ b/code-generator/my_mod/tlm_buffer.py @@ -343,17 +343,25 @@ def GenerateTlmBuffer(settings, other_obc_dbs): + settings["other_obc_data"][i]["driver_path"] ) OutputTlmBufferC_( - output_file_path + obc_name.lower() + "_telemetry_buffer.c", obc_name, body_c, settings, i + output_file_path + obc_name.lower() + "_telemetry_buffer.c", + obc_name, + body_c, + settings, + i, ) OutputTlmBufferH_( - output_file_path + obc_name.lower() + "_telemetry_buffer.h", obc_name, body_h, settings, i + output_file_path + obc_name.lower() + "_telemetry_buffer.h", + obc_name, + body_h, + settings, + i, ) OutputTlmDataDefH_( output_file_path + obc_name.lower() + "_telemetry_data_definitions.h", obc_name, tlmdef_body_h, settings, - i + i, ) From 58ecdef00f908ac19f3512a1155eaef65244cd81 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 20:13:21 +0900 Subject: [PATCH 08/21] fix note --- code-generator/my_mod/util.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/code-generator/my_mod/util.py b/code-generator/my_mod/util.py index fff269297..efb695678 100644 --- a/code-generator/my_mod/util.py +++ b/code-generator/my_mod/util.py @@ -13,12 +13,6 @@ def GenerateSettingNote(settings): note += GetCommitHash_(settings["path_to_db"]) note += "\n" note += " * @note コード生成パラメータ:\n" - note += " * path_to_src: " - note += settings["path_to_src"] - note += "\n" - note += " * path_to_db: " - note += settings["path_to_db"] - note += "\n" note += " * db_prefix: " note += settings["db_prefix"] note += "\n" @@ -35,6 +29,7 @@ def GenerateSettingNote(settings): note += settings["output_file_encoding"] note += "\n" # is_main_obc については,生成状況によって異なるので出力しない + # path_to_src, path_to_db については,実行環境によって異なるので出力しない return note @@ -63,9 +58,6 @@ def GenerateSubObcSettingNote(settings, obc_idx): note += " * input_file_encoding: " note += sub_obc_settings["input_file_encoding"] note += "\n" - note += " * path_to_db: " - note += sub_obc_settings["path_to_db"] - note += "\n" note += " * max_tlm_num: " note += str(sub_obc_settings["max_tlm_num"]) note += "\n" @@ -81,6 +73,7 @@ def GenerateSubObcSettingNote(settings, obc_idx): note += " * code_when_tlm_not_found: " note += sub_obc_settings["code_when_tlm_not_found"] note += "\n" + # path_to_db については,実行環境によって異なるので出力しない return note From ffbc478e85b2291079483d4cc2edfc7480815abd Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 20:20:20 +0900 Subject: [PATCH 09/21] add repository --- code-generator/my_mod/util.py | 29 +++++++++++++++++-- .../aocs/aobc_command_definitions.h | 5 ++-- .../aocs/aobc_telemetry_buffer.c | 5 ++-- .../aocs/aobc_telemetry_buffer.h | 5 ++-- .../aocs/aobc_telemetry_data_definitions.h | 5 ++-- .../aocs/aobc_telemetry_definitions.h | 5 ++-- .../tlm_cmd/block_command_definitions.h | 6 ++-- .../src_user/tlm_cmd/command_definitions.c | 6 ++-- .../src_user/tlm_cmd/command_definitions.h | 6 ++-- .../src_user/tlm_cmd/telemetry_definitions.c | 6 ++-- .../src_user/tlm_cmd/telemetry_definitions.h | 6 ++-- .../tlm_cmd/block_command_definitions.h | 6 ++-- .../src_user/tlm_cmd/command_definitions.c | 6 ++-- .../src_user/tlm_cmd/command_definitions.h | 6 ++-- .../src_user/tlm_cmd/telemetry_definitions.c | 6 ++-- .../src_user/tlm_cmd/telemetry_definitions.h | 6 ++-- 16 files changed, 72 insertions(+), 42 deletions(-) diff --git a/code-generator/my_mod/util.py b/code-generator/my_mod/util.py index efb695678..a53f59bc7 100644 --- a/code-generator/my_mod/util.py +++ b/code-generator/my_mod/util.py @@ -4,12 +4,17 @@ """ import subprocess +import re def GenerateSettingNote(settings): note = "" note += " * @note このコードは自動生成されています!\n" - note += " * @note コード生成 db commit hash: " + note += " * @note コード生成 tlm-cmd-db:\n" + note += " * repository: " + note += GetRepoName_(settings["path_to_db"]) + note += "\n" + note += " * db commit hash: " note += GetCommitHash_(settings["path_to_db"]) note += "\n" note += " * @note コード生成パラメータ:\n" @@ -39,7 +44,11 @@ def GenerateSubObcSettingNote(settings, obc_idx): note = "" note += " * @note このコードは自動生成されています!\n" - note += " * @note コード生成 db commit hash: " + note += " * @note コード生成 tlm-cmd-db:\n" + note += " * repository: " + note += GetRepoName_(sub_obc_settings["path_to_db"]) + note += "\n" + note += " * db commit hash: " note += GetCommitHash_(sub_obc_settings["path_to_db"]) note += "\n" note += " * @note コード生成パラメータ:\n" @@ -86,3 +95,19 @@ def GetCommitHash_(path): return result.stdout.strip() except subprocess.CalledProcessError: return "0000000000000000000000000000000000000000" + + +def GetRepoName_(path): + try: + # GitリモートURLを取得 + result = subprocess.run(["git", "remote", "-v"], cwd=path, text=True, capture_output=True, check=True) + url = result.stdout.split('\n')[0].split('\t')[1].split(' ')[0] # 最初のリモートURLを取得 + + # URLからユーザー名とリポジトリ名を抽出 + match = re.search(r'github.com[:/](.+)/(.+)\.git', url) + if match: + return f"{match.group(1)}/{match.group(2)}" + else: + return "User/Repository name not found" + except subprocess.CalledProcessError: + return "User/Repository name not found" diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h index 4a0ad7242..5562ff6e1 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h @@ -2,14 +2,15 @@ * @file * @brief コマンド定義 * @note このコードは自動生成されています! - * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成 tlm-cmd-db: + * repository: arkedge/c2a-core + * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC * tlm_id_range: 0x90, 0xc0] * is_cmd_prefixed_in_db: 0 * input_file_encoding: utf-8 - * path_to_db: ../examples/subobc/tlm-cmd-db/ * max_tlm_num: 256 * driver_path: aocs/ * driver_type: AOBC_Driver diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c index adffa9488..45951d1c4 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c @@ -3,14 +3,15 @@ * @file * @brief テレメトリバッファー(テレメ中継) * @note このコードは自動生成されています! - * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成 tlm-cmd-db: + * repository: arkedge/c2a-core + * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC * tlm_id_range: 0x90, 0xc0] * is_cmd_prefixed_in_db: 0 * input_file_encoding: utf-8 - * path_to_db: ../examples/subobc/tlm-cmd-db/ * max_tlm_num: 256 * driver_path: aocs/ * driver_type: AOBC_Driver diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h index cbaf5fac9..4c5a1605d 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h @@ -2,14 +2,15 @@ * @file * @brief テレメトリバッファー(テレメ中継) * @note このコードは自動生成されています! - * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成 tlm-cmd-db: + * repository: arkedge/c2a-core + * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC * tlm_id_range: 0x90, 0xc0] * is_cmd_prefixed_in_db: 0 * input_file_encoding: utf-8 - * path_to_db: ../examples/subobc/tlm-cmd-db/ * max_tlm_num: 256 * driver_path: aocs/ * driver_type: AOBC_Driver diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h index c19f149d9..0180b43d0 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h @@ -2,14 +2,15 @@ * @file * @brief バッファリングされているテレメをパースしてMOBC内でかんたんに利用できるようにするためのテレメデータ構造体定義 * @note このコードは自動生成されています! - * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成 tlm-cmd-db: + * repository: arkedge/c2a-core + * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC * tlm_id_range: 0x90, 0xc0] * is_cmd_prefixed_in_db: 0 * input_file_encoding: utf-8 - * path_to_db: ../examples/subobc/tlm-cmd-db/ * max_tlm_num: 256 * driver_path: aocs/ * driver_type: AOBC_Driver diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h index af3261e02..305302db7 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h @@ -2,14 +2,15 @@ * @file * @brief テレメトリ定義 * @note このコードは自動生成されています! - * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成 tlm-cmd-db: + * repository: arkedge/c2a-core + * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC * tlm_id_range: 0x90, 0xc0] * is_cmd_prefixed_in_db: 0 * input_file_encoding: utf-8 - * path_to_db: ../examples/subobc/tlm-cmd-db/ * max_tlm_num: 256 * driver_path: aocs/ * driver_type: AOBC_Driver diff --git a/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h b/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h index 310c4f0a1..a6114352a 100644 --- a/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h @@ -2,10 +2,10 @@ * @file * @brief ブロックコマンド定義 * @note このコードは自動生成されています! - * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成 tlm-cmd-db: + * repository: arkedge/c2a-core + * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 * @note コード生成パラメータ: - * path_to_src: ../examples/mobc/src/ - * path_to_db: ../examples/mobc/tlm-cmd-db/ * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] * is_cmd_prefixed_in_db: 0 diff --git a/examples/mobc/src/src_user/tlm_cmd/command_definitions.c b/examples/mobc/src/src_user/tlm_cmd/command_definitions.c index 7a05ee48b..d8babbb54 100644 --- a/examples/mobc/src/src_user/tlm_cmd/command_definitions.c +++ b/examples/mobc/src/src_user/tlm_cmd/command_definitions.c @@ -3,10 +3,10 @@ * @file * @brief コマンド定義 * @note このコードは自動生成されています! - * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成 tlm-cmd-db: + * repository: arkedge/c2a-core + * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 * @note コード生成パラメータ: - * path_to_src: ../examples/mobc/src/ - * path_to_db: ../examples/mobc/tlm-cmd-db/ * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] * is_cmd_prefixed_in_db: 0 diff --git a/examples/mobc/src/src_user/tlm_cmd/command_definitions.h b/examples/mobc/src/src_user/tlm_cmd/command_definitions.h index 8cf16afff..7b4b8b0fd 100644 --- a/examples/mobc/src/src_user/tlm_cmd/command_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/command_definitions.h @@ -2,10 +2,10 @@ * @file * @brief コマンド定義 * @note このコードは自動生成されています! - * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成 tlm-cmd-db: + * repository: arkedge/c2a-core + * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 * @note コード生成パラメータ: - * path_to_src: ../examples/mobc/src/ - * path_to_db: ../examples/mobc/tlm-cmd-db/ * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] * is_cmd_prefixed_in_db: 0 diff --git a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c index e7ab96a49..9411d8254 100644 --- a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c +++ b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c @@ -3,10 +3,10 @@ * @file * @brief テレメトリ定義 * @note このコードは自動生成されています! - * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成 tlm-cmd-db: + * repository: arkedge/c2a-core + * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 * @note コード生成パラメータ: - * path_to_src: ../examples/mobc/src/ - * path_to_db: ../examples/mobc/tlm-cmd-db/ * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] * is_cmd_prefixed_in_db: 0 diff --git a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h index 61823cf16..75d6512fc 100644 --- a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h @@ -2,10 +2,10 @@ * @file * @brief テレメトリ定義 * @note このコードは自動生成されています! - * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成 tlm-cmd-db: + * repository: arkedge/c2a-core + * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 * @note コード生成パラメータ: - * path_to_src: ../examples/mobc/src/ - * path_to_db: ../examples/mobc/tlm-cmd-db/ * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] * is_cmd_prefixed_in_db: 0 diff --git a/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h b/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h index 686e07c62..d1712308f 100644 --- a/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h @@ -2,10 +2,10 @@ * @file * @brief ブロックコマンド定義 * @note このコードは自動生成されています! - * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成 tlm-cmd-db: + * repository: arkedge/c2a-core + * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 * @note コード生成パラメータ: - * path_to_src: ../examples/subobc/src/ - * path_to_db: ../examples/subobc/tlm-cmd-db/ * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] * is_cmd_prefixed_in_db: 0 diff --git a/examples/subobc/src/src_user/tlm_cmd/command_definitions.c b/examples/subobc/src/src_user/tlm_cmd/command_definitions.c index 0a9c622eb..dc7ac21ff 100644 --- a/examples/subobc/src/src_user/tlm_cmd/command_definitions.c +++ b/examples/subobc/src/src_user/tlm_cmd/command_definitions.c @@ -3,10 +3,10 @@ * @file * @brief コマンド定義 * @note このコードは自動生成されています! - * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成 tlm-cmd-db: + * repository: arkedge/c2a-core + * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 * @note コード生成パラメータ: - * path_to_src: ../examples/subobc/src/ - * path_to_db: ../examples/subobc/tlm-cmd-db/ * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] * is_cmd_prefixed_in_db: 0 diff --git a/examples/subobc/src/src_user/tlm_cmd/command_definitions.h b/examples/subobc/src/src_user/tlm_cmd/command_definitions.h index 0e06cec56..26a488f5f 100644 --- a/examples/subobc/src/src_user/tlm_cmd/command_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/command_definitions.h @@ -2,10 +2,10 @@ * @file * @brief コマンド定義 * @note このコードは自動生成されています! - * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成 tlm-cmd-db: + * repository: arkedge/c2a-core + * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 * @note コード生成パラメータ: - * path_to_src: ../examples/subobc/src/ - * path_to_db: ../examples/subobc/tlm-cmd-db/ * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] * is_cmd_prefixed_in_db: 0 diff --git a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c index 2c474880f..b1cd00c53 100644 --- a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c +++ b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c @@ -3,10 +3,10 @@ * @file * @brief テレメトリ定義 * @note このコードは自動生成されています! - * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成 tlm-cmd-db: + * repository: arkedge/c2a-core + * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 * @note コード生成パラメータ: - * path_to_src: ../examples/subobc/src/ - * path_to_db: ../examples/subobc/tlm-cmd-db/ * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] * is_cmd_prefixed_in_db: 0 diff --git a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h index 091e84d9e..b33272914 100644 --- a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h @@ -2,10 +2,10 @@ * @file * @brief テレメトリ定義 * @note このコードは自動生成されています! - * @note コード生成 db commit hash: ec4ce770d07fb3fa6824f36bd8d5253895174240 + * @note コード生成 tlm-cmd-db: + * repository: arkedge/c2a-core + * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 * @note コード生成パラメータ: - * path_to_src: ../examples/subobc/src/ - * path_to_db: ../examples/subobc/tlm-cmd-db/ * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] * is_cmd_prefixed_in_db: 0 From 7b55dd05c48c255e42cf805be9b0bc2ae6176571 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 20:24:32 +0900 Subject: [PATCH 10/21] Update check_code_generation.yml --- .github/workflows/check_code_generation.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check_code_generation.yml b/.github/workflows/check_code_generation.yml index c8645f8f1..0abc3726c 100644 --- a/.github/workflows/check_code_generation.yml +++ b/.github/workflows/check_code_generation.yml @@ -25,6 +25,8 @@ jobs: working-directory: ./code-generator run: | cp "./settings_${{ matrix.user }}.json" ./settings.json + # sub obc の tlm cmd db は見ない + sed -i 's/ "is_main_obc" : 1,/ "is_main_obc" : 0,/g' ./settings.json python GenerateC2ACode.py - name: check diff From f7b24980106fed976f894ffd96608dfa24ad271d Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 20:24:52 +0900 Subject: [PATCH 11/21] temp --- code-generator/my_mod/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code-generator/my_mod/util.py b/code-generator/my_mod/util.py index a53f59bc7..53e1bb7f1 100644 --- a/code-generator/my_mod/util.py +++ b/code-generator/my_mod/util.py @@ -15,7 +15,7 @@ def GenerateSettingNote(settings): note += GetRepoName_(settings["path_to_db"]) note += "\n" note += " * db commit hash: " - note += GetCommitHash_(settings["path_to_db"]) + # note += GetCommitHash_(settings["path_to_db"]) note += "\n" note += " * @note コード生成パラメータ:\n" note += " * db_prefix: " From 11b08aacb01a9a39c6807928b35628e2c946369d Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 20:27:20 +0900 Subject: [PATCH 12/21] fix small --- code-generator/my_mod/util.py | 6 +++--- .../component_driver/aocs/aobc_command_definitions.h | 4 ++-- .../src_user/component_driver/aocs/aobc_telemetry_buffer.c | 4 ++-- .../src_user/component_driver/aocs/aobc_telemetry_buffer.h | 4 ++-- .../component_driver/aocs/aobc_telemetry_data_definitions.h | 4 ++-- .../component_driver/aocs/aobc_telemetry_definitions.h | 4 ++-- .../mobc/src/src_user/tlm_cmd/block_command_definitions.h | 2 +- examples/mobc/src/src_user/tlm_cmd/command_definitions.c | 2 +- examples/mobc/src/src_user/tlm_cmd/command_definitions.h | 2 +- examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c | 2 +- examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h | 2 +- .../subobc/src/src_user/tlm_cmd/block_command_definitions.h | 2 +- examples/subobc/src/src_user/tlm_cmd/command_definitions.c | 2 +- examples/subobc/src/src_user/tlm_cmd/command_definitions.h | 2 +- .../subobc/src/src_user/tlm_cmd/telemetry_definitions.c | 2 +- .../subobc/src/src_user/tlm_cmd/telemetry_definitions.h | 2 +- 16 files changed, 23 insertions(+), 23 deletions(-) diff --git a/code-generator/my_mod/util.py b/code-generator/my_mod/util.py index 53e1bb7f1..f0796f228 100644 --- a/code-generator/my_mod/util.py +++ b/code-generator/my_mod/util.py @@ -21,8 +21,8 @@ def GenerateSettingNote(settings): note += " * db_prefix: " note += settings["db_prefix"] note += "\n" - note += " * tlm_id_range: [" - note += settings["tlm_id_range"][0] + ", " + settings["tlm_id_range"][1] + "]" + note += " * tlm_id_range: " + note += "[" + settings["tlm_id_range"][0] + ", " + settings["tlm_id_range"][1] + "]" note += "\n" note += " * is_cmd_prefixed_in_db: " note += str(settings["is_cmd_prefixed_in_db"]) @@ -59,7 +59,7 @@ def GenerateSubObcSettingNote(settings, obc_idx): note += sub_obc_settings["db_prefix"] note += "\n" note += " * tlm_id_range: " - note += sub_obc_settings["tlm_id_range"][0] + ", " + sub_obc_settings["tlm_id_range"][1] + "]" + note += "[" + sub_obc_settings["tlm_id_range"][0] + ", " + sub_obc_settings["tlm_id_range"][1] + "]" note += "\n" note += " * is_cmd_prefixed_in_db: " note += str(sub_obc_settings["is_cmd_prefixed_in_db"]) diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h index 5562ff6e1..d4f5bfaa5 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h @@ -4,11 +4,11 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 + * db commit hash: f7b24980106fed976f894ffd96608dfa24ad271d * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC - * tlm_id_range: 0x90, 0xc0] + * tlm_id_range: [0x90, 0xc0] * is_cmd_prefixed_in_db: 0 * input_file_encoding: utf-8 * max_tlm_num: 256 diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c index 45951d1c4..ca7595e28 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c @@ -5,11 +5,11 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 + * db commit hash: f7b24980106fed976f894ffd96608dfa24ad271d * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC - * tlm_id_range: 0x90, 0xc0] + * tlm_id_range: [0x90, 0xc0] * is_cmd_prefixed_in_db: 0 * input_file_encoding: utf-8 * max_tlm_num: 256 diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h index 4c5a1605d..eda350163 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h @@ -4,11 +4,11 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 + * db commit hash: f7b24980106fed976f894ffd96608dfa24ad271d * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC - * tlm_id_range: 0x90, 0xc0] + * tlm_id_range: [0x90, 0xc0] * is_cmd_prefixed_in_db: 0 * input_file_encoding: utf-8 * max_tlm_num: 256 diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h index 0180b43d0..bacb7d451 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h @@ -4,11 +4,11 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 + * db commit hash: f7b24980106fed976f894ffd96608dfa24ad271d * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC - * tlm_id_range: 0x90, 0xc0] + * tlm_id_range: [0x90, 0xc0] * is_cmd_prefixed_in_db: 0 * input_file_encoding: utf-8 * max_tlm_num: 256 diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h index 305302db7..279fcd503 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h @@ -4,11 +4,11 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 + * db commit hash: f7b24980106fed976f894ffd96608dfa24ad271d * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC - * tlm_id_range: 0x90, 0xc0] + * tlm_id_range: [0x90, 0xc0] * is_cmd_prefixed_in_db: 0 * input_file_encoding: utf-8 * max_tlm_num: 256 diff --git a/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h b/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h index a6114352a..58a8dd4f8 100644 --- a/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 + * db commit hash: * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/command_definitions.c b/examples/mobc/src/src_user/tlm_cmd/command_definitions.c index d8babbb54..9d587f84e 100644 --- a/examples/mobc/src/src_user/tlm_cmd/command_definitions.c +++ b/examples/mobc/src/src_user/tlm_cmd/command_definitions.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 + * db commit hash: * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/command_definitions.h b/examples/mobc/src/src_user/tlm_cmd/command_definitions.h index 7b4b8b0fd..05fa7da5b 100644 --- a/examples/mobc/src/src_user/tlm_cmd/command_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 + * db commit hash: * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c index 9411d8254..25344d321 100644 --- a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c +++ b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 + * db commit hash: * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h index 75d6512fc..98959bc6d 100644 --- a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 + * db commit hash: * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h b/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h index d1712308f..36500fea2 100644 --- a/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 + * db commit hash: * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/command_definitions.c b/examples/subobc/src/src_user/tlm_cmd/command_definitions.c index dc7ac21ff..086e94d22 100644 --- a/examples/subobc/src/src_user/tlm_cmd/command_definitions.c +++ b/examples/subobc/src/src_user/tlm_cmd/command_definitions.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 + * db commit hash: * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/command_definitions.h b/examples/subobc/src/src_user/tlm_cmd/command_definitions.h index 26a488f5f..c5e51180a 100644 --- a/examples/subobc/src/src_user/tlm_cmd/command_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 + * db commit hash: * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c index b1cd00c53..88ae37109 100644 --- a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c +++ b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 + * db commit hash: * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h index b33272914..362696279 100644 --- a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 58ecdef00f908ac19f3512a1155eaef65244cd81 + * db commit hash: * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] From 365db7f43361ee97009e394098477c250c37ec40 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 20:34:36 +0900 Subject: [PATCH 13/21] to accommodate both SSH and HTTP --- code-generator/my_mod/util.py | 5 +++-- .../component_driver/aocs/aobc_command_definitions.h | 2 +- .../src_user/component_driver/aocs/aobc_telemetry_buffer.c | 2 +- .../src_user/component_driver/aocs/aobc_telemetry_buffer.h | 2 +- .../component_driver/aocs/aobc_telemetry_data_definitions.h | 2 +- .../component_driver/aocs/aobc_telemetry_definitions.h | 2 +- .../mobc/src/src_user/tlm_cmd/block_command_definitions.h | 2 +- examples/mobc/src/src_user/tlm_cmd/command_definitions.c | 2 +- examples/mobc/src/src_user/tlm_cmd/command_definitions.h | 2 +- examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c | 2 +- examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h | 2 +- .../subobc/src/src_user/tlm_cmd/block_command_definitions.h | 2 +- examples/subobc/src/src_user/tlm_cmd/command_definitions.c | 2 +- examples/subobc/src/src_user/tlm_cmd/command_definitions.h | 2 +- examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c | 2 +- examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h | 2 +- 16 files changed, 18 insertions(+), 17 deletions(-) diff --git a/code-generator/my_mod/util.py b/code-generator/my_mod/util.py index f0796f228..a9f3e6f02 100644 --- a/code-generator/my_mod/util.py +++ b/code-generator/my_mod/util.py @@ -15,6 +15,7 @@ def GenerateSettingNote(settings): note += GetRepoName_(settings["path_to_db"]) note += "\n" note += " * db commit hash: " + note += "xxxx" # note += GetCommitHash_(settings["path_to_db"]) note += "\n" note += " * @note コード生成パラメータ:\n" @@ -103,8 +104,8 @@ def GetRepoName_(path): result = subprocess.run(["git", "remote", "-v"], cwd=path, text=True, capture_output=True, check=True) url = result.stdout.split('\n')[0].split('\t')[1].split(' ')[0] # 最初のリモートURLを取得 - # URLからユーザー名とリポジトリ名を抽出 - match = re.search(r'github.com[:/](.+)/(.+)\.git', url) + # URLからユーザー名とリポジトリ名を抽出(HTTPSとSSHの両方に対応) + match = re.search(r'(?:github\.com[:/])(.+)/(.+)\.git', url) if match: return f"{match.group(1)}/{match.group(2)}" else: diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h index d4f5bfaa5..8b60c3289 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: f7b24980106fed976f894ffd96608dfa24ad271d + * db commit hash: 11b08aacb01a9a39c6807928b35628e2c946369d * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c index ca7595e28..166ca9bb6 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: f7b24980106fed976f894ffd96608dfa24ad271d + * db commit hash: 11b08aacb01a9a39c6807928b35628e2c946369d * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h index eda350163..07729c82e 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: f7b24980106fed976f894ffd96608dfa24ad271d + * db commit hash: 11b08aacb01a9a39c6807928b35628e2c946369d * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h index bacb7d451..e3d121690 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: f7b24980106fed976f894ffd96608dfa24ad271d + * db commit hash: 11b08aacb01a9a39c6807928b35628e2c946369d * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h index 279fcd503..9d06b69d8 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: f7b24980106fed976f894ffd96608dfa24ad271d + * db commit hash: 11b08aacb01a9a39c6807928b35628e2c946369d * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h b/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h index 58a8dd4f8..cca06e9d9 100644 --- a/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: + * db commit hash: xxxx * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/command_definitions.c b/examples/mobc/src/src_user/tlm_cmd/command_definitions.c index 9d587f84e..dc72409d2 100644 --- a/examples/mobc/src/src_user/tlm_cmd/command_definitions.c +++ b/examples/mobc/src/src_user/tlm_cmd/command_definitions.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: + * db commit hash: xxxx * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/command_definitions.h b/examples/mobc/src/src_user/tlm_cmd/command_definitions.h index 05fa7da5b..f82e11986 100644 --- a/examples/mobc/src/src_user/tlm_cmd/command_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: + * db commit hash: xxxx * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c index 25344d321..06244024e 100644 --- a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c +++ b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: + * db commit hash: xxxx * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h index 98959bc6d..1fc6c9a20 100644 --- a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: + * db commit hash: xxxx * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h b/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h index 36500fea2..a0b743b1d 100644 --- a/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: + * db commit hash: xxxx * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/command_definitions.c b/examples/subobc/src/src_user/tlm_cmd/command_definitions.c index 086e94d22..e28126c6a 100644 --- a/examples/subobc/src/src_user/tlm_cmd/command_definitions.c +++ b/examples/subobc/src/src_user/tlm_cmd/command_definitions.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: + * db commit hash: xxxx * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/command_definitions.h b/examples/subobc/src/src_user/tlm_cmd/command_definitions.h index c5e51180a..65f119703 100644 --- a/examples/subobc/src/src_user/tlm_cmd/command_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: + * db commit hash: xxxx * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c index 88ae37109..0dabd4e07 100644 --- a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c +++ b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: + * db commit hash: xxxx * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h index 362696279..8f1139c79 100644 --- a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: + * db commit hash: xxxx * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] From 91057002c3912105ba56ed1e91077ef6a4daf460 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 20:39:21 +0900 Subject: [PATCH 14/21] fix for non .git URL --- code-generator/my_mod/util.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code-generator/my_mod/util.py b/code-generator/my_mod/util.py index a9f3e6f02..3cc5ce494 100644 --- a/code-generator/my_mod/util.py +++ b/code-generator/my_mod/util.py @@ -104,6 +104,10 @@ def GetRepoName_(path): result = subprocess.run(["git", "remote", "-v"], cwd=path, text=True, capture_output=True, check=True) url = result.stdout.split('\n')[0].split('\t')[1].split(' ')[0] # 最初のリモートURLを取得 + # URLの末尾に.gitがなければ追加 + if not url.endswith(".git"): + url += ".git" + # URLからユーザー名とリポジトリ名を抽出(HTTPSとSSHの両方に対応) match = re.search(r'(?:github\.com[:/])(.+)/(.+)\.git', url) if match: From b652ed36ebcf0bf8e900adf444be970c6264bc04 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 20:50:52 +0900 Subject: [PATCH 15/21] to record dir hash --- code-generator/my_mod/util.py | 28 +++++++++++++++---- .../aocs/aobc_command_definitions.h | 2 +- .../aocs/aobc_telemetry_buffer.c | 2 +- .../aocs/aobc_telemetry_buffer.h | 2 +- .../aocs/aobc_telemetry_data_definitions.h | 2 +- .../aocs/aobc_telemetry_definitions.h | 2 +- .../tlm_cmd/block_command_definitions.h | 2 +- .../src_user/tlm_cmd/command_definitions.c | 2 +- .../src_user/tlm_cmd/command_definitions.h | 2 +- .../src_user/tlm_cmd/telemetry_definitions.c | 2 +- .../src_user/tlm_cmd/telemetry_definitions.h | 2 +- .../tlm_cmd/block_command_definitions.h | 2 +- .../src_user/tlm_cmd/command_definitions.c | 2 +- .../src_user/tlm_cmd/command_definitions.h | 2 +- .../src_user/tlm_cmd/telemetry_definitions.c | 2 +- .../src_user/tlm_cmd/telemetry_definitions.h | 2 +- 16 files changed, 38 insertions(+), 20 deletions(-) diff --git a/code-generator/my_mod/util.py b/code-generator/my_mod/util.py index 3cc5ce494..78db71653 100644 --- a/code-generator/my_mod/util.py +++ b/code-generator/my_mod/util.py @@ -15,8 +15,8 @@ def GenerateSettingNote(settings): note += GetRepoName_(settings["path_to_db"]) note += "\n" note += " * db commit hash: " - note += "xxxx" # note += GetCommitHash_(settings["path_to_db"]) + note += GetLatestDirCommitHash_(settings["path_to_db"]) note += "\n" note += " * @note コード生成パラメータ:\n" note += " * db_prefix: " @@ -60,7 +60,9 @@ def GenerateSubObcSettingNote(settings, obc_idx): note += sub_obc_settings["db_prefix"] note += "\n" note += " * tlm_id_range: " - note += "[" + sub_obc_settings["tlm_id_range"][0] + ", " + sub_obc_settings["tlm_id_range"][1] + "]" + note += ( + "[" + sub_obc_settings["tlm_id_range"][0] + ", " + sub_obc_settings["tlm_id_range"][1] + "]" + ) note += "\n" note += " * is_cmd_prefixed_in_db: " note += str(sub_obc_settings["is_cmd_prefixed_in_db"]) @@ -98,18 +100,34 @@ def GetCommitHash_(path): return "0000000000000000000000000000000000000000" +# あるディレクトリの最後に更新されたコミットハッシュを取得する +def GetLatestDirCommitHash_(path): + try: + result = subprocess.run( + ["git", "log", "-n", "1", "--format=%H", "--", path], + text=True, + capture_output=True, + check=True, + ) + return result.stdout.strip() + except subprocess.CalledProcessError: + return "0000000000000000000000000000000000000000" + + def GetRepoName_(path): try: # GitリモートURLを取得 - result = subprocess.run(["git", "remote", "-v"], cwd=path, text=True, capture_output=True, check=True) - url = result.stdout.split('\n')[0].split('\t')[1].split(' ')[0] # 最初のリモートURLを取得 + result = subprocess.run( + ["git", "remote", "-v"], cwd=path, text=True, capture_output=True, check=True + ) + url = result.stdout.split("\n")[0].split("\t")[1].split(" ")[0] # 最初のリモートURLを取得 # URLの末尾に.gitがなければ追加 if not url.endswith(".git"): url += ".git" # URLからユーザー名とリポジトリ名を抽出(HTTPSとSSHの両方に対応) - match = re.search(r'(?:github\.com[:/])(.+)/(.+)\.git', url) + match = re.search(r"(?:github\.com[:/])(.+)/(.+)\.git", url) if match: return f"{match.group(1)}/{match.group(2)}" else: diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h index 8b60c3289..676909834 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 11b08aacb01a9a39c6807928b35628e2c946369d + * db commit hash: 91057002c3912105ba56ed1e91077ef6a4daf460 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c index 166ca9bb6..1595cdc06 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 11b08aacb01a9a39c6807928b35628e2c946369d + * db commit hash: 91057002c3912105ba56ed1e91077ef6a4daf460 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h index 07729c82e..a55e29ac1 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 11b08aacb01a9a39c6807928b35628e2c946369d + * db commit hash: 91057002c3912105ba56ed1e91077ef6a4daf460 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h index e3d121690..91c455a1c 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 11b08aacb01a9a39c6807928b35628e2c946369d + * db commit hash: 91057002c3912105ba56ed1e91077ef6a4daf460 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h index 9d06b69d8..c97b5636d 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 11b08aacb01a9a39c6807928b35628e2c946369d + * db commit hash: 91057002c3912105ba56ed1e91077ef6a4daf460 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h b/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h index cca06e9d9..978900977 100644 --- a/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: xxxx + * db commit hash: 56c0502ad54caac8d6a9065dcb6fdbd6e913f3e9 * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/command_definitions.c b/examples/mobc/src/src_user/tlm_cmd/command_definitions.c index dc72409d2..58078bab7 100644 --- a/examples/mobc/src/src_user/tlm_cmd/command_definitions.c +++ b/examples/mobc/src/src_user/tlm_cmd/command_definitions.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: xxxx + * db commit hash: 56c0502ad54caac8d6a9065dcb6fdbd6e913f3e9 * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/command_definitions.h b/examples/mobc/src/src_user/tlm_cmd/command_definitions.h index f82e11986..4f6e7999f 100644 --- a/examples/mobc/src/src_user/tlm_cmd/command_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: xxxx + * db commit hash: 56c0502ad54caac8d6a9065dcb6fdbd6e913f3e9 * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c index 06244024e..58a6e9932 100644 --- a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c +++ b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: xxxx + * db commit hash: 56c0502ad54caac8d6a9065dcb6fdbd6e913f3e9 * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h index 1fc6c9a20..699f76a7e 100644 --- a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: xxxx + * db commit hash: 56c0502ad54caac8d6a9065dcb6fdbd6e913f3e9 * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h b/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h index a0b743b1d..a1f222fd7 100644 --- a/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: xxxx + * db commit hash: e28c5f3a45187e8b9202b363b27e162713a6bc28 * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/command_definitions.c b/examples/subobc/src/src_user/tlm_cmd/command_definitions.c index e28126c6a..ebe1166c9 100644 --- a/examples/subobc/src/src_user/tlm_cmd/command_definitions.c +++ b/examples/subobc/src/src_user/tlm_cmd/command_definitions.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: xxxx + * db commit hash: e28c5f3a45187e8b9202b363b27e162713a6bc28 * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/command_definitions.h b/examples/subobc/src/src_user/tlm_cmd/command_definitions.h index 65f119703..10c82d3dc 100644 --- a/examples/subobc/src/src_user/tlm_cmd/command_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: xxxx + * db commit hash: e28c5f3a45187e8b9202b363b27e162713a6bc28 * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c index 0dabd4e07..54dacd330 100644 --- a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c +++ b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: xxxx + * db commit hash: e28c5f3a45187e8b9202b363b27e162713a6bc28 * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h index 8f1139c79..f72927e02 100644 --- a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: xxxx + * db commit hash: e28c5f3a45187e8b9202b363b27e162713a6bc28 * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] From 6e52e3f9039da4ababbff33bf22f4aee6202c458 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 21:57:07 +0900 Subject: [PATCH 16/21] define db hash --- code-generator/my_mod/util.py | 55 +++++++++++++------ .../aocs/aobc_command_definitions.h | 2 +- .../aocs/aobc_telemetry_buffer.c | 2 +- .../aocs/aobc_telemetry_buffer.h | 2 +- .../aocs/aobc_telemetry_data_definitions.h | 2 +- .../aocs/aobc_telemetry_definitions.h | 2 +- .../tlm_cmd/block_command_definitions.h | 4 +- .../src_user/tlm_cmd/command_definitions.c | 4 +- .../src_user/tlm_cmd/command_definitions.h | 4 +- .../src_user/tlm_cmd/telemetry_definitions.c | 4 +- .../src_user/tlm_cmd/telemetry_definitions.h | 4 +- .../tlm_cmd/block_command_definitions.h | 4 +- .../src_user/tlm_cmd/command_definitions.c | 4 +- .../src_user/tlm_cmd/command_definitions.h | 4 +- .../src_user/tlm_cmd/telemetry_definitions.c | 4 +- .../src_user/tlm_cmd/telemetry_definitions.h | 4 +- 16 files changed, 63 insertions(+), 42 deletions(-) diff --git a/code-generator/my_mod/util.py b/code-generator/my_mod/util.py index 78db71653..13e3d4c3b 100644 --- a/code-generator/my_mod/util.py +++ b/code-generator/my_mod/util.py @@ -5,18 +5,21 @@ import subprocess import re +import os +import hashlib def GenerateSettingNote(settings): note = "" note += " * @note このコードは自動生成されています!\n" note += " * @note コード生成 tlm-cmd-db:\n" - note += " * repository: " + note += " * repository: " note += GetRepoName_(settings["path_to_db"]) note += "\n" - note += " * db commit hash: " + note += " * db hash (MD5): " # note += GetCommitHash_(settings["path_to_db"]) - note += GetLatestDirCommitHash_(settings["path_to_db"]) + # note += GetLatestDirCommitHash_(settings["path_to_db"]) + note += GetDbHash_(settings["path_to_db"]) note += "\n" note += " * @note コード生成パラメータ:\n" note += " * db_prefix: " @@ -100,20 +103,6 @@ def GetCommitHash_(path): return "0000000000000000000000000000000000000000" -# あるディレクトリの最後に更新されたコミットハッシュを取得する -def GetLatestDirCommitHash_(path): - try: - result = subprocess.run( - ["git", "log", "-n", "1", "--format=%H", "--", path], - text=True, - capture_output=True, - check=True, - ) - return result.stdout.strip() - except subprocess.CalledProcessError: - return "0000000000000000000000000000000000000000" - - def GetRepoName_(path): try: # GitリモートURLを取得 @@ -134,3 +123,35 @@ def GetRepoName_(path): return "User/Repository name not found" except subprocess.CalledProcessError: return "User/Repository name not found" + + +# 入力 DB の csv をファイル名でソートし MD5 を計算,その MD5 をすべて cat して MD5 を計算したものを返す +def GetDbHash_(path): + csv_files_info = FindCsvFilesAndCalculateMd5_(path) + + # ファイル名でソートし,MD5 を結合したのち,その MD5 を計算 + sorted_info = sorted(csv_files_info, key=lambda x: x['filepath']) + concatenated_md5s = ''.join(info['md5'] for info in sorted_info) + final_md5 = hashlib.md5(concatenated_md5s.encode()).hexdigest() + return final_md5 + + +def CalcMd5_(path): + hash_md5 = hashlib.md5() + with open(path, 'rb') as f: + for chunk in iter(lambda: f.read(4096), b""): + hash_md5.update(chunk) + return hash_md5.hexdigest() + + +def FindCsvFilesAndCalculateMd5_(path): + csv_files_info = [] + for root, dirs, files in os.walk(path): + for name in files: + if name.endswith(".csv"): + file_path = os.path.join(root, name) + md5 = CalcMd5_(file_path) + csv_files_info.append({"filepath": file_path, "md5": md5}) + return csv_files_info + + diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h index 676909834..265249411 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 91057002c3912105ba56ed1e91077ef6a4daf460 + * db commit hash: b652ed36ebcf0bf8e900adf444be970c6264bc04 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c index 1595cdc06..76700d648 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 91057002c3912105ba56ed1e91077ef6a4daf460 + * db commit hash: b652ed36ebcf0bf8e900adf444be970c6264bc04 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h index a55e29ac1..3ef05ea47 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 91057002c3912105ba56ed1e91077ef6a4daf460 + * db commit hash: b652ed36ebcf0bf8e900adf444be970c6264bc04 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h index 91c455a1c..c3cd5580b 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 91057002c3912105ba56ed1e91077ef6a4daf460 + * db commit hash: b652ed36ebcf0bf8e900adf444be970c6264bc04 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h index c97b5636d..44eacb455 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: 91057002c3912105ba56ed1e91077ef6a4daf460 + * db commit hash: b652ed36ebcf0bf8e900adf444be970c6264bc04 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h b/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h index 978900977..c153e2b87 100644 --- a/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/block_command_definitions.h @@ -3,8 +3,8 @@ * @brief ブロックコマンド定義 * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: - * repository: arkedge/c2a-core - * db commit hash: 56c0502ad54caac8d6a9065dcb6fdbd6e913f3e9 + * repository: arkedge/c2a-core + * db hash (MD5): e2120a2aaff3346ef5570adeda7a1cd6 * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/command_definitions.c b/examples/mobc/src/src_user/tlm_cmd/command_definitions.c index 58078bab7..745ee6b6d 100644 --- a/examples/mobc/src/src_user/tlm_cmd/command_definitions.c +++ b/examples/mobc/src/src_user/tlm_cmd/command_definitions.c @@ -4,8 +4,8 @@ * @brief コマンド定義 * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: - * repository: arkedge/c2a-core - * db commit hash: 56c0502ad54caac8d6a9065dcb6fdbd6e913f3e9 + * repository: arkedge/c2a-core + * db hash (MD5): e2120a2aaff3346ef5570adeda7a1cd6 * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/command_definitions.h b/examples/mobc/src/src_user/tlm_cmd/command_definitions.h index 4f6e7999f..84be5b4f3 100644 --- a/examples/mobc/src/src_user/tlm_cmd/command_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/command_definitions.h @@ -3,8 +3,8 @@ * @brief コマンド定義 * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: - * repository: arkedge/c2a-core - * db commit hash: 56c0502ad54caac8d6a9065dcb6fdbd6e913f3e9 + * repository: arkedge/c2a-core + * db hash (MD5): e2120a2aaff3346ef5570adeda7a1cd6 * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c index 58a6e9932..9111c0340 100644 --- a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c +++ b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.c @@ -4,8 +4,8 @@ * @brief テレメトリ定義 * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: - * repository: arkedge/c2a-core - * db commit hash: 56c0502ad54caac8d6a9065dcb6fdbd6e913f3e9 + * repository: arkedge/c2a-core + * db hash (MD5): e2120a2aaff3346ef5570adeda7a1cd6 * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h index 699f76a7e..0c645b8c3 100644 --- a/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h +++ b/examples/mobc/src/src_user/tlm_cmd/telemetry_definitions.h @@ -3,8 +3,8 @@ * @brief テレメトリ定義 * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: - * repository: arkedge/c2a-core - * db commit hash: 56c0502ad54caac8d6a9065dcb6fdbd6e913f3e9 + * repository: arkedge/c2a-core + * db hash (MD5): e2120a2aaff3346ef5570adeda7a1cd6 * @note コード生成パラメータ: * db_prefix: SAMPLE_MOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h b/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h index a1f222fd7..586fe0319 100644 --- a/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/block_command_definitions.h @@ -3,8 +3,8 @@ * @brief ブロックコマンド定義 * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: - * repository: arkedge/c2a-core - * db commit hash: e28c5f3a45187e8b9202b363b27e162713a6bc28 + * repository: arkedge/c2a-core + * db hash (MD5): a68cdf10ca467fd750b1d988780fcb5b * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/command_definitions.c b/examples/subobc/src/src_user/tlm_cmd/command_definitions.c index ebe1166c9..635acba99 100644 --- a/examples/subobc/src/src_user/tlm_cmd/command_definitions.c +++ b/examples/subobc/src/src_user/tlm_cmd/command_definitions.c @@ -4,8 +4,8 @@ * @brief コマンド定義 * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: - * repository: arkedge/c2a-core - * db commit hash: e28c5f3a45187e8b9202b363b27e162713a6bc28 + * repository: arkedge/c2a-core + * db hash (MD5): a68cdf10ca467fd750b1d988780fcb5b * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/command_definitions.h b/examples/subobc/src/src_user/tlm_cmd/command_definitions.h index 10c82d3dc..6a88a23eb 100644 --- a/examples/subobc/src/src_user/tlm_cmd/command_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/command_definitions.h @@ -3,8 +3,8 @@ * @brief コマンド定義 * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: - * repository: arkedge/c2a-core - * db commit hash: e28c5f3a45187e8b9202b363b27e162713a6bc28 + * repository: arkedge/c2a-core + * db hash (MD5): a68cdf10ca467fd750b1d988780fcb5b * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c index 54dacd330..8491a799f 100644 --- a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c +++ b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.c @@ -4,8 +4,8 @@ * @brief テレメトリ定義 * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: - * repository: arkedge/c2a-core - * db commit hash: e28c5f3a45187e8b9202b363b27e162713a6bc28 + * repository: arkedge/c2a-core + * db hash (MD5): a68cdf10ca467fd750b1d988780fcb5b * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] diff --git a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h index f72927e02..452ada847 100644 --- a/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h +++ b/examples/subobc/src/src_user/tlm_cmd/telemetry_definitions.h @@ -3,8 +3,8 @@ * @brief テレメトリ定義 * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: - * repository: arkedge/c2a-core - * db commit hash: e28c5f3a45187e8b9202b363b27e162713a6bc28 + * repository: arkedge/c2a-core + * db hash (MD5): a68cdf10ca467fd750b1d988780fcb5b * @note コード生成パラメータ: * db_prefix: SAMPLE_AOBC * tlm_id_range: [0x00, 0x100] From 1ed121df9dc5bc5a7a98aaa85eff0d83a064e630 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 21:59:07 +0900 Subject: [PATCH 17/21] apply black --- code-generator/my_mod/util.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code-generator/my_mod/util.py b/code-generator/my_mod/util.py index 13e3d4c3b..4a3377e69 100644 --- a/code-generator/my_mod/util.py +++ b/code-generator/my_mod/util.py @@ -130,15 +130,15 @@ def GetDbHash_(path): csv_files_info = FindCsvFilesAndCalculateMd5_(path) # ファイル名でソートし,MD5 を結合したのち,その MD5 を計算 - sorted_info = sorted(csv_files_info, key=lambda x: x['filepath']) - concatenated_md5s = ''.join(info['md5'] for info in sorted_info) + sorted_info = sorted(csv_files_info, key=lambda x: x["filepath"]) + concatenated_md5s = "".join(info["md5"] for info in sorted_info) final_md5 = hashlib.md5(concatenated_md5s.encode()).hexdigest() return final_md5 def CalcMd5_(path): hash_md5 = hashlib.md5() - with open(path, 'rb') as f: + with open(path, "rb") as f: for chunk in iter(lambda: f.read(4096), b""): hash_md5.update(chunk) return hash_md5.hexdigest() @@ -153,5 +153,3 @@ def FindCsvFilesAndCalculateMd5_(path): md5 = CalcMd5_(file_path) csv_files_info.append({"filepath": file_path, "md5": md5}) return csv_files_info - - From 8c8c9ee5c23f6318a95a7a0be91a654619b75d6a Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 22:21:04 +0900 Subject: [PATCH 18/21] fix calc way of mf5 --- code-generator/my_mod/util.py | 7 +++++++ .../component_driver/aocs/aobc_command_definitions.h | 2 +- .../src_user/component_driver/aocs/aobc_telemetry_buffer.c | 2 +- .../src_user/component_driver/aocs/aobc_telemetry_buffer.h | 2 +- .../aocs/aobc_telemetry_data_definitions.h | 2 +- .../component_driver/aocs/aobc_telemetry_definitions.h | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/code-generator/my_mod/util.py b/code-generator/my_mod/util.py index 4a3377e69..165e00c5e 100644 --- a/code-generator/my_mod/util.py +++ b/code-generator/my_mod/util.py @@ -137,6 +137,13 @@ def GetDbHash_(path): def CalcMd5_(path): + # 改行コード問題がうざいので,全部 CRLF に変換して計算 + with open(path, 'r', encoding='utf-8') as file: + content = file.read() + content_crlf = content.replace('\n', '\r\n') + return hashlib.md5(content_crlf.encode('utf-8')).hexdigest() + + hash_md5 = hashlib.md5() with open(path, "rb") as f: for chunk in iter(lambda: f.read(4096), b""): diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h index 265249411..b882e0784 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_command_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: b652ed36ebcf0bf8e900adf444be970c6264bc04 + * db commit hash: 1903b95d5b784283e7dcf8dee8012b1ee9dd4fa3 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c index 76700d648..d1ea56467 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.c @@ -5,7 +5,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: b652ed36ebcf0bf8e900adf444be970c6264bc04 + * db commit hash: 1903b95d5b784283e7dcf8dee8012b1ee9dd4fa3 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h index 3ef05ea47..e42afdcdc 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_buffer.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: b652ed36ebcf0bf8e900adf444be970c6264bc04 + * db commit hash: 1903b95d5b784283e7dcf8dee8012b1ee9dd4fa3 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h index c3cd5580b..9f89c8ea7 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_data_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: b652ed36ebcf0bf8e900adf444be970c6264bc04 + * db commit hash: 1903b95d5b784283e7dcf8dee8012b1ee9dd4fa3 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC diff --git a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h index 44eacb455..d54649253 100644 --- a/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h +++ b/examples/mobc/src/src_user/component_driver/aocs/aobc_telemetry_definitions.h @@ -4,7 +4,7 @@ * @note このコードは自動生成されています! * @note コード生成 tlm-cmd-db: * repository: arkedge/c2a-core - * db commit hash: b652ed36ebcf0bf8e900adf444be970c6264bc04 + * db commit hash: 1903b95d5b784283e7dcf8dee8012b1ee9dd4fa3 * @note コード生成パラメータ: * name: AOBC * db_prefix: SAMPLE_AOBC From f7ea83fdbf2692ef2124afdca37f40282a7e5929 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 22:21:47 +0900 Subject: [PATCH 19/21] apply black --- code-generator/my_mod/util.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/code-generator/my_mod/util.py b/code-generator/my_mod/util.py index 165e00c5e..2c5f2db29 100644 --- a/code-generator/my_mod/util.py +++ b/code-generator/my_mod/util.py @@ -138,11 +138,10 @@ def GetDbHash_(path): def CalcMd5_(path): # 改行コード問題がうざいので,全部 CRLF に変換して計算 - with open(path, 'r', encoding='utf-8') as file: + with open(path, "r", encoding="utf-8") as file: content = file.read() - content_crlf = content.replace('\n', '\r\n') - return hashlib.md5(content_crlf.encode('utf-8')).hexdigest() - + content_crlf = content.replace("\n", "\r\n") + return hashlib.md5(content_crlf.encode("utf-8")).hexdigest() hash_md5 = hashlib.md5() with open(path, "rb") as f: From f3fc2d6853464ad89c4157ebb0029ac373a225d7 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 15 Dec 2023 22:24:28 +0900 Subject: [PATCH 20/21] Update CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4bd07156..4e4994355 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ 注意: これは既存の C2A core update の「リリースの間の Pull Request を眺めてなんとなく察する」という曖昧な操作を緩和していくための試みであり,C2A user に対するお知らせを行う場として使っていくことを意図しています.初めから c2a-core の全変更を取り扱うと不必要に煩雑になるだけになってしまうため,完全な変更内容の一覧についてはこれまで通り [GitHub Releases](https://github.com/arkedge/c2a-core/releases) などから参照してください. +## v4.2.0 (Unreleased-12-11) + +### Enhancements +- [#240](https://github.com/arkedge/c2a-core/pull/240): code-generator の出力コードに,設定情報を残すようにする + + ## v4.1.0 (2023-12-11) ### Breaking Changes From b0a95d426c06d5b21945971a54ca5d17cafb599b Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Mon, 18 Dec 2023 13:28:37 +0900 Subject: [PATCH 21/21] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e4994355..5d147a454 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ ### Enhancements - [#240](https://github.com/arkedge/c2a-core/pull/240): code-generator の出力コードに,設定情報を残すようにする +### Migration Guide +- [#240](https://github.com/arkedge/c2a-core/pull/240): user 側でのコードレベルでの対応は不要 + - 新しい code-generator で生成したコードは,既存のものと diff が発生するため,改めてコード生成し直すとよい. + ## v4.1.0 (2023-12-11)