summaryrefslogtreecommitdiff
path: root/script/update/release/src
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-10-06 02:33:53 +0100
committerLeah Rowe <leah@libreboot.org>2023-10-06 02:33:53 +0100
commit2d483d2f5c3716f26bced0d9305a68475cc38f7e (patch)
treea4878d6214adb190c0ef47071d4308b28bc89f5a /script/update/release/src
parent315d0c4572d79282fd9190510234496169bdbdaa (diff)
move build/release/* to update/release
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'script/update/release/src')
-rwxr-xr-xscript/update/release/src128
1 files changed, 128 insertions, 0 deletions
diff --git a/script/update/release/src b/script/update/release/src
new file mode 100755
index 00000000..3a966015
--- /dev/null
+++ b/script/update/release/src
@@ -0,0 +1,128 @@
+#!/usr/bin/env sh
+# SPDX-License-Identifier: GPL-3.0-or-later
+# SPDX-FileCopyrightText: 2020,2021,2023 Leah Rowe <leah@libreboot.org>
+
+[ "x${DEBUG+set}" = 'xset' ] && set -v
+set -u -e
+
+. "include/err.sh"
+
+read projectname < projectname
+
+trees_fetch_list="coreboot u-boot seabios"
+simple_fetch_list="flashrom grub memtest86plus me_cleaner uefitool"
+simple_fetch_list="${simple_fetch_list} bios_extract biosutilities"
+download_only_list="pico-serprog stm32-vserprog"
+
+dirlist="config util script include util-fw"
+linklist="build update handle" # symlinks in main directory, to script: lbmk
+filelist="lbmk README.md COPYING version versiondate projectname"
+
+version="version-unknown"
+versiondate="version-date-unknown"
+eval "$(setvars "" reldir dirname srcdir)"
+
+printf "Building source code archive, version %s\n" "${version}"
+
+main()
+{
+ [ -f version ] && read version < version
+ [ -f versiondate ] && read versiondate < versiondate
+
+ create_release_directory
+ download_modules
+ copy_files
+ purge_files
+
+ create_release_archive
+ printf "Source code archive available at %s.tar.xz\n\n" "${srcdir}"
+}
+
+create_release_directory()
+{
+ reldir="release/${version}"
+ dirname="${projectname}-${version}_src"
+ srcdir="${reldir}/${dirname}"
+
+ [ -d "release/" ] || x_ mkdir -p release/
+ [ -d "${reldir}/" ] || x_ mkdir -p "${reldir}/"
+ [ ! -d "${srcdir}/" ] || x_ rm -Rf "${srcdir}/"
+ [ ! -f "${srcdir}.tar.xz" ] || \
+ x_ rm -f "${srcdir}.tar.xz/"
+
+ x_ mkdir -p "${srcdir}/"
+ x_ printf "%s" "${version}" > "${srcdir}"/version
+}
+
+download_modules()
+{
+ for modname in ${trees_fetch_list}; do
+ [ -d "${modname}" ] || x_ ./update project trees ${modname}
+ done
+ for modname in ${simple_fetch_list} ${download_only_list}; do
+ [ -d "${modname}/" ] || x_ ./update project repo ${modname}
+ done
+}
+
+copy_files()
+{
+ for dir in ${trees_fetch_list}; do
+ [ -d "${dir}" ] || continue
+ for subdir in "${dir}"/*; do
+ [ -d "${subdir}" ] || continue
+ [ "${subdir##*/}" = "${dir}" ] && continue
+ x_ mkdir -p "${srcdir}/${dir}"
+ [ ! -d "${srcdir}/${dir}/${subdir##*/}" ] || \
+ x_ rm -Rf "${srcdir}/${dir}/${subdir##*/}"
+ x_ cp -R "${subdir}" "${srcdir}/${dir}/${subdir##*/}"
+ done
+ done
+ for dir in ${simple_fetch_list} ${dirlist}; do
+ x_ cp -R "${dir}/" "${srcdir}/"
+ done
+
+ for i in ${filelist}; do
+ if [ ! -f "${i}" ]; then
+ x_ rm -Rf "${srcdir}"
+ err "copy_files: file '${i}' does not exist"
+ fi
+ x_ cp "${i}" "${srcdir}/"
+ done
+ (
+ x_ cd "${srcdir}/"
+ for i in ${linklist}; do
+ x_ ln -s lbmk "${i}"
+ done
+ )
+}
+
+purge_files()
+{
+ (
+ x_ cd "${srcdir}/"
+ [ ! -d "coreboot/default/util/kbc1126" ] || \
+ x_ ./update project build -c "coreboot/default/util/kbc1126"
+ x_ ./update project build -x coreboot
+ for p in u-boot seabios coreboot; do
+ x_ ./update project build -c "${p}"
+ done
+ x_ ./update project build -c bios_extract flashrom grub uefitool \
+ util-fw/stm32-vserprog util-fw/stm32-vserprog/libopencm3 \
+ memtest86plus/build32 memtest86plus/build64 util/*
+
+ x_ rm -Rf .git* */.git* */*/.git* */*/*/.git* */*/*/*/.git* \
+ */*/*/*/*/.git* */*/*/*/*/*/.git* */*/*/*/*/*/*/.git*
+ x_ rm -Rf cbutils elf util-fw/rp2040/pico-serprog/build
+ )
+}
+
+create_release_archive()
+{
+ (
+ x_ cd "${reldir}/"
+ x_ tar -c "${dirname}/" | xz -T0 -9e >"${dirname}.tar.xz"
+ x_ rm -Rf "${dirname}/"
+ )
+}
+
+main $@