-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcreate-chtc-tags-etc
executable file
·112 lines (93 loc) · 4.18 KB
/
create-chtc-tags-etc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
set -eu
# create koji tags/targets/etc for chtc
#
# The chtc tags/targets look more like the hcc tags/targets than the osg
# tags/targets, because they aren't per-series so they don't have a layer of indirection
# (so instead of "dist -> osg -> osg-23 -> osg-23-main",
# it's just "dist -> chtc")
BUILD_TAG_EXTRAS=(-x rebuild_srpm=False -x mock.yum.module_hotfixes=1)
ask_yn () {
echo -n "$@"
while read -r; do
case $REPLY in
[Yy]*) return 0 ;;
[Nn]*) return 1 ;;
*) echo "Enter yes or no" ;;
esac
done
return 2
}
do_koji () {
local koji
local perform_actions="$1"
if $perform_actions; then
set -x
koji="osg-koji"
else
koji="echo osg-koji"
fi
# Terminology:
#
# A "package" is a piece of software that can be built in Koji e.g., "condor".
# It doesn't include a version or a specific set of RPMs; it's just the name.
#
# A "package tag" is a tag that only contains packages.
# They usually don't have suffixes after the distro version.
#
# A "build" is an SRPM and all the RPMs that result from buildings its contents.
#
# A "build tag" is a tag that build environments are created from.
# They usually have the suffix "-build".
#
# A "repo tag" (my term) is a tag that builds can be put into (and repos can be created from).
# They have suffixes like "-development", "-testing", "-release".
local top_package_tag top_build_tag prefix new_package_tag new_build_tag
for el in el8 el9; do
# dist-${el} is the top-level package tag.
# All tags inherit from it (often indirectly, e.g., via osg-${el}).
#
# dist-${el}-build is the top-level build tag;
# same thing, all tags inherit from it (usually indirectly).
top_package_tag="dist-${el}"
top_build_tag="dist-${el}-build"
prefix="chtc-${el}"
new_package_tag="chtc-${el}"
new_build_tag="chtc-${el}-build"
### PACKAGE TAG
# OPTIONS TAG
$koji add-tag ${new_package_tag}
### NEW TAGS
# OPTIONS TAG
$koji add-tag --arches=x86_64 "${BUILD_TAG_EXTRAS[@]}" ${new_build_tag}
$koji add-tag --arches=x86_64 ${prefix}-development
$koji add-tag --arches=x86_64 ${prefix}-testing
$koji add-tag --arches=x86_64 ${prefix}-release
### TAG INHERITANCE (LOWER NUMBER WINS)
# PRIORITY CHILD PARENT
$koji add-tag-inheritance --priority=0 ${new_package_tag} ${top_package_tag}
$koji add-tag-inheritance --priority=1 ${new_build_tag} ${top_build_tag}
$koji add-tag-inheritance --priority=0 ${new_build_tag} ${prefix}-development
$koji add-tag-inheritance --priority=0 ${prefix}-development ${prefix}-testing
$koji add-tag-inheritance --priority=0 ${prefix}-testing ${prefix}-release
$koji add-tag-inheritance --priority=0 ${prefix}-release ${new_package_tag}
### BUILD TARGET
# NAME FROM TO
$koji add-target ${prefix} ${new_build_tag} ${prefix}-development
### AUTO-GENERATED ("MINEFIELD-STYLE") REPOS
# NAME FROM TO
$koji add-target kojira-fake-${prefix}-development ${prefix}-development kojira-fake
$koji add-target kojira-fake-${prefix}-testing ${prefix}-testing kojira-fake
$koji add-target kojira-fake-${prefix}-release ${prefix}-release kojira-fake
done
}
echo "** Doing a dry-run **"
do_koji false
echo
if ask_yn "Do the commands look OK? "; then
echo "** Running Koji commands **"
do_koji true
fi
echo
echo "DON'T FORGET TO SET UP PACKAGE SIGNING BEFORE USING THE NEW BUILD TAGS"
echo