[PATCH 1/1] kernel-2.eclass: Support USE=vanilla

Mike Pagano <[email protected]> Fri, 5 Jun 2026 13:56:11 -0400
Newsgroups gmane.linux.gentoo.devel
Message-ID <[email protected]>
The kernel teams have been discussing removing support for
separate and distinct vanilla sources kernel packages.

This change is an attempt to continue to provide a portage
managed vanilla-sources option through a use flag.

Gentoo Sources uses a numeric pattern with NNNN_DESCRIPTION.
For NNNN, a number less than 1500, would be the upstream
incremental patch versions. This change would keep anything
< 1500 and not apply any other patch.

Note: A small change will be done to 0000_README (already in
master) to make upstream incremental patches stop at 1499
instead of the current 1500.

Signed-off-by: Mike Pagano <[email protected]>
---
 eclass/kernel-2.eclass | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 44b1bce50..30c0197dc 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -1239,6 +1239,20 @@ unipatch() {
 		eend $?
 	done
 
+	# for USE=vanilla, remove non-upstream patches
+	# which should be labeled as 1000_ through 1499_
+	if use vanilla; then
+		for patch in ${KPATCH_DIR}/*; do 
+			patchname="${patch##*/}" # Extract filename without path
+			numericprefix="${patchname:0:4}" # Get first 4 characters
+			# Check if it's exactly 4 digits and greater than 1499
+			if [[ $numericprefix =~ ^[0-9]{4}$ ]] && (( numericprefix > 1499 )); then
+				echo "deleting ${patch} ?"
+				rm ${patch} 2>/dev/null
+			fi
+		done
+	fi
+
 	# and now, finally, we patch it :)
 	for x in ${KPATCH_DIR}; do
 		for i in $(find ${x} -maxdepth 1 -iname "*.patch*" -or -iname "*.diff*" | sort -n); do
-- 
2.53.0