prep-staging-8.sh 4.85 KB
Newer Older
Louis Abel's avatar
Louis Abel committed
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
# This should only be ran during straight updates during a minor release cadence.
# In the case of point releases, this will need to be changed accordingly so that
# way it can be ran properly.
#
# The point of this script is to basically allow all old versions of a package
# or set of packages to be available during the life of a point release. As it
# currently stands, CentOS has started doing this for both 8 and 8-stream. RHEL
# also does this (and has always done this, except they take it a step further
# and provide everything, even if it's not installable).
#
# Compose dir example: /mnt/repos-staging/mirror/pub/rocky/8.4-RC2

14
# Source common variables
Louis Abel's avatar
Louis Abel committed
15
export RLVER=8
Louis Abel's avatar
fixes    
Louis Abel committed
16
# shellcheck disable=SC2046,1091,1090
17
source "$(dirname "$0")/common"
Louis Abel's avatar
Louis Abel committed
18
19

echo "** Updating source repos"
20
for y in "${ALL_REPOS[@]}"; do
Louis Abel's avatar
Louis Abel committed
21
  test -d "${STAGING_ROOT}/${RELEASE_DIR}/${y}/source/tree"
Louis Abel's avatar
Louis Abel committed
22
23
  ret_val=$?
  if [ "$ret_val" -eq 0 ]; then
24
    createrepo --update "${STAGING_ROOT}/${RELEASE_DIR}/${y}/source/tree" \
Louis Abel's avatar
Louis Abel committed
25
      "--distro=cpe:/o:rocky:rocky:${REVISION:0:1},Rocky Linux ${REVISION:0:1}"
Louis Abel's avatar
Louis Abel committed
26
27
    test -f /root/bin/sign-repo.sh && /root/bin/sign-repo.sh \
      "${STAGING_ROOT}/${RELEASE_DIR}/${y}/source/tree/repodata/repomd.xml"
Louis Abel's avatar
Louis Abel committed
28
29
    sed -i '/<open-size><\/open-size>/d' \
      "${STAGING_ROOT}/${RELEASE_DIR}/${y}/source/tree/repodata/repomd.xml"
Louis Abel's avatar
Louis Abel committed
30
  else
31
    echo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/source/tree does not exist"
Louis Abel's avatar
Louis Abel committed
32
33
34
35
36
37
38
39
40
41
42
  fi
done

# Sync up some stuff
echo "** Updating arch repos as necessary **"
for x in "${ARCHES[@]}"; do
  echo "${x}: Sync up repos that do not use comps/groups"
  # regular repos, no comps
  for y in "${NONMODS_REPOS[@]}"; do
    # os and debug/tree directories
    for z in os debug/tree; do
43
      test -d "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/${z}"
Louis Abel's avatar
Louis Abel committed
44
45
      ret_val=$?
      if [ "$ret_val" -eq 0 ]; then
46
        createrepo --update "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/${z}" \
Louis Abel's avatar
Louis Abel committed
47
          "--distro=cpe:/o:rocky:rocky:${REVISION:0:1},Rocky Linux ${REVISION:0:1}"
Louis Abel's avatar
Louis Abel committed
48
49
        test -f /root/bin/sign-repo.sh && /root/bin/sign-repo.sh \
          "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/${z}/repodata/repomd.xml"
Louis Abel's avatar
Louis Abel committed
50
51
        sed -i '/<open-size><\/open-size>/d' \
          "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/${z}/repodata/repomd.xml"
Louis Abel's avatar
Louis Abel committed
52
      else
53
        echo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/${z} does not exist"
Louis Abel's avatar
Louis Abel committed
54
55
      fi
    done
Louis Abel's avatar
Louis Abel committed
56
  done
Louis Abel's avatar
Louis Abel committed
57
58
  # repos with comps/groups involved, but only debug
  for y in "${MODS_REPOS[@]}"; do
59
    test -d "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/debug/tree"
Louis Abel's avatar
Louis Abel committed
60
61
    ret_val=$?
    if [ "$ret_val" -eq 0 ]; then
Louis Abel's avatar
Louis Abel committed
62
      createrepo --update "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/debug/tree" \
Louis Abel's avatar
Louis Abel committed
63
        "--distro=cpe:/o:rocky:rocky:${REVISION:0:1},Rocky Linux ${REVISION:0:1}"
Louis Abel's avatar
Louis Abel committed
64
65
      test -f /root/bin/sign-repo.sh && /root/bin/sign-repo.sh \
        "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/debug/tree/repodata/repomd.xml"
Louis Abel's avatar
Louis Abel committed
66
67
      sed -i '/<open-size><\/open-size>/d' \
        "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/debug/tree/repodata/repomd.xml"
Louis Abel's avatar
Louis Abel committed
68
    else
69
      echo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/debug/tree does not exist"
Louis Abel's avatar
Louis Abel committed
70
71
72
73
74
75
    fi
  done

  echo "** Update all repos with comps/groups"
  for y in "${MODS_REPOS[@]}"; do
    echo "${y}: ${x}"
76
    test -d "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os"
Louis Abel's avatar
Louis Abel committed
77
78
    ret_val=$?
    if [ "$ret_val" -eq 0 ]; then
79
      createrepo --update "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os" \
Louis Abel's avatar
Louis Abel committed
80
        --groupfile="/mnt/compose/8/latest-Rocky-8/work/${x}/comps/comps-${y}.${x}.xml" \
Louis Abel's avatar
Louis Abel committed
81
        --xz --revision="${REVISION}" \
Louis Abel's avatar
Louis Abel committed
82
83
        "--distro=cpe:/o:rocky:rocky:${REVISION:0:1},Rocky Linux ${REVISION:0:1}" \
        --workers=8 --checksum=sha256
Louis Abel's avatar
Louis Abel committed
84
85
      test -f /root/bin/sign-repo.sh && /root/bin/sign-repo.sh \
        "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os/repodata/repomd.xml"
Louis Abel's avatar
Louis Abel committed
86
87
      sed -i '/<open-size><\/open-size>/d' \
        "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os/repodata/repomd.xml"
Louis Abel's avatar
Louis Abel committed
88
    else
89
      echo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os does not exist"
Louis Abel's avatar
Louis Abel committed
90
91
92
93
94
95
96
    fi
  done

  echo "** Update modules"
  for y in "${MODS[@]}"; do
    echo "Modules: ${y} ${x}"
    cp "/mnt/compose/8_metadata/${x}/${y}-modules.yaml" /tmp/modules.yaml
97
    test -d "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os"
Louis Abel's avatar
Louis Abel committed
98
99
100
    ret_val=$?
    if [ "$ret_val" -eq 0 ]; then
      modifyrepo --mdtype=modules /tmp/modules.yaml \
101
        "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os/repodata" \
Louis Abel's avatar
Louis Abel committed
102
        --compress --compress-type=gz
Louis Abel's avatar
Louis Abel committed
103
104
105
      # This might not be necessary, but it does not hurt incase repomd is modified
      test -f /root/bin/sign-repo.sh && /root/bin/sign-repo.sh \
        "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os/repodata/repomd.xml"
Louis Abel's avatar
Louis Abel committed
106
107
      sed -i '/<open-size><\/open-size>/d' \
        "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os/repodata/repomd.xml"
Louis Abel's avatar
Louis Abel committed
108
    else
109
      echo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os does not exist"
Louis Abel's avatar
Louis Abel committed
110
    fi
Louis Abel's avatar
Louis Abel committed
111
112
113
114

    rm /tmp/modules.yaml
    sleep 1
  done
Louis Abel's avatar
Louis Abel committed
115
116

  echo "** Fix variants"
Louis Abel's avatar
Louis Abel committed
117
  treeinfoFixer "${x}"
Louis Abel's avatar
Louis Abel committed
118
done