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 13be27b514SPaolo Bonzinifunction subproject_dir() { 14b79b05d1SMichael Roth if test ! -f "$src/subprojects/$1.wrap"; then 15b79b05d1SMichael Roth echo "scripts/archive-source.sh should only process wrap subprojects" 16b79b05d1SMichael Roth exit 1 17be27b514SPaolo Bonzini fi 18be27b514SPaolo Bonzini 19be27b514SPaolo Bonzini # Print the directory key of the wrap file, defaulting to the 20be27b514SPaolo Bonzini # subproject name. The wrap file is in ini format and should 21be27b514SPaolo Bonzini # have a single section only. There should be only one section 22be27b514SPaolo Bonzini # named "[wrap-*]", which helps keeping the script simple. 23be27b514SPaolo Bonzini local dir 24be27b514SPaolo Bonzini dir=$(sed -n \ 25be27b514SPaolo Bonzini -e '/^\[wrap-[a-z][a-z]*\]$/,/^\[/{' \ 26be27b514SPaolo Bonzini -e '/^directory *= */!b' \ 27be27b514SPaolo Bonzini -e 's///p' \ 28be27b514SPaolo Bonzini -e 'q' \ 29be27b514SPaolo Bonzini -e '}' \ 30b79b05d1SMichael Roth "$src/subprojects/$1.wrap") 31be27b514SPaolo Bonzini 32be27b514SPaolo Bonzini echo "${dir:-$1}" 33be27b514SPaolo Bonzini} 34be27b514SPaolo 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 43a95ad49bSPaolo Bonzini berkeley-testfloat-3 anyhow-1-rs arbitrary-int-1-rs bilge-0.2-rs 44bfe0f6b0SPaolo Bonzini bilge-impl-0.2-rs either-1-rs foreign-0.3-rs itertools-0.11-rs 45bfe0f6b0SPaolo Bonzini libc-0.2-rs proc-macro2-1-rs 46d0f0cd5bSPaolo Bonzini proc-macro-error-1-rs proc-macro-error-attr-1-rs quote-1-rs 472b74dd91SManos Pitsidianakis syn-2-rs unicode-ident-1-rs" 482019cabfSPaolo Bonzini 4934bb443eSAnthony Liguorisrc="$1" 5034bb443eSAnthony Liguoriversion="$2" 5134bb443eSAnthony Liguoridestination=qemu-${version} 5234bb443eSAnthony Liguori 53aa4609dcSThomas Huthgit clone --single-branch -b "v${version}" -c advice.detachedHead=false \ 54aa4609dcSThomas Huth "${src}" ${destination} 55aa4609dcSThomas Huth 5634bb443eSAnthony Liguoripushd ${destination} 57aa4609dcSThomas Huth 58aa4609dcSThomas Huthgit submodule update --init --single-branch 592019cabfSPaolo Bonzinimeson subprojects download $SUBPROJECTS 602019cabfSPaolo Bonzini 618648fcd5SAndreas Färber(cd roms/seabios && git describe --tags --long --dirty > .version) 623fccd3f2SMichael Roth(cd roms/skiboot && ./make_version.sh > .version) 6345c61c6cSMichael Roth# Fetch edk2 submodule's submodules, since it won't have access to them via 6445c61c6cSMichael Roth# the tarball later. 65*0311a6edSPeter Maydell 66*0311a6edSPeter Maydell# As recommended by the EDK2 readme, we don't use --recursive here. 67*0311a6edSPeter Maydell# EDK2 won't use any code or feature from a submodule of a submodule, 68*0311a6edSPeter Maydell# so we don't need to add them to the tarball. 69*0311a6edSPeter Maydell# Although we don't necessarily need all of the submodules that EDK2 70*0311a6edSPeter Maydell# has, we clone them all, to avoid running into problems where EDK2 71*0311a6edSPeter Maydell# adds a new submodule or changes its use of an existing one and 72*0311a6edSPeter Maydell# the sources we ship in the tarball then fail to build. 73*0311a6edSPeter Maydell(cd roms/edk2 && git submodule update --init --depth 1) 7434bb443eSAnthony Liguoripopd 75be27b514SPaolo Bonzini 76be27b514SPaolo Bonziniexclude=(--exclude=.git) 77be27b514SPaolo Bonzini# include the tarballs in subprojects/packagecache but not their expansion 78be27b514SPaolo Bonzinifor sp in $SUBPROJECTS; do 79b79b05d1SMichael Roth if grep -xqF "[wrap-file]" $src/subprojects/$sp.wrap; then 80be27b514SPaolo Bonzini exclude+=(--exclude=subprojects/"$(subproject_dir $sp)") 81be27b514SPaolo Bonzini fi 82be27b514SPaolo Bonzinidone 83be27b514SPaolo Bonzinitar "${exclude[@]}" -cJf ${destination}.tar.xz ${destination} 8434bb443eSAnthony Liguorirm -rf ${destination} 85