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

230 lines
14 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-12-03 03:45:34 +01:00
# Koozali is the Packager and Vendor
2023-12-03 03:44:13 +01:00
PACKAGER="Koozali.org <http://www.koozali.org>"
VENDOR="Koozali.org <http://www.koozali.org>"
2023-11-06 10:51:04 +01:00
# Setup sme10 for building - based on centos 7 (el7)
2023-11-03 12:02:03 +01:00
# sme10-os is the parent - all other sme10 repos will inherit most of this...
2024-07-18 03:51:48 +02:00
RELEASE="sme10"
2023-11-06 10:23:40 +01:00
DISTRIBUTION="SME Server v$RELEASE"
2024-07-18 03:51:48 +02:00
TAG="$RELEASE-os"
PARENT="$TAG"
2023-11-06 10:53:15 +01:00
DIST=".el7.sme"
2023-11-03 22:44:50 +01:00
PKGMANAGER="yum"
BOOTSTRAPIMAGE="centos:7"
2024-03-06 00:28:29 +01:00
sudo -u kojiadmin koji add-tag --arches="$RPM_ARCH" dist-"$TAG"
sudo -u kojiadmin koji edit-tag dist-"$TAG" -x mock.package_manager=$PKGMANAGER
2023-11-06 11:04:48 +01:00
sudo -u kojiadmin koji edit-tag -x mock.bootstrap_image="$BOOTSTRAPIMAGE" dist-"$TAG"
sudo -u kojiadmin koji edit-tag -x mock.chroot_setup_cmd="$CHROOTSETUPCMD" dist-"$TAG"
sudo -u kojiadmin koji edit-tag -x rpm.macro.distribution="$DISTRIBUTION" dist-"$TAG"
sudo -u kojiadmin koji edit-tag -x rpm.macro.dist="$DIST" dist-"$TAG"
2023-12-03 03:44:13 +01:00
sudo -u kojiadmin koji edit-tag -x rpm.macro.packager="$PACKAGER" dist-"$TAG"
sudo -u kojiadmin koji edit-tag -x rpm.macro.vendor="$VENDOR" dist-"$TAG"
2024-07-18 03:51:48 +02:00
# add build tag for all $RELEASE targets
BUILDTAG="dist-$RELEASE-build"
sudo -u kojiadmin koji add-group "$BUILDTAG" build
sudo -u kojiadmin koji add-group "$BUILDTAG" srpm-build
sudo -u kojiadmin koji add-group-pkg "$BUILDTAG" build install scl-utils-build python27-build epel-rpm-macros bash bzip2 coreutils cpio diffutils findutils gawk gcc gcc-c++ grep gzip info make patch redhat-rpm-config rpm-build sed shadow-utils tar unzip util-linux which yum-utils xz
sudo -u kojiadmin koji add-group-pkg "$BUILDTAG" srpm-build rpm-build coreutils cpio curl-bin elfutils file git git-lfs glibc-utils grep gzip make pigz plzip rpm sed shadow tar unzip wget xz
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" os http://buildsys.koozali.org/build/7/os/\$arch/
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" updates http://buildsys.koozali.org/build/7/updates/\$arch/
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" smeos http://buildsys.koozali.org/build/10/smeos/\$arch/
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" smeupdates http://buildsys.koozali.org/build/10/smeupdates/\$arch/
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" fastrack http://buildsys.koozali.org/build/7/fastrack/\$arch/
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" opt1 http://buildsys.koozali.org/build/7/opt1/\$arch/
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" opt2 http://buildsys.koozali.org/build/7/opt2/\$arch/
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" opt3 http://buildsys.koozali.org/build/7/opt3/\$arch/
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" epel http://download.fedoraproject.org/pub/epel/7/\$arch/
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" openfusion http://repo.openfusion.net/centos7-\$arch/
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" rpmfusion http://download1.rpmfusion.org/free/el/updates/7/\$arch/
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" sclo-sclo http://mirror.centos.org/centos/7/sclo/\$arch/sclo
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" sclo-rh http://mirror.centos.org/centos/7/sclo/\$arch/rh
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" buildsys-core http://buildsys.koozali.org/build/10/smeserver-core/\$arch/
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" buildsys-contribs http://buildsys.koozali.org/build/10/smeserver-contribs/\$arch/
sudo -u kojiadmin koji add-external-repo -t "$BUILDTAG" groups http://buildsys.koozali.org/build/10/smeserver-groups/\$arch/
sudo -u kojiadmin koji regen-repo dist-"$BUILDTAG" --nowait
2024-04-01 13:05:12 +02:00
# add the build tag for this RELEASE (parent is the os target)
2024-07-18 03:51:48 +02:00
sudo -u kojiadmin koji add-tag --parent dist-"$TAG" --arches="$RPM_ARCH" "$BUILDTAG"
sudo -u kojiadmin koji add-target "$TAG" "$BUILDTAG" dist-"$TAG"
2024-03-06 00:28:29 +01:00
# Add in all packages that make up this repo
# do an api call against gitea to list all the repos in smeserver organisation
# sudo -u kojiadmin koji add-pkg dist-"$TAG" $pkglist
# setup the rest of the sme10 repos
2024-07-18 03:51:48 +02:00
for REPO in contribs contribs-testing addons updates updates-testing testing ; do
TAG="$RELEASE-$REPO"
sudo -u kojiadmin koji add-tag --parent dist-"$PARENT" dist-"$TAG"
2023-09-11 07:39:19 +02:00
done
2024-07-18 03:51:48 +02:00
# set up the smeserver and smecontribs targets (i.e. Only build to testing for smeos and smecontribs - others are staging)
sudo -u kojiadmin koji add-target $RELEASE-test dist-"$BUILDTAG" "dist-$RELEASE-testing"
sudo -u kojiadmin koji add-target $RELEASE-contribs-test dist-"$BUILDTAG" "dist-$RELEASE-contribs-testing"
2023-11-06 03:55:26 +01:00
2024-03-08 08:06:16 +01:00
# Release sme11 is based on Rocky 8 (EL8)
2024-04-01 13:05:12 +02:00
RELEASE="sme11"
2024-03-08 08:14:12 +01:00
DISTRIBUTION="SME Server v$RELEASE"
2024-07-18 03:51:48 +02:00
TAG="$RELEASE-os"
2024-04-01 13:05:12 +02:00
PARENT="$TAG"
2023-11-03 22:44:50 +01:00
EL="8"
2023-11-06 10:53:15 +01:00
DIST=".el$EL.sme"
2023-11-06 10:23:40 +01:00
PKGMANAGER="dnf"
BOOTSTRAPIMAGE="rockylinux:$EL"
2024-03-23 11:03:10 +01:00
sudo -u kojiadmin koji add-external-repo smeos$EL http://koji.koozali.org/kojifiles/repos-dist/$TAG/latest/\$arch/
2024-03-06 06:21:42 +01:00
sudo -u kojiadmin koji add-external-repo os$EL https://dl.rockylinux.org/pub/rocky/$EL/BaseOS/\$arch/os/
# mirrorList=http://mirrors.rockylinux.org/mirrorlist?release=$EL&arch=\$arch&repo=BaseOS-$EL
sudo -u kojiadmin koji add-external-repo appstream$EL https://dl.rockylinux.org/pub/rocky/$EL/AppStream/\$arch/os/
# mirrorlist = https://mirrors.rockylinux.org/mirrorlist?arch=\$arch&repo=AppStream-$EL
sudo -u kojiadmin koji add-external-repo powertools$EL https://dl.rockylinux.org/pub/rocky/$EL/PowerTools/\$arch/os/
# mirrorlist = https://mirrors.rockylinux.org/mirrorlist?arch=\$arch&repo=PowerTools-$EL
sudo -u kojiadmin koji add-external-repo epel$EL https://muug.ca/mirror/fedora-epel/$EL/Everything/\$arch/
# mirrorList=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-$EL&arch=\$arch
sudo -u kojiadmin koji add-external-repo openfusion$EL http://repo.openfusion.net/centos$EL-\$arch/
sudo -u kojiadmin koji add-external-repo rpmfusion$EL http://download1.rpmfusion.org/free/el/updates/$EL/\$arch/
2024-03-23 11:03:10 +01:00
sudo -u kojiadmin koji add-external-repo remi$EL http://rpms.remirepo.net/enterprise/$EL/remi/\$arch/
sudo -u kojiadmin koji add-external-repo remi-modular$EL http://rpms.remirepo.net/enterprise/$EL/modular/\$arch/
sudo -u kojiadmin koji add-external-repo remi-safe$EL http://rpms.remirepo.net/enterprise/$EL/safe/\$arch/
# Setup the os repo - parent of others who will inherit most properties
2024-04-01 13:05:12 +02:00
sudo -u kojiadmin koji add-tag --arches="$RPM_ARCH" dist-"$PARENT"
sudo -u kojiadmin koji edit-tag -x mock.package_manager="$PKGMANAGER" dist-"$PARENT"
sudo -u kojiadmin koji edit-tag -x mock.bootstrap_image="$BOOTSTRAPIMAGE" dist-"$PARENT"
sudo -u kojiadmin koji edit-tag -x rpm.macro.distribution="$DISTRIBUTION" dist-"$PARENT"
sudo -u kojiadmin koji edit-tag -x rpm.macro.dist="$DIST" dist-"$PARENT"
sudo -u kojiadmin koji edit-tag -x rpm.macro.packager="$PACKAGER" dist-"$PARENT"
sudo -u kojiadmin koji edit-tag -x rpm.macro.vendor="$VENDOR" dist-"$PARENT"
# add build tag for all $RELEASE targets
BUILDTAG="$RELEASE-build"
sudo -u kojiadmin koji add-tag --parent dist-"$PARENT" --arches="$RPM_ARCH" dist-"$BUILDTAG"
sudo -u kojiadmin koji add-group dist-"$BUILDTAG" build
sudo -u kojiadmin koji add-group-pkg dist-"$BUILDTAG" build epel-rpm-macros bash bzip2 coreutils cpio diffutils findutils gawk gcc gcc-c++ grep gzip info make patch redhat-rpm-config rpm-build sed shadow-utils tar unzip util-linux which yum-utils xz
sudo -u kojiadmin koji add-group dist-"$BUILDTAG" srpm-build
2024-04-01 13:05:12 +02:00
sudo -u kojiadmin koji add-group-pkg dist-"$BUILDTAG" srpm-build coreutils cpio elfutils file grep gzip make pigz rpm rpm-build sed tar unzip wget xz
sudo -u kojiadmin koji add-group dist="$BUILDTAG" livemedia-build
sudo -u kojiadmin koji add-group-pkg dist-"$BUILDTAG" livemedia-build anaconda bash coreutils dracut-live glibc-all-langpacks lorax-lmc-nonvirt python3-kickstart python3-pycdio selinuc-policy-targeted shadow-utils util-linux
2024-04-01 13:05:12 +02:00
sudo -u kojiadmin koji add-external-repo -t dist-"$BUILDTAG" -m bare os$EL
sudo -u kojiadmin koji add-external-repo -t dist-"$BUILDTAG" -m bare remi-safe$EL
sudo -u kojiadmin koji add-external-repo -t dist-"$BUILDTAG" -m bare remi-modular$EL
sudo -u kojiadmin koji add-external-repo -t dist-"$BUILDTAG" -m bare appstream$EL
sudo -u kojiadmin koji add-external-repo -t dist-"$BUILDTAG" -m bare powertools$EL
sudo -u kojiadmin koji add-external-repo -t dist-"$BUILDTAG" -m bare epel$EL
sudo -u kojiadmin koji add-external-repo -t dist-"$BUILDTAG" -m bare openfusion$EL
sudo -u kojiadmin koji add-external-repo -t dist-"$BUILDTAG" -m bare rpmfusion$EL
sudo -u kojiadmin koji add-external-repo -t dist-"$BUILDTAG" -m bare remi$EL
sudo -u kojiadmin koji regen-repo dist-"$BUILDTAG" --nowait
# setup the rest of the repos - all inherit values from os
for REPO in contribs contribs-testing addons updates updates-testing testing ; do
TAG="$RELEASE-$REPO"
sudo -u kojiadmin koji add-tag --parent "dist-$PARENT" "dist-$TAG"
2024-03-08 08:06:16 +01:00
done
2024-04-01 13:05:12 +02:00
# set up the smeserver and smecontribs targets
2024-07-18 03:51:48 +02:00
sudo -u kojiadmin koji add-target $RELEASE-test dist-"$BUILDTAG" "dist-$RELEASE-testing"
sudo -u kojiadmin koji add-target $RELEASE-contribs-test dist-"$BUILDTAG" "dist-$RELEASE-contribs-testing"
2024-03-08 08:06:16 +01:00
# Release sme12 is based on Rocky 9 (EL9)
RELEASE="12"
2024-03-08 08:14:12 +01:00
DISTRIBUTION="SME Server v$RELEASE"
2024-07-18 03:51:48 +02:00
TAG="$RELEASE-os"
2024-03-08 08:06:16 +01:00
EL="9"
DIST=".el$EL.sme"
PKGMANAGER="dnf"
BOOTSTRAPIMAGE="rockylinux:$EL"
sudo -u kojiadmin koji add-external-repo os$EL https://dl.rockylinux.org/pub/rocky/$EL/BaseOS/\$arch/os/
# mirrorList=http://mirrors.rockylinux.org/mirrorlist?release=$EL&arch=\$arch&repo=BaseOS-$EL
sudo -u kojiadmin koji add-external-repo appstream$EL https://dl.rockylinux.org/pub/rocky/$EL/AppStream/\$arch/os/
# mirrorlist = https://mirrors.rockylinux.org/mirrorlist?arch=\$arch&repo=AppStream-$EL
sudo -u kojiadmin koji add-external-repo powertools$EL https://dl.rockylinux.org/pub/rocky/$EL/PowerTools/\$arch/os/
# mirrorlist = https://mirrors.rockylinux.org/mirrorlist?arch=\$arch&repo=PowerTools-$EL
sudo -u kojiadmin koji add-external-repo epel$EL https://muug.ca/mirror/fedora-epel/$EL/Everything/\$arch/
# mirrorList=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-$EL&arch=\$arch
sudo -u kojiadmin koji add-external-repo openfusion$EL http://repo.openfusion.net/centos$EL-\$arch/
sudo -u kojiadmin koji add-external-repo rpmfusion$EL http://download1.rpmfusion.org/free/el/updates/$EL/\$arch/
# Setup the os repo - parent of others who will inherit most properties
sudo -u kojiadmin koji add-tag --arches="$RPM_ARCH" dist-"$TAG"
sudo -u kojiadmin koji edit-tag dist-"$TAG" -x mock.package_manager="$PKGMANAGER"
sudo -u kojiadmin koji add-tag --parent dist-"$TAG" --arches="$RPM_ARCH" dist-"$TAG"-build
sudo -u kojiadmin koji edit-tag -x mock.bootstrap_image="$BOOTSTRAPIMAGE" dist-"$TAG"
sudo -u kojiadmin koji edit-tag -x rpm.macro.distribution="$DISTRIBUTION" dist-"$TAG"
sudo -u kojiadmin koji edit-tag -x rpm.macro.dist="$DIST" dist-"$TAG"
sudo -u kojiadmin koji edit-tag -x rpm.macro.packager="$PACKAGER" dist-"$TAG"
sudo -u kojiadmin koji edit-tag -x rpm.macro.vendor="$VENDOR" dist-"$TAG"
# add build tag for all $RELEASE targets
BUILDTAG="$RELEASE-build"
sudo -u kojiadmin koji add-tag --parent dist-"$PARENT" --arches="$RPM_ARCH" dist-"$BUILDTAG"
sudo -u kojiadmin koji add-group dist-"$BUILDTAG" build
sudo -u kojiadmin koji add-group-pkg dist-"$BUILDTAG" build epel-rpm-macros bash bzip2 coreutils cpio diffutils findutils gawk gcc gcc-c++ grep gzip info make patch redhat-rpm-config rpm-build sed shadow-utils tar unzip util-linux which yum-utils xz
sudo -u kojiadmin koji add-group dist-"$BUILDTAG" srpm-build
sudo -u kojiadmin koji add-group-pkg dist-"$BUILDTAG" srpm-build coreutils cpio elfutils file grep gzip make pigz rpm rpm-build sed tar unzip wget xz
sudo -u kojiadmin koji add-group dist="$BUILDTAG" livemedia-build
sudo -u kojiadmin koji add-group-pkg dist-"$BUILDTAG" livemedia-build anaconda bash coreutils dracut-live glibc-all-langpacks lorax-lmc-nonvirt python3-kickstart python3-pycdio selinuc-policy-targeted shadow-utils util-linux
sudo -u kojiadmin koji add-external-repo -t dist-"$BUILDTAG" -m bare os$EL
sudo -u kojiadmin koji add-external-repo -t dist-"$BUILDTAG" -m bare appstream$EL
sudo -u kojiadmin koji add-external-repo -t dist-"$BUILDTAG" -m bare powertools$EL
sudo -u kojiadmin koji add-external-repo -t dist-"$BILDTAG" -m bare epel$EL
sudo -u kojiadmin koji add-external-repo -t dist-"$BUILDTAG" -m bare openfusion$EL
sudo -u kojiadmin koji add-external-repo -t dist-"$BUILDTAG" -m bare rpmfusion$EL
sudo -u kojiadmin koji regen-repo dist-"$BUILDTAG" --nowait
# setup the rest of the repos - all inherit values from os
for REPO in contribs contribs-testing addons updates updates-testing testing ; do
TAG="$RELEASE-$REPO"
sudo -u kojiadmin koji add-tag --parent "dist-$PARENT" "dist-$TAG"
2024-03-08 08:06:16 +01:00
done
# set up the smeserver and smecontribs targets
2024-07-18 03:51:48 +02:00
sudo -u kojiadmin koji add-target $RELEASE-test dist-"$BUILDTAG" "dist-$RELEASE-testing"
sudo -u kojiadmin koji add-target $RELEASE-contribs-test dist-"$BUILDTAG" "dist-$RELEASE-contribs-testing"