public inbox for gentoo-kernel@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-kernel] kernel-2.eclass: Easier way to use genpatches in ebuilds
@ 2005-06-22 12:52 Daniel Drake
  2005-06-22 16:24 ` John Mylchreest
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Daniel Drake @ 2005-06-22 12:52 UTC (permalink / raw
  To: gentoo-kernel

[-- Attachment #1: Type: text/plain, Size: 403 bytes --]

This provides an easier way for kernel-2 users to apply genpatches.

In the attached ebuild example, ck-sources-2.6.12_p2.ebuild, all that is
needed is:

K_WANT_GENPATCHES="base"
K_GENPATCHES_VER="1"

The above will translate to genpatches-2.6.12-1.base.tar.bz2
The only other thing you need to do is add $GENPATCHES_URI to SRC_URI and then
you will get genpatches applied with unipatch.

Any comments?

[-- Attachment #2: k2.patch --]
[-- Type: text/x-patch, Size: 2308 bytes --]

Index: kernel-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v
retrieving revision 1.125
diff -u -B -p -r1.125 kernel-2.eclass
--- kernel-2.eclass	15 May 2005 20:30:04 -0000	1.125
+++ kernel-2.eclass	22 Jun 2005 12:49:35 -0000
@@ -36,6 +36,11 @@
 #
 # K_DEFCONFIG			- Allow specifying a different defconfig target.
 #						  If length zero, defaults to "defconfig".
+# K_WANT_GENPATCHES		- Apply genpatches to kernel source. Provide any
+# 						  combination of "base" and "extras"
+# K_GENPATCHES_VER		- The version of the genpatches tarball(s) to apply.
+#						  A value of "5" would apply genpatches-2.6.12-5 to
+#						  my-sources-2.6.12.ebuild
 
 # H_SUPPORTEDARCH		- this should be a space separated list of ARCH's which
 #						  can be supported by the headers ebuild
@@ -71,6 +76,17 @@ LICENSE="GPL-2"
 
 #Eclass functions only from here onwards ...
 #==============================================================
+handle_genpatches() {
+	local tarball
+	[[ -z ${K_WANT_GENPATCHES} || -z ${K_GENPATCHES_VER} ]] && return -1
+
+	for i in ${K_WANT_GENPATCHES} ; do
+		tarball="genpatches-${OKV}-${K_GENPATCHES_VER}.${i}.tar.bz2"
+		GENPATCHES_URI="${GENPATCHES_URI} mirror://gentoo/${tarball}"
+		UNIPATCH_LIST_GENPATCHES="${UNIPATCH_LIST_GENPATCHES} ${DISTDIR}/${tarball}"
+	done
+}
+
 detect_version() {
 	# this function will detect and set
 	# - OKV: Original Kernel Version (2.6.0/2.6.0-test11)
@@ -185,6 +201,8 @@ detect_version() {
 					mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
 		UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-bk*}.bz2 ${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2"
 	fi
+
+	handle_genpatches
 }
 
 kernel_is() {
@@ -865,8 +883,8 @@ headers___fix() {
 kernel-2_src_unpack() {
 	universal_unpack
 
-	[[ -n ${UNIPATCH_LIST} ]] || [[ -n ${UNIPATCH_LIST_DEFAULT} ]] && \
-		unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST}"
+	[[ -n ${UNIPATCH_LIST} || -n ${UNIPATCH_LIST_DEFAULT} || -n ${UNIPATCH_LIST_GENPATCHES} ]] && \
+		unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST_GENPATCHES} ${UNIPATCH_LIST}"
 
 	[[ -z ${K_NOSETEXTRAVERSION} ]] && unpack_set_extraversion
 	unpack_fix_docbook

[-- Attachment #3: ck-sources-2.6.12_p2.ebuild --]
[-- Type: text/plain, Size: 1378 bytes --]

# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-kernel/ck-sources/ck-sources-2.6.11_p10.ebuild,v 1.1 2005/06/13 02:07:56 marineam Exp $

K_PREPATCHED="yes"
UNIPATCH_STRICTORDER="yes"
K_NOUSENAME="yes"
K_WANT_GENPATCHES="base"
K_GENPATCHES_VER="1"
ETYPE="sources"
inherit kernel-2
detect_version

# A few hacks to set ck version via _p instead of -r
MY_P=${P/_p*/}
MY_PR=${PR/r/-r}
MY_PR=${MY_PR/-r0/}
EXTRAVERSION=-ck${PV/*_p/}${MY_PR}
KV_FULL=${OKV}${EXTRAVERSION}
KV_CK=${KV_FULL/-r*/}
detect_version

IUSE="ck-server"
if use ck-server; then
	CK_PATCH="patch-${KV_CK}-server.bz2"
else
	CK_PATCH="patch-${KV_CK}.bz2"
fi

UNIPATCH_LIST="${DISTDIR}/${CK_PATCH}"

DESCRIPTION="Full sources for the Stock Linux kernel and Con Kolivas's high performance patchset"
HOMEPAGE="http://members.optusnet.com.au/ckolivas/kernel/"
SRC_URI="${KERNEL_URI} ${GENPATCHES_URI}
	ck-server? ( http://ck.kolivas.org/patches/2.6/${OKV}/${KV_CK}/patch-${KV_CK}-server.bz2 )
	!ck-server? ( http://ck.kolivas.org/patches/2.6/${OKV}/${KV_CK}/patch-${KV_CK}.bz2 )"

KEYWORDS="~x86 ~amd64"

pkg_postinst() {
	postinst_sources

	einfo "The ck patchset is tuned for desktop usage."
	einfo "To better tune the kernel for server applications add"
	einfo "ck-server to your use flags and reemerge ck-sources"
}


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-07-01  9:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-22 12:52 [gentoo-kernel] kernel-2.eclass: Easier way to use genpatches in ebuilds Daniel Drake
2005-06-22 16:24 ` John Mylchreest
2005-06-23 19:36   ` John Mylchreest
2005-06-23  8:30 ` Henrik Brix Andersen
2005-07-01  9:08 ` Henrik Brix Andersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox