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 13function subproject_dir() { 14 if test ! -f "subprojects/$1.wrap"; then 15 error "scripts/archive-source.sh should only process wrap subprojects" 16 fi 17 18 # Print the directory key of the wrap file, defaulting to the 19 # subproject name. The wrap file is in ini format and should 20 # have a single section only. There should be only one section 21 # named "[wrap-*]", which helps keeping the script simple. 22 local dir 23 dir=$(sed -n \ 24 -e '/^\[wrap-[a-z][a-z]*\]$/,/^\[/{' \ 25 -e '/^directory *= */!b' \ 26 -e 's///p' \ 27 -e 'q' \ 28 -e '}' \ 29 "subprojects/$1.wrap") 30 31 echo "${dir:-$1}" 32} 33 34if [ $# -ne 2 ]; then 35 echo "Usage:" 36 echo " $0 gitrepo version" 37 exit 0 38fi 39 40# Only include wraps that are invoked with subproject() 41SUBPROJECTS="libvfio-user keycodemapdb berkeley-softfloat-3 42 berkeley-testfloat-3 arbitrary-int-1-rs bilge-0.2-rs 43 bilge-impl-0.2-rs either-1-rs itertools-0.11-rs proc-macro2-1-rs 44 proc-macro-error-1-rs proc-macro-error-attr-1-rs quote-1-rs 45 syn-2-rs unicode-ident-1-rs" 46 47src="$1" 48version="$2" 49destination=qemu-${version} 50 51git clone --single-branch -b "v${version}" -c advice.detachedHead=false \ 52 "${src}" ${destination} 53 54pushd ${destination} 55 56git submodule update --init --single-branch 57meson subprojects download $SUBPROJECTS 58 59(cd roms/seabios && git describe --tags --long --dirty > .version) 60(cd roms/skiboot && ./make_version.sh > .version) 61# Fetch edk2 submodule's submodules, since it won't have access to them via 62# the tarball later. 63# 64# A more uniform way to handle this sort of situation would be nice, but we 65# don't necessarily have much control over how a submodule handles its 66# submodule dependencies, so we continue to handle these on a case-by-case 67# basis for now. 68(cd roms/edk2 && \ 69 git submodule update --init --depth 1 -- \ 70 ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 \ 71 BaseTools/Source/C/BrotliCompress/brotli \ 72 CryptoPkg/Library/OpensslLib/openssl \ 73 MdeModulePkg/Library/BrotliCustomDecompressLib/brotli) 74popd 75 76exclude=(--exclude=.git) 77# include the tarballs in subprojects/packagecache but not their expansion 78for sp in $SUBPROJECTS; do 79 if grep -xqF "[wrap-file]" subprojects/$sp.wrap; then 80 exclude+=(--exclude=subprojects/"$(subproject_dir $sp)") 81 fi 82done 83tar "${exclude[@]}" -cJf ${destination}.tar.xz ${destination} 84rm -rf ${destination} 85