commit 2da31caa754f920335a6c371f2b883b570fe717f
Author: Elan Ruusamäe <[email protected]>
Date:   Mon Dec 31 11:28:18 2018 +0200

    add --tmpfs=2G to specicify size of build tmpfs size

 cleanbuild-docker.sh | 37 +++++++++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 4 deletions(-)
---
diff --git a/cleanbuild-docker.sh b/cleanbuild-docker.sh
index 8f4f7c3..6a9ac30 100755
--- a/cleanbuild-docker.sh
+++ b/cleanbuild-docker.sh
@@ -7,19 +7,44 @@ PROGRAM=${0##*/}
 : ${PACKAGE_NAME=''}
 : ${NETWORKING=false}
 : ${TRACING=false}
-: ${TMPFS=true}
+: ${TMPFS="4G"}
 
 dir=$(pwd)
 image=registry.gitlab.com/pld-linux/cleanbuild
 topdir=$dir/rpm
 home=/home/builder
-buildsize="4G"
 
 die() {
        echo >&2 "$0: $*"
        exit 1
 }
 
+is_no() {
+       # Test syntax
+       if [ $# = 0 ]; then
+               return 2
+       fi
+
+       case "$1" in
+       no|No|NO|false|False|FALSE|off|Off|OFF|N|n|0)
+               # true returns zero
+               return 0
+               ;;
+       *)
+               # false returns one
+               return 1
+               ;;
+       esac
+}
+
+tmpfs() {
+       if is_no "${TMPFS:-true}" || [ "$TMPFS" -le 0 ]; then
+               return
+       fi
+
+       echo "--tmpfs $home/rpm/BUILD:rw,exec,nosuid,size=$TMPFS"
+}
+
 create_container() {
        # cleanup first
        docker kill $name >/dev/null 2>&1 || :
@@ -34,7 +59,7 @@ create_container() {
                -v $dir:$home/cleanbuild \
                -v $dir/cache/poldek:/var/cache/poldek \
                -v $dir/cache/ccache/$PACKAGE_NAME:$home/.ccache \
-               $($TMPFS && echo "--tmpfs 
$home/rpm/BUILD:rw,exec,nosuid,size=$buildsize") \
+               $(tmpfs) \
                $image
 
        # set the homedir
@@ -108,7 +133,7 @@ package_build() {
 
 parse_options() {
        local t
-       t=$(getopt -o 'x' --long 'network,no-tmpfs,notmpfs' -n "$PROGRAM" -- 
"$@")
+       t=$(getopt -o 'x' --long 'network,no-tmpfs,notmpfs,tmpfs:' -n 
"$PROGRAM" -- "$@")
        [ $? != 0 ] && exit $?
        eval set -- "$t"
 
@@ -123,6 +148,10 @@ parse_options() {
                --no-tmpfs|--notmpfs)
                        TMPFS=false
                        ;;
+               --tmpfs)
+                       shift
+                       TMPFS="$1"
+                       ;;
                --)
                        shift
                        break
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/cleanbuild.git/commitdiff/2da31caa754f920335a6c371f2b883b570fe717f

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to