diff --git a/koji-setup/bootstrap-build.sh b/koji-setup/bootstrap-build.sh index 275759f..3b8e0c7 100755 --- a/koji-setup/bootstrap-build.sh +++ b/koji-setup/bootstrap-build.sh @@ -14,19 +14,19 @@ if [[ -n "$SRC_RPM_DIR" && -n "$BIN_RPM_DIR" ]]; then find "$DEBUG_RPM_DIR" -name "*.$RPM_ARCH.rpm" | xargs -n 1 -I {} sudo -u kojiadmin koji import {} fi fi -sudo -u kojiadmin koji add-tag dist-"$TAG_NAME" -sudo -u kojiadmin koji edit-tag dist-"$TAG_NAME" -x mock.package_manager=dnf +sudo -u kojiadmin koji add-tag "$TAG_NAME" +sudo -u kojiadmin koji edit-tag "$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 -I {} sudo -u kojiadmin koji add-pkg --owner kojiadmin dist-"$TAG_NAME" {} - sudo -u kojiadmin koji list-untagged | xargs -n 1 -I {} sudo -u kojiadmin koji call tagBuildBypass dist-"$TAG_NAME" {} + sudo -u kojiadmin koji list-pkgs --quiet | xargs -I {} sudo -u kojiadmin koji add-pkg --owner kojiadmin "$TAG_NAME" {} + sudo -u kojiadmin koji list-untagged | xargs -n 1 -I {} sudo -u kojiadmin koji call tagBuildBypass "$TAG_NAME" {} 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 diffutils 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-build sed sed-doc shadow systemd-lib tar unzip which xz -sudo -u kojiadmin koji add-group-pkg dist-"$TAG_NAME"-build srpm-build coreutils cpio curl-bin git glibc-utils grep gzip make pigz plzip rpm-build sed shadow tar unzip wget xz +sudo -u kojiadmin koji add-tag --parent "$TAG_NAME" --arches "$RPM_ARCH" "$TAG_NAME"-build +sudo -u kojiadmin koji add-target "$TAG_NAME" "$TAG_NAME"-build +sudo -u kojiadmin koji add-group "$TAG_NAME"-build build +sudo -u kojiadmin koji add-group "$TAG_NAME"-build srpm-build +sudo -u kojiadmin koji add-group-pkg "$TAG_NAME"-build build autoconf automake automake-dev binutils bzip2 clr-rpm-config coreutils diffutils 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-build sed sed-doc shadow systemd-lib tar unzip which xz +sudo -u kojiadmin koji add-group-pkg "$TAG_NAME"-build srpm-build coreutils cpio curl-bin git glibc-utils grep gzip make pigz plzip rpm-build 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" + sudo -u kojiadmin koji add-external-repo -t "$TAG_NAME"-build "$TAG_NAME"-external-repo "$EXTERNAL_REPO" fi -sudo -u kojiadmin koji regen-repo dist-"$TAG_NAME"-build +sudo -u kojiadmin koji regen-repo "$TAG_NAME"-build diff --git a/koji-setup/deploy-mash.sh b/koji-setup/deploy-mash.sh index 03712c9..ece6a78 100755 --- a/koji-setup/deploy-mash.sh +++ b/koji-setup/deploy-mash.sh @@ -29,7 +29,7 @@ repodir = file://$KOJI_DIR use_sqlite = True use_repoview = False EOF -cat > /etc/mash/clear.mash <<- EOF +cat > /etc/mash/$TAG_NAME.mash <<- EOF [clear] rpm_path = %(arch)s/os/Packages repodata_path = %(arch)s/os/ @@ -37,7 +37,7 @@ source_path = source/SRPMS debuginfo = True multilib = False multilib_method = devel -tag = dist-$TAG_NAME +tag = $TAG_NAME inherit = True strict_keys = False arches = $RPM_ARCH @@ -46,14 +46,14 @@ EOF mkdir -p "$MASH_SCRIPT_DIR" cp -f "$SCRIPT_DIR"/mash.sh "$MASH_SCRIPT_DIR" mkdir -p /etc/systemd/system -cat > /etc/systemd/system/mash.service <<- EOF +cat > /etc/systemd/system/mash@$TAG_NAME.service <<- EOF [Unit] Description=Mash script to loop local repository creation for local image builds [Service] User=kojiadmin Group=kojiadmin -ExecStart=$MASH_SCRIPT_DIR/mash.sh +ExecStart=${MASH_SCRIPT_DIR}/mash.sh %I Restart=always RestartSec=10s @@ -61,4 +61,4 @@ RestartSec=10s WantedBy=multi-user.target EOF systemctl daemon-reload -systemctl enable --now mash +systemctl enable --now mash@$TAG_NAME diff --git a/koji-setup/mash.sh b/koji-setup/mash.sh index e96f8cc..c4c7c96 100755 --- a/koji-setup/mash.sh +++ b/koji-setup/mash.sh @@ -5,10 +5,11 @@ set -e . /etc/profile.d/proxy.sh || : +KOJI_TAG="${KOJI_TAG:-"$1"}" BUILD_ARCH="${BUILD_ARCH:-x86_64}" KOJI_DIR="${KOJI_DIR:-/srv/koji}" MASH_DIR="${MASH_DIR:-/srv/mash}" -MASH_TRACKER_FILE="$MASH_DIR"/latest-mash-build +MASH_TRACKER_FILE="$MASH_DIR"/latest-${KOJI_TAG}-build MASH_TRACKER_DIR="$MASH_DIR"/latest MASH_DIR_OLD="$MASH_TRACKER_DIR".old MASH_DIR_NEW="$MASH_TRACKER_DIR".new @@ -37,18 +38,18 @@ create_dist_repos() { cp -f "${KOJI_REPO_PATH}/groups/comps.xml" "${comps_file}" - make_repo "${source_dir}" "${output_dir}" "clear/${BUILD_ARCH}/os" "Packages" "${bin_rpm_paths}" "${comps_file}" & - make_repo "${source_dir}" "${output_dir}" "clear/${BUILD_ARCH}/debug" "." "${debuginfo_rpm_paths}" & - make_repo "${source_dir}" "${output_dir}" "clear/source/SRPMS" "." "${src_rpm_paths}" & + make_repo "${source_dir}" "${output_dir}" "${KOJI_TAG}/${BUILD_ARCH}/os" "Packages" "${bin_rpm_paths}" "${comps_file}" & + make_repo "${source_dir}" "${output_dir}" "${KOJI_TAG}/${BUILD_ARCH}/debug" "." "${debuginfo_rpm_paths}" & + make_repo "${source_dir}" "${output_dir}" "${KOJI_TAG}/source/SRPMS" "." "${src_rpm_paths}" & wait - create_dnf_conf "${work_dir}/dnf-os.conf" "${output_dir}/clear/${BUILD_ARCH}/os" clear-os - create_dnf_conf "${work_dir}/dnf-debug.conf" "${output_dir}/clear/${BUILD_ARCH}/debug" clear-debug - create_dnf_conf "${work_dir}/dnf-SRPMS.conf" "${output_dir}/clear/source/SRPMS" clear-SRPMS + create_dnf_conf "${work_dir}/dnf-os.conf" "${output_dir}/${KOJI_TAG}/${BUILD_ARCH}/os" clear-os + create_dnf_conf "${work_dir}/dnf-debug.conf" "${output_dir}/${KOJI_TAG}/${BUILD_ARCH}/debug" clear-debug + create_dnf_conf "${work_dir}/dnf-SRPMS.conf" "${output_dir}/${KOJI_TAG}/source/SRPMS" clear-SRPMS - write_packages_file "${work_dir}/dnf-os.conf" "$output_dir/clear/$BUILD_ARCH/packages-os" - write_packages_file "${work_dir}/dnf-debug.conf" "$output_dir/clear/$BUILD_ARCH/packages-debug" - write_packages_file "${work_dir}/dnf-SRPMS.conf" "$output_dir/clear/source/packages-SRPMS" + write_packages_file "${work_dir}/dnf-os.conf" "$output_dir/${KOJI_TAG}/$BUILD_ARCH/packages-os" + write_packages_file "${work_dir}/dnf-debug.conf" "$output_dir/${KOJI_TAG}/$BUILD_ARCH/packages-debug" + write_packages_file "${work_dir}/dnf-SRPMS.conf" "$output_dir/${KOJI_TAG}/source/packages-SRPMS" rm -rf "${work_dir}" } @@ -99,18 +100,20 @@ if [[ -e "$MASH_TRACKER_FILE" ]]; then else MASH_BUILD_NUM=0 fi -KOJI_TAG="${KOJI_TAG:-"dist-clear"}" KOJI_REPO_PATH="$(realpath "$KOJI_DIR/repos/$KOJI_TAG-build/latest")" KOJI_BUILD_NUM="$(basename "$KOJI_REPO_PATH")" if [[ "$MASH_BUILD_NUM" -ne "$KOJI_BUILD_NUM" ]]; then rm -rf "$MASH_DIR_NEW" mkdir -p "$MASH_DIR_NEW" create_dist_repos "$MASH_TRACKER_DIR" "$MASH_DIR_NEW" - if [[ -e "$MASH_TRACKER_DIR" ]]; then - mv "$MASH_TRACKER_DIR" "$MASH_DIR_OLD" + if [[ -e "$MASH_TRACKER_DIR/$KOJI_TAG" ]]; then + mkdir -p "$MASH_DIR_OLD" + mv "$MASH_TRACKER_DIR/$KOJI_TAG" "$MASH_DIR_OLD/$KOJI_TAG" fi - mv "$MASH_DIR_NEW" "$MASH_TRACKER_DIR" + mkdir -p "$MASH_TRACKER_DIR" + mv "$MASH_DIR_NEW/$KOJI_TAG" "$MASH_TRACKER_DIR" rm -rf "$MASH_DIR_OLD" + rm -rf "$MASH_DIR_NEW" echo "$KOJI_BUILD_NUM" > "$MASH_TRACKER_FILE" fi