blob: bf6672554714366806f7028213f301e0ab075208 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
cd "${SCRIPT_DIR}"
if [[ ! -v XEN_REPO_DIR ]]; then
XEN_REPO_DIR="${HOME}/repos/xen"
fi
XEN_VERSION="${1}"
OUR_PATCHES_VERSION="${2}"
XEN_VER_COMPONENTS=( ${XEN_VERSION//./ } )
XEN_MAJOR_MINOR_VERSION="${XEN_VER_COMPONENTS[0]}.${XEN_VER_COMPONENTS[1]}"
git -C "${XEN_REPO_DIR}" fetch origin
readarray -d '' CURRENT_PATCHES < <(find . -maxdepth 1 -type f -name "*.patch" -print0)
if [[ ${#CURRENT_PATCHES[@]} -gt 0 ]]; then
git rm -f *.patch
fi
PATCH_RANGE_START="RELEASE-${XEN_VERSION}"
PATCH_RANGE_END="staging-${XEN_MAJOR_MINOR_VERSION}"
git -C "${XEN_REPO_DIR}" format-patch \
-o "${SCRIPT_DIR}" \
${PATCH_RANGE_START}..origin/${PATCH_RANGE_END}
XEN_NEXT_PATCHLEVEL=$((XEN_VER_COMPONENTS[2]+1))
XEN_NEXT_VERSION="${XEN_MAJOR_MINOR_VERSION}.${XEN_NEXT_PATCHLEVEL}"
PATCH_RANGE_START_ID=$(git -C "${XEN_REPO_DIR}" rev-parse ${PATCH_RANGE_START})
PATCH_RANGE_END_ID=$(git -C "${XEN_REPO_DIR}" rev-parse origin/${PATCH_RANGE_END})
cat <<EOF > "info.txt"
Xen upstream patchset #${OUR_PATCHES_VERSION} for ${XEN_NEXT_VERSION}-pre
Containing patches from
$PATCH_RANGE_START ($PATCH_RANGE_START_ID)
to
$PATCH_RANGE_END ($PATCH_RANGE_END_ID)
EOF
git add \
info.txt \
*.patch
TAG="${XEN_NEXT_VERSION}-pre-patchset-${OUR_PATCHES_VERSION}"
DESCRIPTION="Xen ${TAG}"
git commit \
--signoff \
-m "${DESCRIPTION}"
git tag \
-s \
-m "${DESCRIPTION}" \
"${TAG}"
|