#!/bin/sh #set -x export LC_ALL=C ARCH=$1 CONFIG="fedora.conf" [ -n "$ARCH" ] && { CONFIG="fedora-$ARCH.conf" SPAMOPTS="--nomail" } TARGET_DIR="/mnt/koji/compose/branched" #OLD_COMPOSES_DIR="--old-composes=/mnt/fedora_koji/compose/f23 --old-composes=$TARGET_DIR" NIGHTLY="--nightly" SKIP_PHASES="--skip-phase=productimg" DEST=$(pwd) DATE=$(date "+%Y%m%d") DIST="26" BRANCHED="26" BRANCH="branched" COMPSFILE="comps-f26.xml" GIT_BRANCH="f26" TMPDIR=`mktemp -d /tmp/$DIST.$DATE.XXXX` TOMAIL="$ARCH@lists.fedoraproject.org" FROM="Fedora Branched $ARCH Report " RSYNCPREFIX="sudo -u ftpsync" ATOMIC=$(mktemp -d /tmp/atomic.${DIST}.$DATE.XXXX) ATOMICREPO="/mnt/koji/compose/atomic/$BRANCHED/" ATOMICDEST="/mnt/koji/atomic/$BRANCHED/" OLDCOMPOSE_ID=$(cat $TARGET_DIR/latest-Fedora-26/COMPOSE_ID) # uncomment and edit for resuming a failed compose #COMPOSE_ID="Fedora-23-20150530.n.0" if [ "$ARCH" = "arm" ]; then arches="aarch64" variants="Everything Server Cloud CloudImages Docker" elif [ "$ARCH" = "ppc" ]; then arches="ppc64 ppc64le" variants="Everything Server Cloud CloudImages Docker" elif [ "$ARCH" = "s390" ]; then arches="s390x" variants="Everything Server" TOMAIL="s390x@lists.fedoraproject.org" fi # 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 fedmsg function, using the releng repo definition FEDMSG_MODNAME="compose" FEDMSG_CERTPREFIX="releng" . ./releng/scripts/fedmsg-functions.sh # Announce that we are starting, even though we don't know the compose_id yet.. send_fedmsg "${fedmsg_json_start}" ${DIST} start pushd $TMPDIR git clone https://pagure.io/fedora-comps.git && { pushd fedora-comps make "${COMPSFILE}" cp "${COMPSFILE}" $DEST/ popd } popd [ -z "$ARCH" ] && { ./releng/scripts/block_retired.py } CMD="pungi-koji --notification-script=/usr/bin/pungi-fedmsg-notification --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-Fedora-26/COMPOSE_ID) SHORTCOMPOSE_ID=$(echo $NEWCOMPOSE_ID|sed -e 's|Fedora-.*-||g') fedmsg_json_start=$(printf '{"log": "start", "branch": "%s", "arch": "%s", "compose_id": "%s"}' "$BRANCHED" "$ARCH" "$NEWCOMPOSE_ID") fedmsg_json_done=$(printf '{"log": "done", "branch": "%s", "arch": "%s", "compose_id": "%s"}' "$BRANCHED" "$ARCH" "$NEWCOMPOSE_ID") # Set this to use later for a few items include depcheck DESTDIR=$TARGET_DIR/$NEWCOMPOSE_ID compose-changelog -p $TARGET_DIR/$NEWCOMPOSE_ID/logs/ $TARGET_DIR/$OLDCOMPOSE_ID/ $TARGET_DIR/$NEWCOMPOSE_ID/ /usr/share/mash/spam-o-matic $SPAMOPTS $DESTDIR/compose/Everything/ >$DESTDIR/logs/depcheck [ -z "$ARCH" ] && { ./releng/scripts/critpath.py --url file://$DESTDIR/compose/Everything -o $DESTDIR/logs/critpath.txt branched &> $DESTDIR/logs/critpath.log } # Tell interested persons that the rsync is starting (zomg!) send_fedmsg "${fedmsg_json_start}" ${DIST} rsync.start for a in $arches do for dir in $variants; do $RSYNCPREFIX rsync -avhH $TARGET_DIR/$NEWCOMPOSE_ID/compose/$dir/$a/ /pub/fedora-secondary/development/$DIST/$dir/$a/ --link-dest=/pub/fedora-secondary/development/$DIST/Everything/ --exclude=repodata ; $RSYNCPREFIX rsync -avhH $TARGET_DIR/$NEWCOMPOSE_ID/compose/$dir/$a/ /pub/fedora-secondary/development/$DIST/$dir/$a/ --link-dest=/pub/fedora-secondary/development/$DIST/Everything/ --delete-after ; done done # Tell interested persons that the rsync is done. send_fedmsg "${fedmsg_json_done}" ${DIST} rsync.complete # Tell everyone by fedmsg about the compose send_fedmsg "${fedmsg_json_done}" ${DIST} complete # Tell everyone by email about the compose SUBJECT='Fedora '$DIST' compose report: '$SHORTCOMPOSE_ID' changes' for tomail in $TOMAIL ; do cat $TARGET_DIR/$NEWCOMPOSE_ID/logs/*verbose $DESTDIR/logs/depcheck | \ mutt -e "set from=\"$FROM\"" -e 'set envelope_from=yes' -s "$SUBJECT" $tomail done for koji in arm ppc s390 do if [ "$koji" = "arm" ]; then arches=aarch64 elif [ "$koji" = "ppc" ]; then arches=ppc64,ppc64le elif [ "$koji" = "s390" ]; then arches=s390x fi ./releng/scripts/srpm-excluded-arch.py -a $arches --path $DESTDIR/compose/Everything/source/tree/Packages/ >$DESTDIR/logs/excludearch-$koji.log done # lock needs to be on NFS as we run it from different compose boxes for each secondary arch /usr/local/bin/update-fullfiletimelist -l /pub/fedora-secondary/update-fullfiletimelist.lock -t /pub fedora-secondary find $TARGET_DIR -xdev -depth -maxdepth 2 -mtime +14 -exec rm -rf {} \;