/[gentoo-x86]/eclass/kernel-2.eclass
Gentoo

Diff of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.282 Revision 1.311
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2015 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.282 2013/04/17 13:52:17 tomwij Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.311 2015/07/19 15:46:03 mpagano Exp $
4 4
5# Description: kernel.eclass rewrite for a clean base regarding the 2.6 5# Description: kernel.eclass rewrite for a clean base regarding the 2.6
6# series of kernel with back-compatibility for 2.4 6# series of kernel with back-compatibility for 2.4
7# 7#
8# Original author: John Mylchreest <johnm@gentoo.org> 8# Original author: John Mylchreest <johnm@gentoo.org>
35# messages 35# messages
36# K_EXTRAELOG - same as K_EXTRAEINFO except using elog instead of einfo 36# K_EXTRAELOG - same as K_EXTRAEINFO except using elog instead of einfo
37# K_EXTRAEWARN - same as K_EXTRAEINFO except using ewarn instead of einfo 37# K_EXTRAEWARN - same as K_EXTRAEINFO except using ewarn instead of einfo
38# K_SYMLINK - if this is set, then forcably create symlink anyway 38# K_SYMLINK - if this is set, then forcably create symlink anyway
39# 39#
40# K_BASE_VER - for git-sources, declare the base version this patch is
41# based off of.
40# K_DEFCONFIG - Allow specifying a different defconfig target. 42# K_DEFCONFIG - Allow specifying a different defconfig target.
41# If length zero, defaults to "defconfig". 43# If length zero, defaults to "defconfig".
42# K_WANT_GENPATCHES - Apply genpatches to kernel source. Provide any 44# K_WANT_GENPATCHES - Apply genpatches to kernel source. Provide any
43# combination of "base" and "extras" 45# combination of "base", "extras" or "experimental".
46# K_EXP_GENPATCHES_PULL - If set, we pull "experimental" regardless of the USE FLAG
47# but expect the ebuild maintainer to use K_EXP_GENPATCHES_LIST.
48# K_EXP_GENPATCHES_NOUSE - If set, no USE flag will be provided for "experimental";
49# as a result the user cannot choose to apply those patches.
50# K_EXP_GENPATCHES_LIST - A list of patches to pick from "experimental" to apply when
51# the USE flag is unset and K_EXP_GENPATCHES_PULL is set.
44# K_GENPATCHES_VER - The version of the genpatches tarball(s) to apply. 52# K_GENPATCHES_VER - The version of the genpatches tarball(s) to apply.
45# A value of "5" would apply genpatches-2.6.12-5 to 53# A value of "5" would apply genpatches-2.6.12-5 to
46# my-sources-2.6.12.ebuild 54# my-sources-2.6.12.ebuild
47# K_SECURITY_UNSUPPORTED- If set, this kernel is unsupported by Gentoo Security 55# K_SECURITY_UNSUPPORTED- If set, this kernel is unsupported by Gentoo Security
48# K_DEBLOB_AVAILABLE - A value of "0" will disable all of the optional deblob 56# K_DEBLOB_AVAILABLE - A value of "0" will disable all of the optional deblob
49# code. If empty, will be set to "1" if deblobbing is 57# code. If empty, will be set to "1" if deblobbing is
50# possible. Test ONLY for "1". 58# possible. Test ONLY for "1".
59# K_DEBLOB_TAG - This will be the version of deblob script. It's a upstream SVN tag
60# such asw -gnu or -gnu1.
51# K_PREDEBLOBBED - This kernel was already deblobbed elsewhere. 61# K_PREDEBLOBBED - This kernel was already deblobbed elsewhere.
52# If false, either optional deblobbing will be available 62# If false, either optional deblobbing will be available
53# or the license will note the inclusion of freedist 63# or the license will note the inclusion of freedist
54# code. 64# code.
55# K_LONGTERM - If set, the eclass will search for the kernel source 65# K_LONGTERM - If set, the eclass will search for the kernel source
56# in the long term directories on the upstream servers 66# in the long term directories on the upstream servers
57# as the location has been changed by upstream 67# as the location has been changed by upstream
68# K_KDBUS_AVAILABLE - If set, the ebuild contains the option of installing the
69# kdbus patch. This patch is not installed without the 'kdbus'
70# and 'experimental' use flags.
58# H_SUPPORTEDARCH - this should be a space separated list of ARCH's which 71# H_SUPPORTEDARCH - this should be a space separated list of ARCH's which
59# can be supported by the headers ebuild 72# can be supported by the headers ebuild
60 73
61# UNIPATCH_LIST - space delimetered list of patches to be applied to the 74# UNIPATCH_LIST - space delimetered list of patches to be applied to the
62# kernel 75# kernel
72# Changing any other variable in this eclass is not supported; you can request 85# Changing any other variable in this eclass is not supported; you can request
73# for additional variables to be added by contacting the current maintainer. 86# for additional variables to be added by contacting the current maintainer.
74# If you do change them, there is a chance that we will not fix resulting bugs; 87# If you do change them, there is a chance that we will not fix resulting bugs;
75# that of course does not mean we're not willing to help. 88# that of course does not mean we're not willing to help.
76 89
90PYTHON_COMPAT=( python{2_6,2_7} )
91
77inherit eutils toolchain-funcs versionator multilib 92inherit eutils toolchain-funcs versionator multilib python-any-r1
78EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm 93EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm
79 94
80# Added by Daniel Ostrow <dostrow@gentoo.org> 95# Added by Daniel Ostrow <dostrow@gentoo.org>
81# This is an ugly hack to get around an issue with a 32-bit userland on ppc64. 96# This is an ugly hack to get around an issue with a 32-bit userland on ppc64.
82# I will remove it when I come up with something more reasonable. 97# I will remove it when I come up with something more reasonable.
128 # genpatches for 3.0 and 3.0.1 might be named 143 # genpatches for 3.0 and 3.0.1 might be named
129 # genpatches-3.0-1.base.tar.xz and genpatches-3.0-2.base.tar.xz 144 # genpatches-3.0-1.base.tar.xz and genpatches-3.0-2.base.tar.xz
130 # respectively. Handle this. 145 # respectively. Handle this.
131 146
132 for i in ${K_WANT_GENPATCHES} ; do 147 for i in ${K_WANT_GENPATCHES} ; do
133 if [[ ${KV_MAJOR} -ge 3 ]]; then 148 if [[ ${KV_MAJOR} -ge 3 ]]; then
134 if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then 149 if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then
135 tarball="genpatches-${KV_MAJOR}.${KV_MINOR}-${K_GENPATCHES_VER}.${i}.tar.xz" 150 tarball="genpatches-${KV_MAJOR}.${KV_MINOR}-${K_GENPATCHES_VER}.${i}.tar.xz"
151 else
152 tarball="genpatches-${KV_MAJOR}.${KV_PATCH}-${K_GENPATCHES_VER}.${i}.tar.xz"
153 fi
136 else 154 else
137 tarball="genpatches-${KV_MAJOR}.${KV_PATCH}-${K_GENPATCHES_VER}.${i}.tar.xz"
138 fi
139 else
140 tarball="genpatches-${OKV}-${K_GENPATCHES_VER}.${i}.tar.xz" 155 tarball="genpatches-${OKV}-${K_GENPATCHES_VER}.${i}.tar.xz"
141 fi 156 fi
157
158 local use_cond_start="" use_cond_end=""
159
160 if [[ "${i}" == "experimental" && -z ${K_EXP_GENPATCHES_PULL} && -z ${K_EXP_GENPATCHES_NOUSE} ]] ; then
161 use_cond_start="experimental? ( "
162 use_cond_end=" )"
163
164 if use experimental ; then
165 UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
166 debug-print "genpatches tarball: $tarball"
167 fi
168 else
169 UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
142 debug-print "genpatches tarball: $tarball" 170 debug-print "genpatches tarball: $tarball"
143 GENPATCHES_URI="${GENPATCHES_URI} mirror://gentoo/${tarball}" 171 fi
144 UNIPATCH_LIST_GENPATCHES="${UNIPATCH_LIST_GENPATCHES} ${DISTDIR}/${tarball}" 172 GENPATCHES_URI+=" ${use_cond_start}mirror://gentoo/${tarball}${use_cond_end}"
145 done 173 done
146} 174}
147 175
148detect_version() { 176detect_version() {
149 # this function will detect and set 177 # this function will detect and set
210 238
211# if [[ ${KV_MAJOR} -ge 3 ]]; then 239# if [[ ${KV_MAJOR} -ge 3 ]]; then
212 if [[ ${#OKV_ARRAY[@]} -lt 3 ]]; then 240 if [[ ${#OKV_ARRAY[@]} -lt 3 ]]; then
213 KV_PATCH_ARR=(${KV_PATCH//\./ }) 241 KV_PATCH_ARR=(${KV_PATCH//\./ })
214 242
215 # at this point 031412, Linus is putting all 3.x kernels in a 243 # at this point 031412, Linus is putting all 3.x kernels in a
216 # 3.x directory, may need to revisit when 4.x is released 244 # 3.x directory, may need to revisit when 4.x is released
217 KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.x" 245 KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.x"
218 246
219 [[ -n "${K_LONGTERM}" ]] && 247 [[ -n "${K_LONGTERM}" ]] &&
220 KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm/v${KV_MAJOR}.${KV_PATCH_ARR}" 248 KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm/v${KV_MAJOR}.${KV_PATCH_ARR}"
337 ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz" 365 ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
338 366
339 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.xz ${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.xz" 367 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.xz ${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.xz"
340 fi 368 fi
341 else 369 else
370 KV_PATCH_ARR=(${KV_PATCH//\./ })
371
372 # the different majorminor versions have different patch start versions
373 OKV_DICT=(["2"]="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))" ["3"]="2.6.39" ["4"]="3.19")
374
342 if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then 375 if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then
343 if [[ ${KV_MAJOR}${KV_PATCH} -eq 30 ]]; then 376 OKV=${K_BASE_VER:-$OKV_DICT["${KV_MAJOR}"]}
344 OKV="2.6.39"
345 else
346 KV_PATCH_ARR=(${KV_PATCH//\./ })
347 OKV="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))"
348 fi
349 KERNEL_URI="${KERNEL_BASE_URI}/testing/patch-${CKV//_/-}.xz 377 KERNEL_URI="${KERNEL_BASE_URI}/testing/patch-${CKV//_/-}.xz
350 ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz" 378 ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
351 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV//_/-}.xz" 379 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV//_/-}.xz"
352 fi 380 fi
353 381
356 ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz" 384 ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
357 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${OKV}${RELEASE}.xz" 385 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${OKV}${RELEASE}.xz"
358 fi 386 fi
359 387
360 if [[ ${RELEASETYPE} == -rc-git ]]; then 388 if [[ ${RELEASETYPE} == -rc-git ]]; then
361 if [[ ${KV_MAJOR}${KV_PATCH} -eq 30 ]]; then 389 OKV=${K_BASE_VER:-$OKV_DICT["${KV_MAJOR}"]}
362 OKV="2.6.39"
363 else
364 KV_PATCH_ARR=(${KV_PATCH//\./ })
365 OKV="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))"
366 fi
367 KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz 390 KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz
368 ${KERNEL_BASE_URI}/testing/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz 391 ${KERNEL_BASE_URI}/testing/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz
369 ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz" 392 ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
370 393
371 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz ${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz" 394 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz ${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz"
372 fi 395 fi
373 396
374 397
375 fi 398 fi
376 399
377
378 debug-print-kernel2-variables 400 debug-print-kernel2-variables
379 401
380 handle_genpatches 402 handle_genpatches
381} 403}
382 404
415 kernel_is 2 6 || kernel_is 2 5 437 kernel_is 2 6 || kernel_is 2 5
416} 438}
417 439
418# Capture the sources type and set DEPENDs 440# Capture the sources type and set DEPENDs
419if [[ ${ETYPE} == sources ]]; then 441if [[ ${ETYPE} == sources ]]; then
420 DEPEND="!build? ( sys-apps/sed 442 DEPEND="!build? (
443 sys-apps/sed
421 >=sys-devel/binutils-2.11.90.0.31 )" 444 >=sys-devel/binutils-2.11.90.0.31
422 RDEPEND="!build? ( >=sys-libs/ncurses-5.2 445 )"
446 RDEPEND="!build? (
447 >=sys-libs/ncurses-5.2
423 sys-devel/make 448 sys-devel/make
424 dev-lang/perl 449 dev-lang/perl
425 sys-devel/bc )" 450 sys-devel/bc
426 PDEPEND="!build? ( virtual/dev-manager )" 451 )"
427 452
428 SLOT="${PVR}" 453 SLOT="${PVR}"
429 DESCRIPTION="Sources based on the Linux Kernel." 454 DESCRIPTION="Sources based on the Linux Kernel."
430 IUSE="symlink build" 455 IUSE="symlink build"
456
457 if [[ -n ${K_KDBUS_AVAILABLE} ]]; then
458 IUSE="${IUSE} kdbus"
459 fi
431 460
432 # Bug #266157, deblob for libre support 461 # Bug #266157, deblob for libre support
433 if [[ -z ${K_PREDEBLOBBED} ]] ; then 462 if [[ -z ${K_PREDEBLOBBED} ]] ; then
434 # Bug #359865, force a call to detect_version if needed 463 # Bug #359865, force a call to detect_version if needed
435 kernel_is ge 2 6 27 && \ 464 kernel_is ge 2 6 27 && \
436 [[ -z "${K_DEBLOB_AVAILABLE}" ]] && \ 465 [[ -z "${K_DEBLOB_AVAILABLE}" ]] && \
437 kernel_is le 2 6 ${DEBLOB_MAX_VERSION} && \ 466 kernel_is le 2 6 ${DEBLOB_MAX_VERSION} && \
438 K_DEBLOB_AVAILABLE=1 467 K_DEBLOB_AVAILABLE=1
439 if [[ ${K_DEBLOB_AVAILABLE} == "1" ]] ; then 468 if [[ ${K_DEBLOB_AVAILABLE} == "1" ]] ; then
440 IUSE="${IUSE} deblob" 469 IUSE="${IUSE} deblob"
470
441 # Reflect that kernels contain firmware blobs unless otherwise 471 # Reflect that kernels contain firmware blobs unless otherwise
442 # stripped 472 # stripped
443 LICENSE="${LICENSE} !deblob? ( freedist )" 473 LICENSE="${LICENSE} !deblob? ( freedist )"
474
475 DEPEND+=" deblob? ( ${PYTHON_DEPS} )"
444 476
445 if [[ -n KV_MINOR ]]; then 477 if [[ -n KV_MINOR ]]; then
446 DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}" 478 DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
447 else 479 else
448 DEBLOB_PV="${KV_MAJOR}.${KV_PATCH}" 480 DEBLOB_PV="${KV_MAJOR}.${KV_PATCH}"
450 482
451 if [[ ${KV_MAJOR} -ge 3 ]]; then 483 if [[ ${KV_MAJOR} -ge 3 ]]; then
452 DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}" 484 DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}"
453 fi 485 fi
454 486
487 # deblob svn tag, default is -gnu, to change, use K_DEBLOB_TAG in ebuild
488 K_DEBLOB_TAG=${K_DEBLOB_TAG:--gnu}
455 DEBLOB_A="deblob-${DEBLOB_PV}" 489 DEBLOB_A="deblob-${DEBLOB_PV}"
456 DEBLOB_CHECK_A="deblob-check-${DEBLOB_PV}" 490 DEBLOB_CHECK_A="deblob-check-${DEBLOB_PV}"
457 DEBLOB_HOMEPAGE="http://www.fsfla.org/svnwiki/selibre/linux-libre/" 491 DEBLOB_HOMEPAGE="http://www.fsfla.org/svn/fsfla/software/linux-libre/releases/tags"
458 DEBLOB_URI_PATH="download/releases/LATEST-${DEBLOB_PV}.N" 492 DEBLOB_URI_PATH="${DEBLOB_PV}${K_DEBLOB_TAG}"
459 if ! has "${EAPI:-0}" 0 1 ; then 493 if ! has "${EAPI:-0}" 0 1 ; then
460 DEBLOB_CHECK_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/deblob-check -> ${DEBLOB_CHECK_A}" 494 DEBLOB_CHECK_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/deblob-check -> ${DEBLOB_CHECK_A}"
461 else 495 else
462 DEBLOB_CHECK_URI="mirror://gentoo/${DEBLOB_CHECK_A}" 496 DEBLOB_CHECK_URI="mirror://gentoo/${DEBLOB_CHECK_A}"
463 fi 497 fi
498
464 DEBLOB_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/${DEBLOB_A}" 499 DEBLOB_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/${DEBLOB_A}"
465 HOMEPAGE="${HOMEPAGE} ${DEBLOB_HOMEPAGE}" 500 HOMEPAGE="${HOMEPAGE} ${DEBLOB_HOMEPAGE}"
466 501
467 DEPEND+=" deblob? ( =dev-lang/python-2* )"
468 KERNEL_URI="${KERNEL_URI} 502 KERNEL_URI="${KERNEL_URI}
469 deblob? ( 503 deblob? (
470 ${DEBLOB_URI} 504 ${DEBLOB_URI}
471 ${DEBLOB_CHECK_URI} 505 ${DEBLOB_CHECK_URI}
472 )" 506 )"
687 if kernel_is ge 2 6 18 ; then 721 if kernel_is ge 2 6 18 ; then
688 env_setup_xmakeopts 722 env_setup_xmakeopts
689 emake headers_install INSTALL_HDR_PATH="${D}"/${ddir}/.. ${xmakeopts} || die 723 emake headers_install INSTALL_HDR_PATH="${D}"/${ddir}/.. ${xmakeopts} || die
690 724
691 # let other packages install some of these headers 725 # let other packages install some of these headers
692 rm -rf "${D}"/${ddir}/sound #alsa-headers
693 rm -rf "${D}"/${ddir}/scsi #glibc/uclibc/etc... 726 rm -rf "${D}"/${ddir}/scsi #glibc/uclibc/etc...
694 return 0 727 return 0
695 fi 728 fi
696 729
697 # Do not use "linux/*" as that can cause problems with very long 730 # Do not use "linux/*" as that can cause problems with very long
740 > "${S}"/patches.txt 773 > "${S}"/patches.txt
741 fi 774 fi
742 775
743 mv ${WORKDIR}/linux* "${D}"/usr/src 776 mv ${WORKDIR}/linux* "${D}"/usr/src
744 777
745 if [[ -z ${UNIPATCH_DOCS} ]] ; then 778 if [[ -n "${UNIPATCH_DOCS}" ]] ; then
746 dodoc ${UNIPATCH_DOCS} 779 for i in ${UNIPATCH_DOCS}; do
780 dodoc "${T}"/${i}
781 done
747 fi 782 fi
748} 783}
749 784
750# pkg_preinst functions 785# pkg_preinst functions
751#============================================================== 786#==============================================================
787 [[ ! -d ${ROOT}sys ]] && kernel_is 2 6 && mkdir ${ROOT}sys 822 [[ ! -d ${ROOT}sys ]] && kernel_is 2 6 && mkdir ${ROOT}sys
788 823
789 echo 824 echo
790 elog "If you are upgrading from a previous kernel, you may be interested" 825 elog "If you are upgrading from a previous kernel, you may be interested"
791 elog "in the following document:" 826 elog "in the following document:"
792 elog " - General upgrade guide: http://www.gentoo.org/doc/en/kernel-upgrade.xml" 827 elog " - General upgrade guide: https://wiki.gentoo.org/wiki/Kernel/Upgrade"
793 echo 828 echo
794 829
795 # if K_EXTRAEINFO is set then lets display it now 830 # if K_EXTRAEINFO is set then lets display it now
796 if [[ -n ${K_EXTRAEINFO} ]]; then 831 if [[ -n ${K_EXTRAEINFO} ]]; then
797 echo ${K_EXTRAEINFO} | fmt | 832 echo ${K_EXTRAEINFO} | fmt |
810 while read -s ELINE; do ewarn "${ELINE}"; done 845 while read -s ELINE; do ewarn "${ELINE}"; done
811 fi 846 fi
812 847
813 # optionally display security unsupported message 848 # optionally display security unsupported message
814 # Start with why 849 # Start with why
815 if [[ ${K_SECURITY_UNSUPPORTED} = deblob ]]; then
816 ewarn "Deblobbed kernels are UNSUPPORTED by Gentoo Security."
817 elif [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then 850 if [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then
818 ewarn "${PN} is UNSUPPORTED by Gentoo Security." 851 ewarn "${PN} is UNSUPPORTED by Gentoo Security."
819 fi 852 fi
820 # And now the general message. 853 # And now the general message.
821 if [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then 854 if [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then
822 ewarn "This means that it is likely to be vulnerable to recent security issues." 855 ewarn "This means that it is likely to be vulnerable to recent security issues."
827 # warn sparc users that they need to do cross-compiling with >= 2.6.25(bug #214765) 860 # warn sparc users that they need to do cross-compiling with >= 2.6.25(bug #214765)
828 KV_MAJOR=$(get_version_component_range 1 ${OKV}) 861 KV_MAJOR=$(get_version_component_range 1 ${OKV})
829 KV_MINOR=$(get_version_component_range 2 ${OKV}) 862 KV_MINOR=$(get_version_component_range 2 ${OKV})
830 KV_PATCH=$(get_version_component_range 3 ${OKV}) 863 KV_PATCH=$(get_version_component_range 3 ${OKV})
831 if [[ "$(tc-arch)" = "sparc" ]]; then 864 if [[ "$(tc-arch)" = "sparc" ]]; then
865 if [[ $(gcc-major-version) -lt 4 && $(gcc-minor-version) -lt 4 ]]; then
832 if [[ ${KV_MAJOR} -ge 3 || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.24 ]] 866 if [[ ${KV_MAJOR} -ge 3 || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.24 ]] ; then
833 then
834 echo 867 echo
835 elog "NOTE: Since 2.6.25 the kernel Makefile has changed in a way that" 868 elog "NOTE: Since 2.6.25 the kernel Makefile has changed in a way that"
836 elog "you now need to do" 869 elog "you now need to do"
837 elog " make CROSS_COMPILE=sparc64-unknown-linux-gnu-" 870 elog " make CROSS_COMPILE=sparc64-unknown-linux-gnu-"
838 elog "instead of just" 871 elog "instead of just"
839 elog " make" 872 elog " make"
840 elog "to compile the kernel. For more information please browse to" 873 elog "to compile the kernel. For more information please browse to"
841 elog "https://bugs.gentoo.org/show_bug.cgi?id=214765" 874 elog "https://bugs.gentoo.org/show_bug.cgi?id=214765"
842 echo 875 echo
876 fi
843 fi 877 fi
844 fi 878 fi
845} 879}
846 880
847# pkg_setup functions 881# pkg_setup functions
914 PIPE_CMD="" 948 PIPE_CMD=""
915 case ${extention} in 949 case ${extention} in
916 xz) PIPE_CMD="xz -dc";; 950 xz) PIPE_CMD="xz -dc";;
917 lzma) PIPE_CMD="lzma -dc";; 951 lzma) PIPE_CMD="lzma -dc";;
918 bz2) PIPE_CMD="bzip2 -dc";; 952 bz2) PIPE_CMD="bzip2 -dc";;
919 patch) PIPE_CMD="cat";; 953 patch*) PIPE_CMD="cat";;
920 diff) PIPE_CMD="cat";; 954 diff) PIPE_CMD="cat";;
921 gz|Z|z) PIPE_CMD="gzip -dc";; 955 gz|Z|z) PIPE_CMD="gzip -dc";;
922 ZIP|zip) PIPE_CMD="unzip -p";; 956 ZIP|zip) PIPE_CMD="unzip -p";;
923 *) UNIPATCH_DROP="${UNIPATCH_DROP} ${i/:*/}";; 957 *) UNIPATCH_DROP="${UNIPATCH_DROP} ${i/:*/}";;
924 esac 958 esac
951 else 985 else
952 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch${PATCH_LEVEL}) || die "uncompressing patch failed" 986 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch${PATCH_LEVEL}) || die "uncompressing patch failed"
953 fi 987 fi
954 fi 988 fi
955 fi 989 fi
990
991 # If experimental was not chosen by the user, drop experimental patches not in K_EXP_GENPATCHES_LIST.
992 if [[ "${i}" == *"genpatches-"*".experimental."* && -n ${K_EXP_GENPATCHES_PULL} ]] ; then
993 if [[ -z ${K_EXP_GENPATCHES_NOUSE} ]] && use experimental; then
994 continue
995 fi
996
997 local j
998 for j in ${KPATCH_DIR}/*/50*_*.patch*; do
999 for k in ${K_EXP_GENPATCHES_LIST} ; do
1000 [[ "$(basename ${j})" == ${k}* ]] && continue 2
1001 done
1002 UNIPATCH_DROP+=" $(basename ${j})"
1003 done
1004 else
1005 UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
1006 debug-print "genpatches tarball: $tarball"
1007
1008 # check gcc version < 4.9.X uses patch 5000 and = 4.9.X uses patch 5010
1009 if [[ $(gcc-major-version) -eq 4 ]] && [[ $(gcc-minor-version) -ne 9 ]]; then
1010 # drop 5000_enable-additional-cpu-optimizations-for-gcc-4.9.patch
1011 if [[ $UNIPATCH_DROP != *"5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"* ]]; then
1012 UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
1013 fi
1014 else
1015 if [[ $UNIPATCH_DROP != *"5000_enable-additional-cpu-optimizations-for-gcc.patch"* ]]; then
1016 #drop 5000_enable-additional-cpu-optimizations-for-gcc.patch
1017 UNIPATCH_DROP+=" 5000_enable-additional-cpu-optimizations-for-gcc.patch"
1018 fi
1019 fi
1020
1021 # if kdbus use flag is not set, drop the kdbus patch
1022 if [[ $UNIPATCH_DROP != *"5015_kdbus*.patch"* ]]; then
1023 if ! has kdbus ${IUSE} || ! use kdbus; then
1024 UNIPATCH_DROP="${UNIPATCH_DROP} 5015_kdbus*.patch"
1025 fi
1026 fi
1027 fi
956 done 1028 done
957 1029
958 #populate KPATCH_DIRS so we know where to look to remove the excludes 1030 #populate KPATCH_DIRS so we know where to look to remove the excludes
959 x=${KPATCH_DIR} 1031 x=${KPATCH_DIR}
960 KPATCH_DIR="" 1032 KPATCH_DIR=""
991 1063
992 [ -z ${i/*.patch*/} ] && PATCH_DEPTH=${i/*.patch/} 1064 [ -z ${i/*.patch*/} ] && PATCH_DEPTH=${i/*.patch/}
993 #[ -z ${i/*.diff*/} ] && PATCH_DEPTH=${i/*.diff/} 1065 #[ -z ${i/*.diff*/} ] && PATCH_DEPTH=${i/*.diff/}
994 1066
995 if [ -z "${PATCH_DEPTH}" ]; then PATCH_DEPTH=0; fi 1067 if [ -z "${PATCH_DEPTH}" ]; then PATCH_DEPTH=0; fi
1068
1069 ####################################################################
1070 # IMPORTANT: This is temporary code to support Linux git 3.15_rc1! #
1071 # #
1072 # The patch contains a removal of a symlink, followed by addition #
1073 # of a file with the same name as the symlink in the same #
1074 # location; this causes the dry-run to fail, filed bug #507656. #
1075 # #
1076 # https://bugs.gentoo.org/show_bug.cgi?id=507656 #
1077 ####################################################################
1078 if [[ ${PN} == "git-sources" ]] ; then
1079 if [[ ${KV_MAJOR}${KV_PATCH} -ge 315 && ${RELEASETYPE} == -rc ]] ; then
1080 ebegin "Applying ${i/*\//} (-p1)"
1081 if [ $(patch -p1 --no-backup-if-mismatch -f < ${i} >> ${STDERR_T}) "$?" -eq 0 ]; then
1082 eend 0
1083 rm ${STDERR_T}
1084 break
1085 else
1086 eend 1
1087 eerror "Failed to apply patch ${i/*\//}"
1088 eerror "Please attach ${STDERR_T} to any bug you may post."
1089 eshopts_pop
1090 die "Failed to apply ${i/*\//} on patch depth 1."
1091 fi
1092 fi
1093 fi
1094 ####################################################################
996 1095
997 while [ ${PATCH_DEPTH} -lt 5 ]; do 1096 while [ ${PATCH_DEPTH} -lt 5 ]; do
998 echo "Attempting Dry-run:" >> ${STDERR_T} 1097 echo "Attempting Dry-run:" >> ${STDERR_T}
999 echo "cmd: patch -p${PATCH_DEPTH} --no-backup-if-mismatch --dry-run -f < ${i}" >> ${STDERR_T} 1098 echo "cmd: patch -p${PATCH_DEPTH} --no-backup-if-mismatch --dry-run -f < ${i}" >> ${STDERR_T}
1000 echo "=======================================================" >> ${STDERR_T} 1099 echo "=======================================================" >> ${STDERR_T}
1038 # them during the install phase. 1137 # them during the install phase.
1039 local tmp 1138 local tmp
1040 for x in ${KPATCH_DIR}; do 1139 for x in ${KPATCH_DIR}; do
1041 for i in ${UNIPATCH_DOCS}; do 1140 for i in ${UNIPATCH_DOCS}; do
1042 if [[ -f "${x}/${i}" ]] ; then 1141 if [[ -f "${x}/${i}" ]] ; then
1043 tmp="${tmp} \"${T}/${i}\"" 1142 tmp="${tmp} ${i}"
1044 cp -f "${x}/${i}" "${T}"/ 1143 cp -f "${x}/${i}" "${T}"/
1045 fi 1144 fi
1046 done 1145 done
1047 done 1146 done
1048 UNIPATCH_DOCS="${tmp}" 1147 UNIPATCH_DOCS="${tmp}"
1166 fi 1265 fi
1167 1266
1168 # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox 1267 # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox
1169 # only do this for kernel < 2.6.27 since this file does not exist in later 1268 # only do this for kernel < 2.6.27 since this file does not exist in later
1170 # kernels 1269 # kernels
1171 if [[ -n ${KV_MINOR} && ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} < 2.6.27 ]] 1270 if [[ -n ${KV_MINOR} && ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} < 2.6.27 ]] ; then
1172 then
1173 sed -i \ 1271 sed -i \
1174 -e "s|TOUT := .tmp_gas_check|TOUT := \"${T}\"/.tmp_gas_check|" \ 1272 -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
1175 "${S}"/arch/ppc/Makefile 1273 "${S}"/arch/ppc/Makefile
1176 else 1274 else
1177 sed -i \ 1275 sed -i \
1178 -e "s|TOUT := .tmp_gas_check|TOUT := \"${T}\"/.tmp_gas_check|" \ 1276 -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
1179 "${S}"/arch/powerpc/Makefile 1277 "${S}"/arch/powerpc/Makefile
1180 fi 1278 fi
1181} 1279}
1182 1280
1183kernel-2_src_compile() { 1281kernel-2_src_compile() {
1184 cd "${S}" 1282 cd "${S}"
1185 [[ ${ETYPE} == headers ]] && compile_headers 1283 [[ ${ETYPE} == headers ]] && compile_headers
1186 1284
1187 if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then 1285 if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then
1188 echo ">>> Running deblob script ..." 1286 echo ">>> Running deblob script ..."
1287 python_setup
1189 EPYTHON="python2" sh "${T}/${DEBLOB_A}" --force || die "Deblob script failed to run!!!" 1288 sh "${T}/${DEBLOB_A}" --force || die "Deblob script failed to run!!!"
1190 fi 1289 fi
1191} 1290}
1192 1291
1193# if you leave it to the default src_test, it will run make to 1292# if you leave it to the default src_test, it will run make to
1194# find whether test/check targets are present; since "make test" 1293# find whether test/check targets are present; since "make test"

Legend:
Removed from v.1.282  
changed lines
  Added in v.1.311

  ViewVC Help
Powered by ViewVC 1.1.20