[PATCH] script check-patchlist.sh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Makes it easier to manage patches by listing all the patches
tracked in PatchList.txt and kernel.spec. and those patches
that are in the tree but not added to any of these files.

Signed-off-by: Miguel Flores Silverio <floresmigu3l@xxxxxxxxx>
---
 scripts/check-patchlist.sh | 83 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100755 scripts/check-patchlist.sh

diff --git a/scripts/check-patchlist.sh b/scripts/check-patchlist.sh
new file mode 100755
index 0000000..154441d
--- /dev/null
+++ b/scripts/check-patchlist.sh
@@ -0,0 +1,83 @@
+#! /bin/sh
+# Script to highlight which patches in the current tree are in kernel.spec,
+# PatchList.txt, both files or neither.
+#
+# eg. ./check-patchlist.sh [option]
+
+function usage(){
+    echo "-h, --help "
+    echo "-p, --patchlist List patches only in PatchList.txt.  "
+    echo "-s, --specfile  List patches only in kernel.spec.    "
+}
+
+BASEDIR=$(dirname "$( cd $(dirname $BASH_SOURCE[0]) && pwd)")
+pushd $BASEDIR > /dev/null
+
+function list_all(){
+    echo "===========Legend================"
+    echo "Red   kernel.spec                "
+    echo "Green PatchList.txt & Kernel.spec"
+    echo "Default Neither                  "
+    echo "================================="
+    for patch in $(ls *.patch); do
+	if [ ! -z "$(grep $patch PatchList.txt  && grep $patch kernel.spec)" ]; then
+	    echo -e "\e[32m$patch\e[0m" # In PatchList.txt
+	else
+	    if [ ! -z "$(grep $patch kernel.spec)" ];then
+		echo -e "\e[31m$patch\e[0m" # In Kernel.spec Not In PatchList.txt
+	    else
+		echo -e "\e[39m$patch\e[0m" # Not In kernel.spec nor PatchList.txt
+	    fi
+	fi
+
+
+    done
+}
+
+function list_present_not_included(){
+    for patch in $(ls *.patch); do
+	if [ -z "$(grep $patch PatchList.txt && grep $patch kernel.spec)" ]; then
+	    echo $patch
+	fi
+    done
+}
+
+function list_patchlist(){
+    for patch in $(ls *.patch); do
+	if [ ! -z "$(grep $patch PatchList.txt)" ]; then
+	    echo $patch
+	fi
+    done
+}
+
+function list_specfile(){
+    for patch in $(ls *.patch); do
+	if [ ! -z "$(grep $patch kernel.spec)" ]; then
+	    echo $patch
+	fi
+    done
+}
+
+if [ -z "$@" ]; then
+    list_all
+else
+
+    for opt in "$@"; do
+	case $opt in
+	    -p|--patchlist)
+		list_patchlist
+		;;
+	    -s|--specfile)
+		list_specfile
+		;;
+	    -h|--help)
+		usage
+		;;
+	    *)
+		usage
+		;;
+	esac
+    done
+fi
+
+popd > /dev/null
-- 
2.7.4
_______________________________________________
kernel mailing list
kernel@xxxxxxxxxxxxxxxxxxxxxxx
https://lists.fedoraproject.org/admin/lists/kernel@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux