2015-07-13 22:48:46 +02:00
|
|
|
#!/bin/bash
|
2016-09-08 22:35:48 +02:00
|
|
|
# ${VERSION_NAME}: new version name
|
|
|
|
# ${GPG_KEY_ID}: gpg key id (if not don't sign)
|
|
|
|
# ${USERNAME}: username (if not default to https)
|
|
|
|
# ${COMMIT_ID}: commit id (if not master)
|
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
|
|
|
|
|
|
|
# set local + tz to be reproducible
|
|
|
|
LC_ALL=C
|
|
|
|
LANG=C
|
|
|
|
TZ=UTC
|
|
|
|
export LC_ALL LANG TZ
|
|
|
|
|
2016-10-05 00:45:17 +02:00
|
|
|
if [ -z "$VERSION_NAME" ] || [ "$VERSION_NAME" = "--help" ]; then
|
2016-09-08 22:35:48 +02:00
|
|
|
echo "usage: $0 <version> [commit id] [gpg key id] [username]"
|
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 "gpg key id: used to tag the version, and generate a gpg signature"
|
|
|
|
echo "username: clone the tree using ssh://USERNAME - defaults to https://"
|
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
|
|
|
|
|
2016-09-08 22:35:48 +02:00
|
|
|
if [ -n "${USERNAME}" ]; then
|
2016-10-05 00:45:17 +02:00
|
|
|
git clone "ssh://${USERNAME}@review.coreboot.org:29418/coreboot.git" "coreboot-${VERSION_NAME}"
|
2016-09-08 22:35:48 +02:00
|
|
|
else
|
2016-10-05 00:45:17 +02:00
|
|
|
git clone https://review.coreboot.org/coreboot.git "coreboot-${VERSION_NAME}"
|
2016-09-08 22:35:48 +02:00
|
|
|
fi
|
2016-10-05 00:45:17 +02:00
|
|
|
|
|
|
|
cd "coreboot-${VERSION_NAME}" || exit 1
|
|
|
|
if [ -n "$COMMIT_ID" ]; then
|
|
|
|
git reset --hard "$COMMIT_ID"
|
2016-01-29 23:02:56 +01:00
|
|
|
fi
|
2016-10-05 00:45:17 +02:00
|
|
|
|
2015-07-13 22:48:46 +02:00
|
|
|
git submodule update --init --checkout
|
2016-10-05 00:45:17 +02:00
|
|
|
if [ -n "$GPG_KEY_ID" ]; then
|
|
|
|
git tag -a -s -u "$GPG_KEY_ID" --force "$VERSION_NAME" -m "coreboot version $VERSION_NAME"
|
2016-09-08 22:35:48 +02:00
|
|
|
else
|
2016-10-05 00:45:17 +02:00
|
|
|
git tag -a --force "$VERSION_NAME" -m "coreboot version $VERSION_NAME"
|
2016-09-08 22:35:48 +02:00
|
|
|
fi
|
2016-10-05 00:45:17 +02:00
|
|
|
|
|
|
|
printf "%s-%s\n" "$VERSION_NAME" "$(git log --pretty=%H|head -1)" > .coreboot-version
|
2016-01-29 23:02:56 +01:00
|
|
|
tstamp=$(git log --pretty=format:%ci -1)
|
2015-07-13 22:48:46 +02:00
|
|
|
cd ..
|
2016-10-05 00:45:17 +02:00
|
|
|
|
2016-10-06 00:35:29 +02:00
|
|
|
tar --sort=name --mtime="$tstamp" --owner=coreboot:1000 --group=coreboot:1000 --exclude=*/.git --exclude=*/.gitignore --exclude="coreboot-${VERSION_NAME}/3rdparty/blobs" -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 - "coreboot-${VERSION_NAME}/3rdparty/blobs" |xz -9 > "coreboot-blobs-${VERSION_NAME}.tar.xz"
|
2016-10-05 00:45:17 +02:00
|
|
|
|
2016-09-08 22:35:48 +02:00
|
|
|
if [ -n "${GPG_KEY_ID}" ]; then
|
2016-10-05 00:45:17 +02:00
|
|
|
gpg2 --armor --local-user "$GPG_KEY_ID" --output "coreboot-${VERSION_NAME}.tar.xz.sig" --detach-sig "coreboot-${VERSION_NAME}.tar.xz"
|
|
|
|
gpg2 --armor --local-user "$GPG_KEY_ID" --output "coreboot-blobs-${VERSION_NAME}.tar.xz.sig" --detach-sig "coreboot-blobs-${VERSION_NAME}.tar.xz"
|
2016-09-08 22:35:48 +02:00
|
|
|
fi
|