ced9341
#!/bin/sh
ced9341
ced9341
ced9341
export LC_ALL=C
ced9341
ced9341
CONFIG="fedora.conf"
47103ea
TARGET_DIR="/mnt/koji/compose/branched"
ced9341
#OLD_COMPOSES_DIR="--old-composes=/mnt/fedora_koji/compose/f23 --old-composes=$TARGET_DIR"
ced9341
NIGHTLY="--nightly"
root 41d8d52
SKIP_PHASES="--skip-phase=productimg"
19e8689
DEST=$(pwd)
19e8689
DATE=$(date "+%Y%m%d")
47103ea
DIST="26"
47103ea
BRANCHED="26"
47103ea
BRANCH="branched"
1a8b28e
COMPSFILE="comps-f26.xml"
47103ea
GIT_BRANCH="f26"
a25b08c
TMPDIR=`mktemp -d /tmp/$DIST.$DATE.XXXX`
a25b08c
TOMAIL="devel@lists.fedoraproject.org test@lists.fedoraproject.org"
47103ea
FROM="Fedora Branched Report <rawhide@fedoraproject.org>"
a25b08c
RSYNCPREFIX="sudo -u ftpsync"
a25b08c
ATOMIC=$(mktemp -d /tmp/atomic.${DIST}.$DATE.XXXX)
a25b08c
ATOMICREPO="/mnt/koji/compose/atomic/$BRANCHED/"
7cdfd1d
ATOMICDEST="/mnt/koji/atomic/$BRANCHED/"
47103ea
OLDCOMPOSE_ID=$(cat $TARGET_DIR/latest-Fedora-26/COMPOSE_ID)
ced9341
# uncomment and edit for resuming a failed compose
ced9341
#COMPOSE_ID="Fedora-23-20150530.n.0"
ced9341
84645b1
# assume a releng dir is a git checkout of the releng repo
9dc2ae8
# if it does not exist clone it
9dc2ae8
if [ -d releng ]; then
9dc2ae8
    pushd releng
9dc2ae8
    git pull --rebase
9dc2ae8
    popd
9dc2ae8
else
9dc2ae8
    git clone https://pagure.io/releng.git
9dc2ae8
fi
9dc2ae8
d136a4c
# Set up our fedmsg function, using the releng repo definition
d136a4c
FEDMSG_MODNAME="compose"
d136a4c
FEDMSG_CERTPREFIX="releng"
d136a4c
. ./releng/scripts/fedmsg-functions.sh
d136a4c
fa6f62a
# Announce that we are starting, even though we don't know the compose_id yet..
91aca25
send_fedmsg "${fedmsg_json_start}" ${DIST} start
d136a4c
19e8689
pushd $TMPDIR
e249ad3
git clone https://pagure.io/fedora-comps.git && {
10f81a2
    pushd fedora-comps
19e8689
    make "${COMPSFILE}"
19e8689
    cp "${COMPSFILE}" $DEST/
19e8689
    popd
19e8689
}
19e8689
popd
19e8689
9dc2ae8
./releng/scripts/block_retired.py
a25b08c
14fba4c
CMD="pungi-koji --notification-script=/usr/bin/pungi-fedmsg-notification --config=$CONFIG --old-composes=$TARGET_DIR $OLD_COMPOSES_DIR $NIGHTLY $SKIP_PHASES"
root 41d8d52
ced9341
if [ -z "$COMPOSE_ID" ]; then
ced9341
    CMD="$CMD --target-dir=$TARGET_DIR"
ced9341
else
root 41d8d52
    CMD="$CMD --debug-mode --compose-dir=$TARGET_DIR/$COMPOSE_ID"
ced9341
fi
ced9341
root 41d8d52
time $CMD "$@"
c957262
if [ "$?" != "0" ]; then
c957262
    exit 1
6a498f5
fi
6a498f5
47103ea
NEWCOMPOSE_ID=$(cat $TARGET_DIR/latest-Fedora-26/COMPOSE_ID)
3e2651f
SHORTCOMPOSE_ID=$(echo $NEWCOMPOSE_ID|sed -e 's|Fedora-.*-||g')
fa6f62a
fedmsg_json_start=$(printf '{"log": "start", "branch": "%s", "arch": "%s", "compose_id": "%s"}' "$BRANCHED" "$ARCH" "$NEWCOMPOSE_ID")
fa6f62a
fedmsg_json_done=$(printf '{"log": "done", "branch": "%s", "arch": "%s", "compose_id": "%s"}' "$BRANCHED" "$ARCH" "$NEWCOMPOSE_ID")
a25b08c
1a2692b
# Set this to use later for a few items include depcheck
1a2692b
DESTDIR=$TARGET_DIR/$NEWCOMPOSE_ID
1a2692b
a25b08c
compose-changelog -p $TARGET_DIR/$NEWCOMPOSE_ID/logs/ $TARGET_DIR/$OLDCOMPOSE_ID/ $TARGET_DIR/$NEWCOMPOSE_ID/
9dc2ae8
/usr/share/mash/spam-o-matic $DESTDIR/compose/Everything/ >$DESTDIR/logs/depcheck
9dc2ae8
9dc2ae8
[ -z "$ARCH" ] && {
9dc2ae8
./releng/scripts/critpath.py --url file://$DESTDIR/compose/Everything -o $DESTDIR/logs/critpath.txt branched &> $DESTDIR/logs/critpath.log
9dc2ae8
}
a25b08c
1edd5f8
ostree prune --repo=$ATOMICREPO --keep-younger-than="14 days ago" --refs-only
1edd5f8
e23a5f7
# Tell interested persons that the rsync is starting (zomg!)
e23a5f7
send_fedmsg "${fedmsg_json_start}" ${DIST} rsync.start
1d86df0
9161baf
# Sync the content to /pub/fedora
b4670db
$RSYNCPREFIX compose-partial-copy --arch=armhfp --arch=x86_64 --arch src \
9161baf
    "$TARGET_DIR/$NEWCOMPOSE_ID" /pub/fedora/linux/development/$DIST/ \
