With Gentoo as a source-based distribution, however, this is very easy. Let's assume you want to apply a patch for more debug output to some kde plasma applets. The patch file is called debug.patch, the package name for the plasma applets is kde-base/plasma-apps. All you have to do is
mkdir -p /etc/portage/patches/kde-base/plasma-appsFinished. The patch is automatically applied during the emerge command:
cp debug.patch /etc/portage/patches/kde-base/plasma-apps/
emerge -a1 kde-base/plasma-apps
>>> Preparing source in /var/tmp/portage/kde-base/plasma-apps-4.8.2/work/plasma-apps-4.8.2 ...Isn't that a nice trick? :)
* Applying user patches from /etc/portage/patches//kde-base/plasma-apps ...
* debug.patch ... [ ok ]
* Done with patching
>>> Source prepared.
Just one small warning... this does not work for all ebuilds in the portage tree yet, in case of doubt better check the build log if your patch was really applied. It does work for all ebuilds using base.eclass, which effectively includes all of KDE and all KDE applications.