diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2df31140f75cecdb8753559a235a50a5a5e4cb5d..df2bc7cecc58fd4f8eb236c09a2cc0199bb46adb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,8 +29,6 @@ build_prod: build_community: extends: .build_image - before_script: - - "mv build-community.sh src/build.sh" variables: IMAGE_TAG: $CI_COMMIT_REF_NAME-community IMAGE_TAG_RELEASE: community diff --git a/Dockerfile b/Dockerfile index eed5b20e199e14a5780ace8ff169ea3a8a330194..10b203c4b6f688c490bf0f87abbd6ab02b64969e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -143,7 +143,7 @@ RUN apt-get -qq update RUN apt-get -qqy upgrade RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt clang cron \ - curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick kmod \ + curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick jq kmod \ lib32ncurses5-dev libncurses5 lib32readline-dev lib32z1-dev libtinfo5 liblz4-tool \ libncurses5-dev libsdl1.2-dev libssl-dev libxml2 \ libxml2-utils lsof lzop maven pngcrush \ diff --git a/Dockerfile.community b/Dockerfile.community index 1444d9c075ed352089ebbbf79abce4b4aa5046c3..20f0563f64c157a42ede31bba85212d5ee2ac409 100644 --- a/Dockerfile.community +++ b/Dockerfile.community @@ -134,6 +134,7 @@ VOLUME /root/.ssh # Copy required files ##################### COPY src/ /root/ +COPY build-community.sh /root/build.sh # Create missing directories ############################ @@ -153,7 +154,7 @@ RUN apt-get -qq update RUN apt-get -qqy upgrade RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt clang cron \ - curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick kmod \ + curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick jq kmod \ lib32ncurses5-dev libncurses5 lib32readline-dev lib32z1-dev libtinfo5 liblz4-tool \ libncurses5-dev libsdl1.2-dev libssl-dev libxml2 \ libxml2-utils lsof lzop maven pngcrush \ diff --git a/build-community.sh b/build-community.sh index a6b156e74508b81ee0a218ecca2ec766fea577f9..91fa86741f95f6834d81e95867d859ac93f73f41 100755 --- a/build-community.sh +++ b/build-community.sh @@ -123,7 +123,7 @@ for branch in ${BRANCH_NAME//,/ }; do if [ -d "$path" ]; then cd "$path" git reset -q --hard - git clean -q -fd + git clean -q -dffx cd "$SRC_DIR/$branch_dir" fi done @@ -133,10 +133,9 @@ for branch in ${BRANCH_NAME//,/ }; do yes | repo init -u "$REPO" --reference "$MIRROR_DIR" -b "$branch" &>> "$repo_log" else TAG_PREFIX="" - curl https://gitlab.e.foundation/api/v4/projects/659/repository/tags | grep "\"name\":\"$branch\"" - if [ $? == 0 ] + if curl -s https://gitlab.e.foundation/api/v4/projects/659/repository/tags | jq -r ".[].name" | grep -q "${BRANCH_NAME}" then - echo "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/" fi @@ -290,8 +289,8 @@ for branch in ${BRANCH_NAME//,/ }; do # Start the build echo ">> [$(date)] Starting build for $codename, $branch branch" | tee -a "$DEBUG_LOG" build_successful=false - echo "ANDROID_JACK_VM_ARGS=${ANDROID_JACK_VM_ARGS}" - echo "Switch to Python2" + echo ">> [$(date)] ANDROID_JACK_VM_ARGS=${ANDROID_JACK_VM_ARGS}" + echo ">> [$(date)] Switch to Python2" ln -fs /usr/bin/python2 /usr/bin/python @@ -367,7 +366,7 @@ for branch in ${BRANCH_NAME//,/ }; do fi fi - echo "Switch back to Python3" + echo ">> [$(date)] Switch back to Python3" ln -fs /usr/bin/python3 /usr/bin/python fi done diff --git a/src/build.sh b/src/build.sh index e494fafa01145224011f37236f91d0ed8e647b64..4c61f09bc79a61f61fa6f2bd6d8a415f1fcaf401 100755 --- a/src/build.sh +++ b/src/build.sh @@ -87,9 +87,9 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then echo ">> [$(date)] (Re)initializing branch repository" TAG_PREFIX="" - if curl https://gitlab.e.foundation/api/v4/projects/659/repository/tags | grep "\"name\":\"${BRANCH_NAME}\"" + if curl -s https://gitlab.e.foundation/api/v4/projects/659/repository/tags | jq -r ".[].name" | grep -q ${BRANCH_NAME} then - echo "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/" fi yes | repo init -u "$REPO" -b "${TAG_PREFIX}${BRANCH_NAME}" @@ -196,8 +196,8 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then # Start the build echo ">> [$(date)] Starting build for ${DEVICE}, ${BRANCH_NAME} branch" build_successful=false - echo "ANDROID_JACK_VM_ARGS=${ANDROID_JACK_VM_ARGS}" - echo "Switch to Python2" + echo ">> [$(date)] ANDROID_JACK_VM_ARGS=${ANDROID_JACK_VM_ARGS}" + echo ">> [$(date)] Switch to Python2" ln -fs /usr/bin/python2 /usr/bin/python BRUNCH_DEVICE=${DEVICE} @@ -300,7 +300,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then fi - echo "Switch back to Python3" + echo ">> [$(date)] Switch back to Python3" ln -fs /usr/bin/python3 /usr/bin/python fi