Skip to content

Commit

Permalink
Fix Local Manifest XML logic (#49)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
sounddrill31 committed Aug 5, 2024
1 parent b2bb884 commit 2d82674
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 && \
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/selfhosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ; \
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/twrp-legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 && \
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/twrp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 && \
Expand Down

0 comments on commit 2d82674

Please sign in to comment.