mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 20:03:53 +08:00
Log git source commit (#34749)
* Log git source commit * strip * fix trim * no trim
This commit is contained in:
@@ -151,6 +151,10 @@ struct InitData {
|
||||
gitBranch @11 :Text;
|
||||
gitRemote @13 :Text;
|
||||
|
||||
# this is source commit for prebuilt branches
|
||||
gitSrcCommit @23 :Text;
|
||||
gitSrcCommitDate @24 :Text;
|
||||
|
||||
androidProperties @16 :Map(Text, Text);
|
||||
|
||||
pandaInfo @8 :PandaInfo;
|
||||
|
||||
@@ -257,7 +257,6 @@ bool ends_with(const std::string& s, const std::string& suffix) {
|
||||
|
||||
std::string strip(const std::string &str) {
|
||||
auto should_trim = [](unsigned char ch) {
|
||||
// trim whitespace or a null character
|
||||
return std::isspace(ch) || ch == '\0';
|
||||
};
|
||||
|
||||
|
||||
@@ -51,9 +51,13 @@ rm -f panda/board/obj/panda.bin.signed
|
||||
|
||||
# include source commit hash and build date in commit
|
||||
GIT_HASH=$(git --git-dir=$SOURCE_DIR/.git rev-parse HEAD)
|
||||
GIT_COMMIT_DATE=$(git --git-dir=$SOURCE_DIR/.git show --no-patch --format='%ct %ci' HEAD)
|
||||
DATETIME=$(date '+%Y-%m-%dT%H:%M:%S')
|
||||
VERSION=$(cat $SOURCE_DIR/common/version.h | awk -F\" '{print $2}')
|
||||
|
||||
echo -n "$GIT_HASH" > git_src_commit
|
||||
echo -n "$GIT_COMMIT_DATE" > git_src_commit_date
|
||||
|
||||
echo "[-] committing version $VERSION T=$SECONDS"
|
||||
git add -f .
|
||||
git status
|
||||
|
||||
@@ -50,6 +50,10 @@ kj::Array<capnp::word> logger_build_init_data() {
|
||||
init.setPassive(false);
|
||||
init.setDongleId(params_map["DongleId"]);
|
||||
|
||||
// for prebuilt branches
|
||||
init.setGitSrcCommit(util::read_file("../../git_src_commit"));
|
||||
init.setGitSrcCommitDate(util::read_file("../../git_src_commit_date"));
|
||||
|
||||
auto lparams = init.initParams().initEntries(params_map.size());
|
||||
int j = 0;
|
||||
for (auto& [key, value] : params_map) {
|
||||
|
||||
Reference in New Issue
Block a user