aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSasha Levin <sashal@kernel.org>2021-04-12 12:17:06 -0400
committerSasha Levin <sashal@kernel.org>2021-04-12 12:17:06 -0400
commitf973400570ff197fb227aaaf5a46ca92155d5a02 (patch)
tree73fc7ccda2fb1a9a40634c2ab4442c92896d0f71
parenta8f9b19a7e5e9cc4264eef01e3f2a93c796f8654 (diff)
downloadstable-tools-f973400570ff197fb227aaaf5a46ca92155d5a02.tar.gz
Automatically build dep lists and store info in merge commitHEADmaster
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rwxr-xr-xstable-steal-commits72
1 files changed, 66 insertions, 6 deletions
diff --git a/stable-steal-commits b/stable-steal-commits
index 3c8bf49..c92bebd 100755
--- a/stable-steal-commits
+++ b/stable-steal-commits
@@ -28,32 +28,91 @@ function pick_one {
# Still no? Let's go back to the original commit and hand it off to
# the user.
- git cherry-pick --strategy=recursive -Xpatience -x $1 &> /dev/null
+ git cherry-pick -x $1 &> /dev/null
fi
return $?
}
+function do_dep {
+ cmt=$1
+#return
+ STABLE_MAJ_VER=$(grep VERSION Makefile | head -n1 | awk {'print $3'})
+ STABLE_MIN_VER=$(grep PATCHLEVEL Makefile | head -n1 | awk {'print $3'})
+
+ if [ $(cat ~/deps/v$STABLE_MAJ_VER.$STABLE_MIN_VER/$cmt | wc -l) -gt 10 ]; then
+ return
+ fi
+#/bin/bash
+ echo -e "FAILED: $(git ol $cmt)\n\n" > ~/deps-list
+ oldhead=$(git branch --show-current)
+ if [ "$oldhead" == "" ]; then
+ oldhead=$(git rev-parse HEAD)
+ fi
+ git branch -D tmp-merge-triangle
+ git checkout -b tmp-merge-triangle
+ for i in $(cat ~/deps/v$STABLE_MAJ_VER.$STABLE_MIN_VER/$cmt | awk {'print $1'} | tac); do
+ if [ $(git show $i | grep '^Merge: ' | wc -l) -gt 0 ]; then
+ continue
+ fi
+ cur=$(git rev-parse HEAD)
+ stable steal-commits-nodeps $i^..$i
+ if [ "$(git rev-parse HEAD)" == "$cur" ]; then
+ stat="FAILED"
+ else
+ stat="OK"
+ fi
+ echo "$(git ol $i) - $stat" >> ~/deps-list
+ done
+ echo "Pausing for deps review..."
+ git checkout $oldhead
+ git merge --no-ff -F ~/deps-list tmp-merge-triangle
+ git branch -D tmp-merge-triangle
+# /bin/bash
+}
+
function do_one {
-# for i in $(git log --no-merges --format="%H" --grep 'stable@vger' $1 $2 | tac); do
+# for i in $(git log --no-merges --format="%H" -i --grep 'cc:.*stable' $1 | tac); do
+# for i in $(git log --no-merges --format="%H" -i --grep 'cc:.*stable' --grep 'fixes:' $1 | tac); do
+# for i in $(git log --no-merges --format="%H" --invert-grep --grep 'stable@' $1 $2 | tac); do
+# for i in $(git log --no-merges --format="%H" --invert-grep -i --grep 'cc:.*stable' --grep "fixes:" $1 $2 | tac); do
for i in $(git log --no-merges --format="%H" $1 $2 | tac); do
+# for i in $(git log --no-merges --format="%H" -i --grep 'Fixes:' $1 $2 | tac); do
+# if [ $(git show $i | grep -i "cc:.*stable" | wc -l) -gt 0 ]; then
+# continue
+# fi
+# for i in $(git log --no-merges --format="%H" -i --grep 'Fixes:' $1 $2 | tac); do
subj=$(git log -1 --format="%s" $i)
-
# Let's grab the mainline commit id, this is useful if the version tag
# doesn't exist in the commit we're looking at but exists upstream.
- orig_cmt=$(git log --no-merges --format="%H" -F --grep "$subj" $STABLE_BASE..origin/master | tail -n1)
+ STABLE_MAJ_VER=$(grep VERSION Makefile | head -n1 | awk {'print $3'})
+ STABLE_MIN_VER=$(grep PATCHLEVEL Makefile | head -n1 | awk {'print $3'})
+ for ss in $(git log --no-merges --format="%H" -F --grep "$subj" v$STABLE_MAJ_VER.$STABLE_MIN_VER..origin/master); do
+ newsub=$(git log -1 --format="%s" $ss)
+ if [ "$newsub" == "$subj" ]; then
+ orig_cmt=$ss
+ fi
+ done
+#orig_cmt=$i
# If the commit doesn't apply for us, skip it
check_relevant $orig_cmt
if [ $? -eq "0" ]; then
+ echo "This commits not relevant!"
continue
fi
stable commit-in-tree $orig_cmt
if [ $? -eq 1 ]; then
+ echo "This commit already in tree!"
continue
fi
+ if [ "$(git notes show $orig_cmt 2> /dev/null | wc -l)" -gt 0 ]; then
+ git notes show $orig_cmt
+ /bin/bash
+ fi
+
pick_one $i
if [ $? -gt 0 ] ; then
if [ $(git status -uno --porcelain | wc -l) -eq 0 ]; then
@@ -61,8 +120,9 @@ function do_one {
continue
fi
echo "Cherry pick failed. Fix, commit (or reset) and exit."
- stable deps $i 20
- /bin/bash
+ git cherry-pick --quit; git reset --hard
+ do_dep $orig_cmt
+ echo $orig_cmt $STABLE_MAJ_VER.$STABLE_MIN_VER >> ~/failed
continue
fi