049c81f
#!/bin/bash
c1a3a2c
c1a3a2c
# We always do a rebase to new upstream's tarball for Fedora Rawhide.
c1a3a2c
#
c1a3a2c
# For non-Rawhide Fedora releases, we can sometimes backport specific patches,
c1a3a2c
# if the rebase is not possible.
c1a3a2c
#
c1a3a2c
# This scripts automates this process.
c1a3a2c
c1a3a2c
# Since we are operating in a dist-git repository where we can't fix things with
c1a3a2c
# --force-push if something goes wrong, we need to be extra careful and exit
c1a3a2c
# immediately if something fails.
049c81f
set -e
c1a3a2c
c1a3a2c
curl https://raw.githubusercontent.com/fedora-sysv/initscripts/master/initscripts.spec -o initscripts.spec || exit 1
049c81f
spectool -g initscripts.spec
c1a3a2c
c1a3a2c
# Make a local scratch build in mock first. If it fails, do not upload new tarball!
b401eae
srpm_file="$(basename $(fedpkg srpm | grep -i "wrote" | cut -d ':' -f 2))"
c1a3a2c
arch="$(uname -p)"
c1a3a2c
c1a3a2c
mock -r "fedora-rawhide-${arch}" "${srpm_file}" || exit 2
c1a3a2c
c1a3a2c
# Scratch build passed, the build should pass in Koji as well. Let's proceed:
c1a3a2c
fedpkg new-sources "$(basename $(spectool -S -l initscripts.spec | gawk '{print $2;}'))" || exit 3
c1a3a2c
git add initscripts.spec
c1a3a2c
git commit -m "$(grep Version initscripts.spec | gawk '{print $2;}')"
c1a3a2c
c1a3a2c
git show