From 52a375133e7e3c3c4b0bf0dbd956bb86a2bbd572 Mon Sep 17 00:00:00 2001 From: Devrim Gunduz Date: Sat, 7 Jun 2025 16:18:57 -0500 Subject: [PATCH] scripts: Add sync script for sysupdates repo. Again, the TODO is to merge all scripts. --- scripts/buildserver/packagesyncsysupdates.sh | 46 ++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 scripts/buildserver/packagesyncsysupdates.sh diff --git a/scripts/buildserver/packagesyncsysupdates.sh b/scripts/buildserver/packagesyncsysupdates.sh new file mode 100755 index 000000000..15e4073b4 --- /dev/null +++ b/scripts/buildserver/packagesyncsysupdates.sh @@ -0,0 +1,46 @@ +#!/usr/bin/bash + +######################################################### +# # +# Devrim Gündüz - 2024 # +# # +######################################################### + +# Include common values: +source ~/bin/global.sh + +export BASE_DIR=/var/lib/pgsql/$ossysupdates-sysupdates + +export SYSUPDATES_RPM_DIR=$BASE_DIR/ALLRPMS +export SYSUPDATES_SRPM_DIR=$BASE_DIR/ALLSRPMS + +# Create directories for binary and source RPMs. This directory will help us +# to create the repo files easily (though this can be done via ansible during initial installation: + +mkdir -p $SYSUPDATES_RPM_DIR +mkdir -p $SYSUPDATES_SRPM_DIR + +echo "${green}Syncing PostgreSQL sysupdates RPMs for $os - $osarch${reset}" + +# rsync binary and source RPMs to their own directories: + +rsync --checksum -av --delete --stats $BASE_DIR/RPMS/$osarch/ $BASE_DIR/RPMS/noarch/ $SYSUPDATES_RPM_DIR +rsync --checksum -av --delete --stats $BASE_DIR/SRPMS/ $SYSUPDATES_SRPM_DIR + +# Now, create repo for RPMs and SRPMS: + +createrepo --changelog-limit=3 --workers=4 -d --update $SYSUPDATES_RPM_DIR +createrepo --changelog-limit=3 --workers=4 -d --update $SYSUPDATES_SRPM_DIR + +echo $GPG_PASSWORD | /usr/bin/gpg2 -a --pinentry-mode loopback --detach-sign --batch --yes --passphrase-fd 0 $SYSUPDATES_RPM_DIR/repodata/repomd.xml +echo $GPG_PASSWORD | /usr/bin/gpg2 -a --pinentry-mode loopback --detach-sign --batch --yes --passphrase-fd 0 $SYSUPDATES_SRPM_DIR/repodata/repomd.xml + +# Finally, perform the rsync: + +rsync -ave ssh --delete $SYSUPDATES_RPM_DIR/ yumupload@yum.postgresql.org:yum/yum/common/pgdg-$ossysupdates-sysupdates/$osdistro/$os-$osarch + +# Sync SRPMs to S3 bucket: +aws s3 sync $SYSUPDATES_SRPM_DIR s3://dnf-srpms.postgresql.org20250313103537584600000001/srpms/common/pgdg-$ossysupdates-sysupdates/$osdistro/$os-$osarch --exclude "*.html" +aws cloudfront create-invalidation --distribution-id $CF_SRPM_DISTRO_ID --path /srpms/$packageSyncVersion/$osdistro/$os-$osarch/repodata/* + +exit 0 -- 2.39.5