From 8ed63037e4c8cfaf3df0c01bc86b736a7dc76324 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= <frederic.danis@collabora.com>
Date: Thu, 23 Apr 2020 18:25:12 +0200
Subject: [PATCH] Fix upload
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Current app build failed with following error:
```
$ rsync -e "ssh -oStrictHostKeyChecking=no -i $ARCHIVE_SECRET_FILE" -aP ~/.cache/flatdeb/ostree-repo/. "$upload_host:$UPLOAD_ROOT"
sending incremental file list
rsync: change_dir "/root/.cache/flatdeb/ostree-repo" failed: No such file or directory (2)
```
This commit create a temporary repo directory used by `flatpak-builder`.
Set correct rights so the repository is accessible after upload.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
---
 ci-flatpak-builder.yml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ci-flatpak-builder.yml b/ci-flatpak-builder.yml
index acea984..6171de0 100644
--- a/ci-flatpak-builder.yml
+++ b/ci-flatpak-builder.yml
@@ -22,7 +22,9 @@ build-app:
     - flatpak --if-not-exists --user remote-add --no-gpg-verify mildenhall https://images.apertis.org/public/flatpak/mildenhall
     - flatpak install -y org.apertis.mildenhall.Platform org.apertis.mildenhall.Sdk
   script:
-    - flatpak-builder --default-branch=${APERTIS_RELEASE} --force-clean build-dir flatpak-recipe.yaml
+    - REPODIR=$(mktemp -d repo-XXXXXX)
+    - chmod 755 ${REPODIR}
+    - flatpak-builder --repo=${REPODIR} --default-branch=${APERTIS_RELEASE} --force-clean build-dir flatpak-recipe.yaml
     - |
       case "$CI_COMMIT_REF_NAME" in
         apertis/*)
@@ -33,7 +35,7 @@ build-app:
           ;;
       esac
     - ssh -oStrictHostKeyChecking=no -i "$ARCHIVE_SECRET_FILE" "$upload_host" mkdir -p "$UPLOAD_ROOT"
-    - rsync -e "ssh -oStrictHostKeyChecking=no -i $ARCHIVE_SECRET_FILE" -aP ~/.cache/flatdeb/ostree-repo/. "$upload_host:$UPLOAD_ROOT"
+    - rsync -e "ssh -oStrictHostKeyChecking=no -i $ARCHIVE_SECRET_FILE" -aP ${REPODIR}/. "$upload_host:$UPLOAD_ROOT"
     - ssh -oStrictHostKeyChecking=no -i "$ARCHIVE_SECRET_FILE" "$upload_host" flatpak build-update-repo "$UPLOAD_ROOT"
   only:
     refs:
-- 
GitLab