index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | contrib/completion/bash/devtools.in | 3 | ||||
-rw-r--r-- | contrib/completion/zsh/_devtools.in | 1 | ||||
-rw-r--r-- | doc/man/pkgctl-build.1.asciidoc | 6 | ||||
-rw-r--r-- | src/lib/build/build.sh | 23 |
diff --git a/contrib/completion/bash/devtools.in b/contrib/completion/bash/devtools.in index 31269dd..b0a90e5 100644 --- a/contrib/completion/bash/devtools.in +++ b/contrib/completion/bash/devtools.in @@ -168,6 +168,7 @@ _pkgctl_build_args=( -t --testing -o --offload -c --clean + -w --worker --pkgver --pkgrel @@ -182,6 +183,8 @@ _pkgctl_build_args=( ) _pkgctl_build_args__arch_opts() { _devtools_completions_arch; } _pkgctl_build_args__repo_opts() { _devtools_completions_repo; } +_pkgctl_build_args__worker_opts() { :; } +_pkgctl_build_args_w_opts() { _pkgctl_build_args__worker_opts; } _pkgctl_build_args__pkgver_opts() { :; } _pkgctl_build_args__pkgrel_opts() { :; } _pkgctl_build_args__message_opts() { :; } diff --git a/contrib/completion/zsh/_devtools.in b/contrib/completion/zsh/_devtools.in index ed52a22..45ffde3 100644 --- a/contrib/completion/zsh/_devtools.in +++ b/contrib/completion/zsh/_devtools.in @@ -42,6 +42,7 @@ _pkgctl_build_args=( '(-o --offload)'{-o,--offload}'[Build on a remote server and transfer artifacts afterwards]' '(-c --clean)'{-c,--clean}'[Recreate the chroot before building]' '(-I --install)'{-I,--install}'[Install a package into the working copy of the chroot]:target:_files -g "*.pkg.tar.*(.)"' + '(-w --worker)'{-w,--worker}'[Name of the worker slot, useful for concurrent builds (disables auto-detection)]:slot:' '--nocheck[Do not run the check() function in the PKGBUILD]' '--pkgver=[Set pkgver, reset pkgrel and update checksums]:pkgver:' '--pkgrel=[Set pkgrel to a given value]:pkgrel:' diff --git a/doc/man/pkgctl-build.1.asciidoc b/doc/man/pkgctl-build.1.asciidoc index 489926e..f68e7cf 100644 --- a/doc/man/pkgctl-build.1.asciidoc +++ b/doc/man/pkgctl-build.1.asciidoc @@ -38,6 +38,12 @@ Build Options *-I, --install* 'FILE':: Install a package into the working copy of the chroot +*-w, --worker* 'SLOT':: + Name of the worker slot, useful for concurrent builds. By default the slot + is automatically assigned to the current tty pts number. In case the caller + is not a tty, choose a random slot between 1 and number of available + processing units. + *--nocheck*:: Do not run the check() function in the PKGBUILD diff --git a/src/lib/build/build.sh b/src/lib/build/build.sh index 2153200..191fded 100644 --- a/src/lib/build/build.sh +++ b/src/lib/build/build.sh @@ -25,6 +25,7 @@ source /usr/share/makepkg/util/config.sh source /usr/share/makepkg/util/message.sh set -e +set -o pipefail pkgctl_build_usage() { @@ -47,6 +48,7 @@ pkgctl_build_usage() { -o, --offload Build on a remote server and transfer artifacts afterwards -c, --clean Recreate the chroot before building -I, --install FILE Install a package into the working copy of the chroot + -w, --worker SLOT Name of the worker slot, useful for concurrent builds (disables automatic names) --nocheck Do not run the check() function in the PKGBUILD PKGBUILD OPTIONS @@ -123,9 +125,8 @@ pkgctl_build() { local RELEASE_OPTIONS=() local MAKEPKG_OPTIONS=() - local PTS - PTS="$(tty | sed 's|/dev/pts/||')" - local WORKER="${USER}-${PTS}" + local WORKER= + local WORKER_SLOT= # variables local path pkgbase pkgrepo source @@ -224,6 +225,11 @@ pkgctl_build() { DB_UPDATE=1 shift ;; + -w|--worker) + (( $# <= 1 )) && die "missing argument for %s" "$1" + WORKER_SLOT=$2 + shift 2 + ;; --) shift break @@ -258,6 +264,12 @@ pkgctl_build() { fi fi + # assign default worker slot + if [[ -z ${WORKER_SLOT} ]] && ! WORKER_SLOT="$(tty | sed 's|/dev/pts/||')"; then + WORKER_SLOT=$(( RANDOM % $(nproc) + 1 )) + fi + WORKER="${USER}-${WORKER_SLOT}" + # Update pacman cache for auto-detection if [[ -z ${REPO} ]]; then update_pacman_repo_cache @@ -311,8 +323,9 @@ pkgctl_build() { fi # print gathered build modes - msg2 "repo: ${pkgrepo}" - msg2 "arch: ${BUILD_ARCH[*]}" + msg2 " repo: ${pkgrepo}" + msg2 " arch: ${BUILD_ARCH[*]}" + msg2 "worker: ${WORKER}" # increment pkgrel on rebuild if (( REBUILD )); then |