From e6f2eaf47a177a8eca054d1d70a1b6287e8c3521 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 3 Jun 2024 16:01:35 +0200 Subject: Adding upstream version 102. Signed-off-by: Daniel Baumann --- tools/release.sh | 50 +++++++++++++++++++++++++++++++++++++++----------- tools/test-github.sh | 19 +++++++------------ 2 files changed, 46 insertions(+), 23 deletions(-) (limited to 'tools') diff --git a/tools/release.sh b/tools/release.sh index b6f7826..bc3a523 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -18,39 +18,67 @@ else NEW_VERSION="$1" fi +# change current branch to release +git branch -m release + printf "#### Contributors\n\n" > CONTRIBUTORS.md cat _CONTRIBUTORS >> CONTRIBUTORS.md # Update AUTHORS make AUTHORS -# Update NEWS.md +# Update the contributors list in NEWS.md cargo install clog-cli head -2 NEWS.md > NEWS_header.md tail +2 NEWS.md > NEWS_body.md -printf "dracut-%s\n==========\n" "$NEW_VERSION" > NEWS_header_new.md +printf "dracut-ng-%s\n=============\n" "$NEW_VERSION" > NEWS_header_new.md + +# Append the list to the section in `NEWS.md` cat CONTRIBUTORS.md NEWS_body.md > NEWS_body_with_conttributors.md +# Get a template with [`clog`](https://github.com/clog-tool/clog-cli) # clog will always output both the new release and old release information together -clog -F --infile NEWS_body_with_conttributors.md -r https://github.com/dracutdevs/dracut | sed '1,2d' > NEWS_body_full.md +clog -F --infile NEWS_body_with_conttributors.md -r https://github.com/dracut-ng/dracut-ng | sed '1,2d' > NEWS_body_full.md # Use diff to separate new release information and remove repeated empty lines diff NEWS_body_with_conttributors.md NEWS_body_full.md | grep -e ^\>\ | sed s/^\>\ // | cat -s > NEWS_body_new.md cat NEWS_header.md NEWS_header_new.md NEWS_body_new.md NEWS_body_with_conttributors.md > NEWS.md -# message for https://github.com/dracutdevs/dracut/releases/tag +# message for https://github.com/dracut-ng/dracut-ng/releases/tag cat -s NEWS_body_new.md CONTRIBUTORS.md > release.md # dracut-version.sh printf "#!/bin/sh\n# shellcheck disable=SC2034\nDRACUT_VERSION=%s\n" "$NEW_VERSION" > dracut-version.sh +DRACUT_FULL_VERSION=$NEW_VERSION DRACUT_MAIN_VERSION=$NEW_VERSION make dracut.html + +if [ -z "$(git config --get user.name)" ]; then + git config user.name "dracutng[bot]" +fi + +if [ -z "$(git config --get user.email)" ]; then + git config user.email "" +fi + # Check in AUTHORS and NEWS.md -git config user.name "Dracut Release Bot" -git config user.email "<>" -git commit -m "docs: update NEWS.md and AUTHORS" NEWS.md AUTHORS dracut-version.sh -git push origin master -git tag "$NEW_VERSION" -m "$NEW_VERSION" -git push --tags +git commit -m "docs: update NEWS.md and AUTHORS" NEWS.md AUTHORS dracut-version.sh dracut.html + +# git push can fail due to insufficient permissions +if ! git push -u origin release; then + exit $? +fi + +# Tag the release, validate the tag and push +KEYS=$(gpg --list-secret-keys --keyid-format=long 2> /dev/null) + +if [ -z "$KEYS" ]; then + echo "Could not find gpg or gpg secrets, not signing the git tag." + git tag "$NEW_VERSION" -m "$NEW_VERSION" +else + git tag -s "$NEW_VERSION" -m "$NEW_VERSION" + git tag -v "$NEW_VERSION" +fi # export new version to Github Action -echo "new_version=${NEW_VERSION,,}" >> "${GITHUB_ENV}" +# release will not be generated if pushing the tag failed +git push --tags && echo "new_version=${NEW_VERSION,,}" >> "${GITHUB_ENV}" diff --git a/tools/test-github.sh b/tools/test-github.sh index 4fed092..4a8d318 100755 --- a/tools/test-github.sh +++ b/tools/test-github.sh @@ -7,21 +7,17 @@ set -ex RUN_ID="$1" TESTS=$2 -./configure +# if is cargo installed, let's build and test dracut-cpio +if command -v cargo > /dev/null; then + ./configure --enable-dracut-cpio +else + ./configure +fi NCPU=$(getconf _NPROCESSORS_ONLN) if ! [[ $TESTS ]]; then - # GitHub workflows fetch a clone of the dracut repository which doesn't - # contain git tags, thus "breaking" the RPM build in certain situations - # i.e.: - # DRACUT_MAIN_VERSION in Makefile is defined as an output of `git describe`, - # which in full git clone returns a tag with a numeric version. However, - # without tags it returns SHA of the last commit, which later propagates into - # `Provides:` attribute of the built RPM and can break dependency tree when - # installed - [[ -d .git ]] && git fetch --tags && git describe --tags - make -j "$NCPU" all syncheck rpm logtee + make -j "$NCPU" all syncheck logtee else make -j "$NCPU" enable_documentation=no all logtee @@ -34,7 +30,6 @@ else cd /lib/modules ls -1 | tail -1 )" \ - QEMU_CPU="IvyBridge-v2" \ DRACUT_NO_XATTR=1 \ TEST_RUN_ID="$RUN_ID" \ ${TESTS:+TESTS="$TESTS"} \ -- cgit v1.2.3