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

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
#set -e set -e
rm -f /tmp/pyxis*.json 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` 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 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 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 done
cat /tmp/pyxis*.json > /tmp/pyx.json cat /tmp/pyxis*.json > /tmp/pyx.json
rm -f /tmp/pyx_debug
rm -f /tmp/rhel-shortnames.conf rm -f /tmp/rhel-shortnames.conf
while read -r LINE; do jq '.data[]|.published,.requires_terms,.repository,.registry,.release_categories[0]' < /tmp/pyx.json >/tmp/pyx
if [[ "$LINE" == *\"_id\":* ]] || [[ "$LINE" == *\"total\":* ]]; then readarray -t lines < /tmp/pyx
if [ -z $REGISTRY ] || IDX=0
[ -z $PUBLISHED ] || while [ $IDX -lt ${#lines[@]} ]; do
[ -z $REPOSITORY ] || PUBLISHED=${lines[$IDX]}
[ $REPOSITORY == \"\" ] || REQ_TERMS=${lines[$IDX+1]}
[ "$AVAILABLE" != "Generally Available" ] || REPOSITORY=`echo ${lines[$IDX+2]} | tr -d '"'`
[[ $REPOSITORY == *[@:]* ]] || REGISTRY=`echo ${lines[$IDX+3]} | tr -d '"'`
[[ $REPOSITORY == *[* ]] || RELEASE=`echo ${lines[$IDX+4]} | tr -d '"'`
[[ "$REGISTRY" == *non_registry* ]] || if [ "$PUBLISHED" == "true" ] &&
[[ $REGISTRY != *.* ]] [ "$RELEASE" == "Generally Available" ] &&
then [ $REPOSITORY != \"\" ] &&
continue [[ $REPOSITORY != *[@:]* ]] &&
fi [[ $REPOSITORY != *[* ]] &&
[[ $REGISTRY == *.* ]] &&
[ "$REGISTRY" != "non_registry" ]; then
if [[ $REGISTRY == *quay.io* ]] || if [[ $REGISTRY == *quay.io* ]] ||
[[ $REGISTRY == *redhat.com* ]]; then [[ $REGISTRY == *redhat.com* ]]; then
if [ "$REQUIRES_TERMS" == "1" ]; then if [ "$REQ_TERMS" == "true" ]; then
REGISTRY=registry.redhat.io REGISTRY=registry.redhat.io
fi fi
echo "\"$REPOSITORY\" = \"$REGISTRY/$REPOSITORY\""
echo "\"$REPOSITORY\" = \"$REGISTRY/$REPOSITORY\"" >> /tmp/rhel-shortnames.conf
fi fi
REGISTRY="" echo "\"$REPOSITORY\" = \"$REGISTRY/$REPOSITORY\""
PUBLISHED="" echo $PUBLISHED,$REQ_TERMS,$REPOSITORY,$REGISTRY,$RELEASE >> /tmp/pyx_debug
AVAILABLE="" echo "\"$REPOSITORY\" = \"$REGISTRY/$REPOSITORY\"" >> /tmp/rhel-shortnames.conf
REPOSITORY=""
REQUIRES_TERMS=""
continue
fi fi
if [[ "$LINE" == *\"published\":\ true,* ]]; then IDX=$(($IDX+5))
PUBLISHED=1 done
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
cp /tmp/rhel-shortnames.conf /tmp/r.conf cp /tmp/rhel-shortnames.conf /tmp/r.conf
for D in `cut -d\ -f1 /tmp/r.conf | sort | uniq -d`; do for D in `cut -d\ -f1 /tmp/r.conf | sort | uniq -d`; do