提交 a075db42 编写于 作者: E Ed Espino

Save git root, submodule and changelog information.

The following information will be saved in
${GREENPLUM_INSTALL_DIR}/etc/git-info.json:

* Root repo (uri, sha1)
* Submodules (submodule source path, sha1, tag)

Save git commits since last release tag into
${GREENPLUM_INSTALL_DIR}/etc/git-current-changelog.txt
上级 6a71ff04
......@@ -88,6 +88,25 @@ function build_gppkg() {
popd
}
function git_info() {
pushd ${GPDB_SRC_PATH}
"${CWDIR}/git_info.bash" | tee ${GREENPLUM_INSTALL_DIR}/etc/git-info.json
PREV_TAG=$(git describe --tags --abbrev=0 @^)
cat > ${GREENPLUM_INSTALL_DIR}/etc/git-current-changelog.txt <<-EOF
======================================================================
Git log since previous release tag (${PREV_TAG})
----------------------------------------------------------------------
EOF
git log --abbrev-commit --date=relative "${PREV_TAG}..@" | tee -a ${GREENPLUM_INSTALL_DIR}/etc/git-current-changelog.txt
popd
}
function unittest_check_gpdb() {
pushd ${GPDB_SRC_PATH}
source ${GREENPLUM_INSTALL_DIR}/greenplum_path.sh
......@@ -172,6 +191,7 @@ function _main() {
# the source tree and hence needs to be copied over.
rsync -au gpaddon_src/ ${GPDB_SRC_PATH}/gpAux/${ADDON_DIR}
build_gpdb "${BLD_TARGET_OPTION[@]}"
git_info
build_gppkg
if [ "${TARGET_OS}" != "win32" ] ; then
# Don't unit test when cross compiling. Tests don't build because they
......
#!/bin/bash
set -uo pipefail
# ----------------------------------------------------------------------
# Check for prerequisite utilities
# ----------------------------------------------------------------------
PREREQ_COMMANDS="git"
for COMMAND in ${PREREQ_COMMANDS}; do
type "${COMMAND}" >/dev/null 2>&1 || { echo >&2 "Required command line utility \"${COMMAND}\" is not available. Aborting."; exit 1; }
done
# ----------------------------------------------------------------------
# Retrieve root URI and commit SHA1
# ----------------------------------------------------------------------
URI=$( git remote -v | grep "fetch" | grep "origin" | awk '{print $2}' )
SHA1=$( git rev-parse HEAD )
# ----------------------------------------------------------------------
# Generate root JSON record
# ----------------------------------------------------------------------
echo -n "
{\"root\": {
\"uri\": \"${URI}\",
\"sha1\": \"${SHA1}\"},
\"submodules\": ["
# ----------------------------------------------------------------------
# Generate submodule records
# ----------------------------------------------------------------------
submodules=$( git submodule status )
submodule_count=$( git submodule status | wc -l | tr -d ' ' )
COUNTER=0
IFS=$'\n'
for line in $submodules; do
SOURCE_PATH=$( echo "${line}" | cut -d " " -f3 )
SHA1=$( echo "${line}" | cut -d " " -f2 )
TAG=$( echo "${line}" | cut -d " " -f4 )
COUNTER=$((COUNTER+1))
echo -n "
{\"source_path\": \"${SOURCE_PATH}\",
\"sha1\": \"${SHA1}\",
\"tag\": \"${TAG//[)(]/}\"}"
if [ "${COUNTER}" != "${submodule_count}" ]; then
echo -n ","
fi
done
echo "]}"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册