git add debian/patches/series
fi
+if grep ^debian/patches/series-rt$ ../conflicts ; then
+ $scriptdir/fixupseries debian/patches/series-rt
+ git add debian/patches/series-rt
+fi
+
if grep ^debian/config/defines$ ../conflicts ; then
($scriptdir/fixupcontrol debian/config/defines .. && git add debian/config/defines) || true
fi
git config merge.conflictstyle diff3
#remove some debian patches that conflict with rpi stuff
-patch -p1 -R < debian/patches/bugfix/all/mm-larger-stack-guard-gap-between-vmas.patch
-grep -v bugfix/all/mm-larger-stack-guard-gap-between-vmas.patch debian/patches/series | sponge debian/patches/series
-patch -p1 -R < debian/patches/bugfix/x86/pinctrl-cherryview-add-a-quirk-to-make-acer-chromebo.patch
-grep -v bugfix/x86/pinctrl-cherryview-add-a-quirk-to-make-acer-chromebo.patch debian/patches/series | sponge debian/patches/series
+#patch -p1 -R < debian/patches/bugfix/all/mm-larger-stack-guard-gap-between-vmas.patch
+#grep -v bugfix/all/mm-larger-stack-guard-gap-between-vmas.patch debian/patches/series | sponge debian/patches/series
+#patch -p1 -R < debian/patches/bugfix/x86/pinctrl-cherryview-add-a-quirk-to-make-acer-chromebo.patch
+#grep -v bugfix/x86/pinctrl-cherryview-add-a-quirk-to-make-acer-chromebo.patch debian/patches/series | sponge debian/patches/series
-git commit -a -m 'remove some debian patches that conflict with rpi stuff'
+#git commit -a -m 'remove some debian patches that conflict with rpi stuff'
#pseudomerge in upstream history
#annoyingly newer versions of git require --allow-unrelated-histories while older versions do not recognise it
cd ..
rm -rf usextract
-git commit -a -m 'defuzz patches'
+if ! git diff --quiet; then
+ git commit -a -m 'defuzz patches'
+fi
+
+#apply manual downstream patches, otherwise dgit will remove them.
+MANUALDOWNSTREAMPATCHES=`git diff buildnewlinuxpackage-deb buildnewlinuxpackage-pkgmerge debian/patches/series | grep -E '^\+' | grep -Ev '^\+#' | grep -Ev '^\+rpi/' | grep -Ev '^\+\+' | sed s/^.//`
+for FILE in $MANUALDOWNSTREAMPATCHES ; do
+ patch -p1 < debian/patches/$FILE
+done
+
+if ! git diff --quiet; then
+ git commit -a -m 'apply manual raspbian patches'
+fi
dgit --quilt=auto quilt-fixup