containers-common-1-50.el9

- improve shortnames generation
- Related: #2124478

Signed-off-by: Jindrich Novy <jnovy@redhat.com>
This commit is contained in:
Jindrich Novy 2023-02-22 16:42:46 +01:00
parent c240011c06
commit 68e8c4c18f
3 changed files with 1288 additions and 416 deletions

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@
Epoch: 2
Name: containers-common
Version: 1
Release: 49%{?dist}
Release: 50%{?dist}
Summary: Common configuration and documentation for containers
License: ASL 2.0
ExclusiveArch: %{go_arches}
@ -173,6 +173,10 @@ EOF
%{_datadir}/rhel/secrets/*
%changelog
* Wed Feb 22 2023 Jindrich Novy <jnovy@redhat.com> - 2:1-50
- improve shortnames generation
- Related: #2124478
* Tue Jan 31 2023 Jindrich Novy <jnovy@redhat.com> - 2:1-49
- add missing systemd directories
- Related: #2124478

View File

@ -1,5 +1,5 @@
#!/bin/bash
#set -e
set -e
rm -f /tmp/pyxis*.json
TOTAL=`curl -s --negotiate -u: -H 'Content-Type: application/json' -H 'Accept: application/json' -X GET "https://pyxis.engineering.redhat.com/v1/repositories?page_size=1" | jq .total`
if [ "$TOTAL" == "null" ]; then
@ -11,53 +11,36 @@ for P in `seq 0 $PAGES`; do
curl -s --negotiate -u: -H 'Content-Type: application/json' -H 'Accept: application/json' -X GET "https://pyxis.engineering.redhat.com/v1/repositories?page_size=500&page=$P" > /tmp/pyxis$P.json
done
cat /tmp/pyxis*.json > /tmp/pyx.json
rm -f /tmp/pyx_debug
rm -f /tmp/rhel-shortnames.conf
while read -r LINE; do
if [[ "$LINE" == *\"_id\":* ]] || [[ "$LINE" == *\"total\":* ]]; then
if [ -z $REGISTRY ] ||
[ -z $PUBLISHED ] ||
[ -z $REPOSITORY ] ||
[ $REPOSITORY == \"\" ] ||
[ "$AVAILABLE" != "Generally Available" ] ||
[[ $REPOSITORY == *[@:]* ]] ||
[[ $REPOSITORY == *[* ]] ||
[[ "$REGISTRY" == *non_registry* ]] ||
[[ $REGISTRY != *.* ]]
then
continue
fi
jq '.data[]|.published,.requires_terms,.repository,.registry,.release_categories[0]' < /tmp/pyx.json >/tmp/pyx
readarray -t lines < /tmp/pyx
IDX=0
while [ $IDX -lt ${#lines[@]} ]; do
PUBLISHED=${lines[$IDX]}
REQ_TERMS=${lines[$IDX+1]}
REPOSITORY=`echo ${lines[$IDX+2]} | tr -d '"'`
REGISTRY=`echo ${lines[$IDX+3]} | tr -d '"'`
RELEASE=`echo ${lines[$IDX+4]} | tr -d '"'`
if [ "$PUBLISHED" == "true" ] &&
[ "$RELEASE" == "Generally Available" ] &&
[ $REPOSITORY != \"\" ] &&
[[ $REPOSITORY != *[@:]* ]] &&
[[ $REPOSITORY != *[* ]] &&
[[ $REGISTRY == *.* ]] &&
[ "$REGISTRY" != "non_registry" ]; then
if [[ $REGISTRY == *quay.io* ]] ||
[[ $REGISTRY == *redhat.com* ]]; then
if [ "$REQUIRES_TERMS" == "1" ]; then
if [ "$REQ_TERMS" == "true" ]; then
REGISTRY=registry.redhat.io
fi
echo "\"$REPOSITORY\" = \"$REGISTRY/$REPOSITORY\""
echo "\"$REPOSITORY\" = \"$REGISTRY/$REPOSITORY\"" >> /tmp/rhel-shortnames.conf
fi
REGISTRY=""
PUBLISHED=""
AVAILABLE=""
REPOSITORY=""
REQUIRES_TERMS=""
continue
echo "\"$REPOSITORY\" = \"$REGISTRY/$REPOSITORY\""
echo $PUBLISHED,$REQ_TERMS,$REPOSITORY,$REGISTRY,$RELEASE >> /tmp/pyx_debug
echo "\"$REPOSITORY\" = \"$REGISTRY/$REPOSITORY\"" >> /tmp/rhel-shortnames.conf
fi
if [[ "$LINE" == *\"published\":\ true,* ]]; then
PUBLISHED=1
fi
if [[ "$LINE" == *\"requires_terms\":\ true,* ]]; then
REQUIRES_TERMS=1
fi
if [[ "$LINE" == *\"repository\":\ * ]]; then
REPOSITORY=`echo $LINE | sed 's,^.* ",,' | sed 's;",$;;'`
fi
if [[ "$LINE" == *\"registry\":\ * ]]; then
REGISTRY=`echo $LINE | sed -e 's,^.*:\ ",,' -e 's,".*,,'`
fi
if [[ "$LINE" == *\"release_categories\":\ * ]]; then
read -r LINE
AVAILABLE=`echo $LINE | sed 's,",,g'`
fi
done < /tmp/pyx.json
IDX=$(($IDX+5))
done
cp /tmp/rhel-shortnames.conf /tmp/r.conf
for D in `cut -d\ -f1 /tmp/r.conf | sort | uniq -d`; do