smeserver-koji/koji-setup/koji-bootstrap-build.sh

108 lines
5.5 KiB
Bash
Raw Normal View History

2023-09-04 03:01:52 +02:00
#!/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
2023-09-04 12:30:28 +02:00
set -xe
2023-09-04 03:01:52 +02:00
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
2023-10-18 00:31:59 +02:00
# for RELEASE in (10 11) ; do
# PKGMANAGER = "dnf"
# if [[ $RELEASE == 10 ]] ; then PKGMANAGER = "yum" ; fi
# for REPO in (os contribs addons updates updates-testing testing) ; do
# TAG = "sme$RELEASE-$REPO"
# sudo -u kojiadmin koji add-tag dist-"$TAG"
# sudo -u kojiadmin koji edit-tag dist-"$TAG" -x mock.package_manager=$PKGMANAGER
2023-09-11 07:39:19 +02:00
for TAG in ${TAG_NAME} ; do
sudo -u kojiadmin koji add-tag dist-"$TAG"
2023-10-15 02:22:13 +02:00
if [[ $TAG == "smeos10" || $TAG == "smecontribs10" ]] ; then
sudo -u kojiadmin koji edit-tag dist-"$TAG" -x mock.package_manager=yum
else
sudo -u kojiadmin koji edit-tag dist-"$TAG" -x mock.package_manager=dnf
fi
2023-09-11 07:39:19 +02:00
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
2023-10-15 02:22:13 +02:00
if [[ $TAG == "smeos10" || $TAG == "smecontribs10" ]] ; then
2023-10-18 00:31:59 +02:00
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build os http://buildsys.koozali.org/build/7/os/\$arch/
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build updates http://buildsys.koozali.org/build/7/updates/\$arch/
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build smeos http://buildsys.koozali.org/build/10/smeos/\$arch/
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build smeupdates http://buildsys.koozali.org/build/10/smeupdates/\$arch/
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build fastrack http://buildsys.koozali.org/build/7/fastrack/\$arch/
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build opt1 http://buildsys.koozali.org/build/7/opt1/\$arch/
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build opt2 http://buildsys.koozali.org/build/7/opt2/\$arch/
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build opt3 http://buildsys.koozali.org/build/7/opt3/\$arch/
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build epel http://download.fedoraproject.org/pub/epel/7/\$arch/
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build openfusion http://repo.openfusion.net/centos7-\$arch/
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build rpmfusion http://download1.rpmfusion.org/free/el/updates/7/\$arch/
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build sclo-sclo http://mirror.centos.org/centos/7/sclo/\$arch/sclo
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build sclo-rh http://mirror.centos.org/centos/7/sclo/\$arch/rh
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build buildsys-core http://buildsys.koozali.org/build/10/smeserver-core/\$arch/
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build buildsys-contribs http://buildsys.koozali.org/build/10/smeserver-contribs/\$arch/
sudo -u kojiadmin koji add-external-repo -t dist-smeos10-build groups http://buildsys.koozali.org/build/10/smeserver-groups/\$arch/
2023-10-15 02:22:13 +02:00
elif [[ -n "$EXTERNAL_REPO" ]]; then
2023-09-11 07:39:19 +02:00
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