index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
diff --git a/bin/bootstrap-mysql b/bin/bootstrap-mysql index c3d7080..f05ffe8 100755 --- a/bin/bootstrap-mysql +++ b/bin/bootstrap-mysql @@ -2,8 +2,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" exec 9> "${build_list_lock_file}" if ! verbose_flock -n 9; then diff --git a/bin/build-master-status b/bin/build-master-status index d1382c7..c019a37 100755 --- a/bin/build-master-status +++ b/bin/build-master-status @@ -4,8 +4,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" tmp_dir=$(mktemp -d 'tmp.build-master-status.XXXXXXXXXX' --tmpdir) trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT diff --git a/bin/build-packages b/bin/build-packages index 3d5d2d1..da0ed16 100755 --- a/bin/build-packages +++ b/bin/build-packages @@ -6,8 +6,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # TODO: build other 'architectures', too (pentium4, i486) diff --git a/bin/check-bugtracker b/bin/check-bugtracker index 75f4995..53d8ffb 100755 --- a/bin/check-bugtracker +++ b/bin/check-bugtracker @@ -6,8 +6,8 @@ # shellcheck disable=SC2039,SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" bug_list=$( curl -LSs 'https://bugs.archlinux32.org/index.php?export_list=Export%20Tasklist' | \ diff --git a/bin/check-db-structure b/bin/check-db-structure index 7354bf4..436ce00 100755 --- a/bin/check-db-structure +++ b/bin/check-db-structure @@ -2,8 +2,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # stored functions diff --git a/bin/check-opcodes b/bin/check-opcodes index feaffc3..5965d50 100755 --- a/bin/check-opcodes +++ b/bin/check-opcodes @@ -2,8 +2,8 @@ # shellcheck disable=SC2086,SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" usage( ) { >&2 cat <<EOF diff --git a/bin/clean-cache b/bin/clean-cache index 251d1de..b83e30f 100755 --- a/bin/clean-cache +++ b/bin/clean-cache @@ -2,8 +2,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" if [ $# -eq 0 ]; then dummynator='sudo' diff --git a/bin/clean-git b/bin/clean-git index 9c27958..03e4701 100755 --- a/bin/clean-git +++ b/bin/clean-git @@ -4,8 +4,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" for repo in ${repo_names}; do eval 'repo_path="${repo_paths__'"${repo}"'}"' diff --git a/bin/cleanup b/bin/cleanup index 2ee6397..09a823b 100755 --- a/bin/cleanup +++ b/bin/cleanup @@ -4,8 +4,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # TODO: clean database, too diff --git a/bin/copy-to-build-support b/bin/copy-to-build-support index fc79055..9253fd8 100755 --- a/bin/copy-to-build-support +++ b/bin/copy-to-build-support @@ -6,8 +6,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # shellcheck disable=SC2016 usage() { diff --git a/bin/db-update b/bin/db-update index 2351c77..33a1436 100755 --- a/bin/db-update +++ b/bin/db-update @@ -19,8 +19,8 @@ # shellcheck disable=SC2039,SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # shellcheck disable=SC2016 usage() { diff --git a/bin/delete-packages b/bin/delete-packages index 0065752..116b12d 100755 --- a/bin/delete-packages +++ b/bin/delete-packages @@ -11,8 +11,8 @@ # shellcheck disable=SC2039,SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # TODO: delete other to-be-deleted packages if asked to do so diff --git a/bin/filter-build-logs b/bin/filter-build-logs index fb71154..9671376 100755 --- a/bin/filter-build-logs +++ b/bin/filter-build-logs @@ -4,8 +4,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" { printf '%s\n' \ diff --git a/bin/find-obsolete-packages b/bin/find-obsolete-packages index c965447..a5372a9 100755 --- a/bin/find-obsolete-packages +++ b/bin/find-obsolete-packages @@ -2,8 +2,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" usage() { >&2 echo '' diff --git a/bin/get-assignment b/bin/get-assignment index 1c67279..ba80798 100755 --- a/bin/get-assignment +++ b/bin/get-assignment @@ -14,8 +14,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # TODO: honor manual build order of tool-chain: # toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc diff --git a/bin/get-package-updates b/bin/get-package-updates index 59ec019..cfc0f74 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -6,8 +6,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # TODO: Find out, why sometimes package updates are missed. diff --git a/bin/ii-answer b/bin/ii-answer index 1e30ec1..f7c2d20 100755 --- a/bin/ii-answer +++ b/bin/ii-answer @@ -4,8 +4,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # welcome devs (in #archlinux32 only) welcome_user_regex='^\S\+ -!- \(abaumann\|deep42thought\|tyzoid\|phrik\)(.* has joined \S\+$' diff --git a/bin/ii-connect b/bin/ii-connect index 45eff65..4b9ecec 100755 --- a/bin/ii-connect +++ b/bin/ii-connect @@ -4,8 +4,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # start ii if it is not running if ! pgrep -x ii > /dev/null; then diff --git a/bin/interpret-mail b/bin/interpret-mail index a931cb7..e45c38f 100755 --- a/bin/interpret-mail +++ b/bin/interpret-mail @@ -2,8 +2,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # TODO: enable email interface to delete packages diff --git a/bin/modify-package-state b/bin/modify-package-state index 2ca2178..d5a201f 100755 --- a/bin/modify-package-state +++ b/bin/modify-package-state @@ -2,8 +2,8 @@ # shellcheck disable=SC2039,SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # shellcheck disable=SC2016 usage() { diff --git a/bin/ping-from-slave b/bin/ping-from-slave index 5ba8395..bb569dd 100755 --- a/bin/ping-from-slave +++ b/bin/ping-from-slave @@ -7,8 +7,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # TODO: receive/save some statistics about current build diff --git a/bin/ping-to-master b/bin/ping-to-master index 11dc7b8..3979656 100755 --- a/bin/ping-to-master +++ b/bin/ping-to-master @@ -7,8 +7,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # TODO: abort build if requested to diff --git a/bin/prioritize-build-list b/bin/prioritize-build-list index f5687e6..187cf29 100755 --- a/bin/prioritize-build-list +++ b/bin/prioritize-build-list @@ -2,8 +2,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" if [ $# -ne 1 ]; then echo 'Usage: prioritize-build-list pkg-regex' diff --git a/bin/return-assignment b/bin/return-assignment index dd13925..fdb7e1c 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -18,8 +18,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" if [ -s "${work_dir}/build-master-sanity" ]; then >&2 echo 'Build master is not sane.' diff --git a/bin/sanity-check b/bin/sanity-check index d5b86db..bfe6400 100755 --- a/bin/sanity-check +++ b/bin/sanity-check @@ -4,8 +4,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" usage() { >&2 echo '' diff --git a/bin/seed-build-list b/bin/seed-build-list index 7540f14..3a71429 100755 --- a/bin/seed-build-list +++ b/bin/seed-build-list @@ -4,8 +4,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # shellcheck disable=SC2016 usage() { diff --git a/bin/show-dependencies b/bin/show-dependencies index 111a41b..7eb4ead 100755 --- a/bin/show-dependencies +++ b/bin/show-dependencies @@ -2,8 +2,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # TODO: can this be faster? diff --git a/bin/slave-build-connect b/bin/slave-build-connect index d22597b..7d01e4c 100755 --- a/bin/slave-build-connect +++ b/bin/slave-build-connect @@ -2,8 +2,8 @@ # shellcheck disable=SC2119,SC2120 -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" if [ "x${SSH_ORIGINAL_COMMAND%% *}" = 'xget-assignment' ] || \ [ "x${SSH_ORIGINAL_COMMAND%% *}" = 'xreturn-assignment' ] || \ diff --git a/bin/why-dont-you b/bin/why-dont-you index f31c38c..7117bed 100755 --- a/bin/why-dont-you +++ b/bin/why-dont-you @@ -6,8 +6,8 @@ # investigate, why a certain operation is not done with certain packages -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" # TODO: reintrocude "keep", "stubbornly_keep", "stabilize" and "unstage" # using information from the database. diff --git a/conf/.gitignore b/conf/.gitignore index 9eef7aa..988ee56 100644 --- a/conf/.gitignore +++ b/conf/.gitignore @@ -1,2 +1,2 @@ -local.conf +*.conf admin-gpg-keys diff --git a/conf/common.conf.example b/conf/common.conf.example new file mode 100755 index 0000000..a26a82a --- /dev/null +++ b/conf/common.conf.example @@ -0,0 +1,14 @@ +#!/bin/sh + +# configurable variables used on the build slaves and on the build master +# default values are given as comments + +# To change variables from their default, copy this file to common.conf, +# uncomment and change the desired variables. + +#work_dir="${base_dir}/work" + +#repo_names='packages community archlinux32' +#repo_paths__packages="${work_dir}/repos/packages" +#repo_paths__community="${work_dir}/repos/community" +#repo_paths__archlinux32="${work_dir}/repos/packages32" diff --git a/conf/master.conf.example b/conf/master.conf.example new file mode 100755 index 0000000..4e708f3 --- /dev/null +++ b/conf/master.conf.example @@ -0,0 +1,50 @@ +#!/bin/sh + +# configurable variables used on the build master +# default values are given as comments + +# To change variables from their default, copy this file to common.conf, +# uncomment and change the desired variables. + +#repo_key='0xdeadbeef' + +# to access the master mirror via rsync +#master_mirror_rsync_command='rsync --password-file=/home/slave/rsync.password' +#master_mirror_rsync_directory='rsync://buildmaster@mirror.archlinux32.org/packages32' + +# to access the master mirror via sftp +#master_mirror_sftp_command='sftp -b- user@mirror' + +# root directory of the webserver +#webserver_directory='/srv/http' + +# directory to keep the build log files in +#build_log_directory='/srv/http/build-logs' + +# known package repositories +#standalone_package_repositories=$( +# printf '%s\n' 'build-support' 'gnome-unstable' 'kde-unstable' +#) +#stable_package_repositories=$( +# printf '%s\n' 'community' 'core' 'extra' +#) +#testing_package_repositories=$( +# printf '%s\n' 'community-testing' 'testing' +#) +#staging_package_repositories=$( +# printf '%s\n' 'community-staging' 'staging' +#) + +# irc client configuration +#irc_dir='/home/slave/irc/irc.freenode.net' +#irc_password='top_secret' + +# list of urls to trigger updates of the respective mirrors +#mirror_refresh_trigger_urls='' + +# command to access the mysql database +#mysql_command='mysql buildmaster' + +#build_list_lock_file="${work_dir}/build-list.lock" +#sanity_check_lock_file="${work_dir}/sanity-check.lock" +#package_database_lock_file="${work_dir}/package-database.lock" diff --git a/conf/slave.conf.example b/conf/slave.conf.example new file mode 100755 index 0000000..cda556b --- /dev/null +++ b/conf/slave.conf.example @@ -0,0 +1,33 @@ +#!/bin/sh + +# configurable variables used on the build slaves +# default values are given as comments + +# To change variables from their default, copy this file to common.conf, +# uncomment and change the desired variables. + +#master_build_server="buildmaster.archlinux32.org" +#master_build_server_port="22" +#master_build_server_user="slave" +#master_build_server_identity="${work_dir}/.ssh/id_rsa" + +#package_key='0x15eebadc0de' + +# mirror of sources, identified (solely) by hash +#source_by_hash_mirror='http://sources.archlinux32.org/' + +# what should be tried in what order to somehow repair a broken build +#straws_that_might_repair_failing_builds=$( +# printf '%s\n' \ +# ':' \ +# ':clean_chroot:' \ +# ':mirrored_source_by_hash:' \ +# ':mirrored_source:' \ +# ':with_build_support:' \ +# ':with_build_support:clean_chroot:' +#) + +# commands to run to update the i686 package mirror used for installing i686 packages, +# e.g. the one from /etc/pacman.d/mirrorlist32 (useful on build slaves which do not +# have the master mirror in the mirrorlist32) +#mirror_update_command='' diff --git a/lib/common-functions b/lib/common-functions index 43c6878..bf4306a 100755 --- a/lib/common-functions +++ b/lib/common-functions @@ -6,7 +6,7 @@ if [ -z "${base_dir}" ]; then # just to make shellcheck happy - . '../conf/default.conf' + . '../lib/load-configuration' fi # find_pkgbuilds package repository git_repository git_revision mod_git_revision diff --git a/conf/default.conf b/lib/load-configuration index daa1955..095cadd 100755 --- a/conf/default.conf +++ b/lib/load-configuration @@ -1,16 +1,12 @@ #!/bin/sh -# set up some common variables +# load global variables # shellcheck disable=SC2034 set -e export LANG=C -# TODO: This should become lib/load-configuration to avoid confusion. -# Additionally, there should be conf/common.conf.example, -# conf/master.conf.example and conf/slave.conf.example. - # dirty hack to get this stuff debugable from a bash if [ "x${0##*/}" = "x-bash" ] || [ "x${0##*/}" = "xbash" ] || [ "x${0##*/}" = "xdash" ]; then base_dir=$(pwd) @@ -27,8 +23,11 @@ work_dir="${base_dir}/work" # lib/mysql-functions or we're on the build master and something is wrong # anyway if pgrep -x mysqld >/dev/null 2>&1; then + i_am_the_master=true # shellcheck source=../lib/mysql-functions . "${base_dir}/lib/mysql-functions" +else + i_am_the_master=false fi # TODO: some of this should be read from the database instead @@ -103,8 +102,22 @@ mysql_command='mysql buildmaster' # possibly pull in custom modifications -# shellcheck source=/dev/null -[ -r "${base_dir}/conf/local.conf" ] && . "${base_dir}/conf/local.conf" +if [ -r "${base_dir}/conf/common.conf" ]; then + # shellcheck source=/dev/null + "${base_dir}/conf/common.conf" +fi + +if ${i_am_the_master} && \ + [ -r "${base_dir}/conf/master.conf" ]; then + # shellcheck source=/dev/null + . "${base_dir}/conf/master.conf" +fi + +if ! ${i_am_the_master} && \ + [ -r "${base_dir}/conf/slave.conf" ]; then + # shellcheck source=/dev/null + . "${base_dir}/conf/slave.conf" +fi # check / set up environment diff --git a/lib/mysql-functions b/lib/mysql-functions index a85d97f..4a719a8 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -6,7 +6,7 @@ if [ -z "${base_dir}" ]; then # just to make shellcheck happy - . '../conf/default.conf' + . '../lib/load-configuration' fi # TODO: replace most/all insert-select queries by separate select and insert |