mirror of
https://src.koozali.org/infra/smeserver-koji.git
synced 2024-11-28 11:51:15 +01:00
79 lines
2.9 KiB
Bash
Executable File
79 lines
2.9 KiB
Bash
Executable File
#!/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 -xe
|
|
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
|
|
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
|