From a138eb6a0dca26a457e8ed1428960cacdb31b1a4 Mon Sep 17 00:00:00 2001 From: nyyu Date: Sat, 20 May 2023 08:06:57 +0200 Subject: [PATCH] fix: gen changelog only after successful build --- .woodpecker/.build-lte.yml | 32 +++++++++++----------- .woodpecker/.build-wifi.yml | 30 ++++++++++----------- .woodpecker/.changelog.yml | 26 ++++++++++++++++++ .woodpecker/.copy.yml | 43 +++++++++++++++-------------- .woodpecker/.final.yml | 26 ------------------ .woodpecker/.publish.yml | 26 +++++++++--------- .woodpecker/.sync.yml | 32 +++++++++++----------- changelog.sh | 41 ++++++++++++++++++++++++++++ fix-bt-1.patch | 54 ------------------------------------- fix-bt-2.patch | 40 --------------------------- fix-bt-3.patch | 33 ----------------------- sync.sh | 45 ++----------------------------- 12 files changed, 148 insertions(+), 280 deletions(-) create mode 100644 .woodpecker/.changelog.yml delete mode 100644 .woodpecker/.final.yml create mode 100644 changelog.sh delete mode 100644 fix-bt-1.patch delete mode 100644 fix-bt-2.patch delete mode 100644 fix-bt-3.patch diff --git a/.woodpecker/.build-lte.yml b/.woodpecker/.build-lte.yml index df82353..66ab102 100644 --- a/.woodpecker/.build-lte.yml +++ b/.woodpecker/.build-lte.yml @@ -1,13 +1,11 @@ variables: - - &build_vol '/media/fast/lineage/lineage-20.0:/build' - - &tools_vol '/media/fast/lineage/tools:/tools' - - &http_vol '/srv/http/drone:/http' - - &pub_vol '/mnt/android/lineage:/publish' +- &build_vol '/media/fast/lineage/lineage-20.0:/build' +- &tools_vol '/media/fast/lineage/tools:/tools' matrix: include: - - device: mondrianlte - version: 20.0 + - device: mondrianlte + version: 20.0 skip_clone: true @@ -16,20 +14,20 @@ pipeline: pull: true image: docker.nyyu.dev/lineage/android environment: - - BUILD_HOSTNAME=docker + - BUILD_HOSTNAME=docker commands: - - export HOME=/build - - cd /build - - find /build/out/target/product/$device -type f -name '*.prop' -exec rm -vf {} + || true - - bash -c ". build/envsetup.sh && lunch lineage_$device-userdebug && (mka bacon -j6 || (cat out/build_error && exit 1))" + - export HOME=/build + - cd /build + - find /build/out/target/product/$device -type f -name '*.prop' -exec rm -vf {} + || true + - bash -c ". build/envsetup.sh && lunch lineage_$device-userdebug && (mka bacon -j6 || (cat out/build_error && exit 1))" volumes: - - *build_vol - - *tools_vol + - *build_vol + - *tools_vol when: event: - - manual - - cron + - manual + - cron depends_on: - - sync - - build-wifi +- sync +- build-wifi diff --git a/.woodpecker/.build-wifi.yml b/.woodpecker/.build-wifi.yml index 05167a2..e575945 100644 --- a/.woodpecker/.build-wifi.yml +++ b/.woodpecker/.build-wifi.yml @@ -1,13 +1,11 @@ variables: - - &build_vol '/media/fast/lineage/lineage-20.0:/build' - - &tools_vol '/media/fast/lineage/tools:/tools' - - &http_vol '/srv/http/drone:/http' - - &pub_vol '/mnt/android/lineage:/publish' +- &build_vol '/media/fast/lineage/lineage-20.0:/build' +- &tools_vol '/media/fast/lineage/tools:/tools' matrix: include: - - device: mondrianwifi - version: 20.0 + - device: mondrianwifi + version: 20.0 skip_clone: true @@ -16,19 +14,19 @@ pipeline: pull: true image: docker.nyyu.dev/lineage/android environment: - - BUILD_HOSTNAME=docker + - BUILD_HOSTNAME=docker commands: - - export HOME=/build - - cd /build - - find /build/out/target/product/$device -type f -name '*.prop' -exec rm -vf {} + || true - - bash -c ". build/envsetup.sh && lunch lineage_$device-userdebug && (mka bacon -j6 || (cat out/build_error && exit 1))" + - export HOME=/build + - cd /build + - find /build/out/target/product/$device -type f -name '*.prop' -exec rm -vf {} + || true + - bash -c ". build/envsetup.sh && lunch lineage_$device-userdebug && (mka bacon -j6 || (cat out/build_error && exit 1))" volumes: - - *build_vol - - *tools_vol + - *build_vol + - *tools_vol when: event: - - manual - - cron + - manual + - cron depends_on: - - sync +- sync diff --git a/.woodpecker/.changelog.yml b/.woodpecker/.changelog.yml new file mode 100644 index 0000000..4b190af --- /dev/null +++ b/.woodpecker/.changelog.yml @@ -0,0 +1,26 @@ +variables: +- &build_vol '/media/fast/lineage/lineage-20.0:/build' + +matrix: + include: + - device: mondrian + version: 20.0 + +skip_clone: true + +pipeline: + sync: + image: docker.nyyu.dev/lineage/android + commands: + - cd /build + - bash $CI_WORKSPACE/changelog.sh + volumes: + - *build_vol + when: + event: + - manual + - cron + +depends_on: +- build-wifi +- build-lte diff --git a/.woodpecker/.copy.yml b/.woodpecker/.copy.yml index c9ee490..56d186e 100644 --- a/.woodpecker/.copy.yml +++ b/.woodpecker/.copy.yml @@ -1,13 +1,13 @@ variables: - - &build_vol '/media/fast/lineage/lineage-20.0:/build' - - &http_vol '/srv/http/drone:/http' +- &build_vol '/media/fast/lineage/lineage-20.0:/build' +- &http_vol '/srv/http/drone:/http' matrix: include: - - device: mondrianwifi - version: 20.0 - - device: mondrianlte - version: 20.0 + - device: mondrianwifi + version: 20.0 + - device: mondrianlte + version: 20.0 skip_clone: true @@ -16,31 +16,30 @@ pipeline: pull: true image: alpine commands: - - rm -f /http/lineage-$version-*-UNOFFICIAL-$device.zip* - - mv -f /build/out/target/product/$device/lineage-$version-*-UNOFFICIAL-$device.zip* /http/ - - cat /build/changelog-mondrian-$version.md >> /http/changelog-$device-$version.md - - ls -lh /http/lineage-$version-*-UNOFFICIAL-$device.zip* + - rm -f /http/lineage-$version-*-UNOFFICIAL-$device.zip* + - mv -f /build/out/target/product/$device/lineage-$version-*-UNOFFICIAL-$device.zip* /http/ + - cat /build/changelog-mondrian-$version.md >> /http/changelog-$device-$version.md + - ls -lh /http/lineage-$version-*-UNOFFICIAL-$device.zip* volumes: - - *build_vol - - *http_vol + - *build_vol + - *http_vol when: event: - - manual - - cron + - manual + - cron clean: pull: true image: alpine commands: - - rm -f /build/out/target/product/$device/lineage-$version-*-UNOFFICIAL-$device.zip_* /build/out/target/product/$device/lineage_$device-ota-eng.*.zip - - rm -rf /build/out/target/product/$device/obj/PACKAGING/target_files_intermediates/* - - rm -f /build/changelog-$device-$version.md + - rm -f /build/out/target/product/$device/lineage-$version-*-UNOFFICIAL-$device.zip_* /build/out/target/product/$device/lineage_$device-ota-eng.*.zip + - rm -rf /build/out/target/product/$device/obj/PACKAGING/target_files_intermediates/* + - rm -f /build/changelog-$device-$version.md volumes: - - *build_vol + - *build_vol when: event: - - manual - - cron + - manual + - cron depends_on: - - build-wifi - - build-lte \ No newline at end of file +- changelog diff --git a/.woodpecker/.final.yml b/.woodpecker/.final.yml deleted file mode 100644 index 5a294b5..0000000 --- a/.woodpecker/.final.yml +++ /dev/null @@ -1,26 +0,0 @@ -variables: - - &build_vol '/media/fast/lineage/lineage-20.0:/build' - -matrix: - include: - - device: mondrian - version: 20.0 - -skip_clone: true - -pipeline: - final: - pull: true - image: alpine - commands: - - cd /build - - mv -f gitstate-$device-$version.tmp.txt gitstate-$device-$version.txt - - rm -f changelog-$device-$version.md - volumes: - - *build_vol - when: - event: - - deployment - -depends_on: - - publish diff --git a/.woodpecker/.publish.yml b/.woodpecker/.publish.yml index 3d0b8ce..c3f7a8b 100644 --- a/.woodpecker/.publish.yml +++ b/.woodpecker/.publish.yml @@ -1,13 +1,13 @@ variables: - - &http_vol '/srv/http/drone:/http' - - &pub_vol '/mnt/android/lineage:/publish' +- &http_vol '/srv/http/drone:/http' +- &pub_vol '/mnt/android/lineage:/publish' matrix: include: - - device: mondrianwifi - version: 20.0 - - device: mondrianlte - version: 20.0 + - device: mondrianwifi + version: 20.0 + - device: mondrianlte + version: 20.0 skip_clone: true @@ -16,13 +16,13 @@ pipeline: pull: true image: alpine commands: - - mv /http/lineage-$version-*-UNOFFICIAL-$device.zip* /publish/$version/$device/ - - cat /http/changelog-$device-$version.md >> /publish/$version/$device/changelog.md - - rm -f /http/changelog-$device-$version.md - - ls -lh /publish/$version/$device/ + - mv /http/lineage-$version-*-UNOFFICIAL-$device.zip* /publish/$version/$device/ + - cat /http/changelog-$device-$version.md >> /publish/$version/$device/changelog.md + - rm -f /http/changelog-$device-$version.md + - ls -lh /publish/$version/$device/ volumes: - - *http_vol - - *pub_vol + - *http_vol + - *pub_vol when: event: - - deployment \ No newline at end of file + - deployment diff --git a/.woodpecker/.sync.yml b/.woodpecker/.sync.yml index 14c9b9a..30ecaa4 100644 --- a/.woodpecker/.sync.yml +++ b/.woodpecker/.sync.yml @@ -1,31 +1,31 @@ variables: - - &build_vol '/media/fast/lineage/lineage-20.0:/build' +- &build_vol '/media/fast/lineage/lineage-20.0:/build' matrix: include: - - device: mondrian - version: 20.0 + - device: mondrian + version: 20.0 pipeline: sync: pull: true image: docker.nyyu.dev/lineage/android commands: - - HOME=/home/drone - - git config --global user.email 'drone@nyyu.dev' - - git config --global user.name 'drone' - - cd /build - - rm -rf .repo/repo - - repo init -u https://github.com/LineageOS-UL/android.git -b lineage-$version -g default,-darwin --git-lfs - - mkdir -p .repo/local_manifests - - cp $CI_WORKSPACE/$device.xml .repo/local_manifests/roomservice.xml - - repo forall -c 'git reset --hard --quiet' || true - - bash $CI_WORKSPACE/sync.sh + - HOME=/home/drone + - git config --global user.email 'drone@nyyu.dev' + - git config --global user.name 'drone' + - cd /build + - rm -rf .repo/repo + - repo init -u https://github.com/LineageOS-UL/android.git -b lineage-$version -g default,-darwin --git-lfs + - mkdir -p .repo/local_manifests + - cp $CI_WORKSPACE/$device.xml .repo/local_manifests/roomservice.xml + - repo forall -c 'git reset --hard --quiet' || true + - bash $CI_WORKSPACE/sync.sh environment: version: '20.0' volumes: - - *build_vol + - *build_vol when: event: - - manual - - cron + - manual + - cron diff --git a/changelog.sh b/changelog.sh new file mode 100644 index 0000000..ca44685 --- /dev/null +++ b/changelog.sh @@ -0,0 +1,41 @@ +#!/bin/bash -e +# shellcheck disable=SC2154,SC2207,SC2016,SC2086,SC2250,SC2312,SC2162 + +TOPDIR=$(pwd) + +changelog=${TOPDIR}/changelog-${device}-${version}.md + +declare -A before +if [[ -f gitstate-${device}-${version}.txt ]] +then + read -a tmp < gitstate-${device}-${version}.txt +else + tmp=($(repo forall -c 'echo "${REPO_PATH}:$(git rev-parse --short HEAD)"')) +fi +for i in "${tmp[@]}"; do + IFS=: read -r folder commit <<<"${i}" + before[${folder}]=${commit} +done + +echo -e "# Build $(date '+%Y-%m-%d %H:%M:%S %Z')\n" >>"${changelog}" + +tmp=($(repo forall -c 'echo "${REPO_PATH}:$(git rev-parse --short HEAD)"')) + +for i in "${tmp[@]}"; do + IFS=: read -r folder commit <<<"${i}" + if [[ "${folder}" != lineage/* && "${before[${folder}]}" != "${commit}" ]]; then + cd "${folder}" || continue + log=$(git --no-pager log --pretty=format:"- %s" "${before[${folder}]}".."${commit}") + if [[ $(echo -n "$log" | wc -c) != 0 ]]; then + { + echo "## ${folder} ${before[${folder}]}..${commit}" + echo "$log" + echo + } >>"${changelog}" + fi + cd "${TOPDIR}" || continue + fi +done +cat "${changelog}" + +echo "${tmp[@]}" > gitstate-${device}-${version}.txt \ No newline at end of file diff --git a/fix-bt-1.patch b/fix-bt-1.patch deleted file mode 100644 index db3a39e..0000000 --- a/fix-bt-1.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 56c318bf3cc9208c772c7e6d01e88380d2155c67 Mon Sep 17 00:00:00 2001 -From: "tzu-hsien.huang" -Date: Fri, 26 Aug 2022 11:22:03 +0200 -Subject: [PATCH] Additionally check le_set_event_mask command resturn status - with UNSUPPORTED_LMP_OR_LL_PARAMETER -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -In GD BT stack, stack will check each return status of HCI Commands. E.g. reset , le_set_event_mask, set_event_mask …etc. -In BT spec 5.2, SIG add some parameters for le_set_event_mask for le audio, like LE Terminate BIG Complete event: Supported. -However, some legacy chips do not support LE Audio feature, and controller will return Status: Unsupported LMP Parameter Value when it receives this HCI Command -When it checks the return value and find the status is not SUCCESS, it will cause FAIL and cannot be compatible with old legacy chip. -After brushing GSI, Bluetooth will turn off automatically when it is turned on. -So all CTS test will always fail. - -Check le_set_event_mask command return status with SUCCESS or UNSUPPORTED_LMP_OR_LL_PARAMETER - -Bug: 239662211 -Test: CtsBluetoothTestCases -Change-Id: I2b0cede7f47eecd2124a386e958773289eb6f11c ---- - system/gd/hci/controller.cc | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/system/gd/hci/controller.cc b/system/gd/hci/controller.cc -index da5986fcb7..8be21a20a3 100644 ---- a/system/gd/hci/controller.cc -+++ b/system/gd/hci/controller.cc -@@ -540,7 +540,7 @@ struct Controller::impl { - void le_set_event_mask(uint64_t le_event_mask) { - std::unique_ptr packet = LeSetEventMaskBuilder::Create(le_event_mask); - hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn( -- this, &Controller::impl::check_status)); -+ this, &Controller::impl::check_event_mask_status)); - } - - template -@@ -551,6 +551,15 @@ struct Controller::impl { - ASSERT(status_view.GetStatus() == ErrorCode::SUCCESS); - } - -+ template -+ void check_event_mask_status(CommandCompleteView view) { -+ ASSERT(view.IsValid()); -+ auto status_view = T::Create(view); -+ ASSERT(status_view.IsValid()); -+ ASSERT(status_view.GetStatus() == ErrorCode::SUCCESS || -+ status_view.GetStatus() == ErrorCode::UNSUPPORTED_LMP_OR_LL_PARAMETER); -+ } -+ - #define OP_CODE_MAPPING(name) \ - case OpCode::name: { \ - uint16_t index = (uint16_t)OpCodeIndex::name; \ diff --git a/fix-bt-2.patch b/fix-bt-2.patch deleted file mode 100644 index 1988806..0000000 --- a/fix-bt-2.patch +++ /dev/null @@ -1,40 +0,0 @@ -From bf9a555f96cceb9ce49344e5055c2afa479df21d Mon Sep 17 00:00:00 2001 -From: Peter Cai -Date: Fri, 26 Aug 2022 11:23:30 +0200 -Subject: [PATCH] gd: hci: Ignore unexpected status events - -For some reason, on some old devices, the controller will report a -remote to support SNIFF_SUBRATING even when it does not. Just ignore the -error here (the status event comes from the failure response). - -Change-Id: Ifb9a65fd77f21d15a8dc1ced9240194d38218ef6 ---- - system/gd/hci/hci_layer.cc | 15 +++++++-------- - 1 file changed, 7 insertions(+), 8 deletions(-) - -diff --git a/system/gd/hci/hci_layer.cc b/system/gd/hci/hci_layer.cc -index 57d7e55fff..b5a9d065be 100644 ---- a/system/gd/hci/hci_layer.cc -+++ b/system/gd/hci/hci_layer.cc -@@ -195,14 +195,13 @@ struct HciLayer::impl { - EventView::Create(PacketView(std::make_shared>(std::vector())))); - command_queue_.front().GetCallback()->Invoke(move(command_complete_view)); - } else { -- ASSERT_LOG( -- command_queue_.front().waiting_for_status_ == is_status, -- "0x%02hx (%s) was not expecting %s event", -- op_code, -- OpCodeText(op_code).c_str(), -- logging_id.c_str()); -- -- command_queue_.front().GetCallback()->Invoke(move(response_view)); -+ if (command_queue_.front().waiting_for_status_ == is_status) { -+ command_queue_.front().GetCallback()->Invoke(move(response_view)); -+ } else { -+ CommandCompleteView command_complete_view = CommandCompleteView::Create( -+ EventView::Create(PacketView(std::make_shared>(std::vector())))); -+ command_queue_.front().GetCallback()->Invoke(move(command_complete_view)); -+ } - } - - command_queue_.pop_front(); diff --git a/fix-bt-3.patch b/fix-bt-3.patch deleted file mode 100644 index bd8de4d..0000000 --- a/fix-bt-3.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 6c794ea2b4247a3359453cb178cfd0f8e2d38f56 Mon Sep 17 00:00:00 2001 -From: Sugakesshaa <83747297+bheatleyyy@users.noreply.github.com> -Date: Fri, 9 Sep 2022 03:35:26 +0800 -Subject: [PATCH] Nuke condition check for controller - ---- - system/gd/hci/controller.cc | 13 +++---------- - 1 file changed, 3 insertions(+), 10 deletions(-) - -diff --git a/system/gd/hci/controller.cc b/system/gd/hci/controller.cc -index 8be21a20a3..dbece21c6e 100644 ---- a/system/gd/hci/controller.cc -+++ b/system/gd/hci/controller.cc -@@ -66,16 +66,9 @@ struct Controller::impl { - - hci_->EnqueueCommand(ReadBufferSizeBuilder::Create(), - handler->BindOnceOn(this, &Controller::impl::read_buffer_size_complete_handler)); -- -- if (is_supported(OpCode::LE_READ_BUFFER_SIZE_V2)) { -- hci_->EnqueueCommand( -- LeReadBufferSizeV2Builder::Create(), -- handler->BindOnceOn(this, &Controller::impl::le_read_buffer_size_v2_handler)); -- } else { -- hci_->EnqueueCommand( -- LeReadBufferSizeV1Builder::Create(), -- handler->BindOnceOn(this, &Controller::impl::le_read_buffer_size_handler)); -- } -+ -+ hci_->EnqueueCommand(LeReadBufferSizeV1Builder::Create(), -+ handler->BindOnceOn(this, &Controller::impl::le_read_buffer_size_handler)); - - hci_->EnqueueCommand( - LeReadFilterAcceptListSizeBuilder::Create(), diff --git a/sync.sh b/sync.sh index 67d07fc..f2e5612 100644 --- a/sync.sh +++ b/sync.sh @@ -1,56 +1,18 @@ #!/bin/bash -e -# shellcheck disable=SC2250,SC2154,SC2086,SC1091,SC2312 - -if [[ -z "$CI_WORKSPACE" ]]; then - CI_WORKSPACE=$DRONE_WORKSPACE_BASE -fi +# shellcheck disable=SC2250,SC2154,SC2086,SC2207,SC2016 TOPDIR=$(pwd) -changelog=${TOPDIR}/changelog-mondrian-${version}.md - -declare -A before -if [[ -f gitstate-mondrian-${version}.txt ]] -then - read -a tmp < gitstate-mondrian-${version}.txt -else - tmp=($(repo forall -c 'echo "${REPO_PATH}:$(git rev-parse --short HEAD)"')) -fi -for i in "${tmp[@]}"; do - IFS=: read -r folder commit <<<"${i}" - before[${folder}]=${commit} -done repo sync -q -c -j 6 --fail-fast --force-sync --no-tags || repo sync -q -c -j 6 --fail-fast --force-sync --no-tags || exit 1 -echo -e "# Build $(date '+%Y-%m-%d %H:%M:%S %Z')\n" >>"${changelog}" - -tmp=($(repo forall -c 'echo "${REPO_PATH}:$(git rev-parse --short HEAD)"')) -echo "${tmp[@]}" > gitstate-mondrian-${version}.tmp.txt -for i in "${tmp[@]}"; do - IFS=: read -r folder commit <<<"${i}" - if [[ "${folder}" != lineage/* && "${before[${folder}]}" != "${commit}" ]]; then - cd "${folder}" || continue - log=$(git --no-pager log --pretty=format:"- %s" "${before[${folder}]}".."${commit}") - if [[ $(echo -n "$log" | wc -c) != 0 ]]; then - { - echo "## ${folder} ${before[${folder}]}..${commit}" - echo "$log" - echo - } >>"${changelog}" - fi - cd "${TOPDIR}" || continue - fi -done -cat "${changelog}" - cd build/tools git am $CI_WORKSPACE/fix-store-build-prop-zip.patch || git am --abort cd $TOPDIR - cd packages/apps/LineageParts git am $CI_WORKSPACE/fix-always-enable-taskbar-toggle.patch || git am --abort cd $TOPDIR + cd packages/apps/Trebuchet git am $CI_WORKSPACE/fix-enable-more-grids-for-tablet.patch || git am --abort git am $CI_WORKSPACE/fix-trebuchet-taskbar.patch || git am --abort @@ -58,9 +20,6 @@ cd $TOPDIR #bluetooth cd packages/modules/Bluetooth -#git am $CI_WORKSPACE/fix-bt-1.patch || git am --abort -#git am $CI_WORKSPACE/fix-bt-2.patch || git am --abort -#git am $CI_WORKSPACE/fix-bt-3.patch || git am --abort git am $CI_WORKSPACE/fix-bt-le.patch || git am --abort cd $TOPDIR