# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# Only set MMV to numeric value of -mm release
# Version of Andrew Morton's patchset

RESTRICT="nomirror"

K_PREPATCHED="yes"
K_NOSETEXTRAVERSION="don't_set_it"

ETYPE="sources"
inherit kernel-2 eutils
detect_version

# Create -mm patch version, -mm patch source, -no patch source
MMV="2"
MMPV="${KV/-no*/}-mm${MMV}"
MMPV_SRC="mirror://kernel/linux/kernel/people/akpm/patches/2.6/${MMPV/-mm*/}/${MMPV}/${MMPV}.bz2" 

# add more as you go along
NO_SRC="http://no.oldos.org/files/${KV}/${KV}.bz2"
NO_SRC="${NO_SRC} http://joecool.ftfuchs.com/no-sources/${KV}/${KV}.bz2"


DESCRIPTION="Development branch of the Linux Kernel with Andrew Morton's patchset and other performance-ish patches and tweaks. Maintained by joecool,jasonf, and bzcat-patch_p1.  Hosted by linode.com"
HOMEPAGE="http://no.oldos.org/"

SRC_URI="${KERNEL_URI} ${NO_SRC}"

KEYWORDS="x86 ~amd64 ~ia64 -*"

K_EXTRAEWARN="IMPORTANT: joecool, jasonf, and bzcat_-patch_p1 would like to remind 
you that this is an experimental kernel still.  Don't blame us if things break.
If you experience problems while using no-sources,
go back to a vanilla kernel and see if the problem persists. If the problems
are still there, then you can bug somebody. (Preferably us and 
not the Gentoo devs!)  We lurk at #no-sources on Freenode.
pass rootflags=nopseudo rootfstype=reiser4 to disable metas/ for root reiser4
"

universal_unpack() {
        cd ${WORKDIR}
        unpack linux-${OKV}.tar.bz2
        if [[ "${OKV}" != "${KV_FULL}" ]]; then
                mv linux-${OKV} linux-${KV_FULL} \
                        || die "Unable to move source tree to ${KV_FULL}."
        fi
        cd ${S}

        # remove all backup files
        find . -iname "*~" -exec rm {} \; 2> /dev/null

        if [[ -d ${S}/Documentation/DocBook ]]; then
                cd ${S}/Documentation/DocBook
                sed -ie "s:db2:docbook2:g" Makefile
                cd ${OLDPWD}
        fi

        # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox
        use ppc && \
                sed -ie 's|TOUT := .tmp_gas_check|TOUT  := $(T).tmp_gas_check|' \
                ${S}/arch/ppc/Makefile
}

unpack_fix_install_path() {
	cd ${S}
        # change incorrect install path
        sed     -ie 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile
}

src_unpack() {
	kernel-2_src_unpack
        epatch ${DISTDIR}/${MMPV}.bz2
        epatch ${DISTDIR}/${KV}.bz2
	unpack_fix_install_path
}


