/[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.232 Revision 1.239
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 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.232 2010/05/02 08:48:16 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.239 2010/08/03 17:22:13 robbat2 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>
84[[ -z ${LICENSE} ]] && \ 84[[ -z ${LICENSE} ]] && \
85 LICENSE="GPL-2" 85 LICENSE="GPL-2"
86 86
87# This is the latest KV_PATCH of the deblob tool available from the 87# This is the latest KV_PATCH of the deblob tool available from the
88# libre-sources upstream. 88# libre-sources upstream.
89[[ -z ${DEBLOB_MAX_VERSION} ]] && DEBLOB_MAX_VERSION=33 89[[ -z ${DEBLOB_MAX_VERSION} ]] && DEBLOB_MAX_VERSION=35
90 90
91# No need to run scanelf/strip on kernel sources/headers (bug #134453). 91# No need to run scanelf/strip on kernel sources/headers (bug #134453).
92RESTRICT="binchecks strip" 92RESTRICT="binchecks strip"
93 93
94# set LINUX_HOSTCFLAGS if not already set 94# set LINUX_HOSTCFLAGS if not already set
156 KV_EXTRA=${KV_EXTRA/[-_]*} 156 KV_EXTRA=${KV_EXTRA/[-_]*}
157 else 157 else
158 KV_PATCH=$(get_version_component_range 3- ${OKV}) 158 KV_PATCH=$(get_version_component_range 3- ${OKV})
159 fi 159 fi
160 KV_PATCH=${KV_PATCH/[-_]*} 160 KV_PATCH=${KV_PATCH/[-_]*}
161
162 local v n=0 missing
163 for v in CKV OKV KV_{MAJOR,MINOR,PATCH} ; do
164 [[ -z ${!v} ]] && n=1 && missing="${missing}${v} ";
165 done
166 [[ $n -eq 1 ]] && \
167 eerror "Missing variables: ${missing}" && \
168 die "Failed to extract kernel version (try explicit CKV in ebuild)!"
169 unset v n missing
161 170
162 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2" 171 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
163 172
164 RELEASE=${CKV/${OKV}} 173 RELEASE=${CKV/${OKV}}
165 RELEASE=${RELEASE/_beta} 174 RELEASE=${RELEASE/_beta}
166 RELEASE=${RELEASE/_rc/-rc} 175 RELEASE=${RELEASE/_rc/-rc}
167 RELEASE=${RELEASE/_pre/-pre} 176 RELEASE=${RELEASE/_pre/-pre}
177 # We cannot trivally call kernel_is here, because it calls us to detect the
178 # version
168 kernel_is ge 2 6 && RELEASE=${RELEASE/-pre/-git} 179 #kernel_is ge 2 6 && RELEASE=${RELEASE/-pre/-git}
180 [ $(($KV_MAJOR * 1000 + $KV_MINOR)) -ge 2006 ] && RELEASE=${RELEASE/-pre/-git}
169 RELEASETYPE=${RELEASE//[0-9]} 181 RELEASETYPE=${RELEASE//[0-9]}
170 182
171 # Now we know that RELEASE is the -rc/-git 183 # Now we know that RELEASE is the -rc/-git
172 # and RELEASETYPE is the same but with its numerics stripped 184 # and RELEASETYPE is the same but with its numerics stripped
173 # we can work on better sorting EXTRAVERSION. 185 # we can work on better sorting EXTRAVERSION.
324 # stripped 336 # stripped
325 LICENSE="${LICENSE} !deblob? ( freedist )" 337 LICENSE="${LICENSE} !deblob? ( freedist )"
326 338
327 DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}" 339 DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
328 DEBLOB_A="deblob-${DEBLOB_PV}" 340 DEBLOB_A="deblob-${DEBLOB_PV}"
341 DEBLOB_CHECK_A="deblob-check-${DEBLOB_PV}"
329 DEBLOB_HOMEPAGE="http://www.fsfla.org/svnwiki/selibre/linux-libre/" 342 DEBLOB_HOMEPAGE="http://www.fsfla.org/svnwiki/selibre/linux-libre/"
343 DEBLOB_URI_PATH="download/releases/LATEST-${DEBLOB_PV}.N"
344 if ! has "${EAPI:-0}" 0 1 ; then
345 DEBLOB_CHECK_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/deblob-check -> ${DEBLOB_CHECK_A}"
346 else
347 DEBLOB_CHECK_URI="mirror://gentoo/${DEBLOB_CHECK_A}"
348 fi
349 DEBLOB_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/${DEBLOB_A}"
330 HOMEPAGE="${HOMEPAGE} ${DEBLOB_HOMEPAGE}" 350 HOMEPAGE="${HOMEPAGE} ${DEBLOB_HOMEPAGE}"
331 351
332 KERNEL_URI="${KERNEL_URI} 352 KERNEL_URI="${KERNEL_URI}
333 deblob? ( 353 deblob? (
334 ${DEBLOB_HOMEPAGE}/download/releases/LATEST-${DEBLOB_PV}.N/${DEBLOB_A} 354 ${DEBLOB_URI}
355 ${DEBLOB_CHECK_URI}
335 )" 356 )"
336 else 357 else
337 # We have no way to deblob older kernels, so just mark them as 358 # We have no way to deblob older kernels, so just mark them as
338 # tainted with non-libre materials. 359 # tainted with non-libre materials.
339 LICENSE="${LICENSE} freedist" 360 LICENSE="${LICENSE} freedist"
714 fi 735 fi
715 736
716 # optionally display security unsupported message 737 # optionally display security unsupported message
717 # Start with why 738 # Start with why
718 if [[ ${K_SECURITY_UNSUPPORTED} = deblob ]]; then 739 if [[ ${K_SECURITY_UNSUPPORTED} = deblob ]]; then
719 ewarn "Deblobbed kernels are UNSUPPORTED by Gentoo Security" 740 ewarn "Deblobbed kernels are UNSUPPORTED by Gentoo Security."
720 elif [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then 741 elif [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then
721 ewarn "${PN} is UNSUPPORTED by Gentoo Security." 742 ewarn "${PN} is UNSUPPORTED by Gentoo Security."
722 fi 743 fi
723 # And now the general message. 744 # And now the general message.
724 if [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then 745 if [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then
744 elog "https://bugs.gentoo.org/show_bug.cgi?id=214765" 765 elog "https://bugs.gentoo.org/show_bug.cgi?id=214765"
745 echo 766 echo
746 fi 767 fi
747} 768}
748 769
749postinst_headers() {
750 elog "Kernel headers are usually only used when recompiling your system libc, as"
751 elog "such, following the installation of newer headers, it is advised that you"
752 elog "re-merge your system libc."
753 elog "Failure to do so will cause your system libc to not make use of newer"
754 elog "features present in the updated kernel headers."
755}
756
757# pkg_setup functions 770# pkg_setup functions
758#============================================================== 771#==============================================================
759setup_headers() { 772setup_headers() {
760 [[ -z ${H_SUPPORTEDARCH} ]] && H_SUPPORTEDARCH=${PN/-*/} 773 [[ -z ${H_SUPPORTEDARCH} ]] && H_SUPPORTEDARCH=${PN/-*/}
761 for i in ${H_SUPPORTEDARCH}; do 774 for i in ${H_SUPPORTEDARCH}; do
773 786
774# unipatch 787# unipatch
775#============================================================== 788#==============================================================
776unipatch() { 789unipatch() {
777 local i x y z extention PIPE_CMD UNIPATCH_DROP KPATCH_DIR PATCH_DEPTH ELINE 790 local i x y z extention PIPE_CMD UNIPATCH_DROP KPATCH_DIR PATCH_DEPTH ELINE
778 local STRICT_COUNT PATCH_LEVEL myLC_ALL myLANG extglob_bak 791 local STRICT_COUNT PATCH_LEVEL myLC_ALL myLANG
779 792
780 # set to a standard locale to ensure sorts are ordered properly. 793 # set to a standard locale to ensure sorts are ordered properly.
781 myLC_ALL="${LC_ALL}" 794 myLC_ALL="${LC_ALL}"
782 myLANG="${LANG}" 795 myLANG="${LANG}"
783 LC_ALL="C" 796 LC_ALL="C"
785 798
786 [ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/" 799 [ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/"
787 [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR} 800 [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR}
788 801
789 # We're gonna need it when doing patches with a predefined patchlevel 802 # We're gonna need it when doing patches with a predefined patchlevel
790 extglob_bak=$(shopt -p extglob)
791 shopt -s extglob 803 eshopts_push -s extglob
792 804
793 # This function will unpack all passed tarballs, add any passed patches, and remove any passed patchnumbers 805 # This function will unpack all passed tarballs, add any passed patches, and remove any passed patchnumbers
794 # usage can be either via an env var or by params 806 # usage can be either via an env var or by params
795 # although due to the nature we pass this within this eclass 807 # although due to the nature we pass this within this eclass
796 # it shall be by param only. 808 # it shall be by param only.
822 else 834 else
823 extention=${i/*./} 835 extention=${i/*./}
824 extention=${extention/:*/} 836 extention=${extention/:*/}
825 PIPE_CMD="" 837 PIPE_CMD=""
826 case ${extention} in 838 case ${extention} in
839 xz) PIPE_CMD="xz -dc";;
840 lzma) PIPE_CMD="lzma -dc";;
827 bz2) PIPE_CMD="bzip2 -dc";; 841 bz2) PIPE_CMD="bzip2 -dc";;
828 patch) PIPE_CMD="cat";; 842 patch) PIPE_CMD="cat";;
829 diff) PIPE_CMD="cat";; 843 diff) PIPE_CMD="cat";;
830 gz|Z|z) PIPE_CMD="gzip -dc";; 844 gz|Z|z) PIPE_CMD="gzip -dc";;
831 ZIP|zip) PIPE_CMD="unzip -p";; 845 ZIP|zip) PIPE_CMD="unzip -p";;
918 break 932 break
919 else 933 else
920 eend 1 934 eend 1
921 eerror "Failed to apply patch ${i/*\//}" 935 eerror "Failed to apply patch ${i/*\//}"
922 eerror "Please attach ${STDERR_T} to any bug you may post." 936 eerror "Please attach ${STDERR_T} to any bug you may post."
937 eshopts_pop
923 die "Failed to apply ${i/*\//}" 938 die "Failed to apply ${i/*\//}"
924 fi 939 fi
925 else 940 else
926 PATCH_DEPTH=$((${PATCH_DEPTH} + 1)) 941 PATCH_DEPTH=$((${PATCH_DEPTH} + 1))
927 fi 942 fi
928 done 943 done
929 if [ ${PATCH_DEPTH} -eq 5 ]; then 944 if [ ${PATCH_DEPTH} -eq 5 ]; then
930 eend 1 945 eend 1
931 eerror "Please attach ${STDERR_T} to any bug you may post." 946 eerror "Please attach ${STDERR_T} to any bug you may post."
947 eshopts_pop
932 die "Unable to dry-run patch." 948 die "Unable to dry-run patch."
933 fi 949 fi
934 done 950 done
935 done 951 done
936 952
947 # clean up KPATCH_DIR's - fixes bug #53610 963 # clean up KPATCH_DIR's - fixes bug #53610
948 for x in ${KPATCH_DIR}; do rm -Rf ${x}; done 964 for x in ${KPATCH_DIR}; do rm -Rf ${x}; done
949 965
950 LC_ALL="${myLC_ALL}" 966 LC_ALL="${myLC_ALL}"
951 LANG="${myLANG}" 967 LANG="${myLANG}"
952 eval ${extglob_bak} 968 eshopts_pop
953} 969}
954 970
955# getfilevar accepts 2 vars as follows: 971# getfilevar accepts 2 vars as follows:
956# getfilevar <VARIABLE> <CONFIGFILE> 972# getfilevar <VARIABLE> <CONFIGFILE>
957# pulled from linux-info 973# pulled from linux-info
1116 kernel_is 2 4 && unpack_2_4 1132 kernel_is 2 4 && unpack_2_4
1117 kernel_is 2 6 && unpack_2_6 1133 kernel_is 2 6 && unpack_2_6
1118 fi 1134 fi
1119 1135
1120 if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then 1136 if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then
1121 cp "${DISTDIR}/${DEBLOB_A}" "${T}" 1137 cp "${DISTDIR}/${DEBLOB_A}" "${T}" || die "cp ${DEBLOB_A} failed"
1122 chmod +x "${T}/${DEBLOB_A}" 1138 cp "${DISTDIR}/${DEBLOB_CHECK_A}" "${T}/deblob-check" || die "cp ${DEBLOB_CHECK_A} failed"
1139 chmod +x "${T}/${DEBLOB_A}" "${T}/deblob-check" || die "chmod deblob scripts failed"
1123 fi 1140 fi
1124} 1141}
1125 1142
1126kernel-2_src_compile() { 1143kernel-2_src_compile() {
1127 cd "${S}" 1144 cd "${S}"
1143 [[ ${ETYPE} == headers ]] && install_headers 1160 [[ ${ETYPE} == headers ]] && install_headers
1144 [[ ${ETYPE} == sources ]] && install_sources 1161 [[ ${ETYPE} == sources ]] && install_sources
1145} 1162}
1146 1163
1147kernel-2_pkg_postinst() { 1164kernel-2_pkg_postinst() {
1148 [[ ${ETYPE} == headers ]] && postinst_headers
1149 [[ ${ETYPE} == sources ]] && postinst_sources 1165 [[ ${ETYPE} == sources ]] && postinst_sources
1150} 1166}
1151 1167
1152kernel-2_pkg_setup() { 1168kernel-2_pkg_setup() {
1153 if kernel_is 2 4; then 1169 if kernel_is 2 4; then

Legend:
Removed from v.1.232  
changed lines
  Added in v.1.239

  ViewVC Help
Powered by ViewVC 1.1.20