From b09f79ec8a09d23e8974db3b7867891e28dfae2e Mon Sep 17 00:00:00 2001 From: Alexandre Roux Date: Thu, 6 Jul 2023 11:38:28 +0000 Subject: [PATCH 1/2] fix lineage recognition regex --- build-community.sh | 35 +++++++++++------------ src/build.sh | 69 +++++++++++++++++++++------------------------- 2 files changed, 48 insertions(+), 56 deletions(-) diff --git a/build-community.sh b/build-community.sh index 5616c79..6d2f738 100755 --- a/build-community.sh +++ b/build-community.sh @@ -83,41 +83,38 @@ for branch in ${BRANCH_NAME//,/ }; do if [ -n "$branch" ] && [ -n "$devices" ]; then vendor=lineage - case "$branch" in - v*-nougat*) - vendor="cm" + regex_part1="^v[0-9](\.[0-9]*){0,2}(-(beta|alpha|rc)(\.[0-9]*){0,1}){0,1}-(" + regex_part2=")(-[a-zA-Z0-9_]*)*$" + echo $regex_part1"r"$regex_part2 + + if [[ "${BRANCH_NAME}" =~ $regex_part1"nougat"$regex_part2 ]]; then + vendor="cm" themuppets_branch="cm-14.1" android_version="7.1.2" - ;; - v*-oreo*) + use_openjdk_from_ubuntu=true + elif [[ "${BRANCH_NAME}" =~ $regex_part1"oreo"$regex_part2 ]]; then themuppets_branch="lineage-15.1" android_version="8.1" - ;; - v*-pie*) + use_openjdk_from_ubuntu=true + elif [[ "${BRANCH_NAME}" =~ $regex_part1"pie"$regex_part2 ]]; then themuppets_branch="lineage-16.0" android_version="9" - ;; - v*-q*) + elif [[ "${BRANCH_NAME}" =~ $regex_part1"q"$regex_part2 ]]; then themuppets_branch="lineage-17.1" android_version="10" - ;; - v*-r*) + elif [[ "${BRANCH_NAME}" =~ $regex_part1"r"$regex_part2 ]]; then themuppets_branch="lineage-18.1" android_version="11" - ;; - v*-s*) + elif [[ "${BRANCH_NAME}" =~ $regex_part1"s"$regex_part2 ]]; then themuppets_branch="lineage-19.1" android_version="12" - ;; - v*-t*) + elif [[ "${BRANCH_NAME}" =~ $regex_part1"t"$regex_part2 ]]; then themuppets_branch="lineage-20.0" android_version="13" - ;; - *) + else echo ">> [$(date)] Building branch $branch is not (yet) suppported" exit 1 - ;; - esac + fi android_version_major=$(cut -d '.' -f 1 <<< $android_version) diff --git a/src/build.sh b/src/build.sh index 92cd053..518e31b 100755 --- a/src/build.sh +++ b/src/build.sh @@ -38,44 +38,39 @@ branch_dir=$(sed -E 's/^v[0-9](\.[0-9]*){0,2}(-(beta|alpha|rc)(\.[0-9]*){0,1}){0 branch_dir=${branch_dir^^} if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then - vendor=lineage - case "$BRANCH_NAME" in - v*-nougat*) + vendor=lineage + regex_part1="^v[0-9](\.[0-9]*){0,2}(-(beta|alpha|rc)(\.[0-9]*){0,1}){0,1}-(" + regex_part2=")(-[a-zA-Z0-9_]*)*$" + echo $regex_part1"r"$regex_part2 + + if [[ "${BRANCH_NAME}" =~ $regex_part1"nougat"$regex_part2 ]]; then vendor="cm" - themuppets_branch="cm-14.1" - android_version="7.1.2" - use_openjdk_from_ubuntu=true - ;; - v*-oreo*) - themuppets_branch="lineage-15.1" - android_version="8.1" - use_openjdk_from_ubuntu=true - ;; - v*-pie*) - themuppets_branch="lineage-16.0" - android_version="9" - ;; - v*-q*) - themuppets_branch="lineage-17.1" - android_version="10" - ;; - v*-r*) - themuppets_branch="lineage-18.1" - android_version="11" - ;; - v*-s*) - themuppets_branch="lineage-19.1" - android_version="12" - ;; - v*-t*) - themuppets_branch="lineage-20.0" - android_version="13" - ;; - *) - echo ">> [$(date)] Building branch $branch is not (yet) suppported" - exit 1 - ;; - esac + themuppets_branch="cm-14.1" + android_version="7.1.2" + use_openjdk_from_ubuntu=true + elif [[ "${BRANCH_NAME}" =~ $regex_part1"oreo"$regex_part2 ]]; then + themuppets_branch="lineage-15.1" + android_version="8.1" + use_openjdk_from_ubuntu=true + elif [[ "${BRANCH_NAME}" =~ $regex_part1"pie"$regex_part2 ]]; then + themuppets_branch="lineage-16.0" + android_version="9" + elif [[ "${BRANCH_NAME}" =~ $regex_part1"q"$regex_part2 ]]; then + themuppets_branch="lineage-17.1" + android_version="10" + elif [[ "${BRANCH_NAME}" =~ $regex_part1"r"$regex_part2 ]]; then + themuppets_branch="lineage-18.1" + android_version="11" + elif [[ "${BRANCH_NAME}" =~ $regex_part1"s"$regex_part2 ]]; then + themuppets_branch="lineage-19.1" + android_version="12" + elif [[ "${BRANCH_NAME}" =~ $regex_part1"t"$regex_part2 ]]; then + themuppets_branch="lineage-20.0" + android_version="13" + else + echo ">> [$(date)] Building branch $branch is not (yet) suppported" + exit 1 + fi android_version_major=$(cut -d '.' -f 1 <<< $android_version) -- GitLab From 83da295584b1bcdff598407ed9fdc1b0ea15f678 Mon Sep 17 00:00:00 2001 From: Alexandre Roux Date: Thu, 6 Jul 2023 11:42:38 +0000 Subject: [PATCH 2/2] don't echo the regex --- build-community.sh | 1 - src/build.sh | 1 - 2 files changed, 2 deletions(-) diff --git a/build-community.sh b/build-community.sh index 6d2f738..1895b1c 100755 --- a/build-community.sh +++ b/build-community.sh @@ -85,7 +85,6 @@ for branch in ${BRANCH_NAME//,/ }; do vendor=lineage regex_part1="^v[0-9](\.[0-9]*){0,2}(-(beta|alpha|rc)(\.[0-9]*){0,1}){0,1}-(" regex_part2=")(-[a-zA-Z0-9_]*)*$" - echo $regex_part1"r"$regex_part2 if [[ "${BRANCH_NAME}" =~ $regex_part1"nougat"$regex_part2 ]]; then vendor="cm" diff --git a/src/build.sh b/src/build.sh index 518e31b..7bb96bd 100755 --- a/src/build.sh +++ b/src/build.sh @@ -41,7 +41,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then vendor=lineage regex_part1="^v[0-9](\.[0-9]*){0,2}(-(beta|alpha|rc)(\.[0-9]*){0,1}){0,1}-(" regex_part2=")(-[a-zA-Z0-9_]*)*$" - echo $regex_part1"r"$regex_part2 if [[ "${BRANCH_NAME}" =~ $regex_part1"nougat"$regex_part2 ]]; then vendor="cm" -- GitLab