index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2017-04-23 17:02:43 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-04-23 17:02:43 +0200 |
commit | 502c397de443a82bf9231efbb0c6f583f5326dc3 (patch) | |
tree | 77ec15a99be6039b1ba1b98c7f99d791f488f1c6 | |
parent | 61512d1f05d0c6e98e0f9114bd099ba29495b26c (diff) |
-rwxr-xr-x | bin/build-packages | 101 | ||||
-rwxr-xr-x | bin/slave-build-connect | 9 | ||||
-rwxr-xr-x | conf/default.conf | 5 |
diff --git a/bin/build-packages b/bin/build-packages new file mode 100755 index 0000000..16b895b --- /dev/null +++ b/bin/build-packages @@ -0,0 +1,101 @@ +#!/bin/bash + +# build packages one by one, then upload the binary package to the repository server +# Details: +# https://github.com/archlinux32/builder/wiki/Build-system#build-packages + +# TODOs: +# include package customizations +# handle failed builds +# actually upload the package +# use different build commands for different repositories +# sign packages + +. "${0%/*}/../conf/default.conf" + +while true; do + + package="$( + ssh \ + -i "${master_build_server_identity}" \ + -p "${master_build_server_port}" \ + "${master_build_server_user}@${master_build_server}" \ + 'get-assignment' + )" + + case $? in + + # 0: ok, I gave you an assignment + 0) + repository="${package##* }" + package="${package% *}" + git_revision="${package##* }" + package="${package% *}" + + # Update git repositories (official packages, community packages and the repository of package customizations). + + for repo in "${repo_paths[@]}"; do + git -C "${repo}" clean -df + git -C "${repo}" checkout master + git -C "${repo}" pull + git -C "${repo}" checkout "${git_revision}" &> /dev/null || true + done + + PKGBUILD="$(find_pkgbuild "${package}" "${repository}")" + + if [ ! -r "${PKGBUILD}" ]; then + echo "can't find PKGBUILD to package '${package}' from repository '${repository}': '${PKGBUILD}'" + exit 1 + fi + + ( + cd "${PKGBUILD%/*}" + extra-i686-build + ) + # imagine a blinking cursor here + >&2 echo 'whoops, end of program reached.' + exit 42 + + ;; + + # 1: come back (shortly) later - I was running already + 1) + sleep $[15+$RANDOM%30] + continue + ;; + + # 2: come back later - there are still packages to be built, + # but currently none has all its dependencies ready + 2) + sleep $[60+$RANDOM%30] + continue + ;; + + # 3: come back after the next run of get-package-updates - currently + # there are no pending packages + 3) + + >&2 echo 'Done. No more packages left to build.' + exit 0 + + ;; + + # 4: come back, when you've done your work - you hit the limit on + # maximum allowed parallel jobs per ip + 4) + + >&2 echo 'ERROR: There are too many parallel builds running on this machine.' + exit 1 + + ;; + + *) + + >&2 echo "ERROR: Unknown exit code $?." + exit 1 + + ;; + + esac + +done diff --git a/bin/slave-build-connect b/bin/slave-build-connect new file mode 100755 index 0000000..4fff765 --- /dev/null +++ b/bin/slave-build-connect @@ -0,0 +1,9 @@ +#!/bin/bash + +. "${0%/*}/../conf/default.conf" + +if [ "${SSH_ORIGINAL_COMMAND% *}" == "get-assignment" ]; then + /bin/bash -c "${base_dir}/bin/${SSH_ORIGINAL_COMMAND}" "$@" +else + >&2 echo "Invalid command: ${SSH_ORIGINAL_COMMAND} $@" +fi diff --git a/conf/default.conf b/conf/default.conf index 9da159c..108b517 100755 --- a/conf/default.conf +++ b/conf/default.conf @@ -17,6 +17,11 @@ repo_paths["archlinux32"]="${work_dir}/repos/packages32" lock_file="/tmp/${0##*/}.lock" +master_build_server="master.build.server" +master_build_server_port="22" +master_build_server_user="build-user" +master_build_server_identity="${work_dir}/.ssh/id_rsa" + max_parallel_build_per_client=2 # possibly pull in custom modifications |