SHA256
1
0
forked from pool/qemu

Accepting request 744582 from home:bfrogers:branches:Virtualization

Workflow script tweaks

OBS-URL: https://build.opensuse.org/request/show/744582
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=503
This commit is contained in:
Bruce Rogers 2019-10-31 20:34:37 +00:00 committed by Git OBS Bridge
parent 35e477a4b9
commit ab93feb144
3 changed files with 310 additions and 269 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:86afea4d0fcdfa578dd3b660ccbadd49e996057de08ca8078020cb5c10611f91 oid sha256:cd9adb317ef86b16cecc43d9a223db3bc3c75b1697ea85beeb3f0f3dda24be17
size 56424 size 54480

View File

@ -2,16 +2,12 @@
# config.sh: # config.sh:
# The next few VARIABLES may be edited (or uncommented) as required: # The next few VARIABLES are to be edited as required:
# The following specifies the upstream tag or commit upon which our patchqueue # The following specifies the upstream tag or commit upon which our patchqueue
# gets rebased. The special value LATEST may be used to "automatically" track # gets rebased. The special value LATEST may be used to "automatically" track
# the upstream development tree in the master branch # the upstream development tree in the master branch
GIT_UPSTREAM_COMMIT_ISH=v4.1.0 GIT_UPSTREAM_COMMIT_ISH=v4.1.0
if [[ "$GIT_UPSTREAM_COMMIT_ISH" != "LATEST" ]]; then
# This is the git branch used (otherwise it is computed)
GIT_BRANCH=opensuse-4.1
fi
# WARNING: If transitioning from using LATEST to not, MANUALLY re-set the # WARNING: If transitioning from using LATEST to not, MANUALLY re-set the
# tarball present. If transitioning TO LATEST, make sure that # tarball present. If transitioning TO LATEST, make sure that
# NEXT_RELEASE_IS_MAJOR is set correctly # NEXT_RELEASE_IS_MAJOR is set correctly

View File

