On 06/13/2016 12:54 PM, Peter Robinson wrote:
On Mon, Jun 13, 2016 at 8:45 PM, Miguel Flores Silverio
<floresmigu3l@xxxxxxxxx> wrote:
Signed-off-by: Miguel Flores Silverio <floresmigu3l@xxxxxxxxx>
---
scripts/newpatch.sh | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100755 scripts/newpatch.sh
diff --git a/scripts/newpatch.sh b/scripts/newpatch.sh
new file mode 100755
index 0000000..254827f
--- /dev/null
+++ b/scripts/newpatch.sh
@@ -0,0 +1,42 @@
+#! /bin/sh
+#
+#This script facilitates the addition of a new patch to the source tree.
+# -- Moves patch to tree
+# -- Adds patch to kernel.spec list of patches
+# -- Adds patch to git
+# -- Bumps kernel.spec
We generally don't bump the spec revision unless we're actually going
to push a build. If it's a local build for someone to test something
it's often useful to add an identifier (eg 300.satatest1) to ensure 1)
a smooth upgrade path to a new upstream kernel (probably with fixes
landed) and to make it easy for maintainers to tell if it's an
official or random kernel.
There's a commented out macro at the top of the spec file:
# define buildid .local
Instead of the bump spec, you could enable the macro and maybe change
.local to something else.
+# Should we also be adding patches to PatchList.txt?
+
+
+# Base directory is relative to where the script is.
+BASEDIR=$(dirname "$(cd $(dirname $BASH_SOURCE[0]) && pwd)")
+
+# Check for both a Patch and a description
+if [ -z "$1" ] && [ -z "$2" ]; then
+ echo "usage: $0 [ /path/to/patch/ ] [ description ]"
+ exit 1
+fi
+
+# Kernel.spec file in the current tree
+SPECFILE="$BASEDIR/kernel.spec"
+# Check if trying to add a patch already in kernel.spec
+if [ -n "$(grep $1 $SPECFILE)" ]; then
+ echo "Error: Patch already exists"
+ exit 1
+fi
+
+# If adding a patch outside the source tree move it to the source tree
+mv $1 $BASEDIR/
+
+# ID number of the last patch in kernel.spec
+LPATCH_ID=$(grep ^Patch $SPECFILE | tail -n1 | awk '{ print $1 }' | sed s/Patch// | sed s/://)
+# ID of the next patch to be added to kernel.spec
+NPATCH_ID=$(($LPATCH_ID + 1 ))
+
+# Add patch with new id at the end of the list of patches
+sed -i "/^Patch$LPATCH_ID:\ /a#\ $2\nPatch$NPATCH_ID:\ $1" $SPECFILE
+
+# Keep track of the patch
+git add $1
+
+rpmdev-bumpspec $SPECFILE
--
2.7.4
_______________________________________________
kernel mailing list
kernel@xxxxxxxxxxxxxxxxxxxxxxx
https://lists.fedoraproject.org/admin/lists/kernel@xxxxxxxxxxxxxxxxxxxxxxx
_______________________________________________
kernel mailing list
kernel@xxxxxxxxxxxxxxxxxxxxxxx
https://lists.fedoraproject.org/admin/lists/kernel@xxxxxxxxxxxxxxxxxxxxxxx