134bb443eSAnthony Liguori#!/bin/bash -e 234bb443eSAnthony Liguori# 334bb443eSAnthony Liguori# QEMU Release Script 434bb443eSAnthony Liguori# 534bb443eSAnthony Liguori# Copyright IBM, Corp. 2012 634bb443eSAnthony Liguori# 734bb443eSAnthony Liguori# Authors: 834bb443eSAnthony Liguori# Anthony Liguori <aliguori@us.ibm.com> 934bb443eSAnthony Liguori# 1034bb443eSAnthony Liguori# This work is licensed under the terms of the GNU GPLv2 or later. 1134bb443eSAnthony Liguori# See the COPYING file in the top-level directory. 1234bb443eSAnthony Liguori 131032dccaSPaolo Bonzinifunction subproject_dir() { 14*4b1b34c1SMichael Roth if test ! -f "$src/subprojects/$1.wrap"; then 15*4b1b34c1SMichael Roth echo "scripts/archive-source.sh should only process wrap subprojects" 16*4b1b34c1SMichael Roth exit 1 171032dccaSPaolo Bonzini fi 181032dccaSPaolo Bonzini 191032dccaSPaolo Bonzini # Print the directory key of the wrap file, defaulting to the 201032dccaSPaolo Bonzini # subproject name. The wrap file is in ini format and should 211032dccaSPaolo Bonzini # have a single section only. There should be only one section 221032dccaSPaolo Bonzini # named "[wrap-*]", which helps keeping the script simple. 231032dccaSPaolo Bonzini local dir 241032dccaSPaolo Bonzini dir=$(sed -n \ 251032dccaSPaolo Bonzini -e '/^\[wrap-[a-z][a-z]*\]$/,/^\[/{' \ 261032dccaSPaolo Bonzini -e '/^directory *= */!b' \ 271032dccaSPaolo Bonzini -e 's///p' \ 281032dccaSPaolo Bonzini -e 'q' \ 291032dccaSPaolo Bonzini -e '}' \ 30*4b1b34c1SMichael Roth "$src/subprojects/$1.wrap") 311032dccaSPaolo Bonzini 321032dccaSPaolo Bonzini echo "${dir:-$1}" 331032dccaSPaolo Bonzini} 341032dccaSPaolo Bonzini 359bd0bcc3SThomas Huthif [ $# -ne 2 ]; then 369bd0bcc3SThomas Huth echo "Usage:" 379bd0bcc3SThomas Huth echo " $0 gitrepo version" 389bd0bcc3SThomas Huth exit 0 399bd0bcc3SThomas Huthfi 409bd0bcc3SThomas Huth 412019cabfSPaolo Bonzini# Only include wraps that are invoked with subproject() 422b74dd91SManos PitsidianakisSUBPROJECTS="libvfio-user keycodemapdb berkeley-softfloat-3 43d0f0cd5bSPaolo Bonzini berkeley-testfloat-3 arbitrary-int-1-rs bilge-0.2-rs 44d0f0cd5bSPaolo Bonzini bilge-impl-0.2-rs either-1-rs itertools-0.11-rs proc-macro2-1-rs 45d0f0cd5bSPaolo Bonzini proc-macro-error-1-rs proc-macro-error-attr-1-rs quote-1-rs 462b74dd91SManos Pitsidianakis syn-2-rs unicode-ident-1-rs" 472019cabfSPaolo Bonzini 4834bb443eSAnthony Liguorisrc="$1" 4934bb443eSAnthony Liguoriversion="$2" 5034bb443eSAnthony Liguoridestination=qemu-${version} 5134bb443eSAnthony Liguori 52aa4609dcSThomas Huthgit clone --single-branch -b "v${version}" -c advice.detachedHead=false \ 53aa4609dcSThomas Huth "${src}" ${destination} 54aa4609dcSThomas Huth 5534bb443eSAnthony Liguoripushd ${destination} 56aa4609dcSThomas Huth 57aa4609dcSThomas Huthgit submodule update --init --single-branch 582019cabfSPaolo Bonzinimeson subprojects download $SUBPROJECTS 592019cabfSPaolo Bonzini 608648fcd5SAndreas Färber(cd roms/seabios && git describe --tags --long --dirty > .version) 613fccd3f2SMichael Roth(cd roms/skiboot && ./make_version.sh > .version) 6245c61c6cSMichael Roth# Fetch edk2 submodule's submodules, since it won't have access to them via 6345c61c6cSMichael Roth# the tarball later. 6445c61c6cSMichael Roth# 6545c61c6cSMichael Roth# A more uniform way to handle this sort of situation would be nice, but we 6645c61c6cSMichael Roth# don't necessarily have much control over how a submodule handles its 6745c61c6cSMichael Roth# submodule dependencies, so we continue to handle these on a case-by-case 6845c61c6cSMichael Roth# basis for now. 69bd0da3a3SPhilippe Mathieu-Daudé(cd roms/edk2 && \ 70aa4609dcSThomas Huth git submodule update --init --depth 1 -- \ 71bd0da3a3SPhilippe Mathieu-Daudé ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 \ 72bd0da3a3SPhilippe Mathieu-Daudé BaseTools/Source/C/BrotliCompress/brotli \ 73bd0da3a3SPhilippe Mathieu-Daudé CryptoPkg/Library/OpensslLib/openssl \ 74bd0da3a3SPhilippe Mathieu-Daudé MdeModulePkg/Library/BrotliCustomDecompressLib/brotli) 7534bb443eSAnthony Liguoripopd 761032dccaSPaolo Bonzini 771032dccaSPaolo Bonziniexclude=(--exclude=.git) 781032dccaSPaolo Bonzini# include the tarballs in subprojects/packagecache but not their expansion 791032dccaSPaolo Bonzinifor sp in $SUBPROJECTS; do 80*4b1b34c1SMichael Roth if grep -xqF "[wrap-file]" $src/subprojects/$sp.wrap; then 811032dccaSPaolo Bonzini exclude+=(--exclude=subprojects/"$(subproject_dir $sp)") 821032dccaSPaolo Bonzini fi 831032dccaSPaolo Bonzinidone 841032dccaSPaolo Bonzinitar "${exclude[@]}" -cJf ${destination}.tar.xz ${destination} 8534bb443eSAnthony Liguorirm -rf ${destination} 86