From 1ce7e339769c4fd38ce5a3818e5b5835a867422a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 14 May 2024 23:17:22 +0100 Subject: move rom tarball creation to script/roms export LBMK_RELEASE="y" if this is done, the tarball is created instead of a directory, and the rom images are nuked using ./vendor inject with the nuke option, inserting the correct version files; the rom directory is deleted now the release script logic simple renames existing tarballs. the benefit of this change is fewer lines of code, and now lbmk doesn't use an insane amount of disk space when building a *lot* of release images (the uncompressed directories are deleted after each build) Signed-off-by: Leah Rowe --- include/option.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'include') diff --git a/include/option.sh b/include/option.sh index b79c34f4..b974c630 100755 --- a/include/option.sh +++ b/include/option.sh @@ -171,3 +171,41 @@ check_project() done export LOCALVERSION="-${projectname}-${version%%-*}" } + +mktar_release() +{ + x_ insert_version_files "$1" + mktarball "$1" "${1}.tar.xz" + x_ rm -Rf "$1" +} + +mktarball() +{ + # preserve timestamps for reproducible tarballs + tar_implementation=$(tar --version | head -n1) || : + + [ "${2%/*}" = "${2}" ] || \ + mkdir -p "${2%/*}" || $err "mk, !mkdir -p \"${2%/*}\"" + printf "\nCreating archive: %s\n\n" "$2" + if [ "${tar_implementation% *}" = "tar (GNU tar)" ]; then + tar --sort=name --owner=root:0 --group=root:0 \ + --mtime="UTC 2024-05-04" -c "$1" | xz -T$threads -9e \ + > "$2" || $err "mktarball 1, ${1}" + else + # TODO: reproducible tarballs on non-GNU systems + tar -c "$1" | xz -T$threads -9e > "$2" || \ + $err "mktarball 2, $1" + fi + ( + [ "${2%/*}" != "${2}" ] && x_ cd "${2%/*}" + sha512sum "${2##*/}" > "${2##*/}.sha512" || \ + $err "!sha512sum \"${2##*/}\" > \"${2##*/}.sha512\"" + ) || $err "failed to create tarball checksum" +} + +insert_version_files() +{ + printf "%s\n" "${version}" > "${1}/version" || return 1 + printf "%s\n" "${versiondate}" > "${1}/versiondate" || return 1 + printf "%s\n" "${projectname}" > "${1}/projectname" || return 1 +} -- cgit v1.2.1