Accepting request 227675 from home:bfrogers:branches:Virtualization

Spec file cleanups and git script improvements.

OBS-URL: https://build.opensuse.org/request/show/227675
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=196
This commit is contained in:
Bruce Rogers
2014-03-26 23:48:29 +00:00
committed by Git OBS Bridge
parent 790885198e
commit 721f9f3ac7
5 changed files with 73 additions and 27 deletions

View File

@@ -16,11 +16,25 @@ GIT_BRANCH=opensuse-2.0
GIT_UPSTREAM_TAG=v2.0.0-rc0
QEMU_TMP=/dev/shm/qemu-tmp
# clean up
restore_file_to_package() {
# If the processed file matches the previous one, move the previous
# one back in place, otherwise add the processed file.
if cmp -s "$1" saved."$1"; then
osc mv --force saved."$1" "$1"
else
osc add "$1"
fi
}
# save files in case they remain unchanged
if [ -e 0001-* ]; then
osc rm --force 0*
for i in 0*; do
osc mv $i saved.$i
done
fi
rm -f qemu.spec qemu-linux-user.spec
osc mv qemu.spec saved.qemu.spec
osc mv qemu-linux-user.spec saved.qemu-linux-user.spec
# fetch all patches
rm -rf $QEMU_TMP
@@ -41,13 +55,14 @@ 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
# 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"
restore_file_to_package "$PATCHNAME"
done
# we have all patches as files now - generate the spec files!
@@ -70,5 +85,12 @@ for package in qemu qemu-linux-user; do
fi
done < $package.spec.in > $package.spec
done
osc add 0*
restore_file_to_package qemu.spec
restore_file_to_package qemu-linux-user.spec
# remove any remaining saved files
if [ -e saved.* ]; then
osc rm --force saved.*
fi