91e76bb
    --variant Everything --variant Atomic --variant CloudImages --variant Docker --variant Server --variant Spins --variant Workstation \
91e76bb
    --link-dest=/pub/fedora/linux/development/$DIST/Everything --exclude=repodata
b4670db
$RSYNCPREFIX compose-partial-copy --arch=armhfp --arch=x86_64 --arch src \
9161baf
    "$TARGET_DIR/$NEWCOMPOSE_ID" /pub/fedora/linux/development/$DIST/ \
91e76bb
    --variant Everything --variant Atomic --variant CloudImages --variant Docker --variant Server --variant Spins --variant Workstation \
91e76bb
    --link-dest=/pub/fedora/linux/development/$DIST/Everything --delete-after
91e76bb
$RSYNCPREFIX rm /pub/fedora/linux/development/$DIST/.composeinfo
91e76bb
$RSYNCPREFIX ./releng/scripts/build_composeinfo /pub/fedora/linux/development/$DIST/ --name "$NEWCOMPOSE_ID"
91e76bb
9161baf
# Sync the content to /pub/alt
9161baf
$RSYNCPREFIX compose-partial-copy --arch=armhfp --arch=x86_64 \
9161baf
    "$TARGET_DIR/$NEWCOMPOSE_ID" /pub/alt/development/$DIST/ \
91e76bb
    --variant Cloud --variant Labs \
91e76bb
    --link-dest=/pub/fedora/linux/development/$DIST/Everything/ --exclude=repodata
9161baf
$RSYNCPREFIX compose-partial-copy --arch=armhfp --arch=x86_64 \
9161baf
    "$TARGET_DIR/$NEWCOMPOSE_ID" /pub/alt/development/$DIST/ \
91e76bb
    --variant Cloud --variant Labs \
91e76bb
    --link-dest=/pub/fedora/linux/development/$DIST/Everything/ --delete-after
91e76bb
$RSYNCPREFIX rm /pub/alt/development/$DIST/.composeinfo
91e76bb
$RSYNCPREFIX ./releng/scripts/build_composeinfo /pub/alt/development/$DIST/ --name "$NEWCOMPOSE_ID"
9161baf
9161baf
# Sync the content to /pub/fedora-secondary
9da4561
$RSYNCPREFIX compose-partial-copy --arch=aarch64 --arch=i386 --arch=ppc64 --arch=ppc64le \
9161baf
    "$TARGET_DIR/$NEWCOMPOSE_ID" /pub/fedora-secondary/development/$DIST/ \
9da4561
    --exclude=s390x \
9161baf
    --link-dest=/pub/fedora/linux/development/$DIST/Everything/ --exclude=repodata
9da4561
$RSYNCPREFIX compose-partial-copy --arch=aarch64 --arch=i386 --arch=ppc64 --arch=ppc64le \
9161baf
    "$TARGET_DIR/$NEWCOMPOSE_ID" /pub/fedora-secondary/development/$DIST/ \
9da4561
    --exclude=s390x \
9161baf
    --link-dest=/pub/fedora/linux/development/$DIST/Everything/ --delete-after
a824751
$RSYNCPREFIX rm /pub/fedora-secondary/development/$DIST/.composeinfo
b8f5e60
$RSYNCPREFIX ./releng/scripts/build_composeinfo /pub/fedora-secondary/development/$DIST/ --name "$NEWCOMPOSE_ID"
91e76bb
95b4299
$RSYNCPREFIX rsync -avhH --delete-after $ATOMICREPO $ATOMICDEST
1d86df0
e23a5f7
# Tell interested persons that the rsync is done.
e23a5f7
send_fedmsg "${fedmsg_json_done}" ${DIST} rsync.complete
e23a5f7
e23a5f7
# Tell everyone by fedmsg about the compose
e23a5f7
send_fedmsg "${fedmsg_json_done}" ${DIST} complete
e23a5f7
e23a5f7
# Tell everyone by email about the compose
4acb824
SUBJECT='Fedora '$DIST' compose report: '$SHORTCOMPOSE_ID' changes'
c957262
for tomail in $TOMAIL ; do
c957262
    cat $TARGET_DIR/$NEWCOMPOSE_ID/logs/*verbose $DESTDIR/logs/depcheck | \
c957262
         mutt -e "set from=\"$FROM\"" -e 'set envelope_from=yes' -s "$SUBJECT" $tomail
c957262
done
a25b08c
9dc2ae8
for koji in arm ppc s390
9dc2ae8
do
9dc2ae8
  if [ "$koji" = "arm" ]; then
9dc2ae8
     arches=aarch64
9dc2ae8
  elif [ "$koji" = "ppc" ]; then
9dc2ae8
     arches=ppc64,ppc64le
9dc2ae8
  elif [ "$koji" = "s390" ]; then
a73f1f3
     arches=s390x
9dc2ae8
  fi
bfa3a7c
  ./releng/scripts/srpm-excluded-arch.py -a $arches --path $DESTDIR/compose/Everything/source/tree/Packages/ >$DESTDIR/logs/excludearch-$koji.log
9dc2ae8
done
9dc2ae8
acdcba9
find $TARGET_DIR  -xdev -depth -maxdepth 2 -mtime +14  -exec rm -rf {} \;
b81d96f