2016-04-22 20:44:30 +02:00
|
|
|
#!/bin/bash
|
2011-12-14 02:35:41 +01:00
|
|
|
#
|
2014-07-03 15:15:40 +02:00
|
|
|
# Instead of a quilt workflow, we use a git tree that contains
|
|
|
|
# all the commits on top of a stable tarball.
|
2011-12-14 02:35:41 +01:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2016-04-22 20:44:30 +02:00
|
|
|
set -e
|
|
|
|
|
2013-02-10 19:32:29 +01:00
|
|
|
GIT_TREE=git://github.com/openSUSE/qemu.git
|
2014-03-28 13:03:52 +01:00
|
|
|
GIT_LOCAL_TREE=~/git/qemu-opensuse
|
2017-03-29 06:22:10 +02:00
|
|
|
GIT_BRANCH=opensuse-2.9
|
2017-04-12 21:10:15 +02:00
|
|
|
GIT_UPSTREAM_TAG=v2.9.0-rc4
|
2014-07-03 15:15:40 +02:00
|
|
|
GIT_DIR=/dev/shm/qemu-factory-git-dir
|
|
|
|
CMP_DIR=/dev/shm/qemu-factory-cmp-dir
|
2011-12-14 02:35:41 +01:00
|
|
|
|
2014-07-03 15:15:40 +02:00
|
|
|
rm -rf $GIT_DIR
|
|
|
|
rm -rf $CMP_DIR
|
2014-03-27 00:48:29 +01:00
|
|
|
|
2011-12-14 02:35:41 +01:00
|
|
|
if [ -d "$GIT_LOCAL_TREE" ]; then
|
2014-07-03 15:15:40 +02:00
|
|
|
echo "Processing $GIT_BRANCH branch of local git tree, using tag:" \
|
|
|
|
"$GIT_UPSTREAM_TAG"
|
|
|
|
if ! (cd $GIT_LOCAL_TREE && git show-branch $GIT_BRANCH &>/dev/null); then
|
|
|
|
echo "Error: Branch $GIT_BRANCH not found - please create a remote" \
|
|
|
|
"tracking branch of origin/$GIT_BRANCH"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
git clone -ls $GIT_LOCAL_TREE $GIT_DIR -b $GIT_BRANCH
|
|
|
|
if ! (cd $GIT_LOCAL_TREE && git remote show upstream &>/dev/null); then
|
|
|
|
echo "Remote for upstream git tree not found. Next time add remote" \
|
|
|
|
"named upstream for git://git.qemu.org/qemu.git and update"
|
|
|
|
(cd $GIT_DIR && git remote add upstream git://git.qemu-project.org/qemu.git)
|
|
|
|
(cd $GIT_DIR && git remote update)
|
|
|
|
fi
|
2011-12-14 02:35:41 +01:00
|
|
|
else
|
2014-07-03 15:15:40 +02:00
|
|
|
echo "Processing $GIT_BRANCH branch of remote git tree, using tag:" \
|
|
|
|
"$GIT_UPSTREAM_TAG"
|
|
|
|
echo "(For much fast processing, consider establishing a local git tree" \
|
|
|
|
"at $GIT_LOCAL_TREE)"
|
|
|
|
git clone $GIT_TREE $GIT_DIR -b $GIT_BRANCH
|
|
|
|
(cd $GIT_DIR && git remote add upstream git://git.qemu-project.org/qemu.git)
|
|
|
|
(cd $GIT_DIR && git remote update)
|
2011-12-14 02:35:41 +01:00
|
|
|
fi
|
2014-07-03 15:15:40 +02:00
|
|
|
(cd $GIT_DIR && git format-patch -N $GIT_UPSTREAM_TAG --suffix= -o $CMP_DIR >/dev/null)
|
|
|
|
QEMU_VERSION=`cat $GIT_DIR/VERSION`
|
|
|
|
echo "QEMU version: $QEMU_VERSION"
|
2011-12-14 02:35:41 +01:00
|
|
|
|
2014-07-03 15:15:40 +02:00
|
|
|
rm -rf $GIT_DIR
|
2012-03-07 16:17:02 +01:00
|
|
|
|
2014-07-03 15:15:40 +02:00
|
|
|
(
|
|
|
|
CHANGED_COUNT=0
|
|
|
|
UNCHANGED_COUNT=0
|
|
|
|
DELETED_COUNT=0
|
|
|
|
ADDED_COUNT=0
|
2014-03-27 00:48:29 +01:00
|
|
|
|
2014-07-03 15:15:40 +02:00
|
|
|
shopt -s nullglob
|
2014-03-27 00:48:29 +01:00
|
|
|
|
2014-07-03 15:15:40 +02:00
|
|
|
# Process patches to eliminate useless differences: limit file names to 40 chars
|
|
|
|
# before extension and remove git signature. ('30' below gets us past dir prefix)
|
|
|
|
for i in $CMP_DIR/*; do
|
2016-03-17 17:12:29 +01:00
|
|
|
# format-patch may append a signature, which per default contains the git version
|
|
|
|
# wipe everything starting from the signature tag
|
|
|
|
sed '/^-- $/Q' $i > $CMP_DIR/${i:30:40}.patch
|
2014-07-03 15:15:40 +02:00
|
|
|
rm $i
|
|
|
|
done
|
|
|
|
|
|
|
|
for i in 0???-*.patch; do
|
|
|
|
if [ -e $CMP_DIR/$i ]; then
|
|
|
|
if cmp -s $CMP_DIR/$i $i; then
|
|
|
|
rm $CMP_DIR/$i
|
|
|
|
let UNCHANGED_COUNT+=1
|
|
|
|
else
|
|
|
|
mv $CMP_DIR/$i .
|
|
|
|
let CHANGED_COUNT+=1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
osc rm --force $i
|
|
|
|
let DELETED_COUNT+=1
|
2014-07-17 00:56:01 +02:00
|
|
|
echo " ${i##*/}" >> qemu.changes.deleted
|
2014-07-03 15:15:40 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
for i in $CMP_DIR/*; do
|
|
|
|
mv $i .
|
|
|
|
osc add ${i##*/}
|
|
|
|
let ADDED_COUNT+=1
|
2014-07-17 00:56:01 +02:00
|
|
|
echo " ${i##*/}" >> qemu.changes.added
|
2014-07-03 15:15:40 +02:00
|
|
|
done
|
|
|
|
|
2016-01-19 19:31:32 +01:00
|
|
|
for package in qemu qemu-linux-user; do
|
2014-07-03 15:15:40 +02:00
|
|
|
while IFS= read -r line; do
|
|
|
|
if [ "$line" = "PATCH_FILES" ]; then
|
|
|
|
for i in 0???-*.patch; do
|
|
|
|
NUM=${i%%-*}
|
|
|
|
echo -e "Patch$NUM: $i"
|
|
|
|
done
|
|
|
|
elif [ "$line" = "PATCH_EXEC" ]; then
|
|
|
|
for i in 0???-*.patch; do
|
|
|
|
NUM=${i%%-*}
|
|
|
|
echo "%patch$NUM -p1"
|
|
|
|
done
|
|
|
|
elif [ "$line" = "QEMU_VERSION" ]; then
|
|
|
|
echo "Version: $QEMU_VERSION"
|
|
|
|
elif [[ "$line" =~ ^Source: ]]; then
|
|
|
|
QEMU_TARBALL=qemu-`echo "$line" | cut -d '-' -f 2-`
|
2017-03-29 06:22:10 +02:00
|
|
|
VERSION_FILE=${QEMU_TARBALL%.tar.xz}/roms/seabios/.version
|
|
|
|
SEABIOS_VERSION=`tar JxfO "$QEMU_TARBALL" "$VERSION_FILE"`
|
2014-07-03 15:15:40 +02:00
|
|
|
SEABIOS_VERSION=`echo $SEABIOS_VERSION | cut -d '-' -f 2`
|
|
|
|
echo "$line"
|
|
|
|
elif [ "$line" = "SEABIOS_VERSION" ]; then
|
|
|
|
echo "Version: $SEABIOS_VERSION"
|
|
|
|
else
|
|
|
|
echo "$line"
|
|
|
|
fi
|
|
|
|
done < $package.spec.in > $package.spec
|
2014-07-17 00:56:01 +02:00
|
|
|
|
|
|
|
# Factory requires all deleted and added patches to be mentioned
|
|
|
|
if [ -e qemu.changes.deleted ] || [ -e qemu.changes.added ]; then
|
|
|
|
echo "Patch queue updated from ${GIT_TREE} ${GIT_BRANCH}" > $package.changes.proposed
|
|
|
|
fi
|
|
|
|
if [ -e qemu.changes.deleted ]; then
|
|
|
|
echo "* Patches dropped:" >> $package.changes.proposed
|
|
|
|
cat qemu.changes.deleted >> $package.changes.proposed
|
|
|
|
fi
|
|
|
|
if [ -e qemu.changes.added ]; then
|
|
|
|
echo "* Patches added:" >> $package.changes.proposed
|
|
|
|
cat qemu.changes.added >> $package.changes.proposed
|
|
|
|
fi
|
|
|
|
if [ -e $package.changes.proposed ]; then
|
|
|
|
osc vc --file=$package.changes.proposed $package
|
|
|
|
rm -f $package.changes.proposed
|
|
|
|
fi
|
2014-07-03 15:15:40 +02:00
|
|
|
done
|
2014-07-17 00:56:01 +02:00
|
|
|
if [ -e qemu.changes.deleted ]; then
|
|
|
|
rm -f qemu.changes.deleted
|
|
|
|
fi
|
|
|
|
if [ -e qemu.changes.added ]; then
|
|
|
|
rm -f qemu.changes.added
|
|
|
|
fi
|
2014-07-03 15:15:40 +02:00
|
|
|
echo "git patch summary"
|
|
|
|
echo " unchanged: $UNCHANGED_COUNT"
|
|
|
|
echo " changed: $CHANGED_COUNT"
|
|
|
|
echo " deleted: $DELETED_COUNT"
|
|
|
|
echo " added: $ADDED_COUNT"
|
|
|
|
)
|
2011-12-14 02:35:41 +01:00
|
|
|
|
2014-07-03 15:15:40 +02:00
|
|
|
rm -rf $CMP_DIR
|
2015-04-12 11:13:49 +02:00
|
|
|
|
|
|
|
sed -e 's|^\(Name:.*qemu\)|\1-testsuite|' < qemu.spec > qemu-testsuite.spec
|
|
|
|
osc service localrun format_spec_file
|
|
|
|
|
|
|
|
/bin/sh pre_checkin.sh -q
|
2015-10-08 18:14:43 +02:00
|
|
|
|
|
|
|
echo "Please remember to run pre_checkin.sh after modifying qemu.changes."
|