blob: 1b89b3423a89c5e6ee627d35dd2bcd53d1fd27fb [file] [log] [blame]
Anthony Liguori34bb4432012-07-17 13:33:32 -05001#!/bin/bash -e
2#
3# QEMU Release Script
4#
5# Copyright IBM, Corp. 2012
6#
7# Authors:
8# Anthony Liguori <aliguori@us.ibm.com>
9#
10# This work is licensed under the terms of the GNU GPLv2 or later.
11# See the COPYING file in the top-level directory.
12
Paolo Bonzinibe27b512024-12-19 11:24:13 +010013function subproject_dir() {
Michael Rothb79b05d2025-02-13 17:53:20 -060014 if test ! -f "$src/subprojects/$1.wrap"; then
15 echo "scripts/archive-source.sh should only process wrap subprojects"
16 exit 1
Paolo Bonzinibe27b512024-12-19 11:24:13 +010017 fi
18
19 # Print the directory key of the wrap file, defaulting to the
20 # subproject name. The wrap file is in ini format and should
21 # have a single section only. There should be only one section
22 # named "[wrap-*]", which helps keeping the script simple.
23 local dir
24 dir=$(sed -n \
25 -e '/^\[wrap-[a-z][a-z]*\]$/,/^\[/{' \
26 -e '/^directory *= */!b' \
27 -e 's///p' \
28 -e 'q' \
29 -e '}' \
Michael Rothb79b05d2025-02-13 17:53:20 -060030 "$src/subprojects/$1.wrap")
Paolo Bonzinibe27b512024-12-19 11:24:13 +010031
32 echo "${dir:-$1}"
33}
34
Thomas Huth9bd0bcc2022-11-28 10:25:51 +010035if [ $# -ne 2 ]; then
36 echo "Usage:"
37 echo " $0 gitrepo version"
38 exit 0
39fi
40
Paolo Bonzini2019cab2023-05-18 16:50:00 +020041# Only include wraps that are invoked with subproject()
Manos Pitsidianakis2b74dd92024-10-03 16:28:50 +030042SUBPROJECTS="libvfio-user keycodemapdb berkeley-softfloat-3
Paolo Bonzinid0f0cd52024-10-10 16:11:28 +020043 berkeley-testfloat-3 arbitrary-int-1-rs bilge-0.2-rs
44 bilge-impl-0.2-rs either-1-rs itertools-0.11-rs proc-macro2-1-rs
45 proc-macro-error-1-rs proc-macro-error-attr-1-rs quote-1-rs
Manos Pitsidianakis2b74dd92024-10-03 16:28:50 +030046 syn-2-rs unicode-ident-1-rs"
Paolo Bonzini2019cab2023-05-18 16:50:00 +020047
Anthony Liguori34bb4432012-07-17 13:33:32 -050048src="$1"
49version="$2"
50destination=qemu-${version}
51
Thomas Huthaa4609d2022-11-28 10:25:52 +010052git clone --single-branch -b "v${version}" -c advice.detachedHead=false \
53 "${src}" ${destination}
54
Anthony Liguori34bb4432012-07-17 13:33:32 -050055pushd ${destination}
Thomas Huthaa4609d2022-11-28 10:25:52 +010056
57git submodule update --init --single-branch
Paolo Bonzini2019cab2023-05-18 16:50:00 +020058meson subprojects download $SUBPROJECTS
59
Andreas Färber8648fcd2014-03-20 02:01:55 +010060(cd roms/seabios && git describe --tags --long --dirty > .version)
Michael Roth3fccd3f2018-11-09 10:13:52 -060061(cd roms/skiboot && ./make_version.sh > .version)
Michael Roth45c61c62019-09-12 18:12:01 -050062# Fetch edk2 submodule's submodules, since it won't have access to them via
63# the tarball later.
64#
65# A more uniform way to handle this sort of situation would be nice, but we
66# don't necessarily have much control over how a submodule handles its
67# submodule dependencies, so we continue to handle these on a case-by-case
68# basis for now.
Philippe Mathieu-Daudébd0da3a2021-10-18 12:58:16 +020069(cd roms/edk2 && \
Thomas Huthaa4609d2022-11-28 10:25:52 +010070 git submodule update --init --depth 1 -- \
Philippe Mathieu-Daudébd0da3a2021-10-18 12:58:16 +020071 ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 \
72 BaseTools/Source/C/BrotliCompress/brotli \
73 CryptoPkg/Library/OpensslLib/openssl \
74 MdeModulePkg/Library/BrotliCustomDecompressLib/brotli)
Anthony Liguori34bb4432012-07-17 13:33:32 -050075popd
Paolo Bonzinibe27b512024-12-19 11:24:13 +010076
77exclude=(--exclude=.git)
78# include the tarballs in subprojects/packagecache but not their expansion
79for sp in $SUBPROJECTS; do
Michael Rothb79b05d2025-02-13 17:53:20 -060080 if grep -xqF "[wrap-file]" $src/subprojects/$sp.wrap; then
Paolo Bonzinibe27b512024-12-19 11:24:13 +010081 exclude+=(--exclude=subprojects/"$(subproject_dir $sp)")
82 fi
83done
84tar "${exclude[@]}" -cJf ${destination}.tar.xz ${destination}
Anthony Liguori34bb4432012-07-17 13:33:32 -050085rm -rf ${destination}