Anthony Liguori | 34bb443 | 2012-07-17 13:33:32 -0500 | [diff] [blame] | 1 | #!/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 Bonzini | be27b51 | 2024-12-19 11:24:13 +0100 | [diff] [blame] | 13 | function subproject_dir() { |
Michael Roth | b79b05d | 2025-02-13 17:53:20 -0600 | [diff] [blame] | 14 | if test ! -f "$src/subprojects/$1.wrap"; then |
| 15 | echo "scripts/archive-source.sh should only process wrap subprojects" |
| 16 | exit 1 |
Paolo Bonzini | be27b51 | 2024-12-19 11:24:13 +0100 | [diff] [blame] | 17 | 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 Roth | b79b05d | 2025-02-13 17:53:20 -0600 | [diff] [blame] | 30 | "$src/subprojects/$1.wrap") |
Paolo Bonzini | be27b51 | 2024-12-19 11:24:13 +0100 | [diff] [blame] | 31 | |
| 32 | echo "${dir:-$1}" |
| 33 | } |
| 34 | |
Thomas Huth | 9bd0bcc | 2022-11-28 10:25:51 +0100 | [diff] [blame] | 35 | if [ $# -ne 2 ]; then |
| 36 | echo "Usage:" |
| 37 | echo " $0 gitrepo version" |
| 38 | exit 0 |
| 39 | fi |
| 40 | |
Paolo Bonzini | 2019cab | 2023-05-18 16:50:00 +0200 | [diff] [blame] | 41 | # Only include wraps that are invoked with subproject() |
Manos Pitsidianakis | 2b74dd9 | 2024-10-03 16:28:50 +0300 | [diff] [blame] | 42 | SUBPROJECTS="libvfio-user keycodemapdb berkeley-softfloat-3 |
Paolo Bonzini | a95ad49 | 2025-05-26 12:10:18 +0200 | [diff] [blame] | 43 | berkeley-testfloat-3 anyhow-1-rs arbitrary-int-1-rs bilge-0.2-rs |
Paolo Bonzini | bfe0f6b | 2025-05-23 17:59:52 +0200 | [diff] [blame] | 44 | bilge-impl-0.2-rs either-1-rs foreign-0.3-rs itertools-0.11-rs |
| 45 | libc-0.2-rs proc-macro2-1-rs |
Paolo Bonzini | d0f0cd5 | 2024-10-10 16:11:28 +0200 | [diff] [blame] | 46 | proc-macro-error-1-rs proc-macro-error-attr-1-rs quote-1-rs |
Manos Pitsidianakis | 2b74dd9 | 2024-10-03 16:28:50 +0300 | [diff] [blame] | 47 | syn-2-rs unicode-ident-1-rs" |
Paolo Bonzini | 2019cab | 2023-05-18 16:50:00 +0200 | [diff] [blame] | 48 | |
Anthony Liguori | 34bb443 | 2012-07-17 13:33:32 -0500 | [diff] [blame] | 49 | src="$1" |
| 50 | version="$2" |
| 51 | destination=qemu-${version} |
| 52 | |
Thomas Huth | aa4609d | 2022-11-28 10:25:52 +0100 | [diff] [blame] | 53 | git clone --single-branch -b "v${version}" -c advice.detachedHead=false \ |
| 54 | "${src}" ${destination} |
| 55 | |
Anthony Liguori | 34bb443 | 2012-07-17 13:33:32 -0500 | [diff] [blame] | 56 | pushd ${destination} |
Thomas Huth | aa4609d | 2022-11-28 10:25:52 +0100 | [diff] [blame] | 57 | |
| 58 | git submodule update --init --single-branch |
Paolo Bonzini | 2019cab | 2023-05-18 16:50:00 +0200 | [diff] [blame] | 59 | meson subprojects download $SUBPROJECTS |
| 60 | |
Andreas Färber | 8648fcd | 2014-03-20 02:01:55 +0100 | [diff] [blame] | 61 | (cd roms/seabios && git describe --tags --long --dirty > .version) |
Michael Roth | 3fccd3f | 2018-11-09 10:13:52 -0600 | [diff] [blame] | 62 | (cd roms/skiboot && ./make_version.sh > .version) |
Michael Roth | 45c61c6 | 2019-09-12 18:12:01 -0500 | [diff] [blame] | 63 | # Fetch edk2 submodule's submodules, since it won't have access to them via |
| 64 | # the tarball later. |
| 65 | # |
| 66 | # A more uniform way to handle this sort of situation would be nice, but we |
| 67 | # don't necessarily have much control over how a submodule handles its |
| 68 | # submodule dependencies, so we continue to handle these on a case-by-case |
| 69 | # basis for now. |
Philippe Mathieu-Daudé | bd0da3a | 2021-10-18 12:58:16 +0200 | [diff] [blame] | 70 | (cd roms/edk2 && \ |
Thomas Huth | aa4609d | 2022-11-28 10:25:52 +0100 | [diff] [blame] | 71 | git submodule update --init --depth 1 -- \ |
Philippe Mathieu-Daudé | bd0da3a | 2021-10-18 12:58:16 +0200 | [diff] [blame] | 72 | ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 \ |
| 73 | BaseTools/Source/C/BrotliCompress/brotli \ |
| 74 | CryptoPkg/Library/OpensslLib/openssl \ |
| 75 | MdeModulePkg/Library/BrotliCustomDecompressLib/brotli) |
Anthony Liguori | 34bb443 | 2012-07-17 13:33:32 -0500 | [diff] [blame] | 76 | popd |
Paolo Bonzini | be27b51 | 2024-12-19 11:24:13 +0100 | [diff] [blame] | 77 | |
| 78 | exclude=(--exclude=.git) |
| 79 | # include the tarballs in subprojects/packagecache but not their expansion |
| 80 | for sp in $SUBPROJECTS; do |
Michael Roth | b79b05d | 2025-02-13 17:53:20 -0600 | [diff] [blame] | 81 | if grep -xqF "[wrap-file]" $src/subprojects/$sp.wrap; then |
Paolo Bonzini | be27b51 | 2024-12-19 11:24:13 +0100 | [diff] [blame] | 82 | exclude+=(--exclude=subprojects/"$(subproject_dir $sp)") |
| 83 | fi |
| 84 | done |
| 85 | tar "${exclude[@]}" -cJf ${destination}.tar.xz ${destination} |
Anthony Liguori | 34bb443 | 2012-07-17 13:33:32 -0500 | [diff] [blame] | 86 | rm -rf ${destination} |