Skip to content

Commit c78c496

Browse files
committed
Allow toy-manifest-build to honor keep_git from product-config
Change-Id: I24546567f58b843c3a30d946a91fb785a6e1b440 Reviewed-on: http://review.couchbase.org/c/build-tools/+/163637 Reviewed-by: Ming Ho <[email protected]> Tested-by: Chris Hillery <[email protected]>
1 parent 54ccb1b commit c78c496

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

build-from-manifest/props-for-manifest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ if __name__ == '__main__':
2929
f'BUILD_JOB={details.get("build_job")}\n'
3030
f'PLATFORMS={" ".join(details.get("platforms", []))}\n'
3131
f'GO_VERSION={details.get("go_version", "")}\n'
32+
f'KEEP_GIT={details.get("keep_git", "false")}\n'
3233
f'TOY_BUILD=true\n'
3334
)

build-from-manifest/toy_build_from_manifest

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ PATCH_VIA_GERRIT_OPTS=${OPTS}
7070
EOF
7171

7272
# And stick the build-properties into git for remote toy builders
73-
if [ ! -d toy-build-properties ]; then
74-
git clone ssh://github.com/couchbasebuild/toy-build-properties
73+
if [ ! -d toy-build-manifests ]; then
74+
git clone ssh://github.com/couchbasebuild/toy-build-manifests
7575
fi
76-
pushd toy-build-properties
76+
pushd toy-build-manifests
7777
git fetch --all && git reset --hard origin/master
7878
mkdir -p ${PRODUCT_PATH}/${RELEASE}
7979
cp ../build.properties ${PRODUCT_PATH}/${RELEASE}/${VERSION}.properties
@@ -123,18 +123,28 @@ if [ -e "${PRODUCT_CONFIG}" ]; then
123123
done
124124
fi
125125

126-
echo "Removing any broken symlinks"
127-
echo ============================
128-
# Since we dereference symlinks below, any broken symlinks will cause tar to
129-
# fail with a mysterious "file deleted before we read it" error. Seems
130-
# probably best just to remove them.
131-
find . -xtype l -delete
126+
if [ "${KEEP_GIT}" = "True" ]; then
127+
exclude_git_arg=""
128+
set +x
129+
# As with build_from_manifest.py, we dereference symlinks in .git
130+
# directories so they work on Windows.
131+
echo "Dereferencing .git symlinks"
132+
echo =======================
133+
# Make a local temp file
134+
tempfile=./tmpgitfile
135+
find . -type l -path '*/.git/*' -print0 | while read -rd $'\0' file; do
136+
cp -aL "${file}" ${tempfile}
137+
rm "${file}"
138+
mv ${tempfile} "${file}"
139+
done
140+
set -x
141+
else
142+
exclude_git_arg="--exclude .repo --exclude-vcs"
143+
fi
132144

133145
echo "Creating source tarball"
134146
echo =======================
135-
# As with build_from_manifest.py, we dereference symlinks so .git directories
136-
# will work on Windows. As such, we don't actually need the .repo directory.
137-
tar --create --file ../source.tar.gz --gzip --dereference --exclude .repo .[A-z]* *
147+
tar --create --file ../source.tar.gz --gzip ${exclude_git_arg} .[A-z]* *
138148

139149
# Create final deliverables at WORKSPACE level
140150
popd

0 commit comments

Comments
 (0)