Skip to content
Snippets Groups Projects
Commit 529d7bc3 authored by Alex Iribarren's avatar Alex Iribarren Committed by Marta Vila Fernandes
Browse files

Upgrade to newer reposync, which fixes a bunch of issues

parent e34d87ea
No related branches found
No related tags found
1 merge request!229Upgrade to newer reposync, which fixes a bunch of issues
FROM gitlab-registry.cern.ch/linuxsupport/cc7-base:latest
FROM gitlab-registry.cern.ch/linuxsupport/alma9-base:latest
RUN yum install -y jq createrepo patch python3-requests \
RUN yum install -y yum-utils bc diffutils python3-requests \
&& yum clean all
RUN rm -rf /etc/yum.repos.d/*
......@@ -10,11 +10,6 @@ COPY *.sh /root/
COPY *.py /root/
COPY prod.repos.d/ /root/prod.repos.d/
# Temporary hack, hopefully. Waiting on
# https://github.com/rpm-software-management/yum-utils/pull/49
COPY reposync.patch /root/
RUN patch /usr/bin/reposync /root/reposync.patch
VOLUME /repo
WORKDIR /root
......
--- reposync 2018-10-10 14:02:54.070891179 +0200
+++ reposync.new 2018-10-10 14:03:24.692535073 +0200
@@ -363,7 +363,7 @@
else:
my.logger.warning('Removing %s due to failed signature check: %s' % rpmfn)
os.unlink(pkg.localpath)
- exit_code = 1
+ exit_code = 2
continue
my.closeRpmDB()
......@@ -42,7 +42,6 @@ printf "\nasync=0\n" >> /etc/yum.repos.d/sync.repo
# Create REPOPATH even if the repo is empty
if [ ! -d $REPOPATH ]; then
/bin/mkdir -p ${REPOPATH}
# Repo doesn't exist yet, but we still want createrepo to run even if it's empty
PRECOUNT=-1
fi
......@@ -68,20 +67,15 @@ trap 'rm -f "$LOCKFILE"; exit $?' INT TERM EXIT
if [[ $RUN_REPOSYNC -eq 1 ]]; then
grep 'baseurl=' /etc/yum.repos.d/sync.repo | grep -q 'aarch64'
if [ $? -eq 0 ]; then
AARCH64="--arch=aarch64"
fi
# Run reposync
/usr/bin/reposync \
--delete \
--remote-time \
--downloadcomps \
--download-metadata \
--norepopath \
--source \
--gpgcheck \
--download_path ${REPOPATH} \
${AARCH64} \
--download-path ${REPOPATH} \
--repoid ${REPOID} 2> /local/stderr
RET=$?
......@@ -115,8 +109,7 @@ fi
POSTCOUNT=$(wc -l /tmp/postlist | cut -d' ' -f1)
# cdn.redhat.com delivers us some rpms with junk attached at the end ... ?
# these are 'useable' but since the size changes, metadata must be regenerated to
# take it into account.
# this may not be an issue anymore, but let's track it just in case
POSTSIZE=$(awk '{print $2}' /tmp/postlist | paste -sd+ | bc)
if [[ ($PRECOUNT -eq $POSTCOUNT) && ($PRESIZE -ne $POSTSIZE) ]]; then
......@@ -128,60 +121,14 @@ fi
if [[ ($PRECOUNT -ne $POSTCOUNT) || ($PRESIZE -ne $POSTSIZE) ]]; then
CHANGELIST=$(/usr/bin/diff --changed-group-format='%>' --unchanged-group-format='' <(awk '{print $1}' /tmp/prelist) <(awk '{print $1}' /tmp/postlist))
# Run createrepo
if [[ $RUN_CREATEREPO -eq 1 ]]; then
COMPXMLFILE=$(/bin/ls -1tr ${REPOPATH}/*-comps*xml.gz 2>&1 | /usr/bin/tail -1)
if [ -f "$COMPXMLFILE" ]; then
/bin/cp -f $COMPXMLFILE $REPOPATH/comps.xml.gz
/bin/gunzip -f $REPOPATH/comps.xml.gz
/bin/rm -f $REPOPATH/*-comps*xml.gz
GROUPFILE="-g ${REPOPATH}/comps.xml"
fi
# Run createrepo
/usr/bin/createrepo \
--workers 5 \
--checksum ${CHECKSUM} \
${GROUPFILE} \
--outputdir ${REPOPATH} \
${REPOPATH} 2> /local/stderr
RET=$?
if [[ $RET -ne 0 ]]; then
cat << EOF | error | tee $OUTPUT
"exit_code": $RET,
"error": "createrepo failed",
"output": "$(sed 's/"/\\"/g' /local/stderr)"
EOF
exit $RET
fi
/bin/rm -f $REPOPATH/comps.xml
# Keep the current xml.gz file and remove the older one
UPDXMLFILE=$(/bin/ls -1tr $REPOPATH/*-updateinfo.xml.gz 2>&1 | /usr/bin/tail -1)
if [ -f "$UPDXMLFILE" ]; then
/usr/bin/modifyrepo $UPDXMLFILE $REPOPATH/repodata
NEWUPDXMLFILE=$(sed '/updateinfo.xml.gz/!d; s/.*repodata\/\(.*\)".*/\1/' ${REPOPATH}/repodata/repomd.xml)
/usr/bin/find ${REPOPATH} -name '*updateinfo.xml*' -not -name $NEWUPDXMLFILE -printf "removed '%f'\n" -delete
fi
# Keep the current yaml.gz file and remove the older one
MODULEFILE=$(/bin/ls -1tr ${REPOPATH}/*-module*yaml.gz 2>&1 | /usr/bin/tail -1)
if [ -f "$MODULEFILE" ]; then
/usr/bin/modifyrepo --mdtype=modules $MODULEFILE $REPOPATH/repodata
NEWMODULEFILE=$(sed '/yaml.gz/!d; s/.*repodata\/\(.*\)".*/\1/' ${REPOPATH}/repodata/repomd.xml)
/usr/bin/find ${REPOPATH} -name '*module*.yaml*' -not -path ${REPOPATH}/repodata/$NEWMODULEFILE -printf "removed '%f'\n" -delete
fi
fi # end of if [[ $RUN_CREATEREPO -eq 1 ]]
else # else of if [[ $PRECOUNT -ne $POSTCOUNT ]]
# No new packages
/bin/rm -f $REPOPATH/*-updateinfo.xml.gz $REPOPATH/*-comps*xml.gz $REPOPATH/*-updateinfo.xml
fi
# Keep the current xml.gz file and remove the older one
NEWUPDXMLFILE=$(sed '/updateinfo.xml/!d; s/.*repodata\/\(.*\)".*/\1/' ${REPOPATH}/repodata/repomd.xml)
[ -n "$NEWUPDXMLFILE" ] && /usr/bin/find ${REPOPATH} -name '*updateinfo.xml*' -not -name $NEWUPDXMLFILE -printf "removed '%f'\n" -delete
# Keep the current yaml.gz file and remove the older one
NEWMODULEFILE=$(sed '/yaml.gz/!d; s/.*repodata\/\(.*\)".*/\1/' ${REPOPATH}/repodata/repomd.xml)
[ -n "$NEWMODULEFILE" ] && /usr/bin/find ${REPOPATH} -name '*module*.yaml*' -not -path ${REPOPATH}/repodata/$NEWMODULEFILE -printf "removed '%f'\n" -delete
fi
for rpm in ${CHANGELIST}; do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment