[PATCHv2] Script check-patchlist

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

 



There are patches present in the tree that are present in kernel.spec
but are not recorded in PatchList.txt. The script below helps list
all the patches in the tree and whether they are present in kernel.spec,
PatchList.txt or if they are present but not added to any of those files.

Signed-off-by: Miguel Flores Silverio <floresmigu3l@xxxxxxxxx>
---

* v1
  - use colors to highlight the patch location
  - different flags to list patches in PatchList.txt kernl.spec

* v2
  - Fix: match flags with functionality accordignly
  - Uses characters instead of colors to identify each patch
    not all consoles support color.
  - adds extra flag to show patches that are prsent in the tree but
    not recorded in PatchList.txt nor kernel.spec
    
 scripts/check-patchlist.sh | 91 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 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..64c3d35
--- /dev/null
+++ b/scripts/check-patchlist.sh
@@ -0,0 +1,91 @@
+#! /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 "Helps see patches present in the tree                             "
+    echo "-h, --help                                                        "
+    echo "-p, --patchlist     patches added to PatchList.txt.               "
+    echo "-s, --specfile      patches added to kernel.spec.                 "
+    echo "-n, --not-tracked   patches int the tree but not in PatchList.txt "
+    echo "                    nor kernel.spec                               "
+}
+
+BASEDIR=$(dirname "$( cd $(dirname $BASH_SOURCE[0]) && pwd)")
+pushd $BASEDIR > /dev/null
+
+function list_all(){
+    echo "===========Legend============================"
+    echo "||   In kernel.spec                          "
+    echo "==   In PatchList.txt & Kernel.spec          "
+    echo "|=   Neither in PatchList.txt nor kernel.spec"
+    echo "============================================="
+    for patch in $(ls *.patch); do
+	if [ ! -z "$(grep $patch PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ]
+	then
+	    echo  "|| ${patch}" # In PatchList.txt
+	else
+	    if [ ! -z "$(grep $patch kernel.spec)" ];then
+		echo "== ${patch}" # In Kernel.spec Not In PatchList.txt
+	    else
+		echo "|= ${patch}" # Not In kernel.spec nor PatchList.txt
+	    fi
+	fi
+    done
+}
+
+function list_present_not_tracked(){
+    for patch in $(ls *.patch); do
+	if [ -z "$(grep $patch PatchList.txt)" ] && [ -z "$(grep $patch kernel.spec)" ]
+	then
+	    echo $patch
+	fi
+    done
+}
+
+function list_patchlist(){
+    for patch in $(ls *.patch); do
+	if [ ! -z "$(grep $patch PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ]
+	then
+	    echo $patch
+	fi
+    done
+}
+
+function list_specfile(){
+    for patch in $(ls *.patch); do
+	if [ ! -z "$(grep $patch kernel.spec)" ] && [ -z "$(grep $patch PatchList.txt)" ]
+	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
+		;;
+	    -n|--not-tracked)
+		list_present_not_tracked
+		;;
+	    *)
+		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