Skip to content

Commit 50083a9

Browse files
authored
Merge pull request #143 from AKhozya/feature/add-cpu-quota-option
Add -C option for CPU quota limit on build containers
2 parents 6729ed3 + 5a46e23 commit 50083a9

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

repro.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ function exec_nspawn(){
220220
${EPHEMERAL:+--ephemeral} \
221221
${ISSYSTEMD242:+--pipe} \
222222
${MAX_MEMORY:+--property="MemoryMax=${MAX_MEMORY}"} \
223+
${MAX_CPU:+--property="CPUQuota=${MAX_CPU}"} \
223224
-E "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin" \
224225
-D "$BUILDDIRECTORY/$container" "${@:2}"
225226
if ((EPHEMERAL)); then
@@ -583,6 +584,7 @@ General Options:
583584
-d Run diffoscope if packages are not reproducible
584585
-f Use the local PKGBUILD for building
585586
-n Run makepkg with --nocheck
587+
-C <value> Set a CPU quota for the build container (e.g. 500% for 5 cores)
586588
-M <value> Set an upper limit for RAM use on the build container (e.g. 12G)
587589
-V Print version information
588590
-o <path> Set the output directory (default: ./build)
@@ -594,13 +596,14 @@ function print_version() {
594596
}
595597

596598
function parse_args() {
597-
while getopts :hdnfM:Vo: arg; do
599+
while getopts :hdnfC:M:Vo: arg; do
598600
case $arg in
599601
h) print_help; exit 0;;
600602
V) print_version; exit 0;;
601603
f) pkgbuild_file=1;;
602604
d) run_diffoscope=1;;
603605
n) NOCHECK=1;;
606+
C) MAX_CPU="$OPTARG";;
604607
M) MAX_MEMORY="$OPTARG";;
605608
o) OUTDIR="$OPTARG";;
606609
*) error "unknown argument ${OPTARG}" ; print_help; exit 1;;

0 commit comments

Comments
 (0)