From 2d8267495cb7aa63c760ed8340a165f1d5527419 Mon Sep 17 00:00:00 2001 From: SoundDrill31 <84176052+sounddrill31@users.noreply.github.com> Date: Mon, 5 Aug 2024 18:31:52 +0530 Subject: [PATCH] Fix Local Manifest XML logic (#49) * Change condition for local manifests * Experiment with substitution * Try to avoid export * Mess around with quotes * Simplify command * Experiment with bash -c * Fix local manifest xml handing Thanks to @pugzarecute for coming up with that * Try to use variable in crave run * Fix leftovers from @iamrh1819's PR --- .github/workflows/main.yml | 12 ++++++------ .github/workflows/selfhosted.yml | 13 ++++++------- .github/workflows/twrp-legacy.yml | 9 +++++---- .github/workflows/twrp.yml | 9 +++++---- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0b54b075..a2934b84 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -147,12 +147,12 @@ jobs: LUNCH="breakfast ${{ github.event.inputs.PRODUCT_NAME }} ${{ github.event.inputs.BUILD_TYPE }}" fi - #copy from here + if [[ "${{ github.event.inputs.LOCAL_MANIFEST }}" =~ \.xml(/)?$ ]]; then local_manifest_url="${{ github.event.inputs.LOCAL_MANIFEST }}" export local_manifest_url="${local_manifest_url%/}" # remove trailing slash if it exists - export LOCAL_MANIFEST=$(mkdir -p .repo/local_manifests && rm -rf .repo/local_manifests/* || true && curl -o .repo/local_manifests/local_manifest.xml "${local_manifest_url}") - else + LOCAL_MANIFEST="mkdir -p .repo/local_manifests && rm -rf .repo/local_manifests/* || true && curl -o .repo/local_manifests/local_manifest.xml ${local_manifest_url}" + else export LOCAL_MANIFEST="git clone ${{ github.event.inputs.LOCAL_MANIFEST }} --depth 1 -b ${{github.event.inputs.LOCAL_MANIFEST_BRANCH}} .repo/local_manifests" fi @@ -181,7 +181,7 @@ jobs: echo "Displaying Local Manifests" if [[ -z "${{ secrets.DISPLAY_FALSE }}" ]]; then - $LOCAL_MANIFEST + bash -c "$LOCAL_MANIFEST" cat .repo/local_manifests/*.xml else echo "Displaying is disabled through secrets." @@ -252,7 +252,7 @@ jobs: ${{ github.event.inputs.BUILD_DIFFERENT_ROM }} fi - $LOCAL_MANIFEST + bash -c "$LOCAL_MANIFEST" timeout 1m repo sync --force-sync || { exit_code=$?; [ $exit_code -eq 124 ] || (echo "Error: Process failed with exit code $exit_code"; exit $exit_code); } du -csh . # Output Size when done @@ -432,7 +432,7 @@ jobs: crave ${{ secrets.CRAVE_FLAGS }} run --no-patch --${CLEAN} "rm -rf .repo/local_manifests/ ${{ github.event.inputs.REMOVALS }} && \ # Clone local_manifests repository $BUILD_DIFFERENT_ROM ; \ - $LOCAL_MANIFEST; \ + $LOCAL_MANIFEST && \ # Sync the repositories /opt/crave/resync.sh && \ diff --git a/.github/workflows/selfhosted.yml b/.github/workflows/selfhosted.yml index 2b5fcabc..be5bf6c7 100644 --- a/.github/workflows/selfhosted.yml +++ b/.github/workflows/selfhosted.yml @@ -188,7 +188,7 @@ jobs: if [[ "${{ github.event.inputs.LOCAL_MANIFEST }}" =~ \.xml(/)?$ ]]; then local_manifest_url="${{ github.event.inputs.LOCAL_MANIFEST }}" export local_manifest_url="${local_manifest_url%/}" # remove trailing slash if it exists - export LOCAL_MANIFEST=$(mkdir -p .repo/local_manifests && rm -rf .repo/local_manifests/* || true && curl -o .repo/local_manifests/local_manifest.xml "${local_manifest_url}") + LOCAL_MANIFEST="mkdir -p .repo/local_manifests && rm -rf .repo/local_manifests/* || true && curl -o .repo/local_manifests/local_manifest.xml ${local_manifest_url}" else export LOCAL_MANIFEST="git clone ${{ github.event.inputs.LOCAL_MANIFEST }} --depth 1 -b ${{github.event.inputs.LOCAL_MANIFEST_BRANCH}} .repo/local_manifests" fi @@ -218,7 +218,7 @@ jobs: echo "Displaying Local Manifests" if [[ -z "${{ secrets.DISPLAY_FALSE }}" ]]; then - $LOCAL_MANIFEST + bash -c "$LOCAL_MANIFEST" cat .repo/local_manifests/*.xml else echo "Displaying is disabled through secrets." @@ -289,7 +289,7 @@ jobs: ${{ github.event.inputs.BUILD_DIFFERENT_ROM }} fi - $LOCAL_MANIFEST + bash -c "$LOCAL_MANIFEST" timeout 1m repo sync --force-sync || { exit_code=$?; [ $exit_code -eq 124 ] || (echo "Error: Process failed with exit code $exit_code"; exit $exit_code); } du -csh . # Output Size when done @@ -456,12 +456,11 @@ jobs: crave run --no-patch --${CLEAN} "rm -rf .repo/local_manifests/ ${{ github.event.inputs.REMOVALS }} && \ # Clone local_manifests repository $BUILD_DIFFERENT_ROM ; \ - $LOCAL_MANIFEST; \ - + $LOCAL_MANIFEST && \ + # Sync the repositories /opt/crave/resync.sh && \ - repo forall -c 'git lfs install && git lfs pull && git lfs checkout' && \ - + # Set up build environment export BUILD_USERNAME=${{ github.actor }} ; \ export BUILD_HOSTNAME=crave ; \ diff --git a/.github/workflows/twrp-legacy.yml b/.github/workflows/twrp-legacy.yml index 28d6729e..e170375c 100644 --- a/.github/workflows/twrp-legacy.yml +++ b/.github/workflows/twrp-legacy.yml @@ -101,7 +101,7 @@ jobs: if [[ "${{ github.event.inputs.LOCAL_MANIFEST }}" =~ \.xml(/)?$ ]]; then local_manifest_url="${{ github.event.inputs.LOCAL_MANIFEST }}" export local_manifest_url="${local_manifest_url%/}" # remove trailing slash if it exists - export LOCAL_MANIFEST=$(mkdir -p .repo/local_manifests && rm -rf .repo/local_manifests/* || true && curl -o .repo/local_manifests/local_manifest.xml "${local_manifest_url}") + LOCAL_MANIFEST="mkdir -p .repo/local_manifests && rm -rf .repo/local_manifests/* || true && curl -o .repo/local_manifests/local_manifest.xml ${local_manifest_url}" else export LOCAL_MANIFEST="git clone ${{ github.event.inputs.LOCAL_MANIFEST }} --depth 1 -b ${{github.event.inputs.LOCAL_MANIFEST_BRANCH}} .repo/local_manifests" fi @@ -115,7 +115,7 @@ jobs: echo "Displaying Local Manifests" if [[ -z "${{ secrets.DISPLAY_FALSE }}" ]]; then - $LOCAL_MANIFEST + bash -c "$LOCAL_MANIFEST" cat .repo/local_manifests/*.xml else echo "Displaying is disabled through secrets." @@ -182,7 +182,8 @@ jobs: ${{ github.event.inputs.BUILD_DIFFERENT_ROM }} fi - $LOCAL_MANIFEST + bash -c "$LOCAL_MANIFEST" + timeout 1m repo sync --force-sync || { exit_code=$?; [ $exit_code -eq 124 ] || (echo "Error: Process failed with exit code $exit_code"; exit $exit_code); } du -csh . # Output Size when done @@ -357,7 +358,7 @@ jobs: crave ${{ secrets.CRAVE_FLAGS }} run --no-patch --${CLEAN} "rm -rf .repo/local_manifests/ ${{ github.event.inputs.REMOVALS }} && \ # Clone local_manifests repository $BUILD_DIFFERENT_ROM ; \ - $LOCAL_MANIFEST; \ + $LOCAL_MANIFEST && \ # Sync the repositories /opt/crave/resync.sh && \ diff --git a/.github/workflows/twrp.yml b/.github/workflows/twrp.yml index 5aaf9a30..b623ad80 100644 --- a/.github/workflows/twrp.yml +++ b/.github/workflows/twrp.yml @@ -101,7 +101,7 @@ jobs: if [[ "${{ github.event.inputs.LOCAL_MANIFEST }}" =~ \.xml(/)?$ ]]; then local_manifest_url="${{ github.event.inputs.LOCAL_MANIFEST }}" export local_manifest_url="${local_manifest_url%/}" # remove trailing slash if it exists - export LOCAL_MANIFEST=$(mkdir -p .repo/local_manifests && rm -rf .repo/local_manifests/* || true && curl -o .repo/local_manifests/local_manifest.xml "${local_manifest_url}") + LOCAL_MANIFEST="mkdir -p .repo/local_manifests && rm -rf .repo/local_manifests/* || true && curl -o .repo/local_manifests/local_manifest.xml ${local_manifest_url}" else export LOCAL_MANIFEST="git clone ${{ github.event.inputs.LOCAL_MANIFEST }} --depth 1 -b ${{github.event.inputs.LOCAL_MANIFEST_BRANCH}} .repo/local_manifests" fi @@ -115,7 +115,7 @@ jobs: echo "Displaying Local Manifests" if [[ -z "${{ secrets.DISPLAY_FALSE }}" ]]; then - $LOCAL_MANIFEST + bash -c "$LOCAL_MANIFEST" cat .repo/local_manifests/*.xml else echo "Displaying is disabled through secrets." @@ -182,7 +182,8 @@ jobs: ${{ github.event.inputs.BUILD_DIFFERENT_ROM }} fi - $LOCAL_MANIFEST + bash -c "$LOCAL_MANIFEST" + timeout 1m repo sync --force-sync || { exit_code=$?; [ $exit_code -eq 124 ] || (echo "Error: Process failed with exit code $exit_code"; exit $exit_code); } du -csh . # Output Size when done @@ -357,7 +358,7 @@ jobs: crave ${{ secrets.CRAVE_FLAGS }} run --no-patch --${CLEAN} "rm -rf .repo/local_manifests/ ${{ github.event.inputs.REMOVALS }} && \ # Clone local_manifests repository $BUILD_DIFFERENT_ROM ; \ - $LOCAL_MANIFEST; \ + $LOCAL_MANIFEST && \ # Sync the repositories /opt/crave/resync.sh && \