| |
@@ -0,0 +1,165 @@
|
| |
+ #!/bin/sh
|
| |
+
|
| |
+
|
| |
+ export LC_ALL=C
|
| |
+
|
| |
+ CONFIG="eln.conf"
|
| |
+ TARGET_DIR="/mnt/koji/compose/eln"
|
| |
+ MD_ARCHIVE_DIR="/mnt/koji/compose/metadata-archive"
|
| |
+ SERIES_DIR="$MD_ARCHIVE_DIR/series"
|
| |
+ NIGHTLY="--nightly"
|
| |
+ SKIP_PHASES=""
|
| |
+ DEST=$(pwd)
|
| |
+ DATE=$(date "+%Y%m%d")
|
| |
+ SHORT="Fedora"
|
| |
+ RELEASE="eln"
|
| |
+ COMPSFILE="comps-eln.xml"
|
| |
+ TMPDIR=`mktemp -d /tmp/$RELEASE.$DATE.XXXX`
|
| |
+ TOMAIL="devel@lists.fedoraproject.org test-reports@lists.fedoraproject.org"
|
| |
+ FROM="Fedora ELN Report <rawhide@fedoraproject.org>"
|
| |
+ RSYNCPREFIX="sudo -u ftpsync"
|
| |
+ RSYNCTARGET="/pub/eln/"
|
| |
+ OSTREESRCREPO="/mnt/koji/compose/ostree/repo/"
|
| |
+ OSTREEDESTREPO="/mnt/koji/ostree/repo/"
|
| |
+ OLDCOMPOSE_ID=$(cat $TARGET_DIR/LAST_COMPOSE_ID)
|
| |
+ OLDCOMPOSE_DATE=$(echo $OLDCOMPOSE_ID|sed -e 's|Fedora-.*-||g'|cut -d "." -f1)
|
| |
+ # uncomment and edit for resuming a failed compose
|
| |
+ #COMPOSE_ID="Fedora-23-20150530.n.0"
|
| |
+
|
| |
+ # assume a releng dir is a git checkout of the releng repo
|
| |
+ # if it does not exist clone it
|
| |
+ if [ -d releng ]; then
|
| |
+ pushd releng
|
| |
+ git pull --rebase
|
| |
+ popd
|
| |
+ else
|
| |
+ git clone https://pagure.io/releng.git
|
| |
+ fi
|
| |
+
|
| |
+ # Set up our fedora messaging function, using the releng repo definition
|
| |
+ FEDMSG_MODNAME="compose"
|
| |
+ FEDMSG_CERTPREFIX="releng"
|
| |
+ . ./releng/scripts/fedora-messaging.sh
|
| |
+
|
| |
+ # Announce that we are starting, even though we don't know the compose_id yet..
|
| |
+ fedora_message_json_start=$(printf '{"log": "start", "branch": "%s", "arch": "%s", "short": "%s"}' "$RELEASE" "$ARCH" "$SHORT")
|
| |
+ send_fedora_message "${fedora_message_json_start}" ${RELEASE} start
|
| |
+
|
| |
+ CMD="pungi-koji --notification-script=/usr/bin/pungi-fedmsg-notification --notification-script=pungi-wait-for-signed-ostree-handler --config=$CONFIG --old-composes=$TARGET_DIR $OLD_COMPOSES_DIR $NIGHTLY $SKIP_PHASES"
|
| |
+
|
| |
+ if [ -z "$COMPOSE_ID" ]; then
|
| |
+ CMD="$CMD --target-dir=$TARGET_DIR"
|
| |
+ else
|
| |
+ CMD="$CMD --debug-mode --compose-dir=$TARGET_DIR/$COMPOSE_ID"
|
| |
+ fi
|
| |
+
|
| |
+ time $CMD "$@"
|
| |
+ if [ "$?" != "0" ]; then
|
| |
+ exit 1
|
| |
+ fi
|
| |
+
|
| |
+ NEWCOMPOSE_ID=$(cat $TARGET_DIR/latest-$SHORT-$RELEASE/COMPOSE_ID)
|
| |
+ NEWCOMPOSE_DATE=$(echo $NEWCOMPOSE_ID|sed -e 's|Fedora-.*-||g'|cut -d "." -f1)
|
| |
+ SHORTCOMPOSE_ID=$(echo $NEWCOMPOSE_ID|sed -e 's|Fedora-.*-||g')
|
| |
+
|
| |
+ # Set this to use later for a few items include depcheck
|
| |
+ DESTDIR=$TARGET_DIR/$NEWCOMPOSE_ID
|
| |
+ # Public URLs the synced compose will wind up at, we put them in fedora-messaging
|
| |
+ LOCATION="https://dl.fedoraproject.org$RSYNCTARGET"
|
| |
+ ALT_LOCATION="https://dl.fedoraproject.org$RSYNCALTTARGET"
|
| |
+ SECONDARY_LOCATION="https://dl.fedoraproject.org$RSYNCSECTARGET"
|
| |
+ # Update fedora_message template
|
| |
+ fedora_message_json_start=$(printf '{"log": "start", "branch": "%s", "arch": "%s", "short": "%s", "compose_id": "%s", "location": "%s", "alt_location": "%s", "secondary_location": "%s"}' "$RELEASE" "$ARCH" "$SHORT" "$NEWCOMPOSE_ID", "$LOCATION", "$ALT_LOCATION", "$SECONDARY_LOCATION")
|
| |
+ fedora_message_json_done=$(printf '{"log": "done", "branch": "%s", "arch": "%s", "short": "%s", "compose_id": "%s", "location": "%s", "alt_location": "%s", "secondary_location": "%s"}' "$RELEASE" "$ARCH" "$SHORT" "$NEWCOMPOSE_ID" "$LOCATION" "$ALT_LOCATION" "$SECONDARY_LOCATION")
|
| |
+
|
| |
+ # Fix permissions on the grub efi files and fonts (they're 0600)
|
| |
+ chmod -R go+r $DESTDIR/compose/*/*/os/EFI/
|
| |
+
|
| |
+ if ! compose-changelog -p "$DESTDIR/logs/" "$TARGET_DIR/$OLDCOMPOSE_ID/" "$DESTDIR/" 2>"$DESTDIR/logs/changelog.stderr"; then
|
| |
+ # Generating changelog failed. We should not send an empty announcement to
|
| |
+ # general public.
|
| |
+ TOMAIL=""
|
| |
+ VERSION="$(rpm -q compose-utils)"
|
| |
+ # Instead report it to rel-eng@ list.
|
| |
+ mutt -e "set from=\"$FROM\"" \
|
| |
+ -e 'set envelope_from=yes' \
|
| |
+ -s "Generating changelog for $NEWCOMPOSE_ID failed (with $VERSION)" \
|
| |
+ rel-eng@lists.fedoraproject.org \
|
| |
+ < "$DESTDIR/logs/changelog.stderr"
|
| |
+ fi
|
| |
+
|
| |
+ [ -z "$ARCH" ] && {
|
| |
+ ./releng/scripts/critpath.py --composeurl file://$DESTDIR/compose -o $DESTDIR/logs/critpath.txt rawhide &> $DESTDIR/logs/critpath.log
|
| |
+ }
|
| |
+
|
| |
+ # Tell interested persons that the rsync is starting (zomg!)
|
| |
+ send_fedora_message "${fedora_message_json_start}" ${RELEASE} rsync.start
|
| |
+
|
| |
+ # Sync the content to /pub/fedora-eln
|
| |
+ if [ ! -d "$RSYNCTARGET" ]; then
|
| |
+ $RSYNCPREFIX mkdir -p "$RSYNCTARGET"
|
| |
+ fi
|
| |
+
|
| |
+ included_variants=(
|
| |
+ AppStream
|
| |
+ BaseOS
|
| |
+ CRB
|
| |
+ Extras
|
| |
+ HighAvailability
|
| |
+ NFV
|
| |
+ ResilientStorage
|
| |
+ RT
|
| |
+ SAP
|
| |
+ SAPHANA
|
| |
+ )
|
| |
+ $RSYNCPREFIX compose-partial-copy \
|
| |
+ --arch=aarch64 --arch=x86_64 --arch=ppc64le --arch=s390x --arch=src \
|
| |
+ "$DESTDIR" "$RSYNCTARGET/" \
|
| |
+ ${variants[@]/#/--variant } \
|
| |
+ --exclude=repodata
|
| |
+ $RSYNCPREFIX compose-partial-copy \
|
| |
+ --arch=aarch64 --arch=x86_64 --arch=ppc64le --arch=s390x --arch=src \
|
| |
+ "$DESTDIR" "$RSYNCTARGET/" \
|
| |
+ ${variants[@]/#/--variant } \
|
| |
+ --delete-after
|
| |
+ $RSYNCPREFIX rm "$RSYNCTARGET/.composeinfo"
|
| |
+ $RSYNCPREFIX ./releng/scripts/build_composeinfo "$RSYNCTARGET/" --name "$NEWCOMPOSE_ID"
|
| |
+
|
| |
+ # hardlink content
|
| |
+ time hardlink -v "$RSYNCTARGET"
|
| |
+
|
| |
+ # Tell interested persons that the rsync is done.
|
| |
+ send_fedora_message "${fedora_message_json_done}" ${RELEASE} rsync.complete
|
| |
+
|
| |
+
|
| |
+ # Tell everyone by fedora_message about the compose
|
| |
+ send_fedora_message "${fedora_message_json_done}" ${RELEASE} complete
|
| |
+
|
| |
+ # Tell everyone by email about the compose
|
| |
+ # "$DESTDIR/logs/depcheck" lets not cat out depcheck for now as it does
|
| |
+ # not understand rich dependencies
|
| |
+ if [[ $NEWCOMPOSE_DATE -gt $OLDCOMPOSE_DATE ]]; then
|
| |
+ # Only send one compose report per day or we'll be spamming
|
| |
+ # the devel list.
|
| |
+ SUBJECT='Fedora '$RELEASE' compose report: '$SHORTCOMPOSE_ID' changes'
|
| |
+ for tomail in $TOMAIL ; do
|
| |
+ cat $DESTDIR/logs/*verbose | \
|
| |
+ mutt -e "set from=\"$FROM\"" -e 'set envelope_from=yes' -s "$SUBJECT" $tomail
|
| |
+ done
|
| |
+
|
| |
+ # Save the new compose ID so we don't resend again until the next day
|
| |
+ echo -n $NEWCOMPOSE_ID > $TARGET_DIR/LAST_COMPOSE_ID
|
| |
+ fi
|
| |
+
|
| |
+ # Copy the metadata to the non-garbage-collected metadata archive
|
| |
+ YEAR=$(echo "${SHORTCOMPOSE_ID}" | cut -c1-4)
|
| |
+ mkdir -p "${MD_ARCHIVE_DIR}/${YEAR}/${NEWCOMPOSE_ID}"
|
| |
+ cp "${DESTDIR}"/compose/metadata/*.json "${MD_ARCHIVE_DIR}/${YEAR}/${NEWCOMPOSE_ID}/"
|
| |
+ # Add the compose ID to the 'series' file which records the
|
| |
+ # compose IDs for each SHORT name in order
|
| |
+ mkdir -p "${SERIES_DIR}"
|
| |
+ echo "${NEWCOMPOSE_ID}" >> "${SERIES_DIR}/${SHORT}-${RELEASE}"
|
| |
+
|
| |
+ # Removed all the older than 14 days composes
|
| |
+ find $TARGET_DIR -xdev -depth -maxdepth 2 -mtime +14 -exec rm -rf {} \;
|
| |
+ send_fedora_message "${fedora_message_json_done}" ${RELEASE} cleanup.complete
|
| |
This script will replace the ODCS compose that ELN has been using as well as its reliance on ImageFactory.
Signed-off-by: Stephen Gallagher sgallagh@redhat.com