From 557db9ba1ed2223ad0fa31f508abd025152bf0d7 Mon Sep 17 00:00:00 2001 From: Trevor Batley Date: Mon, 11 Sep 2023 15:39:19 +1000 Subject: [PATCH] move routine before call --- install-koji-farm.sh | 59 +++++++++++++++--------------- koji-setup/koji-bootstrap-build.sh | 34 +++++++++-------- 2 files changed, 47 insertions(+), 46 deletions(-) diff --git a/install-koji-farm.sh b/install-koji-farm.sh index c340a7e..56d5d60 100644 --- a/install-koji-farm.sh +++ b/install-koji-farm.sh @@ -176,36 +176,6 @@ EOF fi # add builders -# if builders added as command line parameters, use those -if [ $KOJI_BUILD_FQDN ] ; then - for FQDN in ${KOJI_HUB_FQDN} ; do - deploy_builder $FQDN - done -else -# otherwise prompt for builders - echo "We will now deploy koji to your build servers" - MSG="Press to use your hub ($KOJI_HUB_FQDN), or enter the FQDN of your first build server) " - BSNO=1 - while true ; do - read -p "Build Server FQDN: " FQDN - MSG="Add another Build Server (will stop asking if left blank) " - if [ -z $FQDN ] ; then - # if blank the first time add builder to the hub - if [[ $BSNO -gt 1 ]] ; then - break - else - FQDN=$KOJI_HUB_FQDN - fi - fi - deploy_builder $FQDN - ((BSNO=BSNO+1)) - done -fi -# -koji-bootstrap-build.sh - -exit 0 - deploy_builder () { local FQDN=$1 # check if server available on port 22 @@ -244,3 +214,32 @@ deploy_builder () { # we found the server and will deploy to it koji-add-builder.sh $FQDN $DEBUG } + +# if builders added as command line parameters, use those +if [ $KOJI_BUILD_FQDN ] ; then + for FQDN in ${KOJI_HUB_FQDN} ; do + deploy_builder $FQDN + done +else +# otherwise prompt for builders + echo "We will now deploy koji to your build servers" + MSG="Press to use your hub ($KOJI_HUB_FQDN), or enter the FQDN of your first build server) " + BSNO=1 + while true ; do + read -p "Build Server FQDN: " FQDN + MSG="Add another Build Server (will stop asking if left blank) " + if [ -z $FQDN ] ; then + # if blank the first time add builder to the hub + if [[ $BSNO -gt 1 ]] ; then + break + else + FQDN=$KOJI_HUB_FQDN + fi + fi + deploy_builder $FQDN + ((BSNO=BSNO+1)) + done +fi + +# +koji-bootstrap-build.sh diff --git a/koji-setup/koji-bootstrap-build.sh b/koji-setup/koji-bootstrap-build.sh index 61453b9..eaf3a32 100755 --- a/koji-setup/koji-bootstrap-build.sh +++ b/koji-setup/koji-bootstrap-build.sh @@ -58,19 +58,21 @@ if [[ -n "$SRC_RPM_DIR" && -n "$BIN_RPM_DIR" ]]; then rm -rf "$STAGING_RPM_DIR" "$HOME/.koji" fi -sudo -u kojiadmin koji add-tag dist-"$TAG_NAME" -sudo -u kojiadmin koji edit-tag dist-"$TAG_NAME" -x mock.package_manager=dnf -if [[ -n "$SRC_RPM_DIR" && -n "$BIN_RPM_DIR" ]]; then - sudo -u kojiadmin koji list-pkgs --quiet | xargs sudo -u kojiadmin koji add-pkg --owner kojiadmin dist-"$TAG_NAME" - sudo -u kojiadmin koji list-untagged | xargs -n 1 -P 100 sudo -u kojiadmin koji call tagBuildBypass dist-"$TAG_NAME" > /dev/null -fi -sudo -u kojiadmin koji add-tag --parent dist-"$TAG_NAME" --arches "$RPM_ARCH" dist-"$TAG_NAME"-build -sudo -u kojiadmin koji add-target dist-"$TAG_NAME" dist-"$TAG_NAME"-build -sudo -u kojiadmin koji add-group dist-"$TAG_NAME"-build build -sudo -u kojiadmin koji add-group dist-"$TAG_NAME"-build srpm-build -sudo -u kojiadmin koji add-group-pkg dist-"$TAG_NAME"-build build autoconf automake automake-dev binutils bzip2 clr-rpm-config coreutils cpio diffutils elfutils file gawk gcc gcc-dev gettext gettext-bin git glibc-dev glibc-locale glibc-utils grep gzip hostname libc6-dev libcap libtool libtool-dev linux-libc-headers m4 make netbase nss-altfiles patch pigz pkg-config pkg-config-dev rpm sed shadow systemd-lib tar unzip which xz -sudo -u kojiadmin koji add-group-pkg dist-"$TAG_NAME"-build srpm-build coreutils cpio curl-bin elfutils file git glibc-utils grep gzip make pigz plzip rpm sed shadow tar unzip wget xz -if [[ -n "$EXTERNAL_REPO" ]]; then - sudo -u kojiadmin koji add-external-repo -t dist-"$TAG_NAME"-build dist-"$TAG_NAME"-external-repo "$EXTERNAL_REPO" -fi -sudo -u kojiadmin koji regen-repo dist-"$TAG_NAME"-build +for TAG in ${TAG_NAME} ; do + sudo -u kojiadmin koji add-tag dist-"$TAG" + sudo -u kojiadmin koji edit-tag dist-"$TAG" -x mock.package_manager=dnf + if [[ -n "$SRC_RPM_DIR" && -n "$BIN_RPM_DIR" ]]; then + sudo -u kojiadmin koji list-pkgs --quiet | xargs sudo -u kojiadmin koji add-pkg --owner kojiadmin dist-"$TAG" + sudo -u kojiadmin koji list-untagged | xargs -n 1 -P 100 sudo -u kojiadmin koji call tagBuildBypass dist-"$TAG" > /dev/null + fi + sudo -u kojiadmin koji add-tag --parent dist-"$TAG" --arches "$RPM_ARCH" dist-"$TAG"-build + sudo -u kojiadmin koji add-target dist-"$TAG" dist-"$TAG"-build + sudo -u kojiadmin koji add-group dist-"$TAG"-build build + sudo -u kojiadmin koji add-group dist-"$TAG"-build srpm-build + sudo -u kojiadmin koji add-group-pkg dist-"$TAG"-build build autoconf automake automake-dev binutils bzip2 clr-rpm-config coreutils cpio diffutils elfutils file gawk gcc gcc-dev gettext gettext-bin git glibc-dev glibc-locale glibc-utils grep gzip hostname libc6-dev libcap libtool libtool-dev linux-libc-headers m4 make netbase nss-altfiles patch pigz pkg-config pkg-config-dev rpm sed shadow systemd-lib tar unzip which xz + sudo -u kojiadmin koji add-group-pkg dist-"$TAG"-build srpm-build coreutils cpio curl-bin elfutils file git glibc-utils grep gzip make pigz plzip rpm sed shadow tar unzip wget xz + if [[ -n "$EXTERNAL_REPO" ]]; then + sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build dist-"$TAG"-external-repo "$EXTERNAL_REPO" + fi + sudo -u kojiadmin koji regen-repo dist-"$TAG"-build +done