summaryrefslogtreecommitdiff
path: root/bin/build-packages
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-10-24 13:46:13 +0200
committerErich Eckner <git@eckner.net>2017-10-24 13:46:13 +0200
commit9f16621f04457bca9ac720ed542fe4626d344a1f (patch)
tree3fc4cb98b2baea554b38eb12a7ea308489fbf9bb /bin/build-packages
parent62ae0182ea898f88445d9402010c3e0d9194d0f5 (diff)
downloadbuilder-9f16621f04457bca9ac720ed542fe4626d344a1f.tar.xz
bin/build-packages, bin/get-assignment: add options to prefer a build order
Diffstat (limited to 'bin/build-packages')
-rwxr-xr-xbin/build-packages22
1 files changed, 19 insertions, 3 deletions
diff --git a/bin/build-packages b/bin/build-packages
index b06a1c7..2c326fa 100755
--- a/bin/build-packages
+++ b/bin/build-packages
@@ -17,11 +17,15 @@ usage() {
>&2 echo ' -l|--local pkgname.git-revision.git-mod-revision.repository:'
>&2 echo ' Build the given package without asking / reporting to the'
>&2 echo ' build master (except -u is given). Cannot be combined with'
- >&2 echo ' -n, -t or -x.'
+ >&2 echo ' -n, -p, -t or -x.'
>&2 echo ' -n count: Build $count packages (if available), then exit.'
>&2 echo ' $count=0 is interpreted as infinity.'
>&2 echo ' The default is $count=1 or 0 iff -t or -x is given.'
>&2 echo ' Cannot be combined with -l.'
+ >&2 echo ' -p|--prefer pkgname:'
+ >&2 echo ' Ask the build master to get an assignment for the given'
+ >&2 echo ' package but built what is offered anyway. Cannot be combined'
+ >&2 echo ' with -l.'
>&2 echo ' -s|--straw $straw:'
>&2 echo ' Use this straw instead of the preconfigured ones. -- May be'
>&2 echo ' given multiple times to allow using multiple straws.'
@@ -35,9 +39,10 @@ usage() {
}
eval set -- "$(
- getopt -o hl:n:s:t:ux \
+ getopt -o hl:n:p:s:t:ux \
--long help \
--long local: \
+ --long prefer: \
--long straw: \
--long upload \
-n "$(basename "$0")" -- "$@" || \
@@ -47,6 +52,7 @@ eval set -- "$(
unset count
unset forced_package
unset forced_straws
+unset prefered_package
exit_after_failure=false
upload_to_build_master=false
timeout=0
@@ -71,6 +77,14 @@ do
[ "${count}" -eq 0 ] && \
count=-1
;;
+ -p|--prefer)
+ shift
+ if [ -n "${prefered_package}" ]; then
+ >&2 echo 'Option -p, --prefer can be given only once.'
+ usage
+ fi
+ prefered_package="$1"
+ ;;
-s|--straw)
shift
forced_straws="${forced_straws} $1"
@@ -105,6 +119,7 @@ fi
if [ -n "${forced_package}" ]; then
if [ -n "${count}" ] || \
[ "${timeout}" -ne 0 ] || \
+ [ -n "${prefered_package}" ] || \
${exit_after_failure}; then
>&2 echo 'Conflicting flags.'
usage
@@ -143,11 +158,12 @@ while [ "${count}" -ne 0 ]; do
err=0
if [ -z "${forced_package}" ]; then
package=$(
+ # shellcheck disable=SC2029
ssh \
-i "${master_build_server_identity}" \
-p "${master_build_server_port}" \
"${master_build_server_user}@${master_build_server}" \
- 'get-assignment'
+ 'get-assignment' "${prefered_package}"
) || err=$?
else
package=$(