diff options
| -rw-r--r-- | Documentation/maintainers/remove_unwanted_patches.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Documentation/maintainers/remove_unwanted_patches.sh b/Documentation/maintainers/remove_unwanted_patches.sh new file mode 100644 index 00000000000..298f6d87bc7 --- /dev/null +++ b/Documentation/maintainers/remove_unwanted_patches.sh @@ -0,0 +1,38 @@ +#!/bin/bash +TMP="/tmp/" +# we also assume that we are run from the directory where we want to remove patches eg. directory where are categories. +find -mindepth 2 -maxdepth 3 -type d -name files -print | sort -u |sed -e "s:/files::g" -e "s:\./::g" |grep kde-misc > ${TMP}/packages-with-patches.txt +EBUILD_BASEDIRS="`cat ${TMP}/packages-with-patches.txt`" +for EBBD in ${EBUILD_BASEDIRS}; do + pushd $EBBD >> /dev/null + # now we are in ebuild directory (eg. kde-base/kdelibs) + find ./files/ -type f |grep -v "CVS/" |sort -u |sed -e "s:\./files/::g" > ${TMP}/patches-per-package.txt # d. generated on the fly per package. + PATCHES="`cat ${TMP}/patches-per-package.txt`" + for PATCH in ${PATCHES}; do + PATCH_IN_USE="false" + # look for ebulids and replace the ${P} ${PV} and ${PN} with its specified values. + find ./ -type f -name \*.ebuild |sort -u |sed -e "s:\./::g" > ${TMP}/ebuild-list-per-package.txt # d. generated on the fly per package. + EBUILDS="`cat ${TMP}/ebuild-list-per-package.txt`" + for EBUILD in ${EBUILDS}; do + P1="`echo ${EBUILD}| sed -e "s:.ebuild::g"`" + if [[ ${P1/*-/} == r* ]]; then + P1=`echo ${P1} | sed -e "s:${P1/*-/}::g" -e "s:-$::g"` + fi + PV=${P1/*-/} + PN=`echo ${P1} | sed -e "s:${P1/*-/}::g" -e "s:-$::g"` + cat ${EBUILD} | sed -e "s:\${PN}:${PN}:g" -e "s:\${PV}:${PV}:g" -e "s:\${P}:${PN}-${PV}:g" |grep "${PATCH}" |wc -l > ${TMP}/tst + COUNT=`cat ${TMP}/tst` + #echo "cat ${EBUILD} | sed -e \"s:\${PN}:${PN}:g\" -e \"s:\${PV}:${PV}:g\" -e \"s:\${P}:${PN}-${PV}:g\" |grep \"${PATCH}\"" # debug + if [[ ${COUNT} -gt 0 ]]; then + #echo "IN USE: ${PATCH}" # debug + PATCH_IN_USE="true" + break # escape no need to work further + fi + done + if [[ ${PATCH_IN_USE} == "false" ]]; then + # for now just write out. + echo "NOT IN USE!: \"${EBBD}/files/${PATCH}\"" >> ${TMP}/cleaner-output.txt + fi + done + popd >> /dev/null +done |
