[OE-core] [PATCH 1/3] tzcode: remove unused patch files

Bystricky, Juro juro.bystricky at intel.com
Tue Jan 30 16:29:23 UTC 2018


> I wonder if we can cook up a script which can check for unused patches,
> it will be very helpful to keep the code tidy
> perhaps it already exists and I am the only one who doesn't know

This highly unoptimized Q&D script will list patches not referenced anywhere
(will barf on filenames with spaces, but typically there are none such files ):

$1 = filoder to (recursively) check, i.e called from meta:  ./recipes-devtools

#!/bin/bash

findpatchesall=`find $1  -name '*.patch' -exec readlink -f {} \;`
findall=`find -L $1 -name '*.*' -not -name "*.patch" -exec readlink -f {} \;`

echo "patches: $findpatchesall"
echo "recipes: $findall"

# Go through all patches and see if any file references them
for patch in $findpatchesall
do
	#echo "checking $patch"
	patch_referenced="0"
	for file1 in $findall
	do
	patch1=`basename $patch`
	if [ -f "$file1" ]; then
		if grep -q $patch1 "$file1"; then
			#echo "referenced in: $file1"
			patch_referenced="1"
		fi
	fi
	done
	if [ "$patch_referenced" == "0" ]; then
		echo "*** $patch ***"
    fi
done




More information about the Openembedded-core mailing list