63 lines
1.4 KiB
Bash
Executable File
63 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
set -ef
|
|
|
|
export GIT_OPTIONAL_LOCKS=0
|
|
|
|
w=$(git rev-parse --path-format=absolute --show-toplevel) ; : "${w:?}" ; cd "$w"
|
|
|
|
dst='debian/patches/pf-tmp'
|
|
src='../linux-extras'
|
|
branches='amd-pstate amd-rapl cpuidle crypto fixes kbuild pksm xfs zstd'
|
|
|
|
if [ -d "${dst}" ] ; then rm -rf "${dst}" ; fi
|
|
mkdir -p "${dst}"
|
|
|
|
kver=
|
|
if [ -n "$1" ] ; then
|
|
kver="$1"
|
|
else
|
|
kver=$(dpkg-parsechangelog --show-field=Version | sed -E 's/^[0-9]+://;s/-[^-]*$//' | cut -d. -f1-2)
|
|
fi
|
|
from="upstream/linux-${kver}.y"
|
|
|
|
t=$(mktemp -d) ; : "${t:?}"
|
|
|
|
cp -ar "${src}" "$t/"
|
|
cd "$t/${src##*/}"
|
|
|
|
git config advice.skippedCherryPicks false
|
|
|
|
for b in ${branches} ; do
|
|
ref="pf/$b-${kver}"
|
|
r="tmp-rebase-$b"
|
|
|
|
git switch --detach "${ref}"
|
|
git switch -C "$r"
|
|
|
|
if git rebase "${from}" ; then
|
|
[ -d "$w/${dst}/$b/" ] || mkdir -p "$w/${dst}/$b"
|
|
|
|
set +e
|
|
env -C "$w" git ls-files -z | grep -zF "${dst}/$b/" | grep -zFv '/.' | env -C "$w" -u GIT_OPTIONAL_LOCKS xargs -r -0 git rm -f
|
|
find "$w/${dst}/$b/" -name '*.patch' -type f -exec rm -f {} +
|
|
set -e
|
|
|
|
git format-patch -N --subject-prefix='' --output-directory "$w/${dst}/$b" "${from}..$r"
|
|
else
|
|
echo >&2
|
|
git rebase --abort
|
|
echo >&2
|
|
fi
|
|
|
|
git switch -q --detach "${ref}"
|
|
git branch -D "$r"
|
|
echo >&2
|
|
done
|
|
|
|
cd "$w" ; rm -rf "$t"
|
|
|
|
echo >&2
|
|
echo 'put in debian/patches/series' >&2
|
|
echo >&2
|
|
find "${dst}/" -type f -name '*.patch' | sed -E 's#^debian/patches/##' | sort -V
|