2018-10-07 03:58:27 +02:00
|
|
|
#!/usr/bin/env bash
|
2020-05-10 17:34:15 +02:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
2016-09-08 22:35:48 +02:00
|
|
|
# ${VERSION_NAME}: new version name
|
2023-01-11 04:17:22 +01:00
|
|
|
# ${COMMIT_ID}: commit id for new version
|
2017-04-04 23:05:24 +02:00
|
|
|
# ${USERNAME}: username (if not default to https)
|
|
|
|
# ${GPG_KEY_ID}: gpg key id (if not don't sign)
|
2016-10-05 00:45:17 +02:00
|
|
|
VERSION_NAME=$1
|
|
|
|
COMMIT_ID=$2
|
|
|
|
USERNAME=$3
|
|
|
|
GPG_KEY_ID=$4
|
2016-09-08 22:35:48 +02:00
|
|
|
|
2015-07-13 22:48:46 +02:00
|
|
|
set -e
|
2016-09-09 00:05:54 +02:00
|
|
|
|
2023-01-11 04:17:22 +01:00
|
|
|
TIME_FILE="$(mktemp -d)/.coreboot-time"
|
|
|
|
COREBOOT_RELEASE_NAME=coreboot-${VERSION_NAME}
|
|
|
|
COREBOOT_TARBALL="${COREBOOT_RELEASE_NAME}.tar.xz"
|
|
|
|
COREBOOT_BLOBS_TARBALL="coreboot-blobs-${VERSION_NAME}.tar.xz"
|
|
|
|
|
2019-11-19 17:09:30 +01:00
|
|
|
if [ -z "$GPG_TTY" ]; then
|
2022-09-02 22:27:45 +02:00
|
|
|
GPG_TTY=$(tty)
|
|
|
|
export GPG_TTY
|
2019-11-19 17:09:30 +01:00
|
|
|
fi
|
|
|
|
|
2016-09-09 00:05:54 +02:00
|
|
|
# set local + tz to be reproducible
|
|
|
|
LC_ALL=C
|
|
|
|
LANG=C
|
2017-09-27 15:06:57 +02:00
|
|
|
TZ=UTC0
|
2016-09-09 00:05:54 +02:00
|
|
|
export LC_ALL LANG TZ
|
|
|
|
|
2022-09-02 22:27:45 +02:00
|
|
|
if [ -z "${VERSION_NAME}" ] || [ "${VERSION_NAME}" = "--help" ] || [ -z "${COMMIT_ID}" ]; then
|
2017-04-04 23:05:24 +02:00
|
|
|
echo "usage: $0 <version> <commit id> [username] [gpg key id]"
|
2016-10-05 00:45:17 +02:00
|
|
|
echo "Tags a new coreboot version and creates a tar archive"
|
|
|
|
echo
|
|
|
|
echo "version: New version name to tag the tree with"
|
|
|
|
echo "commit id: check out this commit-id after cloning the coreboot tree"
|
|
|
|
echo "username: clone the tree using ssh://USERNAME - defaults to https://"
|
2017-04-04 23:05:24 +02:00
|
|
|
echo "gpg key id: used to tag the version, and generate a gpg signature"
|
2015-07-13 22:48:46 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
2016-10-05 00:45:17 +02:00
|
|
|
|
|
|
|
# Verify that tar supports --sort
|
|
|
|
if ! tar --sort=name -cf /dev/null /dev/null 2>/dev/null ; then
|
|
|
|
echo "Error: The installed version of tar does not support --sort"
|
|
|
|
echo " GNU tar version 1.28 or greater is required. Exiting."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-09-02 22:27:45 +02:00
|
|
|
# Clone new copy of repo if needed
|
2023-01-11 04:17:22 +01:00
|
|
|
if [ ! -d "${COREBOOT_RELEASE_NAME}/.git" ]; then
|
|
|
|
rm -rf "${COREBOOT_RELEASE_NAME}"
|
2022-09-02 22:23:25 +02:00
|
|
|
declare -a GIT_REF_OPTS
|
2019-11-19 17:11:04 +01:00
|
|
|
if [ -d .git ]; then
|
2022-09-02 22:23:25 +02:00
|
|
|
GIT_REF_OPTS=("--reference" "." "--dissociate")
|
2019-11-19 17:11:04 +01:00
|
|
|
elif [ -d ../../.git ]; then
|
2022-09-02 22:23:25 +02:00
|
|
|
GIT_REF_OPTS=("--reference" "../.." "--dissociate")
|
2019-11-19 17:11:04 +01:00
|
|
|
fi
|
2017-04-04 23:05:24 +02:00
|
|
|
if [ -n "${USERNAME}" ]; then
|
2023-01-11 04:17:22 +01:00
|
|
|
git clone "${GIT_REF_OPTS[@]}" "ssh://${USERNAME}@review.coreboot.org:29418/coreboot.git" "${COREBOOT_RELEASE_NAME}" --
|
2017-04-04 23:05:24 +02:00
|
|
|
else
|
2023-01-11 04:17:22 +01:00
|
|
|
git clone "${GIT_REF_OPTS[@]}" https://review.coreboot.org/coreboot.git "${COREBOOT_RELEASE_NAME}" --
|
2017-04-04 23:05:24 +02:00
|
|
|
fi
|
2016-09-08 22:35:48 +02:00
|
|
|
fi
|
2016-10-05 00:45:17 +02:00
|
|
|
|
2022-09-02 22:27:45 +02:00
|
|
|
# Handle everything that needs to be done from inside the new coreboot
|
|
|
|
# directory. Use requested version, update submodules, and get ready to
|
|
|
|
# run from outside a git repository, and create a signed tag to push.
|
|
|
|
(
|
2023-01-11 04:17:22 +01:00
|
|
|
cd "${COREBOOT_RELEASE_NAME}" || exit 1
|
|
|
|
git reset --hard "${COMMIT_ID}"
|
2016-10-05 00:45:17 +02:00
|
|
|
|
2022-09-02 22:27:45 +02:00
|
|
|
util/crossgcc/buildgcc -W > .crossgcc-version
|
2021-10-17 16:07:07 +02:00
|
|
|
|
2022-09-02 22:27:45 +02:00
|
|
|
git submodule update --init --checkout
|
|
|
|
if [ -n "${GPG_KEY_ID}" ]; then
|
|
|
|
git tag -a -s -u "$GPG_KEY_ID" --force "${VERSION_NAME}" -m "coreboot version ${VERSION_NAME}" --
|
|
|
|
else
|
|
|
|
git tag -a --force "${VERSION_NAME}" -m "coreboot version ${VERSION_NAME}" --
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf "%s-%s\n" "$VERSION_NAME" "$(git log --pretty=%h -1)" > .coreboot-version
|
2023-01-11 04:17:22 +01:00
|
|
|
printf "%s\n" "$(git log --pretty=format:%ci -1)" > "${TIME_FILE}"
|
2022-09-02 22:27:45 +02:00
|
|
|
)
|
2023-01-11 04:17:22 +01:00
|
|
|
tstamp=$(cat "${TIME_FILE}" | sed 's/ +0000//')
|
2016-10-05 00:45:17 +02:00
|
|
|
|
2022-09-02 22:27:45 +02:00
|
|
|
# Create the two tarballs, source and blobs.
|
|
|
|
exclude_paths="3rdparty/blobs 3rdparty/fsp 3rdparty/intel-microcode 3rdparty/amd_blobs 3rdparty/qc_blobs"
|
2022-06-03 03:56:23 +02:00
|
|
|
|
2022-09-02 22:23:25 +02:00
|
|
|
declare -a blobs_paths
|
|
|
|
declare -a exclude_opts
|
2019-11-19 17:12:05 +01:00
|
|
|
for i in ${exclude_paths}; do
|
2023-01-11 04:17:22 +01:00
|
|
|
blobs_paths+=("${COREBOOT_RELEASE_NAME}/${i}")
|
|
|
|
exclude_opts+=("--exclude=${COREBOOT_RELEASE_NAME}/${i}")
|
2019-11-19 17:12:05 +01:00
|
|
|
done
|
|
|
|
|
2023-01-11 04:17:22 +01:00
|
|
|
tar --sort=name --mtime="${tstamp}" --owner=coreboot:1000 --group=coreboot:1000 --exclude=*/.git --exclude=*/.gitignore --exclude=*/.gitreview --exclude=*/.mailmap --exclude=*/.gitmodules "${exclude_opts[@]}" -cvf - "${COREBOOT_RELEASE_NAME}" |xz -9 > "${COREBOOT_TARBALL}"
|
|
|
|
tar --sort=name --mtime="${tstamp}" --owner=coreboot:1000 --group=coreboot:1000 --exclude=*/.git --exclude=*/.gitignore --exclude=*/.gitreview --exclude=*/.mailmap --exclude=*/.gitmodules -cvf - "${blobs_paths[@]}" |xz -9 > "${COREBOOT_BLOBS_TARBALL}"
|
2016-10-05 00:45:17 +02:00
|
|
|
|
2022-09-02 22:27:45 +02:00
|
|
|
# Sign the tarballs
|
2016-09-08 22:35:48 +02:00
|
|
|
if [ -n "${GPG_KEY_ID}" ]; then
|
2023-01-11 04:17:22 +01:00
|
|
|
gpg --armor --local-user "$GPG_KEY_ID" --output "${COREBOOT_TARBALL}.sig" --detach-sig "${COREBOOT_TARBALL}"
|
|
|
|
gpg --armor --local-user "$GPG_KEY_ID" --output "${COREBOOT_BLOBS_TARBALL}.sig" --detach-sig "${COREBOOT_BLOBS_TARBALL}"
|
2016-09-08 22:35:48 +02:00
|
|
|
fi
|
2023-01-11 04:17:22 +01:00
|
|
|
|
|
|
|
# Clean up
|
|
|
|
rm -f "${TIME_FILE}"
|