/[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.238
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.238 2010/07/30 00:44:59 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>
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=34
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.
714 fi 726 fi
715 727
716 # optionally display security unsupported message 728 # optionally display security unsupported message
717 # Start with why 729 # Start with why
718 if [[ ${K_SECURITY_UNSUPPORTED} = deblob ]]; then 730 if [[ ${K_SECURITY_UNSUPPORTED} = deblob ]]; then
719 ewarn "Deblobbed kernels are UNSUPPORTED by Gentoo Security" 731 ewarn "Deblobbed kernels are UNSUPPORTED by Gentoo Security."
720 elif [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then 732 elif [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then
721 ewarn "${PN} is UNSUPPORTED by Gentoo Security." 733 ewarn "${PN} is UNSUPPORTED by Gentoo Security."
722 fi 734 fi
723 # And now the general message. 735 # And now the general message.
724 if [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then 736 if [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then
744 elog "https://bugs.gentoo.org/show_bug.cgi?id=214765" 756 elog "https://bugs.gentoo.org/show_bug.cgi?id=214765"
745 echo 757 echo
746 fi 758 fi
747} 759}
748 760
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 761# pkg_setup functions
758#============================================================== 762#==============================================================
759setup_headers() { 763setup_headers() {
760 [[ -z ${H_SUPPORTEDARCH} ]] && H_SUPPORTEDARCH=${PN/-*/} 764 [[ -z ${H_SUPPORTEDARCH} ]] && H_SUPPORTEDARCH=${PN/-*/}
761 for i in ${H_SUPPORTEDARCH}; do 765 for i in ${H_SUPPORTEDARCH}; do
773 777
774# unipatch 778# unipatch
775#============================================================== 779#==============================================================
776unipatch() { 780unipatch() {
777 local i x y z extention PIPE_CMD UNIPATCH_DROP KPATCH_DIR PATCH_DEPTH ELINE 781 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 782 local STRICT_COUNT PATCH_LEVEL myLC_ALL myLANG
779 783
780 # set to a standard locale to ensure sorts are ordered properly. 784 # set to a standard locale to ensure sorts are ordered properly.
781 myLC_ALL="${LC_ALL}" 785 myLC_ALL="${LC_ALL}"
782 myLANG="${LANG}" 786 myLANG="${LANG}"
783 LC_ALL="C" 787 LC_ALL="C"
785 789
786 [ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/" 790 [ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/"
787 [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR} 791 [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR}
788 792
789 # We're gonna need it when doing patches with a predefined patchlevel 793 # We're gonna need it when doing patches with a predefined patchlevel
790 extglob_bak=$(shopt -p extglob)
791 shopt -s extglob 794 eshopts_push -s extglob
792 795
793 # This function will unpack all passed tarballs, add any passed patches, and remove any passed patchnumbers 796 # 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 797 # usage can be either via an env var or by params
795 # although due to the nature we pass this within this eclass 798 # although due to the nature we pass this within this eclass
796 # it shall be by param only. 799 # it shall be by param only.
822 else 825 else
823 extention=${i/*./} 826 extention=${i/*./}
824 extention=${extention/:*/} 827 extention=${extention/:*/}
825 PIPE_CMD="" 828 PIPE_CMD=""
826 case ${extention} in 829 case ${extention} in
830 xz) PIPE_CMD="xz -dc";;
831 lzma) PIPE_CMD="lzma -dc";;
827 bz2) PIPE_CMD="bzip2 -dc";; 832 bz2) PIPE_CMD="bzip2 -dc";;
828 patch) PIPE_CMD="cat";; 833 patch) PIPE_CMD="cat";;
829 diff) PIPE_CMD="cat";; 834 diff) PIPE_CMD="cat";;
830 gz|Z|z) PIPE_CMD="gzip -dc";; 835 gz|Z|z) PIPE_CMD="gzip -dc";;
831 ZIP|zip) PIPE_CMD="unzip -p";; 836 ZIP|zip) PIPE_CMD="unzip -p";;
918 break 923 break
919 else 924 else
920 eend 1 925 eend 1
921 eerror "Failed to apply patch ${i/*\//}" 926 eerror "Failed to apply patch ${i/*\//}"
922 eerror "Please attach ${STDERR_T} to any bug you may post." 927 eerror "Please attach ${STDERR_T} to any bug you may post."
928 eshopts_pop
923 die "Failed to apply ${i/*\//}" 929 die "Failed to apply ${i/*\//}"
924 fi 930 fi
925 else 931 else
926 PATCH_DEPTH=$((${PATCH_DEPTH} + 1)) 932 PATCH_DEPTH=$((${PATCH_DEPTH} + 1))
927 fi 933 fi
928 done 934 done
929 if [ ${PATCH_DEPTH} -eq 5 ]; then 935 if [ ${PATCH_DEPTH} -eq 5 ]; then
930 eend 1 936 eend 1
931 eerror "Please attach ${STDERR_T} to any bug you may post." 937 eerror "Please attach ${STDERR_T} to any bug you may post."
938 eshopts_pop
932 die "Unable to dry-run patch." 939 die "Unable to dry-run patch."
933 fi 940 fi
934 done 941 done
935 done 942 done
936 943
947 # clean up KPATCH_DIR's - fixes bug #53610 954 # clean up KPATCH_DIR's - fixes bug #53610
948 for x in ${KPATCH_DIR}; do rm -Rf ${x}; done 955 for x in ${KPATCH_DIR}; do rm -Rf ${x}; done
949 956
950 LC_ALL="${myLC_ALL}" 957 LC_ALL="${myLC_ALL}"
951 LANG="${myLANG}" 958 LANG="${myLANG}"
952 eval ${extglob_bak} 959 eshopts_pop
953} 960}
954 961
955# getfilevar accepts 2 vars as follows: 962# getfilevar accepts 2 vars as follows:
956# getfilevar <VARIABLE> <CONFIGFILE> 963# getfilevar <VARIABLE> <CONFIGFILE>
957# pulled from linux-info 964# pulled from linux-info
1143 [[ ${ETYPE} == headers ]] && install_headers 1150 [[ ${ETYPE} == headers ]] && install_headers
1144 [[ ${ETYPE} == sources ]] && install_sources 1151 [[ ${ETYPE} == sources ]] && install_sources
1145} 1152}
1146 1153
1147kernel-2_pkg_postinst() { 1154kernel-2_pkg_postinst() {
1148 [[ ${ETYPE} == headers ]] && postinst_headers
1149 [[ ${ETYPE} == sources ]] && postinst_sources 1155 [[ ${ETYPE} == sources ]] && postinst_sources
1150} 1156}
1151 1157
1152kernel-2_pkg_setup() { 1158kernel-2_pkg_setup() {
1153 if kernel_is 2 4; then 1159 if kernel_is 2 4; then

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

  ViewVC Help
Powered by ViewVC 1.1.20