mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-24 14:32:58 +00:00
e1531466e1
This change updates grub to the 2.04 release. The new release changed how grub is built, so the bootstrap and bootstrap.conf files have to be added to the dist-git. Also, the gitignore file changed so it has to be updated. Since the patches have been forward ported to 2.04, there's no need for a logic to maintain a patch with the delta between the release and the grub master branch. So the release-to-master.patch is dropped and no longer is updated by the do-rebase script. Also since gnulib isn't part of the grub repository anymore and cloned by the boostrap tool, a gnulib tarball is included as other source file and copied before calling the bootstrap tool. That way grub can be built even in builders that only have access to the sources lookaside cache. Resolves: rhbz#1727279 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
189 lines
4.1 KiB
Bash
Executable file
189 lines
4.1 KiB
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
set -u
|
|
shopt -qu globstar
|
|
shopt -qs expand_aliases
|
|
export LC_COLLATE=C
|
|
export LC_ALL=C
|
|
|
|
diff_ops="-O.git.diff.order --patience -l0"
|
|
format_patch_ops="--zero-commit --no-signature --no-numbered --stat=80 --summary $diff_ops"
|
|
alias othergit="GIT_DIR=$PWD/.rhboot.git GIT_WORK_TREE=$PWD git"
|
|
alias formatpatch="othergit format-patch $format_patch_ops"
|
|
|
|
usage()
|
|
{
|
|
retcode=0
|
|
if [ -n "${1:-}" ]; then
|
|
exec 1>&2
|
|
retcode=$1
|
|
fi
|
|
echo usage: "do-rebase [OPTIONS] [--dist RELEASEVER | RELEASEVER ] [GITREPO]"
|
|
echo OPTIONS: --dist=RELEASEVER --repo=REPO --amend --nocommit --nobumpspec
|
|
exit $retcode
|
|
}
|
|
|
|
if ! git status | grep -q 'nothing to commit, working .* clean' ; then
|
|
echo "Working directory is not clean, cannot rebase." 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
gitrepo="git@github.com:rhboot/grub2.git"
|
|
releasever=""
|
|
amend=""
|
|
commit=1
|
|
bumpspec=1
|
|
|
|
declare -a savedargs
|
|
savedargs=()
|
|
while [ $# -gt 0 ]; do
|
|
case $1 in
|
|
--help|-h|--usage|-?|-u)
|
|
usage
|
|
;;
|
|
--dist=*)
|
|
releasever=${1##--dist=}
|
|
;;
|
|
--dist)
|
|
shift
|
|
releasever=$1
|
|
;;
|
|
--repo=*)
|
|
gitrepo=${1##--repo=}
|
|
;;
|
|
--repo)
|
|
shift
|
|
gitrepo=$1
|
|
;;
|
|
--amend)
|
|
amend="--amend"
|
|
;;
|
|
--commit)
|
|
commit=1
|
|
;;
|
|
--nocommit|--no-commit|--nc)
|
|
# --nocommit implies nobumpspec, but --bumpspec after it will
|
|
# force bumpspec to get run.
|
|
commit=0
|
|
bumpspec=0
|
|
;;
|
|
--bumpspec)
|
|
bumpspec=2
|
|
;;
|
|
--nobumpspec|--no-bumpspec|--nb)
|
|
bumpspec=0
|
|
;;
|
|
*)
|
|
savedargs[${#savedargs[@]}]="$1"
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
set -- "${savedargs[@]}"
|
|
|
|
if [ -z "${releasever}" -a $# -gt 0 ]; then
|
|
releasever=$1
|
|
shift
|
|
else
|
|
dist=$(git status | grep "On branch" | cut -d\ -f3-)
|
|
if [ -z "$dist" ]; then
|
|
echo "Could not figure out distro release version" 1>&2
|
|
usage 1
|
|
fi
|
|
case "$(eval echo \${dist})" in
|
|
.fc*)
|
|
releasever=$(echo ${dist} | \
|
|
sed 's/^\.fc\([[:digit:]]\+\)$/fedora-\1/')
|
|
;;
|
|
.*)
|
|
releasever=$(echo $dist | \
|
|
sed 's/^\.\([[:alpha:]]\+\)\([[:digit:]]\+\)$/\1-\2/')
|
|
;;
|
|
rhel*)
|
|
releasever=${dist}
|
|
dist=.el${releasever##rhel-}
|
|
;;
|
|
esac
|
|
if [ -z "${releasever}" -o "${releasever}" = "${dist}" ]; then
|
|
echo "Could not figure out distro release version" 1>&2
|
|
usage 1
|
|
fi
|
|
fi
|
|
|
|
if [ -z "$releasever" ]; then
|
|
echo "Could not figure out distro release version" 1>&2
|
|
usage 1
|
|
fi
|
|
|
|
if [ -n "${1:-}" ]; then
|
|
gitrepo=$1
|
|
shift
|
|
fi
|
|
|
|
if [ $# -ge 1 ]; then
|
|
echo "Unknown argument \"$1\"" 1>&2
|
|
usage 1
|
|
fi
|
|
|
|
if [ ! -d $PWD/.rhboot.git ]; then
|
|
othergit init
|
|
othergit config core.abbrev 11
|
|
if ! othergit remote add \
|
|
rhboot $gitrepo \
|
|
>/dev/null 2>&1 ; then
|
|
echo "Could not add remote: rhboot" 1>&2
|
|
exit 1
|
|
fi
|
|
elif othergit remote show -n rhboot | grep -q "URL: github$" ; then
|
|
if ! othergit remote add \
|
|
rhboot $gitrepo \
|
|
>/dev/null 2>&1 ; then
|
|
echo "Could not add remote: rhboot" 1>&2
|
|
exit 1
|
|
fi
|
|
else
|
|
othergit remote set-url rhboot ${gitrepo}
|
|
fi
|
|
|
|
othergit fetch rhboot
|
|
remote=$(othergit branch --list -r "rhboot/${releasever}" 2>/dev/null)
|
|
if [ "${remote}" != " rhboot/${releasever}" ]; then
|
|
echo branch \"${releasever}\" does not appear to exist 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
unset LC_ALL
|
|
git rm -q 0*.patch
|
|
|
|
# No need for this patch anymore, the package is rebased on latest release now.
|
|
#> release-to-master.patch
|
|
#othergit diff --full-index --binary $diff_ops grub-2.04..refs/remotes/rhboot/master > release-to-master.patch
|
|
#git add release-to-master.patch
|
|
|
|
fedpkg sources
|
|
curl -L https://github.com/rhboot/gnulib/archive/fixes.tar.gz > gnulib-fixes.tar.gz.new
|
|
if cmp -s gnulib-fixes.tar.gz gnulib-fixes.tar.gz.new; then
|
|
rm gnulib-fixes.tar.gz.new
|
|
else
|
|
mv gnulib-fixes.tar.gz.new gnulib-fixes.tar.gz
|
|
sed -i -e '/gnulib-/d' sources
|
|
fedpkg upload gnulib-fixes.tar.gz
|
|
git add sources
|
|
fi
|
|
|
|
> grub.patches
|
|
patches=$(formatpatch refs/remotes/rhboot/master..refs/remotes/rhboot/${releasever})
|
|
for x in $patches ; do
|
|
echo Patch$(echo ${x} | cut -d- -f1): ${x} >> grub.patches
|
|
done
|
|
if [[ -z "$amend" && ${bumpspec} -gt 0 ]] || [[ ${bumpspec} -ge 2 ]] ; then
|
|
rpmdev-bumpspec -c "- Rebased to newer upstream for ${releasever}" grub2.spec
|
|
fi
|
|
git add 0*.patch grub2.spec grub.patches
|
|
if [[ ${commit} -eq 1 ]] ; then
|
|
if [ -z "$amend" ]; then
|
|
fedpkg commit -s -c
|
|
else
|
|
git commit --amend
|
|
fi
|
|
fi
|