diff options
author | P. J. McDermott <pj@pehjota.net> | 2015-05-31 17:21:37 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2015-05-31 18:07:10 (EDT) |
commit | 945c82aa6f9be7a6f516ae9734f8c2bdf4ce0d6a (patch) | |
tree | 30cad8736b62c6e1ed23aadc10d3537cc6424321 /resources/scripts/helpers/build/release/src | |
parent | 9739e0f061cd3279baa2e18cbc76d258b91dd2f3 (diff) | |
download | libreboot-feature/modular-release-generation.zip libreboot-feature/modular-release-generation.tar.gz libreboot-feature/modular-release-generation.tar.bz2 |
build/release/src: New scriptfeature/modular-release-generation
This new script doesn't generate a manifest, changes directories as
little as possible, generates a correct commitid file even if a
non-master branch is checked out, and supports including a version
string in the archive file name.
Diffstat (limited to 'resources/scripts/helpers/build/release/src')
-rwxr-xr-x | resources/scripts/helpers/build/release/src | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/resources/scripts/helpers/build/release/src b/resources/scripts/helpers/build/release/src new file mode 100755 index 0000000..5134cbe --- /dev/null +++ b/resources/scripts/helpers/build/release/src @@ -0,0 +1,117 @@ +#!/bin/sh + +# +# helper script: generate the source release archive +# +# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk> +# Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +printf 'Building the source release archive\n' + +if [ -f version ]; then + version="$(cat version)" + distdir="libreboot_${version}_src" +else + distdir='libreboot_src' +fi + +printf 'Deleting old source release archives\n' +rm -f "${distdir}.tar.xz" +rm -f "release/${distdir}.tar.xz" +rm -Rf "${distdir}/" + +mkdir "${distdir}/" + +printf 'Copying sources to %s/\n' "${distdir}" +for resource in *; do + case "${resource}" in + libreboot_* | release | tobuild* | docs);; + *) cp -R "${resource}" "${distdir}/";; + esac +done + +if [ -f version ]; then + printf '%s\n' "${version}" >"${distdir}/version" +else + git rev-parse HEAD >"${distdir}/commitid" +fi + +printf 'Cleaning files in %s/\n' "${distdir}" + +# Clean old builds. +(cd "${distdir}/" && ./build clean all) +printf '\n' + +# Delete Git repositories and properties and Subversion administrative +# directories and properties. +rm -Rf "${distdir}/bucts/".git* +rm -Rf "${distdir}/flashrom/".svn* +rm -Rf "${distdir}/grub/".git* + +# Delete useless files. +rm -Rf "${distdir}/TODO/" +rm -f "${distdir}/push" + +# Delete the deblob scripts. +# Since the source archive doesn't distribute the download scripts and already +# comes with a deblobbed coreboot, the deblobbing scripts aren't needed at all. +rm -Rf "${distdir}/resources/utilities/coreboot-libre/" + +# We don't want to encourage development to happen on the release archives. +# Development goes in Git. These scripts are not needed in the source archive, +# because the files that they download are already included and trimmed. +rm -Rf "${distdir}/resources/scripts/helpers/build/release/" +rm -f "${distdir}/download" +rm -Rf "${distdir}/resources/scripts/helpers/download/" +rm -Rf "${distdir}/resources/scripts/helpers/build/trim/" + +# Patches are not needed, because they are already applied to coreboot sources. +rm -Rf "${distdir}/resources/libreboot/patch/" + +# coreboot's crossgcc archives are distributed separately. +rm -Rf "${distdir}/coreboot/util/crossgcc/tarballs/" + +# ich9deblob: There are certain files in there that the user most likely does +# not want to share. +rm -f "${distdir}/resources/utilities/ich9deblob/deblobbed_descriptor.bin" +rm -f "${distdir}/resources/utilities/ich9deblob/factory.rom" +rm -f "${distdir}/resources/utilities/ich9deblob/libreboot.rom" +rm -f "${distdir}/resources/utilities/ich9deblob/mkdescriptor.c" +rm -f "${distdir}/resources/utilities/ich9deblob/mkdescriptor.h" +rm -f "${distdir}/resources/utilities/ich9deblob/mkgbe.c" +rm -f "${distdir}/resources/utilities/ich9deblob/mkgbe.h" +rm -f "${distdir}/resources/utilities/ich9deblob/ich9fdgbe_4m.bin" +rm -f "${distdir}/resources/utilities/ich9deblob/ich9fdgbe_8m.bin" +rm -f "${distdir}/resources/utilities/ich9deblob/demefactory_4kdescriptor.bin" +rm -f "${distdir}/mkgbe.c" +rm -f "${distdir}/mkgbe.h" +rm -f "${distdir}/ich9fdgbe_8m.bin" +rm -f "${distdir}/ich9fdgbe_4m.bin" + +printf 'Creating %s.tar.xz\n' "${distdir}" +tar -c "${distdir}/" | xz -9e >"${distdir}.tar.xz" + +# Move the archives to the release/ directory. +[ -d release/ ] || mkdir release/ +mv "${distdir}.tar.xz" release/ + +rm -Rf "${distdir}/" + +printf 'Source release archives are stored in release/\n' |