diff --git a/install-koji-farm.sh b/install-koji-farm.sh index 08167d8..8c116d7 100644 --- a/install-koji-farm.sh +++ b/install-koji-farm.sh @@ -73,7 +73,7 @@ KOJID_CAPACITY=16 SRC_RPM_DIR= BIN_RPM_DIR= DEBUG_RPM_DIR= -EXTERNAL_REPO="http://mirrorlist.centos.org/releases/10/smeos/" +EXTERNAL_REPO="http://buildsys.koozali.org/build/7/os/\$arch/" # create the parameter script used by koji scripts cat > $SCRIPT_DIR/koji-parameters.sh <<- EOT diff --git a/koji-setup/koji-bootstrap-build.sh b/koji-setup/koji-bootstrap-build.sh new file mode 100755 index 0000000..1caaa36 --- /dev/null +++ b/koji-setup/koji-bootstrap-build.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# SPDX-License-Identifier: Apache-2.0 + +set -e +DEBUG= +SILENT="-s" +QUIET="-q" +for param in $1 $2 ; do + if [ $param ] ; then + case $param in + debug ) + DEBUG="debug" ;; + esac + else + break + fi +done + +if [ $DEBUG ] ; then + set -x + SILENT= + QUIET="-v" +fi + +# load required parameters +SCRIPT_DIR="$(dirname "$(realpath "$0")")" +if [ ! -f "$SCRIPT_DIR"/koji-parameters.sh ] ; then + echo "$SCRIPT_DIR/koji-parameters.sh NOT found - aborting" + exit 1 +fi +source "$SCRIPT_DIR"/koji-parameters.sh + +STAGING_RPM_DIR="$KOJI_DIR/work/imported-rpms" +STAGING_RPM_SRC_DIR="$STAGING_RPM_DIR/src" +STAGING_RPM_BIN_DIR="$STAGING_RPM_DIR/bin" +STAGING_RPM_DEBUG_DIR="$STAGING_RPM_DIR/debug" + +import_koji_pkg() { + local src_dir="$1" + local dst_dir="$2" + local search_pattern="$3" + cp -r "$src_dir" "$dst_dir" + chown -R "$HTTPD_USER":"$HTTPD_USER" "$dst_dir" + find "$dst_dir" -name "$search_pattern" -exec koji import --link {} + > /dev/null +} + +if [[ -n "$SRC_RPM_DIR" && -n "$BIN_RPM_DIR" ]]; then + ADMIN_KOJI_DIR="$(echo ~kojiadmin)/.koji" + cp -r "$ADMIN_KOJI_DIR" "$HOME/.koji" + mkdir -p "$STAGING_RPM_DIR" + chown -R "$HTTPD_USER":"$HTTPD_USER" "$STAGING_RPM_DIR" + + import_koji_pkg "$SRC_RPM_DIR" "$STAGING_RPM_SRC_DIR" "*.src.rpm" + import_koji_pkg "$BIN_RPM_DIR" "$STAGING_RPM_BIN_DIR" "*.$RPM_ARCH.rpm" + if [[ -n "$DEBUG_RPM_DIR" ]]; then + import_koji_pkg "$DEBUG_RPM_DIR" "$STAGING_RPM_DEBUG_DIR" "*.$RPM_ARCH.rpm" + fi + + 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 diff --git a/koji-setup/koji-parameters.sh b/koji-setup/koji-parameters.sh index 156d74d..21f3bfd 100644 --- a/koji-setup/koji-parameters.sh +++ b/koji-setup/koji-parameters.sh @@ -25,7 +25,7 @@ export SRC_RPM_DIR= export BIN_RPM_DIR= export DEBUG_RPM_DIR= # Comment the following if supplying all RPMs as an upstream and not a downstream -export EXTERNAL_REPO=http://mirrorlist.centos.org/releases/10/smeos/ +export EXTERNAL_REPO=hhttp://buildsys.koozali.org/build/7/os/\$arch/ ## POSTGRESQL DATABASE export POSTGRES_DIR=/var/lib/pgsql