pungi-fedora/nightly-dnf.sh
Lubomír Sedlář 12e0b161bf Add a config and script for Rawhide done with DNF
This is a temporary measure for testing. It will shadow real rawhide
composes and redo them with depsolving based on DNF.

The composes will land in /mnt/koji/compose/rawhide-dnf and there will
be logs with information about changes in package set.

Nothing will be sent to fedmsg, no mails will be sent.

Only the package set is created, no extra images or even repos are
created.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
2017-03-27 14:53:00 +02:00

54 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
# Abort if any command fails or undefined variable is used.
set -eu
export LC_ALL=C
CONFIG=fedora-dnf.conf
TARGET_DIR=/mnt/koji/compose/rawhide-dnf
DATE=$(date +%Y%m%d)
COMPSDIR=$(mktemp -d "/tmp/rawhide-dnf.$DATE.XXXX")
COMPSFILE=comps-rawhide.xml
# Clone comps repo, create comps file for rawhide and copy it into current
# directory.
git clone https://pagure.io/fedora-comps.git "$COMPSDIR"
make -C "$COMPSDIR" "$COMPSFILE"
cp "$COMPSDIR/$COMPSFILE" "$(pwd)/"
rm -rf "$COMPSDIR"
# Pick yum-based compose to replicate: the one from the same day should do.
YUM_COMPOSE=/mnt/koji/compose/rawhide/Fedora-Rawhide-$DATE.n.0
# Retrieve Koji event id from it
EVENT=$(python -m json.tool <"$YUM_COMPOSE/work/global/koji-event" | grep id | tr -d -c '0-9')
# Make sure target directory exists
mkdir -p $TARGET_DIR
# Run the compose with correct event, and only use the required phases.
time pungi-koji --config="$CONFIG" --target-dir="$TARGET_DIR" --nightly --koji-event="$EVENT" \
--just-phase init --just-phase pkgset --just-phase gather --just-phase test \
--old-composes="$TARGET_DIR"
DNF_COMPOSE=$(readlink -f $TARGET_DIR/latest-Fedora-Rawhide)
# Compose was successful, let's compute differences in packages
LOG_DIR="$DNF_COMPOSE/logs/global/depsolve/"
mkdir -p "$LOG_DIR"
# For each variant.arch combination there is a separate log file. The filenames
# contain both variant UID and arch, so they are unique and can be safely
# copied into one directory.
for logfile in $YUM_COMPOSE/work/*/pungi/*.log; do
# Find path relative to compose topdir: work/<arch>/pungi/<variant>.<arch>.log
log=$(echo "$logfile" | rev | cut -d/ -f-4 | rev)
# The command exits with 1 if there are differences, so we will suppress
# that to avoid having script exit after processing first log.
pungi-compare-depsolving "$YUM_COMPOSE/$log" "$DNF_COMPOSE/$log" >"$LOG_DIR/$(basename "$log")" || true
done
# Delete composes older than 7 days.
find $TARGET_DIR -xdev -depth -maxdepth 2 -mtime +7 -exec rm -rf {} \;