[gnome-build-meta/abderrahim/update-local-repo: 19/19] simplify update-local-repo.sh script
- From: Abderrahim Kitouni <akitouni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-build-meta/abderrahim/update-local-repo: 19/19] simplify update-local-repo.sh script
- Date: Sun, 13 Dec 2020 09:15:36 +0000 (UTC)
commit 6e1e40c8540a23b58f86074f61a851e073326d0a
Author: Abderrahim Kitouni <akitouni gnome org>
Date: Wed Sep 2 22:08:57 2020 +0100
simplify update-local-repo.sh script
The important parts of utils/update-repo.sh are now merged into it and
we use the flatpak CLI instead of ostree to make things easier
utils/update-local-repo.sh | 69 +++++++++++++++++++++------
utils/update-repo.sh | 116 ---------------------------------------------
2 files changed, 55 insertions(+), 130 deletions(-)
---
diff --git a/utils/update-local-repo.sh b/utils/update-local-repo.sh
index 49030b2d..ca71cf5c 100755
--- a/utils/update-local-repo.sh
+++ b/utils/update-local-repo.sh
@@ -2,13 +2,35 @@
set -eu
-: ${BST:=bst}
-export BST
+BST=bst
+REPO_ELEMENTS=''
-: ${REPO_ELEMENT:=vm/repo-devel.bst}
-: ${OSTREE_LAYER:=git}
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --user)
+ REPO_ELEMENTS="$REPO_ELEMENTS vm/repo.bst"
+ ;;
+ --devel)
+ REPO_ELEMENTS="$REPO_ELEMENTS vm/repo-devel.bst"
+ ;;
+ --element=*)
+ REPO_ELEMENTS="$REPO_ELEMENTS ${1#--element=}"
+ ;;
+ --element)
+ shift
+ REPO_ELEMENTS="$REPO_ELEMENTS ${1}"
+ ;;
+ --help) ;&
+ -h)
+ echo "$0 [--user] [--devel] [--element=element.bst]"
+ exit 0
+ ;;
+ esac
+ shift
+done
+
+test -z "$REPO_ELEMENTS" && REPO_ELEMENTS="vm/repo-devel.bst"
-ref="$(${BST} show --format "%{vars}" --deps none "${REPO_ELEMENT}" | sed '/ostree-branch: /{;s///;q;};d')"
if ! [ -d ostree-gpg ]; then
rm -rf ostree-gpg.tmp
@@ -30,13 +52,32 @@ EOF
mv ostree-gpg.tmp ostree-gpg
fi
-script_dir=$(dirname $0)
-$script_dir/update-repo.sh \
- --gpg-homedir=ostree-gpg \
- --gpg-sign="$(cat ostree-gpg/default-id)" \
- --collection-id=org.gnome.gnomeos \
- --target-ref="${ref%-*}-${OSTREE_LAYER}" \
- ostree-repo "${REPO_ELEMENT}" \
- "${ref}"
-
+test -d ostree-repo || ostree init --repo=ostree-repo --mode=archive
gpg --homedir=ostree-gpg --export --armor >ostree-repo/key.gpg
+
+
+${BST} build ${REPO_ELEMENTS}
+
+
+checkout="$(mktemp --suffix="-update-repo" -d -p .)"
+
+on_exit() {
+ rm -rf "${checkout}"
+}
+trap on_exit EXIT
+
+updated_refs=""
+
+for element in ${REPO_ELEMENTS}; do
+ ${BST} checkout --hardlinks $element "$checkout/$element"
+ ref=$(ostree refs --repo $checkout/$element)
+ prev_commit=$(ostree rev-parse --repo ostree-repo ${ref} 2>/dev/null || true)
+ test -n "${prev_commit}" && updated_refs="${updated_refs} ${ref}"
+ flatpak build-commit-from --gpg-homedir=ostree-gpg --gpg-sign="$(cat ostree-gpg/default-id)" \
+ --src-repo="$checkout/$element" --extra-collection-id=org.gnome.GnomeOS ostree-repo $ref
+done
+
+test -n "${updated_refs}" && ostree static-delta generate --repo ostree-repo ${updated_refs}
+
+flatpak build-update-repo --gpg-homedir=ostree-gpg --gpg-sign="$(cat ostree-gpg/default-id)" \
+ --prune ostree-repo
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]