commit 43e7b0a6462f35d5e0b47177965f5acbce8a45ff
parent d6f7fa43143e162168b723273179355976957a02
Author: kristapsdz <kristaps@bsd.lv>
Date: Mon, 16 Mar 2020 22:48:28 +0000
parent d6f7fa43143e162168b723273179355976957a02
Author: kristapsdz <kristaps@bsd.lv>
Date: Mon, 16 Mar 2020 22:48:28 +0000
Add ability to track by fetch HEAD commit sequence.
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/db.ort b/db.ort @@ -100,6 +100,9 @@ struct report { field unamehash text limit eq 32 comment "Hash of uname[mnrsv]. This is used to quickly establish a kind of machine identity."; + field fetchhead text limit le 40 default "" + comment "Git hash for branch master. May be empty."; + field id int rowid;
diff --git a/main.c b/main.c @@ -624,7 +624,7 @@ post(struct kreq *r) struct kpair *kps, *kpe, *kpd, *kpb, *kpt, *kpi, *kpc, *kpn, *kpl, *sig, *kpu, *kpum, *kpun, *kpur, *kpus, - *kpuv; + *kpuv, *kpf; size_t i, sz; MD5_CTX ctx; char *buf = NULL; @@ -652,6 +652,7 @@ post(struct kreq *r) (kpd = r->fieldmap[VALID_REPORT_DEPEND]) == NULL || (kpc = r->fieldmap[VALID_REPORT_DISTCHECK]) == NULL || (kpe = r->fieldmap[VALID_REPORT_ENV]) == NULL || + (kpf = r->fieldmap[VALID_REPORT_FETCHHEAD]) == NULL || (kpi = r->fieldmap[VALID_REPORT_INSTALL]) == NULL || (kpl = r->fieldmap[VALID_REPORT_LOG]) == NULL || (kps = r->fieldmap[VALID_REPORT_START]) == NULL || @@ -751,6 +752,7 @@ post(struct kreq *r) "report-build=%" PRId64 "&" "report-distcheck=%" PRId64 "&" "report-env=%" PRId64 "&" + "report-fetchhead=%s&" "report-depend=%" PRId64 "&" "report-install=%" PRId64 "&" "report-log=%s&" @@ -766,6 +768,7 @@ post(struct kreq *r) kpb->parsed.i, kpc->parsed.i, kpe->parsed.i, + kpf->parsed.s, kpd->parsed.i, kpi->parsed.i, logdigest, @@ -824,7 +827,8 @@ post(struct kreq *r) kpur->parsed.s, /* unamer */ kpus->parsed.s, /* unames */ kpuv->parsed.s, /* unamev */ - unamedigest); /* unamehash */ + unamedigest, /* unamehash */ + kpf->parsed.s); /* fetchhead */ kutil_info(r, user->email, "log submitted: %s", proj->name); http_open(r, KHTTP_201, KMIME__MAX, 0);
diff --git a/minci.sh b/minci.sh @@ -215,6 +215,7 @@ do TIME_test=0 TIME_install=0 TIME_distcheck=0 + FETCH_HEAD= TIME_start=$(date +%s) @@ -224,7 +225,7 @@ do while : do head="" - nhead="" + FETCH_HEAD="" # If we have a repository already, update and clean it # out; otherwise, clone it afresh. @@ -235,22 +236,21 @@ do if [ -z "$NOOP" ] then cd "$reponame" - head=$(cut -f1 .git/FETCH_HEAD 2>/dev/null) || head="" + head=$(cut -f1 .git/FETCH_HEAD 2>/dev/null | head -1) || head="" fi run "git fetch origin" "$reponame" || break run "git reset --hard origin/master" "$reponame" || break run "git clean -fdx" "$reponame" || break if [ -z "$NOOP" ] then - nhead=$(cut -f1 .git/FETCH_HEAD) || nhead="" + FETCH_HEAD=$(cut -f1 .git/FETCH_HEAD | head -1) || FETCH_HEAD="" fi else - head="" - nhead="" run "git clone $repo" "$reponame" || break if [ -z "$NOOP" ] then cd "$reponame" + FETCH_HEAD=$(cut -f1 .git/FETCH_HEAD | head -1) || FETCH_HEAD="" fi # Grabs the newest .git/FETCH_HEAD. run "git fetch origin" "$reponame" || break @@ -261,7 +261,7 @@ do # repository, then doing re-test it unless -f was passed. if [ -z "$FORCE" -a -n "$head" -a \ - -n "$nhead" -a "$head" = "$nhead" ] + -n "$FETCH_HEAD" -a "$head" = "$FETCH_HEAD" ] then debug "repository is fresh: $reponame" TIME_start=0 @@ -324,6 +324,7 @@ do QUERY="${QUERY}&report-build=${TIME_build}" QUERY="${QUERY}&report-distcheck=${TIME_distcheck}" QUERY="${QUERY}&report-env=${TIME_env}" + QUERY="${QUERY}&report-fetchhead=${FETCH_HEAD}" QUERY="${QUERY}&report-depend=${TIME_depend}" QUERY="${QUERY}&report-install=${TIME_install}" if [ $TIME_distcheck -eq 0 ] @@ -379,6 +380,7 @@ do -F "report-unamer=${UNAME_R}" \ -F "report-unames=${UNAME_S}" \ -F "report-unamev=${UNAME_V}" \ + -F "report-fetchhead=${FETCH_HEAD}" \ -F "user-apikey=${API_KEY}" \ -F "signature=${SIGNATURE}" \ "${SERVER}"
: nply/minci