From 13c5134b1e0ac045eb877c0f68ab2d7f1ee903db Mon Sep 17 00:00:00 2001 From: olf Date: Fri, 13 Jan 2023 14:59:18 +0100 Subject: [PATCH] Update / Overhaul CI configuration (#330) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update / Overhaul CI configuration * Create ci_sfos3.4.0-i486.yml * Update and rename ci-sfos3.4.0.yml to ci_sfos3.4.0-armv7hl.yml * Create ci_sfos4.0.1-aarch64.yml * Create ci_sfos4.4.0-aarch64-armv7hl-i486.yml * Update ci_sfos4.0.1-aarch64.yml * Update ci_sfos4.0.1-aarch64.yml * Update ci_sfos3.4.0-armv7hl.yml * Introduce caching of SDK images * Introduce caching of SDK images * Introduce caching of SDK images * Introduce caching of SDK images * Fix * Raise timeout for builds triggered by a git tag * Raise timeout for builds triggered by a git tag * Raise timeout for builds triggered by a git tag * Indent * Use "latest" * Missed "latest" * indent * Indent * Indent * Insert two "-" in comments * Address more "unappllies" * Set base image to ubuntu-22.04 … because ubuntu-latest is a moving target and the GitHub-action scripts are versioned any way, hence manual version updates are inevitable. * Set base image to ubuntu-22.04 … because ubuntu-latest is a moving target and the GitHub-action scripts are versioned any way, hence manual version updates are inevitable. * More elaborate comments * Set base image to ubuntu-22.04 … because ubuntu-latest is a moving target and the GitHub-action scripts are versioned any way, hence manual version updates are inevitable. * Set base image to ubuntu-22.04 … because ubuntu-latest is a moving target and the GitHub-action scripts are versioned any way, hence manual version updates are inevitable. * Set base image to ubuntu-22.04 … because ubuntu-latest is a moving target and the GitHub-action scripts are versioned any way, hence manual version updates are inevitable. * Omit (ab)use of bash arrays * Shorten comment * Omit (ab)use of bash arrays * Omit (ab)use of bash arrays * Omit (ab)use of bash arrays * Drop last `|| true`, because the scriptlets … (`%pre*`, `%post*`, %trigger*` and `%file*`) are not run with `set -e` (in contrast to main sections `%prep`, `%build` and `%install`), but they shall not return an exit code ≠ 0 (i.e., must not indicate a failure of then whole scriptlet; hence they all conclude with an explicit `exit 0`), otherwise the ongoing RPM transaction might fail and the RPM database may become corrupted (presumably not if the `%pre` scriptlet fails, because the transaction has not started yet, then). --- ...> ci_sfos.latest-aarch64-armv7hl-i486.yml} | 47 ++++++++------ .github/workflows/ci_sfos3.4.0-armv7hl.yml | 62 +++++++++++++++++++ .github/workflows/ci_sfos3.4.0-i486.yml | 58 +++++++++++++++++ .github/workflows/ci_sfos4.0.1-aarch64.yml | 58 +++++++++++++++++ rpm/patchmanager.spec | 6 +- src/tools/pm_apply | 2 +- 6 files changed, 210 insertions(+), 23 deletions(-) rename .github/workflows/{build.yml => ci_sfos.latest-aarch64-armv7hl-i486.yml} (59%) create mode 100644 .github/workflows/ci_sfos3.4.0-armv7hl.yml create mode 100644 .github/workflows/ci_sfos3.4.0-i486.yml create mode 100644 .github/workflows/ci_sfos4.0.1-aarch64.yml diff --git a/.github/workflows/build.yml b/.github/workflows/ci_sfos.latest-aarch64-armv7hl-i486.yml similarity index 59% rename from .github/workflows/build.yml rename to .github/workflows/ci_sfos.latest-aarch64-armv7hl-i486.yml index 5e7d4249c..02c357466 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/ci_sfos.latest-aarch64-armv7hl-i486.yml @@ -1,44 +1,54 @@ -name: Github CI build +name: CI on SFOS-latest (aarch64,armv7hl,i486) on: push: tags: - '*' - pull_request: - branches: - - master - - patchmanager3 env: - RELEASE: 4.0.1.45 + RELEASE: latest jobs: build: - runs-on: ubuntu-latest - + runs-on: ubuntu-22.04 + env: + SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3 steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v3 - name: Prepare run: mkdir output - - name: Build armv7hl + # Caching Docker images is not ready yet, see + # https://github.com/storeman-developers/harbour-storeman-installer/blob/devel/cache-docker-images_github-ci.md + #- name: Cache Docker images of the Sailfish-SDK + # id: cache-sdk + # uses: actions/cache@v3 + # with: + # path: $GITHUB_WORKSPACE/… + # key: cache + + - name: Build aarch64 + # mb2 wants bash: https://github.com/sailfishos/sdk-setup/blob/master/sdk-setup/src/mb2#L1 run: docker run --rm --privileged -v $PWD:/share coderus/sailfishos-platform-sdk:$RELEASE /bin/bash -c " mkdir -p build ; cd build ; cp -r /share/* . ; - mb2 -t SailfishOS-$RELEASE-armv7hl build --enable-debug ; + mb2 -t SailfishOS-$RELEASE-aarch64 build --enable-debug ; sudo cp -r RPMS/*.rpm /share/output" - - name: Build aarch64 + - name: Build armv7hl + # mb2 wants bash: https://github.com/sailfishos/sdk-setup/blob/master/sdk-setup/src/mb2#L1 run: docker run --rm --privileged -v $PWD:/share coderus/sailfishos-platform-sdk:$RELEASE /bin/bash -c " mkdir -p build ; cd build ; cp -r /share/* . ; - mb2 -t SailfishOS-$RELEASE-aarch64 build --enable-debug ; + mb2 -t SailfishOS-$RELEASE-armv7hl build --enable-debug ; sudo cp -r RPMS/*.rpm /share/output" - name: Build i486 + # mb2 wants bash: https://github.com/sailfishos/sdk-setup/blob/master/sdk-setup/src/mb2#L1 run: docker run --rm --privileged -v $PWD:/share coderus/sailfishos-platform-sdk:$RELEASE /bin/bash -c " mkdir -p build ; cd build ; @@ -47,21 +57,20 @@ jobs: sudo cp -r RPMS/*.rpm /share/output" - name: Upload build result - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: output-rpms - path: output + path: output/ - name: Create release if: contains(github.ref, 'release') run: | set -x - assets=() + assets="" for asset in output/*.rpm; do - assets+=("-a" "$asset") + assets="$assets -a $asset" done tag_name="${GITHUB_REF##*/}" - hub release create "${assets[@]}" -m "$tag_name" "$tag_name" + hub release create"$assets" -m "$tag_name" "$tag_name" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - diff --git a/.github/workflows/ci_sfos3.4.0-armv7hl.yml b/.github/workflows/ci_sfos3.4.0-armv7hl.yml new file mode 100644 index 000000000..3020faf7a --- /dev/null +++ b/.github/workflows/ci_sfos3.4.0-armv7hl.yml @@ -0,0 +1,62 @@ +name: CI on SFOS 3.4.0 (armv7hl) + +on: + push: + tags: + - '*' + pull_request: + branches: + - master + - patchmanager3 + +env: + RELEASE: 3.4.0.24 + +jobs: + build: + runs-on: ubuntu-22.04 + env: + SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Prepare + run: mkdir output + + # Caching Docker images is not ready yet, see + # https://github.com/storeman-developers/harbour-storeman-installer/blob/devel/cache-docker-images_github-ci.md + #- name: Cache Docker images of the Sailfish-SDK + # id: cache-sdk + # uses: actions/cache@v3 + # with: + # path: $GITHUB_WORKSPACE/… + # key: cache + + - name: Build armv7hl + # mb2 wants bash: https://github.com/sailfishos/sdk-setup/blob/master/sdk-setup/src/mb2#L1 + run: docker run --rm --privileged -v $PWD:/share coderus/sailfishos-platform-sdk:$RELEASE /bin/bash -c " + mkdir -p build ; + cd build ; + cp -r /share/* . ; + mb2 -t SailfishOS-$RELEASE-armv7hl build --enable-debug ; + sudo cp -r RPMS/*.rpm /share/output" + + - name: Upload build result + uses: actions/upload-artifact@v3 + with: + name: output-rpms + path: output/ + + - name: Create release + if: contains(github.ref, 'release') + run: | + set -x + assets="" + for asset in output/*.rpm; do + assets="$assets -a $asset" + done + tag_name="${GITHUB_REF##*/}" + hub release create"$assets" -m "$tag_name" "$tag_name" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci_sfos3.4.0-i486.yml b/.github/workflows/ci_sfos3.4.0-i486.yml new file mode 100644 index 000000000..edd4ca94a --- /dev/null +++ b/.github/workflows/ci_sfos3.4.0-i486.yml @@ -0,0 +1,58 @@ +name: CI on SFOS 3.4.0 (i486) + +on: + push: + tags: + - '*' + +env: + RELEASE: 3.4.0.24 + +jobs: + build: + runs-on: ubuntu-22.04 + env: + SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Prepare + run: mkdir output + + # Caching Docker images is not ready yet, see + # https://github.com/storeman-developers/harbour-storeman-installer/blob/devel/cache-docker-images_github-ci.md + #- name: Cache Docker images of the Sailfish-SDK + # id: cache-sdk + # uses: actions/cache@v3 + # with: + # path: $GITHUB_WORKSPACE/… + # key: cache + + - name: Build i486 + # mb2 wants bash: https://github.com/sailfishos/sdk-setup/blob/master/sdk-setup/src/mb2#L1 + run: docker run --rm --privileged -v $PWD:/share coderus/sailfishos-platform-sdk:$RELEASE /bin/bash -c " + mkdir -p build ; + cd build ; + cp -r /share/* . ; + mb2 -t SailfishOS-$RELEASE-i486 build --enable-debug ; + sudo cp -r RPMS/*.rpm /share/output" + + - name: Upload build result + uses: actions/upload-artifact@v3 + with: + name: output-rpms + path: output/ + + - name: Create release + if: contains(github.ref, 'release') + run: | + set -x + assets="" + for asset in output/*.rpm; do + assets="$assets -a $asset" + done + tag_name="${GITHUB_REF##*/}" + hub release create"$assets" -m "$tag_name" "$tag_name" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci_sfos4.0.1-aarch64.yml b/.github/workflows/ci_sfos4.0.1-aarch64.yml new file mode 100644 index 000000000..9225296fb --- /dev/null +++ b/.github/workflows/ci_sfos4.0.1-aarch64.yml @@ -0,0 +1,58 @@ +name: CI on SFOS 4.0.1 (aarch64) + +on: + push: + tags: + - '*' + +env: + RELEASE: 4.0.1.45 + +jobs: + build: + runs-on: ubuntu-22.04 + env: + SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Prepare + run: mkdir output + + # Caching Docker images is not ready yet, see + # https://github.com/storeman-developers/harbour-storeman-installer/blob/devel/cache-docker-images_github-ci.md + #- name: Cache Docker images of the Sailfish-SDK + # id: cache-sdk + # uses: actions/cache@v3 + # with: + # path: $GITHUB_WORKSPACE/… + # key: cache + + - name: Build aarch64 + # mb2 wants bash: https://github.com/sailfishos/sdk-setup/blob/master/sdk-setup/src/mb2#L1 + run: docker run --rm --privileged -v $PWD:/share coderus/sailfishos-platform-sdk:$RELEASE /bin/bash -c " + mkdir -p build ; + cd build ; + cp -r /share/* . ; + mb2 -t SailfishOS-$RELEASE-aarch64 build --enable-debug ; + sudo cp -r RPMS/*.rpm /share/output" + + - name: Upload build result + uses: actions/upload-artifact@v3 + with: + name: output-rpms + path: output/ + + - name: Create release + if: contains(github.ref, 'release') + run: | + set -x + assets="" + for asset in output/*.rpm; do + assets="$assets -a $asset" + done + tag_name="${GITHUB_REF##*/}" + hub release create"$assets" -m "$tag_name" "$tag_name" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/rpm/patchmanager.spec b/rpm/patchmanager.spec index 2c922b5c6..2b80c9cd4 100644 --- a/rpm/patchmanager.spec +++ b/rpm/patchmanager.spec @@ -141,13 +141,13 @@ case "$1" in ;; [2-9]) # Update echo "Updating %{name}: %%pre section" - # Unapply all patches if Patchmanager 2.x is installed + # Disable and deactivate ("unapply") all Patches if Patchmanager 2.x is installed if [ -d /var/lib/patchmanager/ausmt/patches/ ] then - /usr/sbin/patchmanager --unapply-all || true + /usr/sbin/patchmanager --unapply-all if [ -n "$(ls -A /var/lib/patchmanager/ausmt/patches/)" ] then - echo "Unapply all patches before updating %{name}!" + echo "Do disable ("unapply") all Patches: %{name} must not be updated unless all Patches are inactive!" exit 1 # An exit N with N ≠ 0 in a %%pre scriptlet might not constitute an # appropriate way to terminate an update (here: from PM2 to PM3), see e.g., # https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax diff --git a/src/tools/pm_apply b/src/tools/pm_apply index 3ad963b01..49b2ec24a 100644 --- a/src/tools/pm_apply +++ b/src/tools/pm_apply @@ -23,7 +23,7 @@ PATCH_NAME="unified_diff.patch" PATCH_PATH="$PATCH_DIR/$PATCH_NAME" PATCH_EDITED_NAME="unified_diff_${SYS_BITNESS}bit.patch" -# list of candidate paths to attempt 32/64bit library path correction +# list of candidate paths to attempt 32-/64-bit library path correction MANGLE_CANDIDATES="" if [ -z "$DISABLE_MANGLING" ] && [ -r "/etc/patchmanager/manglelist.conf" ] ; then source /etc/patchmanager/manglelist.conf