common_8 3.24 KB
Newer Older
Louis Abel's avatar
Louis Abel committed
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
# To be sourced by scripts to use

# Revision must always start with a major number
REVISION=8.4

MAJOR="${REVISION:0:1}"
MINOR="${REVISION:2:1}"

# comment or blank if needed
APPEND_TO_DIR="-RC2"

STAGING_ROOT="/mnt/repos-staging"
PRODUCTION_ROOT="/mnt/repos-production"

# relative to ${ENV}_ROOT
CATEGORY_STUB="mirror/pub/rocky"
RELEASE_DIR="${CATEGORY_STUB}/${REVISION}${APPEND_TO_DIR}"

# Set all repos that have no comps/groups associated with them. This is even in
# cases where repos will not be available by normal means. It's just for
# consistency.
NONMODS_REPOS=(
  extras
  Devel
  nfv
  storage/gluster9
Louis Abel's avatar
Louis Abel committed
27
  virt/advanced-virtualization
Louis Abel's avatar
Louis Abel committed
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  plus
)

# These repos have comps/groups, except for debuginfo and sources
MODS_REPOS=(
  BaseOS
  AppStream
  HighAvailability
  ResilientStorage
  PowerTools
)

ALL_REPOS=(
  "${NONMODS_REPOS[@]}"
  "${MODS_REPOS[@]}"
)

Louis Abel's avatar
Louis Abel committed
45
46
47
48
49
50
51
52
53
54
55
56
57
NONSIG_COMPOSE=(
  Rocky
  Rocky-devel
  Extras
  Plus
  NFV
)

declare -A SIG_COMPOSE
SIG_COMPOSE=(
  [Gluster9]="storage/gluster9"
)

Louis Abel's avatar
Louis Abel committed
58
59
60
61
62
# These repos have modules
MODS=(
  AppStream
  PowerTools
)
Louis Abel's avatar
Louis Abel committed
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
112
113
114
115
116
117
118

# functions
# Note, EL8 and EL9 may not be the same, do not put in 'common'
function treeinfoFixer() {
  BaseOSArch="${1}"
  TREEINFO_VAR="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${BaseOSArch}/os/.treeinfo"
  PRISTINE_TREE="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${BaseOSArch}/os/.treeinfo-pristine"
  test -f "${PRISTINE_TREE}"
  pris_retval=$?
  if [ "$pris_retval" -eq 0 ]; then
    /bin/cp "${PRISTINE_TREE}" "${TREEINFO_VAR}"
  else
    echo "WARNING: We do not have a pristine treeinfo to copy from"
  fi
}

# Note, EL8 and EL9 may not be the same, do not put in 'common'
function treeinfoModder() {
  BaseOSArch="${1}"
  TREEINFO_VAR="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${BaseOSArch}/os/.treeinfo"
  PRISTINE_TREE="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${BaseOSArch}/os/.treeinfo-pristine"
  test -f "${TREEINFO_VAR}"
  treeinfo_retval=$?
  test -x /usr/bin/python3
  python_retval=$?
  # There is an awk way to do this, but it was easier to implement python and
  # cat heredoc together. It felt cleaner. This was a trick I had used in a
  # previous life when I had to admin Solaris systems, and I needed a way to
  # add a solaris 10 system into FreeIPA (it was not fun, let me tell you). But
  # the take away is I learned something kind of on the fly and well, it worked.
  # Emails should have stamps.
  if [ "$treeinfo_retval" -eq 0 ] && [ "$python_retval" -eq 0 ]; then
    cat <<EOF | /usr/bin/python3
from configparser import ConfigParser
config = ConfigParser()
config.read('${TREEINFO_VAR}')
config.set('tree', 'variants', 'BaseOS,AppStream')
config.add_section('variant-AppStream')
config.set('variant-AppStream', 'id', 'AppStream')
config.set('variant-AppStream', 'name', 'AppStream')
config.set('variant-AppStream', 'type', 'variant')
config.set('variant-AppStream', 'uid', 'AppStream')
config.set('variant-AppStream', 'packages', '../../../AppStream/${BaseOSArch}/os/Packages')
config.set('variant-AppStream', 'repository', '../../../AppStream/${BaseOSArch}/os/')

with open('${TREEINFO_VAR}', 'w') as configfile:
    config.write(configfile)
EOF
  else
    echo "${TREEINFO_VAR}, or python3 does not exist on this system."
  fi
  /bin/cp "${TREEINFO_VAR}" "${PRISTINE_TREE}"
}

export -f treeinfoFixer
export -f treeinfoModder