Index: head/emulators/qemu-cheri/Makefile.snapshot =================================================================== --- head/emulators/qemu-cheri/Makefile.snapshot (revision 412633) +++ head/emulators/qemu-cheri/Makefile.snapshot (revision 412634) @@ -1,9 +1,9 @@ # $FreeBSD$ # # Generated file! Do not edit! # # Generated by: files/gen-Makefile.snapshot.sh. # -SNAPDATE= 20160310 +SNAPDATE= 20160405 -QEMU_COMMIT= d348332f2be05d2811a382be5a4f2b445d62db3f +QEMU_COMMIT= 5d1f1bf1d043e871212f785d3e67890c47dcb499 Index: head/emulators/qemu-cheri/distinfo =================================================================== --- head/emulators/qemu-cheri/distinfo (revision 412633) +++ head/emulators/qemu-cheri/distinfo (revision 412634) @@ -1,2 +1,2 @@ -SHA256 (CTSRD-CHERI-qemu-0.d20160310-d348332f2be05d2811a382be5a4f2b445d62db3f_GH0.tar.gz) = 18573bb98de40fd30206bd9bb99a12f064a09a57edb0a426a5df24cc2e4bcd8d -SIZE (CTSRD-CHERI-qemu-0.d20160310-d348332f2be05d2811a382be5a4f2b445d62db3f_GH0.tar.gz) = 11138454 +SHA256 (CTSRD-CHERI-qemu-0.d20160405-5d1f1bf1d043e871212f785d3e67890c47dcb499_GH0.tar.gz) = e55d610c2496ffeb8eb17610351d4589490967fd19805729d06ee2a25869605d +SIZE (CTSRD-CHERI-qemu-0.d20160405-5d1f1bf1d043e871212f785d3e67890c47dcb499_GH0.tar.gz) = 11139121 Index: head/emulators/qemu-cheri/files/gen-Makefile.snapshot.sh =================================================================== --- head/emulators/qemu-cheri/files/gen-Makefile.snapshot.sh (revision 412633) +++ head/emulators/qemu-cheri/files/gen-Makefile.snapshot.sh (revision 412634) @@ -1,23 +1,46 @@ #!/bin/sh # # Simple script to fetch the latest commits via the github API. Requires # curl and jq. Uses unauthenticated access which is ratelimited to 60 # queries per hour. -get_repo_sha() +REPOS_URL=https://api.github.com/repos/CTSRD-CHERI +MAX_DATE=1970101 + +tmpfile=`mktemp -t gen-Makefile.snapshot` + +query_repo() { - curl https://api.github.com/repos/CTSRD-CHERI/$1/branches/qemu-cheri | \ - jq -r '.commit.sha' + curl ${REPOS_URL}/$1/branches/qemu-cheri > $tmpfile + + # Accumulate the dates of the last commits to find the snapshot date + committime=`jq -r '.commit.commit.committer.date' $tmpfile` + committime=${committime%%T*} + year=${committime%%-*} + month=${committime%-*} + month=${month#*-} + day=${committime##*-} + dateint=${year}${month}${day} + if [ $dateint -gt $MAX_DATE ]; then + export MAX_DATE=$dateint + fi + + SHA=`jq -r '.commit.sha' $tmpfile` } +query_repo qemu +QEMU_COMMIT=$SHA + cat < Makefile.snapshot # \$FreeBSD\$ # # Generated file! Do not edit! # # Generated by: files/gen-Makefile.snapshot.sh. # -SNAPDATE= $(date +%Y%m%d) +SNAPDATE= ${MAX_DATE} -QEMU_COMMIT= $(get_repo_sha qemu) +QEMU_COMMIT= ${QEMU_COMMIT} EOF + +rm -f $tmpfile