From 8c464301da3d22685186984a68eecea8442c6bf4 Mon Sep 17 00:00:00 2001 From: Pete Fotheringham Date: Mon, 21 Oct 2024 15:49:00 +0100 Subject: [PATCH 1/2] Revert "Fix indentation", fix #699 This reverts commit d369421e628b9e8aff0c6716270277e61cd3e1fc. a --- src/new_build.sh | 57 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/src/new_build.sh b/src/new_build.sh index f3edeeb..76fbf92 100755 --- a/src/new_build.sh +++ b/src/new_build.sh @@ -241,19 +241,54 @@ for codename in ${devices//,/ }; do "https://gitlab.com/the-muppets/manifest/raw/$themuppets_branch/muppets.xml" .repo/local_manifests/proprietary_gitlab.xml fi - # `repo init` - if [ "$CALL_REPO_INIT" = true ]; then - echo ">> [$(date)] (Re)initializing branch repository" | tee -a "$repo_log" - if [ "$LOCAL_MIRROR" = true ]; then - ( yes||: ) | repo init -u https://github.com/LineageOS/android.git --reference "$MIRROR_DIR" -b "$branch" -g default,-darwin,-muppets,muppets_"${codename}" --git-lfs &>> "$repo_log" - else - ( yes||: ) | repo init -u https://github.com/LineageOS/android.git -b "$branch" -g default,-darwin,-muppets,muppets_"${codename}" --git-lfs &>> "$repo_log" - fi + # `repo init` + if [ "$CALL_REPO_INIT" = true ]; then + echo ">> [$(date)] (Re)initializing branch repository" | tee -a "$repo_log" + if [ "$LOCAL_MIRROR" = true ]; then + ( yes||: ) | repo init -u https://github.com/LineageOS/android.git --reference "$MIRROR_DIR" -b "$branch" -g default,-darwin,-muppets,muppets_"${codename}" --git-lfs &>> "$repo_log" else - echo ">> [$(date)] Calling repo init disabled" + ( yes||: ) | repo init -u https://github.com/LineageOS/android.git -b "$branch" -g default,-darwin,-muppets,muppets_"${codename}" --git-lfs &>> "$repo_log" fi + else + echo ">> [$(date)] Calling repo init disabled" + fi - # Setup our overlays + # `repo sync` + repo_sync_returncode=0 + if [ "$CALL_REPO_SYNC" = true ]; then + set +eu + echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log" + repo sync "${jobs_arg[@]}" "${retry_fetches_arg[@]}" --current-branch --force-sync &>> "$repo_log" + repo_sync_returncode=$? + set -eu + else + echo ">> [$(date)] Syncing branch repository disabled" | tee -a "$repo_log" + fi + + if [ $repo_sync_returncode -ne 0 ]; then + echo ">> [$(date)] repo sync failed for $codename, $branch branch" | tee -a "$DEBUG_LOG" + # call post-build.sh so the failure is logged in a way that is more visible + if [ -f /root/userscripts/post-build.sh ]; then + echo ">> [$(date)] Running post-build.sh for $codename" >> "$DEBUG_LOG" + /root/userscripts/post-build.sh "$codename" false "$branch" &>> "$DEBUG_LOG" || echo ">> [$(date)] Warning: post-build.sh failed!" + fi + do_cleanup + continue + fi + + if [ "$CALL_GIT_LFS_PULL" = true ]; then + echo ">> [$(date)] Calling git lfs pull" | tee -a "$repo_log" + repo forall -v -c git lfs pull &>> "$repo_log" + else + echo ">> [$(date)] Calling git lfs pull disabled" | tee -a "$repo_log" + fi + + if [ ! -d "vendor/$vendor" ]; then + echo ">> [$(date)] Missing \"vendor/$vendor\", aborting" + exit 1 + fi + + # Setup our overlays if [ "$BUILD_OVERLAY" = true ]; then echo "Using BUILD_OVERLAY is not yet working" exit 1 @@ -280,6 +315,8 @@ for codename in ${devices//,/ }; do los_ver_minor=$(sed -n -e 's/^\s*PRODUCT_VERSION_MINOR = //p' "$makefile_containing_version") los_ver="$los_ver_major.$los_ver_minor" +# DEBUG_LOG="$LOGS_DIR/$logsubdir/lineage-$los_ver-$builddate-$RELEASE_TYPE-$codename.log" + # Set RELEASE_TYPE echo ">> [$(date)] Setting \"$RELEASE_TYPE\" as release type" sed -i "/\$(filter .*\$(${vendor^^}_BUILDTYPE)/,/endif/d" "$makefile_containing_version" From 6d86a5c7e7ca0e69447ad0db3195705fd84b703d Mon Sep 17 00:00:00 2001 From: Pete Fotheringham Date: Mon, 21 Oct 2024 15:53:09 +0100 Subject: [PATCH 2/2] Fix indentation without deleteing code --- src/new_build.sh | 86 ++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/src/new_build.sh b/src/new_build.sh index 76fbf92..331e529 100755 --- a/src/new_build.sh +++ b/src/new_build.sh @@ -241,52 +241,52 @@ for codename in ${devices//,/ }; do "https://gitlab.com/the-muppets/manifest/raw/$themuppets_branch/muppets.xml" .repo/local_manifests/proprietary_gitlab.xml fi - # `repo init` - if [ "$CALL_REPO_INIT" = true ]; then - echo ">> [$(date)] (Re)initializing branch repository" | tee -a "$repo_log" - if [ "$LOCAL_MIRROR" = true ]; then - ( yes||: ) | repo init -u https://github.com/LineageOS/android.git --reference "$MIRROR_DIR" -b "$branch" -g default,-darwin,-muppets,muppets_"${codename}" --git-lfs &>> "$repo_log" - else - ( yes||: ) | repo init -u https://github.com/LineageOS/android.git -b "$branch" -g default,-darwin,-muppets,muppets_"${codename}" --git-lfs &>> "$repo_log" - fi - else - echo ">> [$(date)] Calling repo init disabled" - fi - - # `repo sync` - repo_sync_returncode=0 - if [ "$CALL_REPO_SYNC" = true ]; then - set +eu - echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log" - repo sync "${jobs_arg[@]}" "${retry_fetches_arg[@]}" --current-branch --force-sync &>> "$repo_log" - repo_sync_returncode=$? - set -eu - else - echo ">> [$(date)] Syncing branch repository disabled" | tee -a "$repo_log" - fi - - if [ $repo_sync_returncode -ne 0 ]; then - echo ">> [$(date)] repo sync failed for $codename, $branch branch" | tee -a "$DEBUG_LOG" - # call post-build.sh so the failure is logged in a way that is more visible - if [ -f /root/userscripts/post-build.sh ]; then - echo ">> [$(date)] Running post-build.sh for $codename" >> "$DEBUG_LOG" - /root/userscripts/post-build.sh "$codename" false "$branch" &>> "$DEBUG_LOG" || echo ">> [$(date)] Warning: post-build.sh failed!" + # `repo init` + if [ "$CALL_REPO_INIT" = true ]; then + echo ">> [$(date)] (Re)initializing branch repository" | tee -a "$repo_log" + if [ "$LOCAL_MIRROR" = true ]; then + ( yes||: ) | repo init -u https://github.com/LineageOS/android.git --reference "$MIRROR_DIR" -b "$branch" -g default,-darwin,-muppets,muppets_"${codename}" --git-lfs &>> "$repo_log" + else + ( yes||: ) | repo init -u https://github.com/LineageOS/android.git -b "$branch" -g default,-darwin,-muppets,muppets_"${codename}" --git-lfs &>> "$repo_log" fi - do_cleanup - continue - fi + else + echo ">> [$(date)] Calling repo init disabled" + fi - if [ "$CALL_GIT_LFS_PULL" = true ]; then - echo ">> [$(date)] Calling git lfs pull" | tee -a "$repo_log" - repo forall -v -c git lfs pull &>> "$repo_log" - else - echo ">> [$(date)] Calling git lfs pull disabled" | tee -a "$repo_log" - fi + # `repo sync` + repo_sync_returncode=0 + if [ "$CALL_REPO_SYNC" = true ]; then + set +eu + echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log" + repo sync "${jobs_arg[@]}" "${retry_fetches_arg[@]}" --current-branch --force-sync &>> "$repo_log" + repo_sync_returncode=$? + set -eu + else + echo ">> [$(date)] Syncing branch repository disabled" | tee -a "$repo_log" + fi - if [ ! -d "vendor/$vendor" ]; then - echo ">> [$(date)] Missing \"vendor/$vendor\", aborting" - exit 1 - fi + if [ $repo_sync_returncode -ne 0 ]; then + echo ">> [$(date)] repo sync failed for $codename, $branch branch" | tee -a "$DEBUG_LOG" + # call post-build.sh so the failure is logged in a way that is more visible + if [ -f /root/userscripts/post-build.sh ]; then + echo ">> [$(date)] Running post-build.sh for $codename" >> "$DEBUG_LOG" + /root/userscripts/post-build.sh "$codename" false "$branch" &>> "$DEBUG_LOG" || echo ">> [$(date)] Warning: post-build.sh failed!" + fi + do_cleanup + continue + fi + + if [ "$CALL_GIT_LFS_PULL" = true ]; then + echo ">> [$(date)] Calling git lfs pull" | tee -a "$repo_log" + repo forall -v -c git lfs pull &>> "$repo_log" + else + echo ">> [$(date)] Calling git lfs pull disabled" | tee -a "$repo_log" + fi + + if [ ! -d "vendor/$vendor" ]; then + echo ">> [$(date)] Missing \"vendor/$vendor\", aborting" + exit 1 + fi # Setup our overlays if [ "$BUILD_OVERLAY" = true ]; then