From d7851a8deb3019ba93b966ba9045dc6dcc8e4c52 Mon Sep 17 00:00:00 2001 From: Antoine Fontaine Date: Fri, 24 Apr 2020 19:49:34 +0200 Subject: [PATCH] add pin script and documentation --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ pin-this-tree.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 README.md create mode 100755 pin-this-tree.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..1e3335f --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ + +# platform manifest for postmarketOS's anbox image + +have a look at https://gitlab.com/postmarketOS/anbox-image-make/ +for the build instructions. + +please don't rely on the commit hash in this repo, as they will be +rebased. + +## `pin-this-tree.sh` + +this tool is used to maintain this repository: it pins every git tree +to its currently checked out commit. + +How to pin the commits: + +1. in this repo, get back to the original, non-pinned, + version of the manifest +```sh +git checkout unpinned default.xml +``` + +2. get the android source +```sh +cd anbox-image-make # (that's the git repo above) +make fetch && date=$(date -u +%s) # get the latest version of the source +``` + +3. pin the versions and create the tarball +```sh +cd source # anbox-image-make/source, or wherever you did put it +repo forall -c '~/platform_manifests/pin-this-tree.sh' +tar -czf anbox-image-$date.tar.gz * +``` + +then go back to this repository, `git commit default.xml -m "pin to $date"`, `git push` and upload the tarball. + +## Note for maintainers + +When not pushing a change that pin commits, remember to update the unpinned tag: `git tag -f unpinned` diff --git a/pin-this-tree.sh b/pin-this-tree.sh new file mode 100755 index 0000000..7ef3e25 --- /dev/null +++ b/pin-this-tree.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# pin every repo to the current checked out commit +# this script assumes no commit is already pinned + +# tested with GNU and Busybox sed. + +if [ -n "$1" ]; then + manifest="$1" +else + dir="$(realpath "$(dirname "$0")")" + if [ -z "$dir" ]; then + dir=. + fi + manifest="$dir"/default.xml +fi + +if ! [ -f "$manifest" ]; then + echo "could not find $manifest. make sure to cd" \ + "in the platform_manifest directory that contains it" + exit 1 +fi + +commit="$(git rev-parse HEAD)" +path="$REPO_PATH" + +sed "$(cat <| revision="$commit" />| + # … and append the desired commit +EOT +)" "$manifest" -i