Implement new userpatch feature in existing eclass?

Nekun <[email protected]> Sun, 04 Apr 2021 17:54:07 +0000
Newsgroups gmane.linux.gentoo.portage.devel
Message-ID <[email protected]>
Hi all.

Recently, I start working on optional atom specifiers feature in 
userpatch facility: if package directory name starts with percent sign, 
following word threated as a regular Portage atom, e.g 
"/etc/portage/patches/sys-kernel/%<=gentoo-sources-5.4" == 
"<=sys-kernel/gentoo-sources-5.4". This might be very useful in cases 
when patches applied to minor updates, but major update breaks it (e.g., 
in Linux kernel), so I want to specify smth like "=gentoo-sources-5.4*". 
I added new command in portageq to match two atoms and call it from 
eapply_user function in phase-function.sh, in same manner as 
has_version/best_version are called it. But recently I found that 
eapply_user implemented in Portage only in EAPI 6, and there is its 
predecessor, epatch_user, implemented in epatch.eclass. So, ebuilds with 
EAPI<6 (I found 4463 in last gentoo snapshot) will ignore new "atomic" 
patch directories. Obviously, this is rather confusing, unacceptable 
behaviour.

Can I patch epatch.eclass in gentoo repository to implement new 
userpatch facility for older EAPIs? I guess that EAPI version is 
considered as stable, unchangeable behaviour of all functions, but in 
other side, this feature doesn't changes anything existing: old 
userpatch semantics preserves and order of applying 
(${P}-${PR},${P},${PN}) not changed, seeking for atoms added at tail.