From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-dev+bounces-93719-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 671811382C5 for <garchives@archives.gentoo.org>; Fri, 5 Feb 2021 17:58:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4430DE08CD; Fri, 5 Feb 2021 17:58:48 +0000 (UTC) Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [IPv6:2607:f8b0:4864:20::f2c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 04E2DE08AD for <gentoo-dev@lists.gentoo.org>; Fri, 5 Feb 2021 17:58:47 +0000 (UTC) Received: by mail-qv1-xf2c.google.com with SMTP id ew18so3869478qvb.4 for <gentoo-dev@lists.gentoo.org>; Fri, 05 Feb 2021 09:58:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version; bh=STqQrM8xIrce40/tPv644uJqO4RxWVXIqMt5co3wuMk=; b=gW3bgrpf1Skj54U+kZBN3PwDPGXKfLaYLfSja+Bi4y2IvxGBOTBSFC7Zcza4GK4Ysz A/7q9SPc7lrMSxYXOX7MukeaBokFOyC4usJHhj2LPJOBbYwqi56DhaRcWikqxookKXoV ian2KhVwJjk2jhyDG4sQU+EaTGa8muTdKvU7VKe3Mn229jkutG4O5baFAiizy45IEfYT wblZdvg6fp2U/jn+xZgeVynRjf0EWxL8SYIDg03k2uZMQlozXHSSaFzDuFWKE9RpCBT8 8n2Uz01n2dGmGwpwDKN1ysisPEwfOKqkw3GJZEKL92MOPW6DZu/rajitR3gJIwuzmsao Mx8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=STqQrM8xIrce40/tPv644uJqO4RxWVXIqMt5co3wuMk=; b=FfVAN+KAL4A290hxUPerpnPJy0KtiYksDnCLGeFJCOnZuVQozTDWTlojXtHvM5Pzai J7XxvqSI/bMHZeqnKjYnmT0Jfdl3gJnVyFLtddPxH5HqyNlL6EPlxilr8KpG57oM2eXg vNfJdDQZOKE00zcXGTrD6mBWavYf801biwZU2qc4xp7drM9iJh7JxPATdWFo9BtsAm+h 5UGR/j9WNcRFs9Hf37cvt7sXS6g4IBjCwpzpSWGrQ7rd6ibnRtIsSiZSYitX5qtKX7vS C5wa8f32R6BqfBTLP7OCXoDCmVZuaOJN/A3reuYWjJVCLAgabOiN1dRFrtEDQqHf0SX1 x4oA== X-Gm-Message-State: AOAM53020Cqb6WVn5vYub6qfFvKBHnJ5AdyJu4+fV4umdEfFm9k1Lvj1 dgUi83xsNw61zQQ9gmUNLmg= X-Google-Smtp-Source: ABdhPJylqFzZb7NlM/0ApVkj67Dpq61n6oEnX7QYu5Q48bHMs3kzQg1IwlEjJBkmoP4cBarKYyr5Mw== X-Received: by 2002:a0c:8c87:: with SMTP id p7mr5586888qvb.46.1612547926111; Fri, 05 Feb 2021 09:58:46 -0800 (PST) Received: from callisto (c-73-175-137-55.hsd1.pa.comcast.net. [73.175.137.55]) by smtp.gmail.com with ESMTPSA id 9sm9327544qtr.64.2021.02.05.09.58.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 09:58:45 -0800 (PST) From: David Michael <fedora.dm0@gmail.com> To: gentoo-dev@lists.gentoo.org Cc: kernel@gentoo.org Subject: [gentoo-dev] [PATCH] kernel-2.eclass: EAPI 7 support Date: Fri, 05 Feb 2021 12:58:44 -0500 Message-ID: <87wnvmqtuz.fsf@gmail.com> Precedence: bulk List-Post: <mailto:gentoo-dev@lists.gentoo.org> List-Help: <mailto:gentoo-dev+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-dev+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-dev+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-dev.gentoo.org> X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain X-Archives-Salt: 07df4135-ed4b-4f5e-a72c-fedcabe694b0 X-Archives-Hash: a032ddd8d54fb0d0797f855a69a4e612 This converts installation paths prefixed with EROOT or ED to have a leading slash, switches DEPEND to BDEPEND for EAPI 7 so tools are installed in BROOT and natively executable, and makes eapply_user the default src_prepare behavior for EAPIs since 6. It also drops the binutils build-time dependency since it was added in the original kernel.eclass implementation ~20 years ago to enforce a minimum version to avoid old assembly bugs. All affected versions are long gone, and it isn't required to install sources anyway, so skip building the unused binutils dependency. Signed-off-by: David Michael <fedora.dm0@gmail.com> --- Hi, Can the kernel eclass support EAPI 7 now? It would help auditing dependencies to eventually support BDEPEND properly in the ebuilds using the eclass. The patch also corrects some whitespace issues that my editor was highlighting, like extra end-of-line space or random embedded tabs. I could drop those changes if needed. Thanks. David eclass/kernel-2.eclass | 67 +++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass index dccd39ec8f2..12ab19baee7 100644 --- a/eclass/kernel-2.eclass +++ b/eclass/kernel-2.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: kernel-2.eclass @@ -8,7 +8,7 @@ # John Mylchreest <johnm@gentoo.org> # Mike Pagano <mpagano@gentoo.org> # <so many, many others, please add yourself> -# @SUPPORTED_EAPIS: 2 3 4 5 6 +# @SUPPORTED_EAPIS: 2 3 4 5 6 7 # @BLURB: Eclass for kernel packages # @DESCRIPTION: # This is the kernel.eclass rewrite for a clean base regarding the 2.6 @@ -28,7 +28,7 @@ # @ECLASS-VARIABLE: K_NODRYRUN # @DEFAULT_UNSET # @DESCRIPTION: -# if this is set then patch --dry-run will not +# if this is set then patch --dry-run will not # be run. Certain patches will fail with this parameter # See bug #507656 @@ -198,11 +198,11 @@ # If you do change them, there is a chance that we will not fix resulting bugs; # that of course does not mean we're not willing to help. -inherit toolchain-funcs +inherit estack toolchain-funcs [[ ${EAPI:-0} == [012345] ]] && inherit epatch -[[ ${EAPI:-0} == [0123456] ]] && inherit estack eapi7-ver +[[ ${EAPI:-0} == [0123456] ]] && inherit eapi7-ver case ${EAPI:-0} in - 2|3|4|5|6) + 2|3|4|5|6|7) EXPORT_FUNCTIONS src_{unpack,prepare,compile,install,test} \ pkg_{setup,preinst,postinst,postrm} ;; *) die "${ECLASS}: EAPI ${EAPI} not supported" ;; @@ -314,7 +314,6 @@ handle_genpatches() { # - KV: Kernel Version (2.6.0-gentoo/2.6.0-test11-gentoo-r1) # - EXTRAVERSION: The additional version appended to OKV (-gentoo/-gentoo-r1) detect_version() { - # We've already run, so nothing to do here. [[ -n ${KV_FULL} ]] && return 0 @@ -540,7 +539,6 @@ detect_version() { UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz ${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz" fi - fi debug-print-kernel2-variables @@ -600,10 +598,8 @@ kernel_is_2_6() { # Capture the sources type and set DEPENDs if [[ ${ETYPE} == sources ]]; then - DEPEND="!build? ( - sys-apps/sed - >=sys-devel/binutils-2.11.90.0.31 - )" + [[ ${EAPI} == [0-6] ]] && DEPEND="!build? ( sys-apps/sed )" || + BDEPEND="!build? ( sys-apps/sed )" RDEPEND="!build? ( dev-lang/perl sys-devel/bc @@ -638,7 +634,8 @@ if [[ ${ETYPE} == sources ]]; then # tree has been dropped from the kernel. kernel_is lt 4 14 && LICENSE+=" !deblob? ( linux-firmware )" - DEPEND+=" deblob? ( ${PYTHON_DEPS} )" + [[ ${EAPI} == [0-6] ]] && DEPEND+=" deblob? ( ${PYTHON_DEPS} )" || + BDEPEND+=" deblob? ( ${PYTHON_DEPS} )" if [[ -n KV_MINOR ]]; then DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}" @@ -826,7 +823,7 @@ unpack_set_extraversion() { unpack_fix_install_path() { cd "${S}" - sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile + sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile } # Compile Functions @@ -855,7 +852,7 @@ compile_headers() { # autoconf.h isnt generated unless it already exists. plus, we have # no guarantee that any headers are installed on the system... - [[ -f ${EROOT}usr/include/linux/autoconf.h ]] \ + [[ -f ${EROOT%/}/usr/include/linux/autoconf.h ]] \ || touch include/linux/autoconf.h # if K_DEFCONFIG isn't set, force to "defconfig" @@ -932,10 +929,10 @@ install_headers() { # of this crap anymore :D if kernel_is ge 2 6 18 ; then env_setup_xmakeopts - emake headers_install INSTALL_HDR_PATH="${ED}"${ddir}/.. ${xmakeopts} || die + emake headers_install INSTALL_HDR_PATH="${ED%/}"${ddir}/.. ${xmakeopts} || die # let other packages install some of these headers - rm -rf "${ED}"${ddir}/scsi || die #glibc/uclibc/etc... + rm -rf "${ED%/}"${ddir}/scsi || die #glibc/uclibc/etc... return 0 fi @@ -943,15 +940,15 @@ install_headers() { # $S values where the cmdline to cp is too long pushd "${S}" >/dev/null dodir ${ddir}/linux - cp -pPR "${S}"/include/linux "${ED}"${ddir}/ || die - rm -rf "${ED}"${ddir}/linux/modules || die + cp -pPR "${S}"/include/linux "${ED%/}"${ddir}/ || die + rm -rf "${ED%/}"${ddir}/linux/modules || die dodir ${ddir}/asm - cp -pPR "${S}"/include/asm/* "${ED}"${ddir}/asm || die + cp -pPR "${S}"/include/asm/* "${ED%/}"${ddir}/asm || die if kernel_is 2 6 ; then dodir ${ddir}/asm-generic - cp -pPR "${S}"/include/asm-generic/* "${ED}"${ddir}/asm-generic || die + cp -pPR "${S}"/include/asm-generic/* "${ED%/}"${ddir}/asm-generic || die fi # clean up @@ -983,7 +980,7 @@ install_sources() { done fi - mv "${WORKDIR}"/linux* "${ED}"usr/src || die + mv "${WORKDIR}"/linux* "${ED%/}"/usr/src || die if [[ -n "${UNIPATCH_DOCS}" ]] ; then for i in ${UNIPATCH_DOCS}; do @@ -1025,19 +1022,19 @@ postinst_sources() { # if we are to forcably symlink, delete it if it already exists first. if [[ ${K_SYMLINK} -gt 0 ]]; then - [[ -h ${EROOT}usr/src/linux ]] && { rm "${EROOT}"usr/src/linux || die; } + [[ -h ${EROOT%/}/usr/src/linux ]] && { rm "${EROOT%/}"/usr/src/linux || die; } MAKELINK=1 fi # if the link doesnt exist, lets create it - [[ ! -h ${EROOT}usr/src/linux ]] && MAKELINK=1 + [[ ! -h ${EROOT%/}/usr/src/linux ]] && MAKELINK=1 if [[ ${MAKELINK} == 1 ]]; then - ln -sf linux-${KV_FULL} "${EROOT}"usr/src/linux || die + ln -sf linux-${KV_FULL} "${EROOT%/}"/usr/src/linux || die fi # Don't forget to make directory for sysfs - [[ ! -d ${EROOT}sys ]] && kernel_is 2 6 && { mkdir "${EROOT}"sys || die ; } + [[ ! -d ${EROOT%/}/sys ]] && kernel_is 2 6 && { mkdir "${EROOT%/}"/sys || die ; } echo elog "If you are upgrading from a previous kernel, you may be interested" @@ -1048,13 +1045,13 @@ postinst_sources() { # if K_EXTRAEINFO is set then lets display it now if [[ -n ${K_EXTRAEINFO} ]]; then echo ${K_EXTRAEINFO} | fmt | - while read -s ELINE; do einfo "${ELINE}"; done + while read -s ELINE; do einfo "${ELINE}"; done fi # if K_EXTRAELOG is set then lets display it now if [[ -n ${K_EXTRAELOG} ]]; then echo ${K_EXTRAELOG} | fmt | - while read -s ELINE; do elog "${ELINE}"; done + while read -s ELINE; do elog "${ELINE}"; done fi # if K_EXTRAEWARN is set then lets display it now @@ -1242,7 +1239,7 @@ unipatch() { local GCC_MINOR_VER=$(gcc-minor-version) # optimization patch for gcc < 8.X and kernel > 4.13 - if kernel_is ge 4 13 ; then + if kernel_is ge 4 13 ; then if [[ ${GCC_MAJOR_VER} -lt 8 ]] && [[ ${GCC_MAJOR_VER} -gt 4 ]]; then UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch" UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch" @@ -1323,8 +1320,8 @@ unipatch() { if [ -z "${PATCH_DEPTH}" ]; then PATCH_DEPTH=0; fi #################################################################### - # IMPORTANT: This code is to support kernels which cannot be # - # tested with the --dry-run parameter # + # IMPORTANT: This code is to support kernels which cannot be # + # tested with the --dry-run parameter # # # # These patches contain a removal of a symlink, followed by # # addition of a file with the same name as the symlink in the # @@ -1443,7 +1440,6 @@ getfilevar() { # patchsets. detect_arch() { - local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL # COMPAT_URI is the contents of ${ARCH}_URI @@ -1554,13 +1550,12 @@ kernel-2_src_unpack() { # Apply any user patches kernel-2_src_prepare() { - debug-print "Applying any user patches" # apply any user patches case ${EAPI:-0} in 0|1|2|3|4|5) epatch_user ;; - 6) eapply_user ;; + *) eapply_user ;; esac } @@ -1660,11 +1655,11 @@ kernel-2_pkg_postrm() { [[ ${ETYPE} == headers ]] && return 0 # If there isn't anything left behind, then don't complain. - [[ -e ${EROOT}usr/src/linux-${KV_FULL} ]] || return 0 + [[ -e ${EROOT%/}/usr/src/linux-${KV_FULL} ]] || return 0 echo ewarn "Note: Even though you have successfully unmerged " ewarn "your kernel package, directories in kernel source location: " - ewarn "${EROOT}usr/src/linux-${KV_FULL}" + ewarn "${EROOT%/}/usr/src/linux-${KV_FULL}" ewarn "with modified files will remain behind. By design, package managers" ewarn "will not remove these modified files and the directories they reside in." echo -- 2.26.2