aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-12-01 14:47:32 -0500
committerB. Stack <bgstack15@gmail.com>2022-12-01 14:47:32 -0500
commit93388fc0273a7f46bd02b640f2d4a4fff856cdd0 (patch)
treec881f68352a6eea007031ac18b55936c876f4a31
parentinitial commit (diff)
downloadipasam-93388fc0273a7f46bd02b640f2d4a4fff856cdd0.tar.gz
ipasam-93388fc0273a7f46bd02b640f2d4a4fff856cdd0.tar.bz2
ipasam-93388fc0273a7f46bd02b640f2d4a4fff856cdd0.zip
handle updated page view, and dynamic chroot listing
-rwxr-xr-xupdate-ipasam-rpm.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/update-ipasam-rpm.sh b/update-ipasam-rpm.sh
index b292d72..ad9f81e 100755
--- a/update-ipasam-rpm.sh
+++ b/update-ipasam-rpm.sh
@@ -8,6 +8,7 @@
# Project: update-ipasam-rpm
# Purpose: Build new ipasam package when ipa-server-trust-ad increments
# History:
+# 2022-12-01 improve to handle current page design, and dynamically learn all copr chroots to exclude
# Usage:
# on AlmaLinux 8 system (storage3) in cron.
# Dependencies:
@@ -32,7 +33,8 @@ test ! -d "${logfd}" && mkdir -p "${logfd}"
old_ver="$( cat "${old_ver_file}" 2>/dev/null )"
# get newest version available
page="$( curl "${mirror_path}" --silent )"
- latest_file="$( echo "${page}" | awk -F'>' '/ipa-server-trust-ad/{print $2}' | awk -F'"' '{print $2}' | sort --version-sort | tail -n1 )"
+ #latest_file="$( echo "${page}" | awk -F'>' '/ipa-server-trust-ad/{print $2}' | awk -F'"' '{print $2}' | sort --version-sort | tail -n1 )"
+ latest_file="$( echo "${page}" | awk '/ipa-server-trust-ad/' | grep -oE '"ipa-server-trust-ad.*\.rpm"' | tr -d '"'| sort --version-sort | tail -n1 )"
# Awk $5 because package name takes first four columns when splitting with dash
latest_ver="$( echo "${latest_file}" | awk -F'-' 'BEGIN{OFS="-"} {print $5}' )"
latest_rel="$( echo "${latest_file}" | awk -F'-' '{print $6}' | awk -F'.' '{print $1}' )"
@@ -48,7 +50,10 @@ test ! -d "${logfd}" && mkdir -p "${logfd}"
-e "/%define samver\>/s/%\(.*$/${latest_ver}/;" \
-e "/%define samrel\>/s/%\(.*$/${latest_rel}/;"
rpmbuild --nodeps -bs ipasam.spec && {
- copr build --exclude-chroot 'epel-6-i386' --exclude-chroot 'epel-6-x86_64' --exclude-chroot 'fedora-34-i386' --exclude-chroot 'fedora-35-i386' --exclude-chroot 'fedora-36-i386' --exclude-chroot 'fedora-rawhide-i386' --nowait "${coprrepo}" ~/rpmbuild/SRPMS/ipasam-${new_ver}.src.rpm
+ available_chroots="$( copr list bgstack15 | awk -v "name=${coprrepo}" '/Name:/ && $0 ~ name {a=1} /Name:/ && $0 !~ name {a=0} /results/{if(a==1)print $1;}' | tr -d ':' )"
+ # exclude all chroots except epel-7-x86_64 epel-8-x86_64
+ excluded_chroots="$( echo "${available_chroots}" | grep -vE 'epel-[78]-x86_64' )"
+ copr build $( for word in ${excluded_chroots} ; do printf "%s %s" "--exclude-chroot" "${word}" ) --nowait "${coprrepo}" ~/rpmbuild/SRPMS/ipasam-${new_ver}.src.rpm
test ! -d "${old_ver_fd}" && mkdir p "${old_ver_fd}"
echo "${new_ver}" > "${old_ver_file}"
rm ~/.cache/ipasam.spec
bgstack15