From b2485c343a7d4b0e68ab79100c9a49f632e6122d Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Thu, 16 Dec 2021 12:47:51 +0000 Subject: [PATCH 1/2] Revert "ci: Use bookworm image" This reverts commit d7e27bc79300778f6a509bae35b90daf0f6a9f5d. Bookworm breaks build because it ships a newer version of rustlib-regex than supported. --- .gitlab-ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ef7826bc..a14c86eb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: $CI_REGISTRY/world/phosh/phosh/debian:v0.0.20211208 +image: debian:bullseye stages: - build @@ -6,7 +6,10 @@ stages: before_script: - apt-get -y update - - apt-get -y install ca-certificates + - apt-get -y install wget ca-certificates gnupg + - echo "deb [trusted=yes] http://ci.puri.sm/ bullseyeci main" > /etc/apt/sources.list.d/ci.list + - wget -O- https://ci.puri.sm/ci-repo.key | apt-key add - + - apt-get -y update build_docs: stage: build @@ -53,7 +56,6 @@ build_deb: - cp ../*.deb . build_deb:arm64: - image: debian:bookworm tags: - aarch64 stage: build From 4a7dc799be721b5fdc4125076cb06676c3a3b334 Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Thu, 16 Dec 2021 12:49:46 +0000 Subject: [PATCH 2/2] ci: Fix formatting At the same time, reduce indentation level on lists because otherwise the formatter is broken. --- .gitlab-ci.yml | 118 ++++++++++++++++++++++++------------------------- tools/yamlfmt | 13 ++++-- 2 files changed, 69 insertions(+), 62 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a14c86eb..91f2c271 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,124 +1,124 @@ image: debian:bullseye stages: - - build - - test +- build +- test before_script: - - apt-get -y update - - apt-get -y install wget ca-certificates gnupg - - echo "deb [trusted=yes] http://ci.puri.sm/ bullseyeci main" > /etc/apt/sources.list.d/ci.list - - wget -O- https://ci.puri.sm/ci-repo.key | apt-key add - - - apt-get -y update +- apt-get -y update +- apt-get -y install wget ca-certificates gnupg +- echo "deb [trusted=yes] http://ci.puri.sm/ bullseyeci main" > /etc/apt/sources.list.d/ci.list +- wget -O- https://ci.puri.sm/ci-repo.key | apt-key add - +- apt-get -y update build_docs: stage: build artifacts: paths: - - _build + - _build script: - - apt-get -y install python3-pip python3-sphinx - - pip3 install recommonmark - - ./doc/build.sh _build + - apt-get -y install python3-pip python3-sphinx + - pip3 install recommonmark + - ./doc/build.sh _build except: variables: - - $PKG_ONLY == "1" + - $PKG_ONLY == "1" build_meson: stage: build artifacts: paths: - - _build + - _build expire_in: 3h script: - - apt-get -y build-dep . - - meson . _build/ -Ddepdatadir=/usr/share --werror - - ninja -C _build install + - apt-get -y build-dep . + - meson . _build/ -Ddepdatadir=/usr/share --werror + - ninja -C _build install except: variables: - - $PKG_ONLY == "1" + - $PKG_ONLY == "1" build_deb: stage: build artifacts: paths: - - '*.deb' + - '*.deb' script: - - rm -f ../*.deb - - apt-get -y build-dep . - - apt-get -y install devscripts - - REV=$(git log -1 --format=%h) - - VER=$(dpkg-parsechangelog -SVersion) - - DEBFULLNAME="Librem5 CI" - - EMAIL="librem5-builds@lists.community.puri.sm" - - dch -v"$VER+librem5ci$CI_PIPELINE_ID.$REV" "$MSG" - - debuild -i -us -uc -b - - cp ../*.deb . + - rm -f ../*.deb + - apt-get -y build-dep . + - apt-get -y install devscripts + - REV=$(git log -1 --format=%h) + - VER=$(dpkg-parsechangelog -SVersion) + - DEBFULLNAME="Librem5 CI" + - EMAIL="librem5-builds@lists.community.puri.sm" + - dch -v"$VER+librem5ci$CI_PIPELINE_ID.$REV" "$MSG" + - debuild -i -us -uc -b + - cp ../*.deb . build_deb:arm64: tags: - - aarch64 + - aarch64 stage: build artifacts: paths: - - '*.deb' + - '*.deb' script: - - rm -f ../*.deb - - apt-get -y build-dep . - - apt-get -y install devscripts - - REV=$(git log -1 --format=%h) - - VER=$(dpkg-parsechangelog -SVersion) - - DEBFULLNAME="Librem5 CI" - - EMAIL="librem5-builds@lists.community.puri.sm" - - dch -v"$VER+librem5ci$CI_PIPELINE_ID.$REV" "$MSG" - - debuild -i -us -uc -b - - cp ../*.deb . + - rm -f ../*.deb + - apt-get -y build-dep . + - apt-get -y install devscripts + - REV=$(git log -1 --format=%h) + - VER=$(dpkg-parsechangelog -SVersion) + - DEBFULLNAME="Librem5 CI" + - EMAIL="librem5-builds@lists.community.puri.sm" + - dch -v"$VER+librem5ci$CI_PIPELINE_ID.$REV" "$MSG" + - debuild -i -us -uc -b + - cp ../*.deb . test_lintian: stage: test needs: - - job: build_deb - artifacts: true + - job: build_deb + artifacts: true script: - - apt-get -y install lintian - - lintian *.deb + - apt-get -y install lintian + - lintian *.deb except: variables: - - $PKG_ONLY == "1" + - $PKG_ONLY == "1" test: stage: test needs: - - job: build_meson - artifacts: true + - job: build_meson + artifacts: true script: - - apt-get -y build-dep . - - apt-get -y install clang-tidy - - ninja -C _build test - - tools/style-check_build _build + - apt-get -y build-dep . + - apt-get -y install clang-tidy + - ninja -C _build test + - tools/style-check_build _build except: variables: - - $PKG_ONLY == "1" + - $PKG_ONLY == "1" test_style: stage: test needs: [] script: - - apt-get -y build-dep . - - tools/style-check_source + - apt-get -y build-dep . + - tools/style-check_source except: variables: - - $PKG_ONLY == "1" + - $PKG_ONLY == "1" check_release: stage: test needs: [] only: refs: - - master + - master script: - - apt-get -y install git python3 - - (head -n 1 ./debian/changelog && git tag) | ./debian/check_release.py + - apt-get -y install git python3 + - (head -n 1 ./debian/changelog && git tag) | ./debian/check_release.py except: variables: - - $PKG_ONLY == "1" + - $PKG_ONLY == "1" diff --git a/tools/yamlfmt b/tools/yamlfmt index 0aef3523..39c0ec1c 100755 --- a/tools/yamlfmt +++ b/tools/yamlfmt @@ -4,7 +4,8 @@ Usage: yamlfmt.py [--apply] file.yaml """ -import ruamel.yaml +import io +from ruamel.yaml import YAML import sys args = sys.argv[:] @@ -16,10 +17,16 @@ except ValueError: path = args[1] +def dump(yaml, yml): + buf = io.BytesIO() + yaml.dump(yml, buf) + return buf.getvalue().decode('utf-8') + with open(path) as f: contents = f.read() - yml = ruamel.yaml.round_trip_load(contents) - formatted = ruamel.yaml.round_trip_dump(yml, block_seq_indent=2) + yaml = YAML() + yml = yaml.load(contents) + formatted = dump(yaml, yml) well_formatted = formatted == contents if not well_formatted: