Skip to content

Commit f408168

Browse files
committed
Add SST renaming script
1 parent a170cdb commit f408168

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

sst-rename.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#! /bin/sh
2+
3+
if [ "$1" = "-n" ]; then
4+
dryrun=:
5+
shift
6+
fi
7+
8+
for f; do
9+
[ -f $f ] || (echo "ERROR: $f: file not found"; exit 1)
10+
old_maint=$(yq -e '.data.maintainer' $f | awk '{print $1}')
11+
case $old_maint in
12+
# nonconformant renames
13+
ssg_virtualization) new_maint=rhel-sst-virtualization ;;
14+
sst_cloud_experience) new_maint=rhel-sst-cloudexperience ;;
15+
sst_insights) new_maint=rhel-sst-idm-insights ;;
16+
sst_rhel_lightspeed) new_maint=rhel-sst-lightspeed ;;
17+
sst_rhgs) new_maint=rhel-sst-rh-ceph-storage ;;
18+
# individuals instead of SSTs
19+
bstinson) new_maint=rhel-sst-program ;;
20+
jwboyer) new_maint=rhel-sst-rh-samba-storage ;;
21+
kkeithle) new_maint=rhel-sst-rh-ceph-storage ;;
22+
plautrba) new_maint=rhel-sst-security-selinux ;;
23+
# typos or obsolete names
24+
sst_platform_storage) new_maint=rhel-sst-logical-storage ;;
25+
sst_virtualization_spice) new_maint=rhel-sst-virtualization ;;
26+
sst_window_management) new_maint=rhel-sst-display-window-management ;;
27+
# regular patterns
28+
ssg_*|sst_*) new_maint=rhel-${old_maint//_/-} ;;
29+
rhel-ssg-*|rhel-sst-*) new_maint=${old_maint} ;;
30+
*) echo "ERROR: $f: unknown maintainer: $old_maint" ; exit 2 ;;
31+
esac
32+
33+
$dryrun env MAINT=${new_maint} yq -I 2 -i '.data.maintainer = strenv(MAINT)' $f
34+
35+
d=${f%/*}
36+
b=${f##*/}
37+
[ $d != $f ] || d="."
38+
case $b in
39+
cee_support_unwanted.yaml)
40+
nf=$d/${new_maint}--unwanted.yaml
41+
;;
42+
cee-support-workload.yaml)
43+
nf=$d/${new_maint}--all.yaml
44+
;;
45+
mingw-pkg-config-exclusion.yaml)
46+
nf=$d/${new_maint}--mingw-pkg-config-unwanted.yaml
47+
;;
48+
mingw-pkgs-exclusion.yaml)
49+
nf=$d/${new_maint}--mingw-unwanted.yaml
50+
;;
51+
rhel-8-appstream-comps-performance.yaml)
52+
nf=$d/${new_maint}--performance.yaml
53+
;;
54+
ssg_*-*|sst_*-*)
55+
pfx=${b%%-*}
56+
sfx=${b#*-}
57+
[ "$pfx" = "$old_maint" ] || (echo "WARNING: $f: maintainer mismatch: $old_maint")
58+
nf=$d/${new_maint}--$sfx
59+
;;
60+
sst_*)
61+
pfx=${b%.yaml}
62+
[ "$pfx" = "$old_maint" ] || (echo "WARNING: $f: maintainer mismatch: $old_maint")
63+
nf=$d/${new_maint}--all.yaml
64+
;;
65+
rhel-ssg-*--*|rhel-sst-*--*) nf=$f ;;
66+
*) echo "ERROR: $f: unknown filename pattern: $f" ; exit 3 ;;
67+
esac
68+
69+
if [ "$nf" != "$f" ]; then
70+
echo "$f ($old_maint) -> $nf ($new_maint)"
71+
$dryrun git mv $f $nf || (echo "ERROR: rename of $f to $nf failed"; exit 4)
72+
fi
73+
done

0 commit comments

Comments
 (0)