Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7fbec968 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

build: Format build script

parent 66bcdaa7
Loading
Loading
Loading
Loading
+48 −52
Original line number Original line Diff line number Diff line
@@ -117,7 +117,6 @@ for branch in ${BRANCH_NAME//,/ }; do


    android_version_major=$(cut -d '.' -f 1 <<<$android_version)
    android_version_major=$(cut -d '.' -f 1 <<<$android_version)



    mkdir -p "$SRC_DIR/$branch_dir"
    mkdir -p "$SRC_DIR/$branch_dir"
    cd "$SRC_DIR/$branch_dir"
    cd "$SRC_DIR/$branch_dir"


@@ -139,8 +138,7 @@ for branch in ${BRANCH_NAME//,/ }; do
      yes | repo init -u "$REPO" --reference "$MIRROR_DIR" -b "$branch" &>>"$repo_log"
      yes | repo init -u "$REPO" --reference "$MIRROR_DIR" -b "$branch" &>>"$repo_log"
    else
    else
      TAG_PREFIX=""
      TAG_PREFIX=""
      if curl -s https://gitlab.e.foundation/api/v4/projects/659/repository/tags?search=${BRANCH_NAME} | jq -r ".[].name" | grep -q "${BRANCH_NAME}"
      if curl -s https://gitlab.e.foundation/api/v4/projects/659/repository/tags?search=${BRANCH_NAME} | jq -r ".[].name" | grep -q "${BRANCH_NAME}"; then
      then
        echo ">> [$(date)] Branch name $branch is a tag on e/os/releases, prefix with refs/tags/ for 'repo init'"
        echo ">> [$(date)] Branch name $branch is a tag on e/os/releases, prefix with refs/tags/ for 'repo init'"
        TAG_PREFIX="refs/tags/"
        TAG_PREFIX="refs/tags/"
      fi
      fi
@@ -301,7 +299,6 @@ for branch in ${BRANCH_NAME//,/ }; do
        echo ">> [$(date)] Switch to Python2"
        echo ">> [$(date)] Switch to Python2"
        ln -fs /usr/bin/python2 /usr/bin/python
        ln -fs /usr/bin/python2 /usr/bin/python



        BRUNCH_DEVICE=${codename}
        BRUNCH_DEVICE=${codename}


        if [ "${ENG_BUILD}" = true ]; then
        if [ "${ENG_BUILD}" = true ]; then
@@ -381,7 +378,6 @@ for branch in ${BRANCH_NAME//,/ }; do
  fi
  fi
done
done



if [ "$DELETE_OLD_LOGS" -gt "0" ]; then
if [ "$DELETE_OLD_LOGS" -gt "0" ]; then
  find "$LOGS_DIR" -maxdepth 1 -name repo-*.log | sort | head -n -$DELETE_OLD_LOGS | xargs -r rm
  find "$LOGS_DIR" -maxdepth 1 -name repo-*.log | sort | head -n -$DELETE_OLD_LOGS | xargs -r rm
fi
fi
+138 −142
Original line number Original line Diff line number Diff line
@@ -95,8 +95,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then
  echo ">> [$(date)] (Re)initializing branch repository"
  echo ">> [$(date)] (Re)initializing branch repository"


  TAG_PREFIX=""
  TAG_PREFIX=""
  if curl -s https://gitlab.e.foundation/api/v4/projects/659/repository/tags?search=${BRANCH_NAME} | jq -r ".[].name" | grep -q ${BRANCH_NAME}
  if curl -s https://gitlab.e.foundation/api/v4/projects/659/repository/tags?search=${BRANCH_NAME} | jq -r ".[].name" | grep -q ${BRANCH_NAME}; then
  then
    echo ">> [$(date)] Branch name ${BRANCH_NAME} is a tag on e/os/releases, prefix with refs/tags/ for 'repo init'"
    echo ">> [$(date)] Branch name ${BRANCH_NAME} is a tag on e/os/releases, prefix with refs/tags/ for 'repo init'"
    TAG_PREFIX="refs/tags/"
    TAG_PREFIX="refs/tags/"
  fi
  fi
@@ -136,10 +135,10 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then
  if [ "$repo_status" != "0" ]; then
  if [ "$repo_status" != "0" ]; then
    if [ -f /root/userscripts/clean.sh ]; then
    if [ -f /root/userscripts/clean.sh ]; then
      if [[ "$repo_out" == *"Failing repos:"* ]]; then
      if [[ "$repo_out" == *"Failing repos:"* ]]; then
        list_line=`echo -e $repo_out | sed 's/.*Failing repos: //'`
        list_line=$(echo -e $repo_out | sed 's/.*Failing repos: //')
      fi
      fi
      if [[ "$repo_out" == *"Cannot remove project"* ]]; then
      if [[ "$repo_out" == *"Cannot remove project"* ]]; then
        list_line=`echo -e $repo_out | grep "Cannot remove project" | sed -e 's/.*error: \(.*\): Cannot.*/\1/'`
        list_line=$(echo -e $repo_out | grep "Cannot remove project" | sed -e 's/.*error: \(.*\): Cannot.*/\1/')
      fi
      fi
      echo ">> [$(date)] Running clean.sh"
      echo ">> [$(date)] Running clean.sh"
      /root/userscripts/clean.sh $list_line
      /root/userscripts/clean.sh $list_line
@@ -155,7 +154,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then
    repo forall -c 'git lfs pull'
    repo forall -c 'git lfs pull'
  fi
  fi



  if [ ! -d "vendor/$vendor" ]; then
  if [ ! -d "vendor/$vendor" ]; then
    echo ">> [$(date)] Missing \"vendor/$vendor\", aborting"
    echo ">> [$(date)] Missing \"vendor/$vendor\", aborting"
    exit 1
    exit 1
@@ -198,7 +196,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then
      echo ">> [$(date)] Syncing branch repository"
      echo ">> [$(date)] Syncing branch repository"
      cd "$SRC_DIR/$branch_dir" || return 1
      cd "$SRC_DIR/$branch_dir" || return 1



      if ! repo sync -c -j$(nproc --all) --force-sync; then
      if ! repo sync -c -j$(nproc --all) --force-sync; then
        sync_successful=false
        sync_successful=false
        build_device=false
        build_device=false
@@ -224,7 +221,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then
    if [ -f /root/userscripts/pre-build.sh ]; then
    if [ -f /root/userscripts/pre-build.sh ]; then
      echo ">> [$(date)] Running pre-build.sh for ${DEVICE}"
      echo ">> [$(date)] Running pre-build.sh for ${DEVICE}"



      if ! /root/userscripts/pre-build.sh "${DEVICE}"; then
      if ! /root/userscripts/pre-build.sh "${DEVICE}"; then
        build_device=false
        build_device=false
      fi
      fi
@@ -414,7 +410,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then


      #with only systemimage, we don't have a e-*.zip
      #with only systemimage, we don't have a e-*.zip
      if [ "${BUILD_ONLY_SYSTEMIMAGE}" = true ]; then
      if [ "${BUILD_ONLY_SYSTEMIMAGE}" = true ]; then
        build=e-`grep lineage.version system/build.prop | sed s/#.*// | sed s/.*=// | tr -d \\n`.zip
        build=e-$(grep lineage.version system/build.prop | sed s/#.*// | sed s/.*=// | tr -d \n).zip
        if [ "$BACKUP_INTERMEDIATE_SYSTEM_IMG" = true ]; then
        if [ "$BACKUP_INTERMEDIATE_SYSTEM_IMG" = true ]; then
          mv obj/PACKAGING/target_files_intermediates/lineage*/IMAGES/system.img ./
          mv obj/PACKAGING/target_files_intermediates/lineage*/IMAGES/system.img ./
          zip "$ZIP_DIR/$zipsubdir/IMG-$build" system.img
          zip "$ZIP_DIR/$zipsubdir/IMG-$build" system.img
@@ -426,7 +422,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then
      fi
      fi


      if [ "$IS_EMULATOR" = true -a "$BACKUP_EMULATOR" = true ]; then
      if [ "$IS_EMULATOR" = true -a "$BACKUP_EMULATOR" = true ]; then
        EMULATOR_ARCHIVE="IMG-e-`grep lineage.version system/build.prop | sed s/#.*// | sed s/.*=// | tr -d '\n'`.zip"
        EMULATOR_ARCHIVE="IMG-e-$(grep lineage.version system/build.prop | sed s/#.*// | sed s/.*=// | tr -d '\n').zip"
        mv ../../../host/linux-x86/sdk_addon/*-img.zip "$ZIP_DIR/$zipsubdir/$EMULATOR_ARCHIVE"
        mv ../../../host/linux-x86/sdk_addon/*-img.zip "$ZIP_DIR/$zipsubdir/$EMULATOR_ARCHIVE"
        pushd "$ZIP_DIR/$zipsubdir"
        pushd "$ZIP_DIR/$zipsubdir"
        sha256sum "$EMULATOR_ARCHIVE" >"$EMULATOR_ARCHIVE.sha256sum"
        sha256sum "$EMULATOR_ARCHIVE" >"$EMULATOR_ARCHIVE.sha256sum"