@ -14,6 +14,35 @@ source ./config.sh
declare -A COMMIT_IDS_BY_SUBMODULE_PATH declare -A COMMIT_IDS_BY_SUBMODULE_PATH
# Get version info from the packages' tarball - decode and do some checks
BASE_RE="qemu-[[:digit:]]+(\.[[:digit:]]+){2}(-rc[[:digit:]])?"
EXTRA_RE="\+git\.[[:digit:]]+\.([[:xdigit:]]+)"
SUFFIX_RE="\.tar\.xz"
SIG_SUFFIX_RE="\.tar\.xz\.sig"
QEMU_TARBALL=($(find -maxdepth 1 -type f -regextype posix-extended -regex \
"\./$BASE_RE($EXTRA_RE)?$SUFFIX_RE" -printf "%f "))
QEMU_TARBALL_SIG=($(find -maxdepth 1 -type f -regextype posix-extended -regex \
"\./$BASE_RE($EXTRA_RE)?$SIG_SUFFIX_RE" -printf "%f "))
if [ ${#QEMU_TARBALL[@]} -gt 1 ]; then
echo "Multiple qemu tarballs detected. Please clean up"
exit
fi
if [ ${#QEMU_TARBALL_SIG[@]} -gt 1 ]; then
echo "Multiple qemu tarballs signature files detected. Please clean up"
exit
fi
OLD_SOURCE_VERSION_AND_EXTRA=$(echo $QEMU_TARBALL 2>/dev/null | head --bytes=-8\
| cut --bytes=6-)
VERSION_EXTRA=$(echo $OLD_SOURCE_VERSION_AND_EXTRA|awk -F+ '{if ($2) print \
"+"$2}')
if [ "$OLD_SOURCE_VERSION_AND_EXTRA" = "" ]; then
echo "ERROR: No tarball found!"
exit
fi
#==============================================================================
TEMP_CHECK() { TEMP_CHECK() {
# TEMPORARY! FOR NOW WE REQUIRE THESE LOCALLY TO DO WORK ON PACKAGE # TEMPORARY! FOR NOW WE REQUIRE THESE LOCALLY TO DO WORK ON PACKAGE
REQUIRED_LOCAL_REPO_MAP=( REQUIRED_LOCAL_REPO_MAP=(
@ -38,6 +67,7 @@ for entry in ${REQUIRED_LOCAL_REPO_MAP[@]}; do
else else
echo "ERROR! For now, you need to have these local git repos available:" echo "ERROR! For now, you need to have these local git repos available:"
echo ${REQUIRED_LOCAL_REPO_MAP[@]} echo ${REQUIRED_LOCAL_REPO_MAP[@]}
exit
fi fi
done done
} }
@ -69,9 +99,9 @@ for (( i=0; i <$SUBMODULE_COUNT; i++ )); do
touch $BUNDLE_DIR/${SUBMODULE_DIRS[$i]}/${SUBMODULE_COMMIT_IDS[$i]}.id touch $BUNDLE_DIR/${SUBMODULE_DIRS[$i]}/${SUBMODULE_COMMIT_IDS[$i]}.id
done done
if [ "$GIT_UPSTREAM_COMMIT_ISH" = "LATEST" ]; then if [ "$GIT_UPSTREAM_COMMIT_ISH" = "LATEST" ]; then
GIT_UPSTREAM_COMMIT=$(cd ${LOCAL_REPO_MAP[0]} && git rev-parse upstream/master) GIT_UPSTREAM_COMMIT=$NEW_COMMIT_ISH_FULL
else else
# (I need to make this smarter, or change something - works for tag, but not normal commit?): # TODO: make this smarter, or change something - works for tag, but not normal commit?
GIT_UPSTREAM_COMMIT=$(git -C ${LOCAL_REPO_MAP[0]} show-ref -d $GIT_UPSTREAM_COMMIT_ISH|grep -F "^{}"|awk '{print $1}') GIT_UPSTREAM_COMMIT=$(git -C ${LOCAL_REPO_MAP[0]} show-ref -d $GIT_UPSTREAM_COMMIT_ISH|grep -F "^{}"|awk '{print $1}')
fi fi
touch $BUNDLE_DIR/$GIT_UPSTREAM_COMMIT.id touch $BUNDLE_DIR/$GIT_UPSTREAM_COMMIT.id
@ -93,13 +123,15 @@ for (( i=0; i <$REPO_COUNT; i++ )); do
if [[ $(git -C $GIT_DIR/$SUBDIR ls-remote --heads origin $GIT_BRANCH) ]]; then if [[ $(git -C $GIT_DIR/$SUBDIR ls-remote --heads origin $GIT_BRANCH) ]]; then
git -C $GIT_DIR/$SUBDIR fetch origin $GIT_BRANCH git -C $GIT_DIR/$SUBDIR fetch origin $GIT_BRANCH
if [[ $(git -C $GIT_DIR/$SUBDIR rev-list $GITREPO_COMMIT_ISH..FETCH_HEAD) ]]; then if [[ $(git -C $GIT_DIR/$SUBDIR rev-list $GITREPO_COMMIT_ISH..FETCH_HEAD) ]]; then
git -C $GIT_DIR/$SUBDIR bundle create $BUNDLE_DIR/$SUBDIR$GITREPO_COMMIT_ISH.bundle $GITREPO_COMMIT_ISH..FETCH_HEAD || true git -C $GIT_DIR/$SUBDIR bundle create $BUNDLE_DIR/$SUBDIR$GITREPO_COMMIT_ISH.bundle $GITREPO_COMMIT_ISH..FETCH_HEAD
fi fi
fi fi
fi fi
fi fi
done done
tar cJvf bundles.tar.xz -C $BUNDLE_DIR . # keep diffs to a minimum - touch bundle files to "something common" TODO: decide if there's something better
find $BUNDLE_DIR -exec touch -r qemu-$SOURCE_VERSION$VERSION_EXTRA.tar.xz {} \;
tar --format gnu --xz -cf bundles.tar.xz -C $BUNDLE_DIR .
rm -rf $BUNDLE_DIR rm -rf $BUNDLE_DIR
rm -rf $GIT_DIR rm -rf $GIT_DIR
} }
@ -129,14 +161,11 @@ for entry in ${BUNDLE_FILES[@]}; do
LOCAL_REPO=$(readlink -f ${LOCAL_REPO_MAP[$PATCH_RANGE_INDEX]}) LOCAL_REPO=$(readlink -f ${LOCAL_REPO_MAP[$PATCH_RANGE_INDEX]})
if [ -e $LOCAL_REPO ]; then if [ -e $LOCAL_REPO ]; then
# TODO: Detect if it's there before trying to remove!
git -C $LOCAL_REPO remote remove bundlerepo || true git -C $LOCAL_REPO remote remove bundlerepo || true
# git won't let you delete this branch if it's the current branch (returns 1) HOW TO HANDLE? # git won't let you delete a branch we're on - so get onto master temporarily (TODO: is there a better approach?)
# detect this case, and ask user to switch to another branch? or do it for them - switch to master killing any "state" for this branch
git -C $LOCAL_REPO checkout master -f git -C $LOCAL_REPO checkout master -f
git -C $LOCAL_REPO branch -D frombundle || true git -C $LOCAL_REPO branch -D frombundle || true
git -C $LOCAL_REPO remote add bundlerepo $BUNDLE_DIR/$entry git -C $LOCAL_REPO remote add bundlerepo $BUNDLE_DIR/$entry
# in next, the head may be FETCH_HEAD or HEAD depending on how we created:
git -C $LOCAL_REPO fetch bundlerepo FETCH_HEAD git -C $LOCAL_REPO fetch bundlerepo FETCH_HEAD
git -C $LOCAL_REPO branch frombundle FETCH_HEAD git -C $LOCAL_REPO branch frombundle FETCH_HEAD
git -C $LOCAL_REPO remote remove bundlerepo git -C $LOCAL_REPO remote remove bundlerepo
@ -150,85 +179,15 @@ rm -rf $BUNDLE_DIR
#============================================================================== #==============================================================================
bundle2spec() { redo_tarball_and_rebase_patches() {
rm -rf $GIT_DIR rm -rf $GIT_DIR
rm -rf $CMP_DIR
rm -rf $BUNDLE_DIR
rm -f checkpatch.log
rm -f checkthese
# there's probably a better place for the next: (only needed due to development failures?)
rm -rf checkdir
if [ "$GIT_UPSTREAM_COMMIT_ISH" = "LATEST" ]; then
for (( i=0; i <$REPO_COUNT; i++ )); do
if [[ -e $(readlink -f ${LOCAL_REPO_MAP[$i]}) ]]; then
git -C ${LOCAL_REPO_MAP[$i]} remote update upstream &> /dev/null
fi
done
#TODO: do we really want to checkout here? the code which gets the latest submodule commits doesnt rely on this !!! IN FACT master here isn't for latest upstream - that is the upstream branch!
# git -C ${LOCAL_REPO_MAP[0]} checkout master --recurse-submodules -f
# TODO: THE FOLLOWING NEEDS HELP
QEMU_VERSION=$(git -C ${LOCAL_REPO_MAP[0]} show origin:VERSION)
MAJOR_VERSION=$(echo $QEMU_VERSION|awk -F. '{print $1}')
MINOR_VERSION=$(echo $QEMU_VERSION|awk -F. '{print $2}')
if [ "$NEXT_RELEASE_IS_MAJOR" = "0" ]; then
GIT_BRANCH=opensuse-$MAJOR_VERSION.$[$MINOR_VERSION+1]
else
GIT_BRANCH=opensuse-$[$MAJOR_VERSION+1].0
fi
fi
BASE_RE="qemu-[[:digit:]]+(\.[[:digit:]]+){2}(-rc[[:digit:]])?"
EXTRA_RE="\+git\.[[:digit:]]+\.([[:xdigit:]]+)"
SUFFIX_RE="\.tar\.xz"
SIG_SUFFIX_RE="\.tar\.xz\.sig"
QEMU_TARBALL=($(find -maxdepth 1 -type f -regextype posix-extended -regex \
"\./$BASE_RE($EXTRA_RE)?$SUFFIX_RE" -printf "%f "))
QEMU_TARBALL_SIG=($(find -maxdepth 1 -type f -regextype posix-extended -regex \
"\./$BASE_RE($EXTRA_RE)?$SIG_SUFFIX_RE" -printf "%f "))
if [ ${#QEMU_TARBALL[@]} -gt 1 ]; then
echo "Multiple qemu tarballs detected. Please clean up"
exit
fi
if [ ${#QEMU_TARBALL_SIG[@]} -gt 1 ]; then
echo "Multiple qemu tarballs signature files detected. Please clean up"
exit
fi
# It's ok for either of these to be empty when using "LATEST"
OLD_SOURCE_VERSION_AND_EXTRA=$(echo $QEMU_TARBALL 2>/dev/null | head --bytes=-8\
| cut --bytes=6-)
VERSION_EXTRA=$(echo $OLD_SOURCE_VERSION_AND_EXTRA|awk -F+ '{if ($2) print \
"+"$2}')
if [ "$OLD_SOURCE_VERSION_AND_EXTRA" = "" ]; then
echo "Warning: No tarball found"
fi
# TODO: (repo file not yet done)
if [ "$GIT_UPSTREAM_COMMIT_ISH" = "LATEST" ]; then
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# DO TARBALL, GETTING ALL FROM UPSTREAM DIRECTLY # CREATE TARBALL, USING FRESH REPO - WE COULD RELY MORE ON LOCAL IF WE WERE MORE CAREFUL
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if [[ $QEMU_TARBALL =~ $BASE_RE$EXTRA_RE$SUFFIX_RE ]]; then
OLD_COMMIT_ISH=${BASH_REMATCH[3]}
else
#Assume release (or release candidate) tarball with equivalent tag:
OLD_COMMIT_ISH=$(cd ${LOCAL_REPO_MAP[0]} && git rev-list --abbrev-commit \
--abbrev=9 -1 v$OLD_SOURCE_VERSION_AND_EXTRA)
fi
if [ ${#QEMU_TARBALL_SIG[@]} -ne 0 ]; then
echo "INFO: Ignoring signature file: $QEMU_TARBALL_SIG"
QEMU_TARBALL_SIG=
fi
# TODO: HERE WE REFERENCE MASTER - NEEDS FIXING
NEW_COMMIT_ISH_FULL=$(cd ${LOCAL_REPO_MAP[0]} && git rev-parse upstream/master)
NEW_COMMIT_ISH=$(cd ${LOCAL_REPO_MAP[0]} && git rev-parse --short=9 \
upstream/master)
NOW_SECONDS=$(date +%s)
# TODO: HERE WE REFERENCE MASTER - NEEDS FIXING # TODO: WHAT IS THIS NEXT LINE EVEN DOING FOR US?? (OK, it's initing a repo, what do we rely on there?)
git clone -ls ${LOCAL_REPO_MAP[0]} $GIT_DIR -b master --single-branch &>/dev/null git clone -ls ${LOCAL_REPO_MAP[0]} $GIT_DIR -b master --single-branch &>/dev/null
if [ "$OLD_COMMIT_ISH" != "$NEW_COMMIT_ISH" ]; then
echo "Please wait..." echo "Please wait..."
(cd $GIT_DIR && git remote add upstream \ (cd $GIT_DIR && git remote add upstream \
git://git.qemu-project.org/qemu.git &>/dev/null) git://git.qemu-project.org/qemu.git &>/dev/null)
@ -241,22 +200,6 @@ if [ "$GIT_UPSTREAM_COMMIT_ISH" = "LATEST" ]; then
(cd $GIT_DIR && git submodule update --init &>/dev/null) (cd $GIT_DIR && git submodule update --init &>/dev/null)
(cd $GIT_DIR/roms/edk2 && git submodule update --init &>/dev/null) (cd $GIT_DIR/roms/edk2 && git submodule update --init &>/dev/null)
VERSION_EXTRA=+git.$NOW_SECONDS.$NEW_COMMIT_ISH VERSION_EXTRA=+git.$NOW_SECONDS.$NEW_COMMIT_ISH
fi
QEMU_VERSION=$(cat $GIT_DIR/VERSION)
MAJOR_VERSION=$(echo $QEMU_VERSION|awk -F. '{print $1}')
MINOR_VERSION=$(echo $QEMU_VERSION|awk -F. '{print $2}')
X=$(echo $QEMU_VERSION|awk -F. '{print $3}')
# 0 = release, 50 = development cycle, 90..99 equate to release candidates
if [ "$X" != "0" -a "$X" != "50" ]; then
if [ "$NEXT_RELEASE_IS_MAJOR" = "0" ]; then
SOURCE_VERSION=$MAJOR_VERSION.$[$MINOR_VERSION+1].0-rc$[X-90]
else
SOURCE_VERSION=$[$MAJOR_VERSION+1].0.0-rc$[X-90]
fi
else
SOURCE_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$X
fi
if [ "$OLD_COMMIT_ISH" != "$NEW_COMMIT_ISH" ]; then
if (cd ${LOCAL_REPO_MAP[0]} && git describe --exact-match $NEW_COMMIT_ISH \ if (cd ${LOCAL_REPO_MAP[0]} && git describe --exact-match $NEW_COMMIT_ISH \
&>/dev/null); then &>/dev/null); then
if [ "$X" = "50" ]; then if [ "$X" = "50" ]; then
@ -279,8 +222,9 @@ if [ "$GIT_UPSTREAM_COMMIT_ISH" = "LATEST" ]; then
unset QEMU_TARBALL_SIG unset QEMU_TARBALL_SIG
xz -T 0 qemu-$SOURCE_VERSION$VERSION_EXTRA.tar xz -T 0 qemu-$SOURCE_VERSION$VERSION_EXTRA.tar
osc add qemu-$SOURCE_VERSION$VERSION_EXTRA.tar.xz osc add qemu-$SOURCE_VERSION$VERSION_EXTRA.tar.xz
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# OK GET THE SUBMODULE COMMIT ID'S FROM THIS NEWLY MINTED QEMU CHECKOUT! WE'LL USE THAT WHEN WE REBASE OUR PATCHES # GET THE SUBMODULE COMMIT ID'S FROM THIS NEWLY MINTED QEMU CHECKOUT. WE'LL USE THAT WHEN WE REBASE OUR PATCHES
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !! We (perhaps temporarily) do MORE recursive submodules, since we are tracking ALL in these scripts, while upstream doesn't include all in tarball currently # !! We (perhaps temporarily) do MORE recursive submodules, since we are tracking ALL in these scripts, while upstream doesn't include all in tarball currently
@ -298,16 +242,19 @@ if [ "$GIT_UPSTREAM_COMMIT_ISH" = "LATEST" ]; then
COMMIT_IDS_BY_SUBMODULE_PATH[${SUBMODULE_DIRS[$i]}/]=${SUBMODULE_COMMIT_IDS[$i]} COMMIT_IDS_BY_SUBMODULE_PATH[${SUBMODULE_DIRS[$i]}/]=${SUBMODULE_COMMIT_IDS[$i]}
done done
COMMIT_IDS_BY_SUBMODULE_PATH[SUPERPROJECT]=$NEW_COMMIT_ISH_FULL COMMIT_IDS_BY_SUBMODULE_PATH[SUPERPROJECT]=$NEW_COMMIT_ISH_FULL
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# MOVE BUNDLE COMMITS OVER TO LOCAL frombundle BRANCH # MOVE BUNDLE COMMITS OVER TO LOCAL frombundle BRANCH
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
bundle2local bundle2local
mkdir -p $BUNDLE_DIR
tar xJf bundles.tar.xz -C $BUNDLE_DIR
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# REBASE frombundle patches USING COMMIT_IDS_BY_SUBMODULE, ALSO USING OLD ID'S STORED IN OLD BUNDLE # REBASE frombundle patches USING COMMIT_IDS_BY_SUBMODULE, ALSO USING OLD ID'S STORED IN OLD BUNDLE
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
mkdir -p $BUNDLE_DIR
tar xJf bundles.tar.xz -C $BUNDLE_DIR
# Now go through all the submodule local repos that are present and create a bundle file for the patches found there # Now go through all the submodule local repos that are present and create a bundle file for the patches found there
for (( i=0; i <$REPO_COUNT; i++ )); do for (( i=0; i <$REPO_COUNT; i++ )); do
if [[ -e $(readlink -f ${LOCAL_REPO_MAP[$i]}) ]]; then if [[ -e $(readlink -f ${LOCAL_REPO_MAP[$i]}) ]]; then
@ -326,56 +273,28 @@ if [ "$GIT_UPSTREAM_COMMIT_ISH" = "LATEST" ]; then
if ! $(git -C ${LOCAL_REPO_MAP[$i]} rebase --onto ${COMMIT_IDS_BY_SUBMODULE_PATH[$SUBDIR]} $GITREPO_COMMIT_ISH >/dev/null); then if ! $(git -C ${LOCAL_REPO_MAP[$i]} rebase --onto ${COMMIT_IDS_BY_SUBMODULE_PATH[$SUBDIR]} $GITREPO_COMMIT_ISH >/dev/null); then
# TODO: record that this one needs manual help! # TODO: record that this one needs manual help!
echo "Rebase of ${LOCAL_REPO_MAP[$i]}, branch $GIT_BRANCH needs manual help" echo "Rebase of ${LOCAL_REPO_MAP[$i]}, branch $GIT_BRANCH needs manual help"
REBASE_FAILS="${LOCAL_REPO_MAP[$i]} $REBASE_FAILS"
fi fi
fi fi
fi fi
done done
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! }
# CREATE BUNDLE FROM $GIT_BRANCH branch
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #==============================================================================
initbundle
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! bundle2spec() {
# GET BUNDLE PATCHES FROM BUNDLE_DIR rm -f checkpatch.log
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! rm -f checkthese
fi rm -rf checkdir
rm -rf $GIT_DIR rm -rf $GIT_DIR
# We're done with GIT_UPSTREAM_COMMIT_ISH carrying the special value LATEST rm -rf $CMP_DIR
GIT_UPSTREAM_COMMIT_ISH=$NEW_COMMIT_ISH rm -rf $BUNDLE_DIR
WRITE_LOG=0 mkdir -p $BUNDLE_DIR
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# DONE WITH LATEST WORK
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
else # not based on LATEST upstream master, rather any upstream commitish
if [ "$OLD_SOURCE_VERSION_AND_EXTRA" = "" ]; then
echo "Failure: tarball required which corresponds to commitish:" \
"$GIT_UPSTREAM_COMMITISH"
exit
fi
if [ -d "${LOCAL_REPO_MAP[0]}" ]; then
echo "Processing local git tree branch: master, using commitish:"\
"$GIT_UPSTREAM_COMMIT_ISH"
if ! (cd ${LOCAL_REPO_MAP[0]} && git show-branch master &>/dev/null)
then
echo "Error: Branch master not found - please create a remote"\
"tracking branch of origin/master"
exit
fi
# ( THIS ISNT WORKING - IS OLD HISTORY:)
else
echo "Processing $GIT_BRANCH branch of remote git tree, using"\
"commitish: $GIT_UPSTREAM_COMMIT_ISH"
echo "(For fast processing, consider establishing a local git tree"\
"at ${LOCAL_REPO_MAP[0]})"
fi
SOURCE_VERSION=$OLD_SOURCE_VERSION_AND_EXTRA
QEMU_VERSION=$(tar JxfO qemu-$SOURCE_VERSION$VERSION_EXTRA.tar.xz qemu-$SOURCE_VERSION/VERSION)
NEW_COMMIT_ISH=
WRITE_LOG=1
fi
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# NOW PROCESS BUNDLES INTO COMMITS AND FILL SPEC FILE # NOW PROCESS BUNDLES INTO COMMITS AND FILL SPEC FILE
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
mkdir -p $BUNDLE_DIR
tar xJf bundles.tar.xz -C $BUNDLE_DIR tar xJf bundles.tar.xz -C $BUNDLE_DIR
BUNDLE_FILES=$(find $BUNDLE_DIR -printf "%P\n"|grep "bundle$") BUNDLE_FILES=$(find $BUNDLE_DIR -printf "%P\n"|grep "bundle$")
@ -442,7 +361,7 @@ rm -rf $BUNDLE_DIR
for i in [0-9]*.patch; do for i in [0-9]*.patch; do
osc rm --force $i osc rm --force $i
done done
# we need to make sure that w/out the numbered prefixes, the patchnames are all unique # make sure that w/out the numbered prefixes, the patchnames are all unique
mkdir checkdir mkdir checkdir
for i in $CMP_DIR/*; do for i in $CMP_DIR/*; do
BASENAME=$(basename $i) BASENAME=$(basename $i)
@ -530,7 +449,7 @@ rm -rf $BUNDLE_DIR
rm -f checkpatch.log rm -f checkpatch.log
if [ "$TOTAL_COUNT" != "0" -a "$VERSION_EXTRA" != "" -a "$OLD_COMMIT_ISH" =\ if [ "$TOTAL_COUNT" != "0" -a "$VERSION_EXTRA" != "" -a "$OLD_COMMIT_ISH" =\
"$NEW_COMMIT_ISH" ]; then "$NEW_COMMIT_ISH" ]; then
# Patches changed, so update the version using current time # Only patches changed: update the version using current timestamp
VERSION_EXTRA=+git.$NOW_SECONDS.$OLD_COMMIT_ISH VERSION_EXTRA=+git.$NOW_SECONDS.$OLD_COMMIT_ISH
osc mv qemu-$OLD_SOURCE_VERSION_AND_EXTRA.tar.xz \ osc mv qemu-$OLD_SOURCE_VERSION_AND_EXTRA.tar.xz \
qemu-$SOURCE_VERSION$VERSION_EXTRA.tar.xz qemu-$SOURCE_VERSION$VERSION_EXTRA.tar.xz
@ -639,6 +558,9 @@ rm -rf $BUNDLE_DIR
if [ -e qemu.changes.added ]; then if [ -e qemu.changes.added ]; then
rm -f qemu.changes.added rm -f qemu.changes.added
fi fi
if [[ "0" = "$(expr $CHANGED_COUNT + $DELETED_COUNT + $ADDED_COUNT)" ]]; then
osc revert bundles.tar.xz
fi
echo "git patch summary" echo "git patch summary"
echo " unchanged: $UNCHANGED_COUNT" echo " unchanged: $UNCHANGED_COUNT"
echo " changed: $CHANGED_COUNT" echo " changed: $CHANGED_COUNT"
@ -656,26 +578,146 @@ osc service localrun format_spec_file
usage() { usage() {
echo "Usage:" echo "Usage:"
echo "bash ./git_update.sh <command> echo "bash ./git_update.sh <command>"
echo description: package maintenance using a git-based workflow. Commands:" echo "description: package maintenance using a git-based workflow. Commands:"
echo " git2pkg (update package spec file and patches from git. Is default)" echo " git2pkg (update package spec file and patches from git. Is default)"
echo " pkg2git (update git (frombundle branch) from the package "bundleofbundles")" echo " pkg2git (update git (frombundle branch) from the package "bundleofbundles")"
echo " refresh (refresh spec file from spec file template and "bundlofbundles")" echo " refresh (refresh spec file from spec file template and "bundlofbundles")"
echo "(See script for details on doing 'LATEST' workflow)"
} }
#============================================================================== #==============================================================================
# LATEST processing currently doesn't expect cmdline params, so do it here, up front echo "WARNING: Script using local git repos. Some operations may be time consuming..."
if [ "$GIT_UPSTREAM_COMMIT_ISH" = "LATEST" ]; then #TODO: Most of these checks are not necessary
echo "Processing latest upstream changes" for (( i=0; i <$REPO_COUNT; i++ )); do
echo "(If SUCCESS is not printed upon completion, see /tmp/latest.log for issues)" if [[ -e $(readlink -f ${LOCAL_REPO_MAP[$i]}) ]]; then
TEMP_CHECK if [[ -d ${LOCAL_REPO_MAP[$i]}/.git/rebase-merge || \
bundle2spec &> /tmp/latest.log -d ${LOCAL_REPO_MAP[$i]}/.git/rebase-apply ]]; then
echo "SUCCESS" echo "ERROR! Rebase appears to be in progress in ${LOCAL_REPO_MAP[$i]}. Please resolve"
tail -9 /tmp/latest.log
exit exit
fi fi
if ! git -C ${LOCAL_REPO_MAP[$i]} submodule update --init --recursive &> /dev/null; then
echo "Please clean up state of local repo ${LOCAL_REPO_MAP[$i]} before using script"
echo "(ensure git submodule update --init --recursive is successful)"
exit
fi
if [ "$(git -C ${LOCAL_REPO_MAP[$i]} status --porcelain)" ]; then
echo "Please clean up state of local repo ${LOCAL_REPO_MAP[$i]} before using script"
echo "(ensure git status --porcelain produces no output)"
exit
fi
if ! git -C ${LOCAL_REPO_MAP[$i]} checkout master --recurse-submodules -f &> /dev/null; then
echo "Please clean up state of local repo ${LOCAL_REPO_MAP[$i]} before using script"
echo "(cannot check out master, incl. it's submodules)"
exit
fi
if ! git -C ${LOCAL_REPO_MAP[$i]} submodule update --init --recursive &> /dev/null; then
echo "Please clean up state of local repo ${LOCAL_REPO_MAP[$i]} before using script"
echo "(cannot init and update master submodules)"
exit
fi
if [ "$(git -C ${LOCAL_REPO_MAP[$i]} status --porcelain)" ]; then
echo "Please clean up state of local repo ${LOCAL_REPO_MAP[$i]} before using script"
echo "(ensure git status --porcelain produces no output)"
exit
fi
fi
done
if [ "$GIT_UPSTREAM_COMMIT_ISH" = "LATEST" ]; then
if [ "$1" = "continue" ]; then
CONTINUE_AFTER_REBASE=1
else
if [ "$1" = "pause" ]; then
PAUSE_BEFORE_BUNDLE_CREATION=1
else
if [ "$1" ]; then
echo "ERROR: unrecognized option '$1'. Script in LATEST mode only recognizes 'pause' and 'continue' options"
exit
fi
fi
fi
for (( i=0; i <$REPO_COUNT; i++ )); do
if [[ -e $(readlink -f ${LOCAL_REPO_MAP[$i]}) ]]; then
git -C ${LOCAL_REPO_MAP[$i]} remote update upstream &> /dev/null
fi
done
NEW_COMMIT_ISH_FULL=$(cd ${LOCAL_REPO_MAP[0]} && git rev-parse upstream/master)
NEW_COMMIT_ISH=${NEW_COMMIT_ISH_FULL:0:8}
git -C ${LOCAL_REPO_MAP[0]} checkout $NEW_COMMIT_ISH_FULL --recurse-submodules -f &> /dev/null
QEMU_VERSION=$(git -C ${LOCAL_REPO_MAP[0]} show upstream/master:VERSION)
MAJOR_VERSION=$(echo $QEMU_VERSION|awk -F. '{print $1}')
MINOR_VERSION=$(echo $QEMU_VERSION|awk -F. '{print $2}')
X=$(echo $QEMU_VERSION|awk -F. '{print $3}')
# 0 = release, 50 = development cycle, 90..99 equate to release candidates
if [ "$X" != "0" -a "$X" != "50" ]; then
if [ "$NEXT_RELEASE_IS_MAJOR" = "0" ]; then
SOURCE_VERSION=$MAJOR_VERSION.$[$MINOR_VERSION+1].0-rc$[X-90]
GIT_BRANCH=opensuse-$MAJOR_VERSION.$[$MINOR_VERSION+1]
else
SOURCE_VERSION=$[$MAJOR_VERSION+1].0.0-rc$[X-90]
GIT_BRANCH=opensuse-$[$MAJOR_VERSION+1].0
fi
else
SOURCE_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$X
GIT_BRANCH=opensuse-$MAJOR_VERSION.$[$MINOR_VERSION+1]
fi
WRITE_LOG=0
echo "Processing LATEST upstream changes"
echo "(If SUCCESS is not printed upon completion, see /tmp/latest.log for issues)"
TEMP_CHECK
if [[ $QEMU_TARBALL =~ $BASE_RE$EXTRA_RE$SUFFIX_RE ]]; then
OLD_COMMIT_ISH=${BASH_REMATCH[3]}
else
#Assume release (or release candidate) tarball with equivalent tag:
OLD_COMMIT_ISH=$(cd ${LOCAL_REPO_MAP[0]} && git rev-list --abbrev-commit \
--abbrev=9 -1 v$OLD_SOURCE_VERSION_AND_EXTRA)
fi
if [ ${#QEMU_TARBALL_SIG[@]} -ne 0 ]; then
echo "INFO: Ignoring signature file: $QEMU_TARBALL_SIG"
QEMU_TARBALL_SIG=
fi
NOW_SECONDS=$(date +%s)
if [ "$OLD_COMMIT_ISH" != "$NEW_COMMIT_ISH" ]; then
if [ "$CONTINUE_AFTER_REBASE" = "1" ]; then
echo "continue after rebase selected but tarball is out of date. Continuing not possible."
echo "If desired, save your rebase work (eg, branch $GIT_BRANCH), because otherwise it will"
echo "be lost. Then run script again without the continue option"
exit
fi
redo_tarball_and_rebase_patches &> /tmp/latest.log
if [[ "$REBASE_FAILS" ]]; then
echo "ERROR! Rebase of the $GIT_BRANCH branch failed in the following local git repos:"
echo $REBASE_FAILS
echo "Manually resolve all these rebases, then finish the workflow by passing 'continue' to script"
if [[ "$PAUSE_BEFORE_BUNDLE_CREATION" = "1" ]]; then
echo "Feel free to also do the work now occasioned by the selected 'pause' option"
fi
exit
fi
CONTINUE_AFTER_REBASE=1
fi
if [[ "$PAUSE_BEFORE_BUNDLE_CREATION" = "1" ]]; then
echo "As requested, pausing before re-creating bundle of bundles for additional patch or specfile work"
echo "(using current 'ready to go' $GIT_BRANCH branch of local repos to produce patches.)"
echo "When changes are complete, finish the workflow by passing 'continue' to script"
exit
fi
if [ "$CONTINUE_AFTER_REBASE" = "1" ]; then
initbundle &>> /tmp/latest.log
fi
bundle2spec &>> /tmp/latest.log
echo "SUCCESS"
tail -9 /tmp/latest.log
else # not LATEST
git -C ${LOCAL_REPO_MAP[0]} checkout $GIT_UPSTREAM_COMMIT_ISH --recurse-submodules -f &> /dev/null
NEW_COMMIT_ISH=
SOURCE_VERSION=$OLD_SOURCE_VERSION_AND_EXTRA
QEMU_VERSION=$(tar JxfO qemu-$SOURCE_VERSION$VERSION_EXTRA.tar.xz qemu-$SOURCE_VERSION/VERSION)
MAJOR_VERSION=$(echo $QEMU_VERSION|awk -F. '{print $1}')
MINOR_VERSION=$(echo $QEMU_VERSION|awk -F. '{print $2}')
GIT_BRANCH=opensuse-$MAJOR_VERSION.$MINOR_VERSION
WRITE_LOG=1
if [ "$1" = "" ]; then if [ "$1" = "" ]; then
set -- git2pkg set -- git2pkg
fi fi
@ -684,7 +726,7 @@ case $1 in
initbundle initbundle
;; ;;
git2pkg ) git2pkg )
echo "Updating the package from the $GIT_BRANCH branch of the local repos." echo "Updating the package using the $GIT_BRANCH branch of the local repos."
echo "(If SUCCESS is not printed upon completion, see /tmp/git2pkg.log for issues)" echo "(If SUCCESS is not printed upon completion, see /tmp/git2pkg.log for issues)"
TEMP_CHECK TEMP_CHECK
initbundle &> /tmp/git2pkg.log initbundle &> /tmp/git2pkg.log
@ -719,3 +761,6 @@ case $1 in
usage usage
;; ;;
esac esac
fi
exit