summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2022-09-02 14:27:45 -0600
committerMartin L Roth <gaumless@gmail.com>2022-11-23 03:48:10 +0000
commitd05ea79e40c4a7c6e19a3804ad14eaa4ece38402 (patch)
tree4a6c86f987909b0cbbdac482e78fc8dcfb287d57 /util
parentc87ab01c2d2e70c64d88d3afd4d49a0687b05b3c (diff)
downloadcoreboot-d05ea79e40c4a7c6e19a3804ad14eaa4ece38402.tar.gz
coreboot-d05ea79e40c4a7c6e19a3804ad14eaa4ece38402.tar.bz2
coreboot-d05ea79e40c4a7c6e19a3804ad14eaa4ece38402.zip
util/release/build-release: Fix style issues
No real functional changes, just cleaning up shellcheck issues, putting braces around variables, add comments and the like. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I6e79afc8d725e86ddbf7f4eb4685bed190c20738 Reviewed-on: https://review.coreboot.org/c/coreboot/+/67319 Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util')
-rwxr-xr-xutil/release/build-release50
1 files changed, 28 insertions, 22 deletions
diff --git a/util/release/build-release b/util/release/build-release
index f609bf194e40..ab0231ed43c5 100755
--- a/util/release/build-release
+++ b/util/release/build-release
@@ -12,7 +12,8 @@ GPG_KEY_ID=$4
set -e
if [ -z "$GPG_TTY" ]; then
- export GPG_TTY=$(tty)
+ GPG_TTY=$(tty)
+ export GPG_TTY
fi
# set local + tz to be reproducible
@@ -21,7 +22,7 @@ LANG=C
TZ=UTC0
export LC_ALL LANG TZ
-if [ -z "$VERSION_NAME" ] || [ "$VERSION_NAME" = "--help" ] || [ -z "$COMMIT_ID" ]; then
+if [ -z "${VERSION_NAME}" ] || [ "${VERSION_NAME}" = "--help" ] || [ -z "${COMMIT_ID}" ]; then
echo "usage: $0 <version> <commit id> [username] [gpg key id]"
echo "Tags a new coreboot version and creates a tar archive"
echo
@@ -39,7 +40,9 @@ if ! tar --sort=name -cf /dev/null /dev/null 2>/dev/null ; then
exit 1
fi
-if [ ! -d "coreboot-${VERSION_NAME}" ]; then
+# Clone new copy of repo if needed
+if [ ! -d "coreboot-${VERSION_NAME}/.git" ]; then
+ rm -rf "coreboot-${VERSION_NAME}"
declare -a GIT_REF_OPTS
if [ -d .git ]; then
GIT_REF_OPTS=("--reference" "." "--dissociate")
@@ -53,29 +56,31 @@ if [ ! -d "coreboot-${VERSION_NAME}" ]; then
fi
fi
-cd "coreboot-${VERSION_NAME}" || exit 1
-if [ -n "$COMMIT_ID" ]; then
- git reset --hard "$COMMIT_ID"
-fi
+# 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.
+(
+ cd "coreboot-${VERSION_NAME}" || exit 1
+ if [ -n "${COMMIT_ID}" ]; then
+ git reset --hard "${COMMIT_ID}"
+ fi
-util/crossgcc/buildgcc -W > .crossgcc-version
+ util/crossgcc/buildgcc -W > .crossgcc-version
-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
+ 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
+)
-printf "%s-%s\n" "$VERSION_NAME" "$(git log --pretty=%h -1)" > .coreboot-version
-tstamp=$(git log --pretty=format:%ci -1)
-cd ..
+tstamp=$(tr "-" " " < "coreboot-${VERSION_NAME}/.coreboot-version")
-exclude_paths="3rdparty/blobs "
-exclude_paths+="3rdparty/fsp "
-exclude_paths+="3rdparty/intel-microcode "
-exclude_paths+="3rdparty/amd_blobs "
-exclude_paths+="3rdparty/qc_blobs "
+# Create the two tarballs, source and blobs.
+exclude_paths="3rdparty/blobs 3rdparty/fsp 3rdparty/intel-microcode 3rdparty/amd_blobs 3rdparty/qc_blobs"
declare -a blobs_paths
declare -a exclude_opts
@@ -87,6 +92,7 @@ done
tar --sort=name --mtime="${tstamp}" --owner=coreboot:1000 --group=coreboot:1000 --exclude=*/.git --exclude=*/.gitignore "${exclude_opts[@]}" -cvf - "coreboot-${VERSION_NAME}" |xz -9 > "coreboot-${VERSION_NAME}.tar.xz"
tar --sort=name --mtime="${tstamp}" --owner=coreboot:1000 --group=coreboot:1000 --exclude=*/.git --exclude=*/.gitignore -cvf - "${blobs_paths[@]}" |xz -9 > "coreboot-blobs-${VERSION_NAME}.tar.xz"
+# Sign the tarballs
if [ -n "${GPG_KEY_ID}" ]; then
gpg --armor --local-user "$GPG_KEY_ID" --output "coreboot-${VERSION_NAME}.tar.xz.sig" --detach-sig "coreboot-${VERSION_NAME}.tar.xz"
gpg --armor --local-user "$GPG_KEY_ID" --output "coreboot-blobs-${VERSION_NAME}.tar.xz.sig" --detach-sig "coreboot-blobs-${VERSION_NAME}.tar.xz"