pungi-fedora/nightly.sh
Dennis Gilmore c688bf345e make old style .composeinfo files on the master mirror for beaker import
Signed-off-by: Dennis Gilmore <dennis@ausil.us>
2016-03-18 14:52:10 -05:00

160 lines
7.7 KiB
Bash
Executable File

#!/bin/sh
export LC_ALL=C
CONFIG="fedora.conf"
TARGET_DIR="/mnt/koji/compose/rawhide"
#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="rawhide"
BRANCHED="rawhide"
BRANCH="rawhide"
COMPSFILE="comps-rawhide.xml"
GIT_BRANCH="master"
TMPDIR=`mktemp -d /tmp/$DIST.$DATE.XXXX`
MOCK="/usr/bin/mock"
TOMAIL="devel@lists.fedoraproject.org test@lists.fedoraproject.org"
FROM="Fedora Rawhide Report <rawhide@fedoraproject.org>"
RSYNCPREFIX="sudo -u ftpsync"
ATOMIC=$(mktemp -d /tmp/atomic.${DIST}.$DATE.XXXX)
ATOMICREPO="/mnt/koji/compose/atomic/$BRANCHED/"
ATOMICDEST="/pub/fedora/linux/atomic/$BRANCHED/"
OLDCOMPOSE_ID=$(cat $TARGET_DIR/latest-Fedora-/COMPOSE_ID)
# 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 fedmsg function, using the releng repo definition
fedmsg_json_start=$(printf '{"log": "start", "branch": "%s", "arch": "%s"}' "$BRANCHED" "$ARCH")
fedmsg_json_done=$(printf '{"log": "done", "branch": "%s", "arch": "%s"}' "$BRANCHED" "$ARCH")
FEDMSG_MODNAME="compose"
FEDMSG_CERTPREFIX="releng"
. ./releng/scripts/fedmsg-functions.sh
# Announce that we are starting...
send_fedmsg "${fedmsg_json_start}" ${DIST} start
pushd $TMPDIR
git clone https://git.fedorahosted.org/git/comps.git && {
pushd comps
make "${COMPSFILE}"
cp "${COMPSFILE}" $DEST/
popd
}
popd
./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
export mail=0
fi
NEWCOMPOSE_ID=$(cat $TARGET_DIR/latest-Fedora-/COMPOSE_ID)
SHORTCOMPOSE_ID=$(echo $NEWCOMPOSE_ID|sed -e 's|Fedora-.*-||g')
DESTDIR=$TARGET_DIR/$NEWCOMPOSE_ID
MOCKCONFIG="fedora-${DIST}-compose-x86_64"
$MOCK -r $MOCKCONFIG --uniqueext=$DATE --init
$MOCK -r $MOCKCONFIG --uniqueext=$DATE --install lorax rpm-ostree git
$MOCK -r $MOCKCONFIG --uniqueext=$DATE --shell "mkdir -p ${DESTDIR}/compose/Atomic/x86_64/iso"
$MOCK -r $MOCKCONFIG --uniqueext=$DATE --shell ""
$MOCK -r $MOCKCONFIG --uniqueext=$DATE --shell "if [ ! -d $ATOMICREPO ]; then ostree init --repo=$ATOMICREPO --mode=archive-z2;fi"
$MOCK -r $MOCKCONFIG --uniqueext=$DATE --shell "git clone https://pagure.io/fedora-atomic.git $ATOMIC && pushd $ATOMIC && git log -n 1 --pretty='%h: %ci - %s' && git checkout ${GIT_BRANCH}"
$MOCK -r $MOCKCONFIG --uniqueext=$DATE --shell "git clone https://git.fedorahosted.org/git/spin-kickstarts.git /spin-kickstarts && pushd /spin-kickstarts && git log -n 1 --pretty='%h: %ci - %s' && git checkout ${GIT_BRANCH}"
$MOCK -r $MOCKCONFIG --uniqueext=$DATE --shell "cd $ATOMIC && sed -i -e 's|mirrorlist=.*$|baseurl=http://kojipkgs.fedoraproject.org/compose/$BRANCH/$NEWCOMPOSE_ID/compose/Everything/x86_64/os/|g' fedora*repo"
$MOCK -r $MOCKCONFIG --uniqueext=$DATE --shell "rpm-ostree compose tree --repo=$ATOMICREPO $ATOMIC/fedora-atomic-docker-host.json >$logdir/atomic"
$MOCK -r $MOCKCONFIG --uniqueext=$DATE --shell "lorax --nomacboot -p Fedora -v ${BRANCHED} -r ${SHORTCOMPOSE_ID} \
-s http://kojipkgs.fedoraproject.org/compose/$BRANCH/$NEWCOMPOSE_ID/compose/Everything/x86_64/os/ \
-i fedora-productimg-atomic \
-t Atomic \
--tmp /tmp/ \
--logfile=${DESTDIR}/logs/x86_64/atomic \
--add-template /spin-kickstarts/atomic-installer/lorax-configure-repo.tmpl \
--add-template-var=ostree_osname=fedora-atomic \
--add-arch-template-var=ostree_repo=https://kojipkgs.fedoraproject.org/compose/atomic/$BRANCHED/ \
--add-template-var=ostree_ref=fedora-atomic/${BRANCHED}/x86_64/docker-host \
--add-arch-template /spin-kickstarts/atomic-installer/lorax-embed-repo.tmpl \
--add-arch-template-var=ostree_osname=fedora-atomic \
--add-arch-template-var=ostree_ref=fedora-atomic/${BRANCHED}/x86_64/docker-host \
${DESTDIR}/compose/Atomic/x86_64/os/ "
$MOCK -r $MOCKCONFIG --uniqueext=$DATE --shell "cp -l ${DESTDIR}/compose/Atomic/x86_64/os/images/boot.iso ${DESTDIR}/compose/Atomic/x86_64/iso/Fedora-Atomic-x86_64-${BRANCHED}-${DATE}.iso"
$MOCK -r $MOCKCONFIG --uniqueext=$DATE --shell "pushd ${DESTDIR}/compose/Atomic/x86_64/iso/ ;sha256sum -b --tag *iso >Fedora-Atomic-${BRANCHED}-x86_64-CHECKSUM; popd"
$MOCK -r $MOCKCONFIG --uniqueext=$DATE --clean
compose-changelog -p $TARGET_DIR/$NEWCOMPOSE_ID/logs/ $TARGET_DIR/$OLDCOMPOSE_ID/ $TARGET_DIR/$NEWCOMPOSE_ID/
/usr/share/mash/spam-o-matic $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 dir in Everything Atomic CloudImages Docker Server Spins Workstation ;
do
$RSYNCPREFIX rsync -avhH $TARGET_DIR/$NEWCOMPOSE_ID/compose/$dir/ /pub/fedora/linux/development/$DIST/$dir/ --link-dest=/pub/fedora/linux/development/$DIST/Everything/ --exclude=repodata ;
$RSYNCPREFIX rsync -avhH $TARGET_DIR/$NEWCOMPOSE_ID/compose/$dir/ /pub/fedora/linux/development/$DIST/$dir/ --link-dest=/pub/fedora/linux/development/$DIST/Everything/ --delete-after ;
$RSYNCPREFIX ./releng/scripts/build_composeinfo /pub/fedora/linux/development/$DIST/ ;
done
for dir in Cloud Labs ;
do
$RSYNCPREFIX rsync -avhH $TARGET_DIR/$NEWCOMPOSE_ID/compose/$dir/ /pub/alt/development/$DIST/$dir/ --link-dest=/pub/fedora/linux/development/$DIST/Everything/ --exclude=repodata ;
$RSYNCPREFIX rsync -avhH $TARGET_DIR/$NEWCOMPOSE_ID/compose/$dir/ /pub/alt/development/$DIST/$dir/ --link-dest=/pub/fedora/linux/development/$DIST/Everything/ --delete-after ;
$RSYNCPREFIX ./releng/scripts/build_composeinfo /pub/alt/development/$DIST/
done
$RSYNCPREFIX rsync -avhH --delete-after $ATOMICREPO $ATOMICDEST
# 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'
if [ "$mail" = "0" ]; then
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
fi
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=s390,s390x
fi
./releng/scripts/srpm-excluded-arch.py -a $arches --path $DESTDIR/compose/Everything/source/tree/SRPMS/\*/ >$DESTDIR/logs/excludearch-$koji.log
done