Log git source commit (#34749)

* Log git source commit

* strip

* fix trim

* no trim
pull/34750/head
Adeeb Shihadeh 2 months ago committed by GitHub
parent 2d9f33cbe2
commit 54f1b00447
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      cereal/log.capnp
  2. 1
      common/util.cc
  3. 4
      release/build_devel.sh
  4. 4
      system/loggerd/logger.cc

@ -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) {

Loading…
Cancel
Save