Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit 485a1b7

Browse files
utils: cleanup scripts a little
1 parent 2fd436f commit 485a1b7

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

utils/docker/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
set -e
2323

24-
source $(dirname $0)/set-ci-vars.sh
24+
source $(dirname ${0})/set-ci-vars.sh
2525
IMG_VER=${IMG_VER:-devel}
2626
TAG="${OS}-${OS_VER}-${IMG_VER}"
2727
IMAGE_NAME=${CONTAINER_REG}:${TAG}
@@ -48,7 +48,7 @@ if [[ -z "${CONTAINER_REG}" ]]; then
4848
fi
4949

5050
# Set command to execute in the Docker container
51-
if [[ -z "$COMMAND" ]]; then
51+
if [[ -z "${COMMAND}" ]]; then
5252
echo "COMMAND will be based on the type of build: ${TYPE}"
5353
case ${TYPE} in
5454
debug)

utils/docker/prepare-for-build.sh

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,15 @@
1010

1111
set -e
1212

13-
if [[ -z "${WORKDIR}" ]]; then
14-
echo "ERROR: The variable WORKDIR has to contain a path to the root " \
15-
"of this project - 'build' sub-directory will be created there."
16-
exit 1
17-
fi
18-
1913
INSTALL_DIR=/tmp/libpmemobj-cpp
2014
EXAMPLE_TEST_DIR=/tmp/build_example
2115
TEST_DIR=${PMEMKV_TEST_DIR:-${DEFAULT_TEST_DIR}}
2216

17+
### Helper functions, used in run-*.sh scripts
2318
function sudo_password() {
2419
echo ${USERPASS} | sudo -Sk $*
2520
}
2621

27-
echo "Current WORKDIR content:"
28-
ls ${WORKDIR} -alh
29-
30-
if [ "${CI_RUN}" == "YES" ]; then
31-
echo "CI build: change WORKDIR's owner and prepare tmpfs device"
32-
sudo_password chown -R $(id -u).$(id -g) ${WORKDIR}
33-
34-
sudo_password mkdir ${TEST_DIR}
35-
sudo_password chmod 0777 ${TEST_DIR}
36-
sudo_password mount -o size=2G -t tmpfs none ${TEST_DIR}
37-
fi || true
38-
39-
40-
## Helper functions, used in run-*.sh scripts
4122
function workspace_cleanup() {
4223
echo "Cleanup build dirs"
4324

@@ -92,3 +73,20 @@ function compile_example_standalone() {
9273
make -j$(nproc)
9374
cd -
9475
}
76+
77+
### Additional checks, to be run, when this file is sourced
78+
if [[ -z "${WORKDIR}" ]]; then
79+
echo "ERROR: The variable WORKDIR has to contain a path to the root " \
80+
"of this project - 'build' sub-directory will be created there."
81+
exit 1
82+
fi
83+
84+
# this should be run only on CIs
85+
if [ "${CI_RUN}" == "YES" ]; then
86+
echo "CI build: change WORKDIR's owner and prepare tmpfs device"
87+
sudo_password chown -R $(id -u).$(id -g) ${WORKDIR}
88+
89+
sudo_password mkdir ${TEST_DIR}
90+
sudo_password chmod 0777 ${TEST_DIR}
91+
sudo_password mount -o size=2G -t tmpfs none ${TEST_DIR}
92+
fi || true

0 commit comments

Comments
 (0)