Re: [PATCHv3] Script to highlight state of patches in tree

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

 



On 08/10/2016 02:19 AM, Miguel Flores Silverio wrote:
The intent for this script is to make easier patch management
and documentation.

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

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

* PATCHv2
  - 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
* PATCHv3
  - Fix: Logic missing condition for patches in tree recorded in
    PatchList.txt but missing in kernel.spec
  - Add: Option for patches present in the tree but only recorded in
    PatchList.txt
---
 scripts/check-patchlist.sh | 113 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 113 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..c8c4d79
--- /dev/null
+++ b/scripts/check-patchlist.sh
@@ -0,0 +1,113 @@
+#! /bin/sh
+# This script was created in a effort to make patch management a bit easier.
+# It list all the patches in the current tree and identifies if they are
+# present in the kernel.spec, PatchList.txt, both files or neither.
+#
+# eg. ./check-patchlist.sh [optional flag]
+
+function usage(){
+    echo "List all the patches currently in the tree. It also helps identify"
+    echo "if the patch is present in kernel.spec or PatchList.txt.          "
+    echo "-h, --help                                                        "
+    echo "-t, --tracked       patches in both kernel.spec and PatchList.txt "
+    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                              "

Minor typo here with the help text, I'll fix it up and apply this to the tree.

+}
+
+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                        "
+    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}" # Patches in kernel.spec and PatchList.txt
+
+	elif [ ! -z "$(grep $patch PatchList.txt)" ] && [ -z "$(grep $patch kernel.spec)" ]
+	then
+	     echo "* ${patch}" # Patches in PatchList.txt but not in kernel.spec
+
+	elif [ -z "$(grep $patch PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ]
+	then
+	    echo ". ${patch}" # Patches in kernel.spec but not in PatchList.txt
+
+	else
+	    echo "- ${patch}" # Neither in PatchList.txt nor kernel.spec
+
+	fi
+    done
+}
+
+function list_present_not_added(){
+    for patch in $(ls *.patch); do
+	if [ -z "$(grep $patch PatchList.txt)" ] && [ -z "$(grep $patch kernel.spec)" ]
+	then
+	    echo $patch
+	fi
+    done
+}
+
+function list_present_added(){
+    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 PatchList.txt)" ] && [ ! -z "$(grep $patch kernel.spec)" ]
+	then
+	    echo $patch
+	fi
+    done
+}
+
+if [ -z "$@" ]; then
+    list_all
+else
+
+    for opt in "$@"; do
+	case $opt in
+	    -t|--tracked)
+		list_present_added
+		;;
+	    -s|--specfile)
+		list_specfile
+		;;
+	    -h|--help)
+		usage
+		;;
+	    -n|--not-added)
+		list_present_not_added
+		;;
+	    -p|--patchlist)
+		list_patchList
+		;;
+	    *)
+		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