[gnome-build-meta/abderrahim/fix-update-repo: 4/4] utils/update-local-repo.sh: use ostree instead of flatpak




commit 4fd85ea74713242c908fbc437c77706a9aec7408
Author: Abderrahim Kitouni <akitouni gnome org>
Date:   Sat Jan 15 15:59:20 2022 +0100

    utils/update-local-repo.sh: use ostree instead of flatpak
    
    for some reason flatpak produces corrupt repositories
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-build-meta/-/merge_requests/1478>

 utils/update-local-repo.sh | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/utils/update-local-repo.sh b/utils/update-local-repo.sh
index d40b7f651..b11e02262 100755
--- a/utils/update-local-repo.sh
+++ b/utils/update-local-repo.sh
@@ -66,19 +66,24 @@ on_exit() {
 }
 trap on_exit EXIT
 
-updated_refs=""
+export OSTREE_REPO=ostree-repo
 
+updated_refs=""
 for element in ${REPO_ELEMENTS}; do
-    ${BST} checkout --hardlinks $element "$checkout/$element"
+    ${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)" \
-            --timestamp=NOW \
-            --src-repo="$checkout/$element" --extra-collection-id=org.gnome.GnomeOS ostree-repo $ref
-done
+    commit=$(ostree --repo=$checkout/$element rev-parse $ref)
+    prev_commit=$(ostree rev-parse $ref 2>/dev/null || true)
+
+    ostree pull-local $checkout/$element $commit
+    ostree commit --branch=$ref --tree=ref=$commit --skip-if-unchanged \
+           --gpg-homedir=ostree-gpg --gpg-sign=$(cat ostree-gpg/default-id)
 
-test -n "${updated_refs}" && ostree static-delta generate --repo ostree-repo ${updated_refs}
+    new_commit=$(ostree rev-parse $ref)
+    test -n "$prev_commit" && test "$new_commit" != "$prev_commit" && updated_refs="$updated_refs $ref"
+done
 
-flatpak build-update-repo --gpg-homedir=ostree-gpg --gpg-sign="$(cat ostree-gpg/default-id)" \
-        --prune ostree-repo
+ostree prune --refs-only --keep-younger-than="6 months ago"
+test -n "${updated_refs}" && ostree static-delta generate ${updated_refs}
+ostree summary --update --gpg-homedir=ostree-gpg --gpg-sign="$(cat ostree-gpg/default-id)"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]