SHA256
1
0
forked from pool/qemu
qemu/update_git.sh
Andreas Färber 2308027159 Accepting request 176308 from home:a_faerber:branches:Virtualization
Split off qemu-linux-user - this simplifies each build and decouples them, with the nice side-effect of fixing at least the qemu{,-tools,-guest-agent} SLE_11_SP2 x86_64 build.

OBS-URL: https://build.opensuse.org/request/show/176308
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=138
2013-05-23 13:25:41 +00:00

72 lines
1.8 KiB
Bash

#!/bin/bash -e
#
# While updating versions of QEMU to 1.0 I got fed up with the
# quilt workflow and just put up a git tree that contains all
# the commits on top of a stable tarball.
#
# When updating this package, just either update the git tree
# below (use rebase!) or change the tree path and use your own
#
# That way we can easily rebase against the next stable release
# when it comes.
GIT_TREE=git://github.com/openSUSE/qemu.git
GIT_LOCAL_TREE=/home/andreas/QEMU/qemu-opensuse
GIT_BRANCH=opensuse-1.5
GIT_UPSTREAM_TAG=v1.5.0
QEMU_TMP=/dev/shm/qemu-tmp
# clean up
if [ -e 0001-* ]; then
osc rm --force 0*
fi
rm -f qemu.spec qemu-linux-user.spec
# fetch all patches
rm -rf $QEMU_TMP
OSCDIR="$(pwd)"
if [ -d "$GIT_LOCAL_TREE" ]; then
git clone -ls $GIT_LOCAL_TREE $QEMU_TMP
cd $QEMU_TMP
else
git clone $GIT_TREE $QEMU_TMP
cd $QEMU_TMP
git remote add upstream git://git.qemu.org/qemu.git
git remote update
fi
git checkout $GIT_BRANCH
git format-patch -N $GIT_UPSTREAM_TAG -o "$OSCDIR"
cd "$OSCDIR"
rm -rf $QEMU_TMP
# cut off file name after 40 bytes, so we work around git version differences
# while at it, also remove the signature
for i in 0*; do
PATCHNAME=${i%.patch}
PATCHNAME=${i:0:40}.patch
head -n $(expr $(wc -l $i | cut -d ' ' -f 1) - 3) $i > "$PATCHNAME.tmp"
rm "$i"
mv "$PATCHNAME.tmp" "$PATCHNAME"
done
# we have all patches as files now - generate the spec files!
for package in qemu qemu-linux-user; do
while IFS= read -r line; do
if [ "$line" = "PATCH_FILES" ]; then
for i in 0*; do
NUM=${i%%-*}
echo -e "Patch$NUM: $i"
done
elif [ "$line" = "PATCH_EXEC" ]; then
for i in 0*; do
NUM=${i%%-*}
echo "%patch$NUM -p1"
done
else
echo "$line"
fi
done < $package.spec.in > $package.spec
done
osc add 0*