SHA256
1
0
forked from pool/qemu

Accepting request 878083 from home:bfrogers:branches:Virtualization

Misc small changes

OBS-URL: https://build.opensuse.org/request/show/878083
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=627
This commit is contained in:
Bruce Rogers
2021-03-09 22:50:50 +00:00
committed by Git OBS Bridge
parent 2d7bf67d6a
commit eedf97c38f
4 changed files with 53 additions and 37 deletions

View File

@@ -1,5 +1,7 @@
#!/bin/bash
set -e
# update_git.sh: script to manage package maintenance using a git-based
# workflow. Commands are as follows:
# git2pkg (update package spec file and patches from git)
@@ -12,6 +14,10 @@
check_requirements() {
RC=0
if [[ ! -e ./config.sh ]]; then
echo "ERROR: Missing config.sh configuration script"
RC=1
fi
if [[ ! $(rpm -q git-core) ]]; then
echo "ERROR: Missing dependency: git-core"
RC=1
@@ -51,11 +57,9 @@ check_requirements
#==============================================================================
set -e
source ./config.sh
# If you're using LATEST, we assume you are an expert!
# If you're using LATEST, we assume you are an expert so no basic help provided
if [ "$GIT_UPSTREAM_COMMIT_ISH" != "LATEST" ]; then
if [ "$1" = "" ]; then
set -- git2pkg
@@ -99,7 +103,7 @@ fi
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:]])?"
BASE_RE="qemu-[[:digit:]]+(\.[[:digit:]]+){2,3}(-rc[[:digit:]])?"
EXTRA_RE="\+git\.[[:digit:]]+\.([[:xdigit:]]+)"
SUFFIX_RE="\.tar\.xz"
SIG_SUFFIX_RE="\.tar\.xz\.sig"
@@ -234,7 +238,7 @@ for entry in ${ID_FILES[@]}; do
fi
done
if [[ "$i" = "REPO_COUNT" ]]; then
echo "ERROR! BUNDLE SUBPROJECT NOT MENTIONED IN config.sh! Fix!"
echo "ERROR! BUNDLE SUBPROJECT $SUBDIR NOT MENTIONED IN config.sh! Fix!"
exit
fi
@@ -665,17 +669,22 @@ rm -rf $BUNDLE_DIR
fi
done
elif [ "$line" = "PATCH_EXEC" ]; then
unset PREV_S
for i in [0-9][0-9][0-9][0-9]*-*.patch; do
S=$(grep "^Include-If: " $i) || true
NUM=${i%%-*}
if [ "$S" != "" ]; then
echo "${S:12}"
echo "%patch$NUM -p1"
if [ "$PREV_S" != "" -a "$PREV_S" != "$S" ]; then
echo "%endif"
else
echo "%patch$NUM -p1"
fi
if [ "$S" != "" -a "$S" != "$PREV_S" ]; then
echo "${S:12}"
fi
echo "%patch$NUM -p1"
PREV_S=$S
done
if [ "$PREV_S" != "" ]; then
echo "%endif"
fi
elif [ "$line" = "INSERT_VERSIONING" ]; then
echo "%define qemuver $QEMU_VERSION$VERSION_EXTRA"
echo "%define srcver $SOURCE_VERSION$VERSION_EXTRA"
@@ -796,14 +805,13 @@ if [[ ! -e $(readlink -f ${LOCAL_REPO_MAP[0]}) ]]; then
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Got an affirmative answer, proceeding..."
setup_common_vars
# TODO: The following doesn't really do what we need (we adjust later) FIX!!!
# git clone --depth 1 -b $GIT_BRANCH --single-branch $PACKAGE_MAIN_GIT_REPO ${LOCAL_REPO_MAP[0]}
git -c init.defaultBranch=$GIT_BRANCH init ${LOCAL_REPO_MAP[0]}
git -C ${LOCAL_REPO_MAP[0]} remote add origin $PACKAGE_MAIN_GIT_REPO &>/dev/null
git -C ${LOCAL_REPO_MAP[0]} fetch origin +refs/tags/initial:refs/tags/initial --no-tags
git -C ${LOCAL_REPO_MAP[0]} reset --hard initial
#TODO: The next is not actually used - get rid of when we decide for sure it won't get used
GIT_UPSTREAM_COMMIT=$(git -C ${LOCAL_REPO_MAP[0]} ls-remote origin |grep -F "$GIT_UPSTREAM_COMMIT_ISH^{}"|awk '{print $1}')
# Here we use *COMMIT_ISH, not *_COMMIT - is that an issue?
# Here we've changed to use *COMMIT_ISH, not *_COMMIT - is that an issue?
git -C ${LOCAL_REPO_MAP[0]} fetch --depth=1 origin +refs/tags/$GIT_UPSTREAM_COMMIT_ISH:refs/tags/$GIT_UPSTREAM_COMMIT_ISH --no-tags
git -C ${LOCAL_REPO_MAP[0]} remote add upstream $UPSTREAM_GIT_REPO &>/dev/null
bundle2local
@@ -826,10 +834,8 @@ if [[ ! -e $(readlink -f ${LOCAL_REPO_MAP[0]}) ]]; then
fi
exit
fi
# There are some req's on needing a recent git, and a recent osc (double chk the osc part - I guess it's related to the osc service )
# get the current state of the git superproject
# TODO: This sends output to stdout which we don't want to see
# TODO: Perhaps useful: get the current state of the git superproject
# The following sends output to stdout which we don't want to see
#git -C ${LOCAL_REPO_MAP[0]} status --untracked-files=no --branch --porcelain=2 \
# | awk '{print "var"NR"="$3}'
# $var1 is the current commit
@@ -837,11 +843,16 @@ fi
# $var3 is the current upstream branch (if set), as in eg 'origin/opensuse-5.0'
# $var4 is not of use to us
if [ "$GIT_UPSTREAM_COMMIT_ISH" != "LATEST" ]; then
if [ ! "$GIT_UPSTREAM_COMMIT_ISH" = "v$OLD_SOURCE_VERSION_AND_EXTRA" ]; then
echo "Tarball name (which we decode) doesn't correspond to the \$GIT_UPSTREAM_COMMIT_ISH in config.sh"
exit
fi
setup_common_vars
fi
# TODO: What checks should be different between LATEST and non-LATEST?
# If we don't actually patch from the submodule repo, we shouldn't care about what's in the local one
# Does non-LATEST really require master? (indeed - get rid of use or need of master as much as possible)
echo "WARNING: Script using local git repos. Some operations may be time consuming..."
# TODO: Most of these checks are not necessary
echo "ALERT: Script using local git repos. Some operations may be time consuming..."
# TODO: Some of these checks are perhaps not necessary
for (( i=0; i <$REPO_COUNT; i++ )); do
if [[ -e $(readlink -f ${LOCAL_REPO_MAP[$i]}) ]]; then
if [[ -e ${LOCAL_REPO_MAP[$i]}/.git/shallow ]]; then
@@ -853,7 +864,7 @@ for (( i=0; i <$REPO_COUNT; i++ )); do
echo "ERROR! Rebase appears to be in progress in ${LOCAL_REPO_MAP[$i]}. Please resolve"
exit
fi
# !! Does this presume the branch as indicated in config is the current branch? (I believe that's been my modus operandi to date, so perhaps THAT should be enforced at this point?)
# TODO: We've not even verified what branch we're on here - so this is a bit misguided!
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)"
@@ -864,15 +875,25 @@ for (( i=0; i <$REPO_COUNT; i++ )); do
echo "(ensure git status --porcelain produces no output)"
exit
fi
if ! git -C ${LOCAL_REPO_MAP[$i]} checkout $GIT_BRANCH --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 $GIT_BRANCH, incl. it's submodules)"
exit
# TODO: See about doing the following better (also see what needs to happen for LATEST)
if [ "$GIT_UPSTREAM_COMMIT_ISH" != "LATEST" ]; then
if $(git -C ${LOCAL_REPO_MAP[$i]} branch --remote | grep -F "origin/$GIT_BRANCH" >/dev/null); then
if ! $(git -C ${LOCAL_REPO_MAP[$i]} branch | grep -F "$GIT_BRANCH" >/dev/null); then
echo "Please clean up state of local repo ${LOCAL_REPO_MAP[$i]} before using script"
echo "(cannot find branch $GIT_BRANCH, please create a tracking branch of remote origin/$GIT_BRANCH)"
exit
fi
if ! git -C ${LOCAL_REPO_MAP[$i]} checkout $GIT_BRANCH --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 $GIT_BRANCH, incl. it's submodules)"
exit
fi
fi
fi
# This does additional setup now that we've possibly grabbed additional submodules
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 $GIT_BRANCH branch submodules)"
echo "(cannot init and update current branch submodules)"
exit
fi
if [ "$(git -C ${LOCAL_REPO_MAP[$i]} status --porcelain)" ]; then
@@ -950,12 +971,7 @@ if [ "$GIT_UPSTREAM_COMMIT_ISH" = "LATEST" ]; then
echo "SUCCESS"
tail -9 /tmp/latest.log
else # not LATEST
if [ ! "$GIT_UPSTREAM_COMMIT_ISH" = "v$OLD_SOURCE_VERSION_AND_EXTRA" ]; then
echo "Tarball name (which we decode) doesn't correspond to the \$GIT_UPSTREAM_COMMIT_ISH in config.sh"
exit
fi
git -C ${LOCAL_REPO_MAP[0]} checkout $GIT_UPSTREAM_COMMIT_ISH --recurse-submodules -f &> /dev/null
setup_common_vars
#NOTNEEDED? git -C ${LOCAL_REPO_MAP[0]} checkout $GIT_UPSTREAM_COMMIT_ISH --recurse-submodules -f &> /dev/null
NEW_COMMIT_ISH=
WRITE_LOG=1
case $1 in