2 # SPDX-License-Identifier: GPL-2.0-only
3 # ${VERSION_NAME}: new version name
4 # ${COMMIT_ID}: commit id (if not master)
5 # ${USERNAME}: username (if not default to https)
6 # ${GPG_KEY_ID}: gpg key id (if not don't sign)
14 if [ -z "$GPG_TTY" ]; then
18 # set local + tz to be reproducible
24 if [ -z "$VERSION_NAME" ] ||
[ "$VERSION_NAME" = "--help" ] ||
[ -z "$COMMIT_ID" ]; then
25 echo "usage: $0 <version> <commit id> [username] [gpg key id]"
26 echo "Tags a new coreboot version and creates a tar archive"
28 echo "version: New version name to tag the tree with"
29 echo "commit id: check out this commit-id after cloning the coreboot tree"
30 echo "username: clone the tree using ssh://USERNAME - defaults to https://"
31 echo "gpg key id: used to tag the version, and generate a gpg signature"
35 # Verify that tar supports --sort
36 if ! tar --sort=name
-cf /dev
/null
/dev
/null
2>/dev
/null
; then
37 echo "Error: The installed version of tar does not support --sort"
38 echo " GNU tar version 1.28 or greater is required. Exiting."
42 if [ ! -d "coreboot-${VERSION_NAME}" ]; then
44 GIT_REF_OPTS
="--reference . --dissociate"
45 elif [ -d ..
/..
/.git
]; then
46 GIT_REF_OPTS
="--reference ../.. --dissociate"
48 if [ -n "${USERNAME}" ]; then
49 git clone
${GIT_REF_OPTS} "ssh://${USERNAME}@review.coreboot.org:29418/coreboot.git" "coreboot-${VERSION_NAME}"
51 git clone ${GIT_REF_OPTS} https://review.coreboot.org/coreboot.git "coreboot-
${VERSION_NAME}"
55 cd "coreboot-
${VERSION_NAME}" || exit 1
56 if [ -n "$COMMIT_ID" ]; then
57 git reset --hard "$COMMIT_ID"
60 util/crossgcc/buildgcc -W > .crossgcc-version
62 git submodule update --init --checkout
63 if [ -n "$GPG_KEY_ID" ]; then
64 git tag -a -s -u "$GPG_KEY_ID" --force "$VERSION_NAME" -m "coreboot version
$VERSION_NAME"
66 git tag -a --force "$VERSION_NAME" -m "coreboot version
$VERSION_NAME"
69 printf "%s-
%s
\n" "$VERSION_NAME" "$
(git log
--pretty=%h|
head -1)" > .coreboot-version
70 tstamp=$(git log --pretty=format:%ci -1)
73 exclude_paths="3rdparty
/blobs
"
74 exclude_paths+="3rdparty
/fsp
"
75 exclude_paths+="3rdparty
/intel-microcode
"
76 exclude_paths+="3rdparty
/amd_blobs
"
77 exclude_paths+="3rdparty
/qc_blobs
"
79 for i in ${exclude_paths}; do
80 blobs_paths+="coreboot-
${VERSION_NAME}/${i} "
81 exclude_opts+="--exclude=coreboot-
${VERSION_NAME}/${i} "
84 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"
85 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"
87 if [ -n "${GPG_KEY_ID}" ]; then
88 gpg
--armor --local-user "$GPG_KEY_ID" --output "coreboot-${VERSION_NAME}.tar.xz.sig" --detach-sig "coreboot-${VERSION_NAME}.tar.xz"
89 gpg
--armor --local-user "$GPG_KEY_ID" --output "coreboot-blobs-${VERSION_NAME}.tar.xz.sig" --detach-sig "coreboot-blobs-${VERSION_NAME}.tar.xz"