3 # Copyright (c) 2013 Intel Corporation. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 # This script is expected to be run by `git-buildpackage' (called by `gbs
8 # build') as a postexport hook. Its purpose is to remove the tar file generated
9 # by `gbs export' with `git archive' and create a new archive with tar itself.
11 # It is helpful in two ways:
12 # - It automates the generation of a proper archive for RPM builds so that one
13 # does not need to create a separate git tree with all sources for `gbs
15 # - Since tar is used, the archive's members all have their actual mtimes as
16 # opposed to the time of the git tree-ish passed to `git archive'. This is
17 # part of the solution for incremental builds in Tizen: since we use actual
18 # file mtimes, they are not rebuilt by `make'.
20 # As a postexport hook, there are two additional environment variables
21 # available: GBP_GIT_DIR is /path/to/src/xwalk/.git, and GBP_TMP_DIR is the
22 # temporary directory containing everything in /path/to/src/xwalk/packaging
23 # that will be copied to $GBSROOT/local/sources and used by `rpmbuild' to build
26 # The script is run from GBP_TMP_DIR.
28 # Fail early to avoid bigger problems later in the process.
31 TAR_FILE="${GBP_TMP_DIR}/crosswalk.tar"
33 if [ ! -f "${TAR_FILE}" ]; then
34 echo "${TAR_FILE} does not exist. Aborting."
38 # The top-level directory that _contains_ src/.
39 BASE_SRC_DIR=`readlink -f "${GBP_GIT_DIR}/../../.."`
41 echo "${GBP_GIT_DIR}/../../.. does not seem to be a valid path. Aborting."
45 # Erase the archive generated with `git archive'.
48 echo "Creating a new ${TAR_FILE} from ${BASE_SRC_DIR}/src"
50 # The --transform parameter is used to prepend all archive members with
51 # crosswalk/ so they all share a common root. Note it is crosswalk/, without
52 # any version numbers, so that any build files in an external directory
53 # referring to a source file does not need to be updated just because of a
55 tar --update --file "${TAR_FILE}" \
56 --exclude-vcs --exclude=LayoutTests \
57 --exclude=src/out --directory="${BASE_SRC_DIR}" \
58 --transform="s:^:crosswalk/:S" \