diff options
| author | Peter Maydell | 2017-09-22 13:14:27 +0200 |
|---|---|---|
| committer | Peter Maydell | 2017-09-22 13:14:28 +0200 |
| commit | a664607440511fdf8cff9d1c2afefbdbca1d1295 (patch) | |
| tree | 60f1bea3059ad94867ed67ba1956556526653453 /scripts/archive-source.sh | |
| parent | Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20170922' into staging (diff) | |
| parent | docker: Drop 'set -e' from run script (diff) | |
| download | qemu-a664607440511fdf8cff9d1c2afefbdbca1d1295.tar.gz qemu-a664607440511fdf8cff9d1c2afefbdbca1d1295.tar.xz qemu-a664607440511fdf8cff9d1c2afefbdbca1d1295.zip | |
Merge remote-tracking branch 'remotes/famz/tags/build-and-test-automation-pull-request' into staging
# gpg: Signature made Fri 22 Sep 2017 08:28:38 BST
# gpg: using RSA key 0xCA35624C6A9171C6
# gpg: Good signature from "Fam Zheng <famz@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg: It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 5003 7CB7 9706 0F76 F021 AD56 CA35 624C 6A91 71C6
* remotes/famz/tags/build-and-test-automation-pull-request: (36 commits)
docker: Drop 'set -e' from run script
docker: Use archive-source.py
tests: Add README for vm tests
MAINTAINERS: Add tests/vm entry
Makefile: Add rules to run vm tests
tests: Add OpenBSD image
tests: Add NetBSD image
tests: Add FreeBSD image
tests: Add ubuntu.i386 image
tests: Add vm test lib
tests: Add a test key pair
scripts: Add archive-source.sh
qemu.py: Add "wait()" method
gitignore: Ignore vm test images
MAINTAINERS: Fix subsystem name for "Build and test automation"
buildsys: Move rdma libs to per object
buildsys: Move brlapi libs to per object
buildsys: Move usb redir cflags/libs to per object
buildsys: Move libusb cflags/libs to per object
buildsys: Move libcacard cflags/libs to per object
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts/archive-source.sh')
| -rwxr-xr-x | scripts/archive-source.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh new file mode 100755 index 0000000000..c4e7d98f4d --- /dev/null +++ b/scripts/archive-source.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# +# Author: Fam Zheng <famz@redhat.com> +# +# Archive source tree, including submodules. This is created for test code to +# export the source files, in order to be built in a different environment, +# such as in a docker instance or VM. +# +# This code is licensed under the GPL version 2 or later. See +# the COPYING file in the top-level directory. + +error() { + printf %s\\n "$*" >&2 + exit 1 +} + +if test $# -lt 1; then + error "Usage: $0 <output tarball>" +fi + +tar_file="$1" +list_file="$1.list" +submodules=$(git submodule foreach --recursive --quiet 'echo $name') + +if test $? -ne 0; then + error "git submodule command failed" +fi + +trap "status=$?; rm -f \"$list_file\"; exit \$status" 0 1 2 3 15 + +if test -n "$submodules"; then + { + git ls-files || error "git ls-files failed" + for sm in $submodules; do + (cd $sm; git ls-files) | sed "s:^:$sm/:" + if test "${PIPESTATUS[*]}" != "0 0"; then + error "git ls-files in submodule $sm failed" + fi + done + } | grep -x -v $(for sm in $submodules; do echo "-e $sm"; done) > "$list_file" +else + git ls-files > "$list_file" +fi + +if test $? -ne 0; then + error "failed to generate list file" +fi + +tar -cf "$tar_file" -T "$list_file" || error "failed to create tar file" + +exit 0 |
