2
0

make-release 2.6 KB

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