diff options
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/Manifest.gz | bin | 36972 -> 37101 bytes | |||
-rw-r--r-- | eclass/acct-group.eclass | 39 | ||||
-rw-r--r-- | eclass/acct-user.eclass | 146 | ||||
-rw-r--r-- | eclass/autotools.eclass | 22 | ||||
-rw-r--r-- | eclass/db.eclass | 30 | ||||
-rw-r--r-- | eclass/dist-kernel-utils.eclass | 161 | ||||
-rw-r--r-- | eclass/kernel-build.eclass | 6 | ||||
-rw-r--r-- | eclass/kernel-install.eclass | 144 | ||||
-rw-r--r-- | eclass/lua-utils.eclass | 70 | ||||
-rw-r--r-- | eclass/mount-boot.eclass | 19 | ||||
-rw-r--r-- | eclass/nvidia-driver.eclass | 236 | ||||
-rw-r--r-- | eclass/office-ext-r1.eclass | 135 | ||||
-rw-r--r-- | eclass/optfeature.eclass | 7 | ||||
-rw-r--r-- | eclass/python-utils-r1.eclass | 62 | ||||
-rw-r--r-- | eclass/qt5-build.eclass | 3 | ||||
-rwxr-xr-x | eclass/tests/python-utils-r1.sh | 18 | ||||
-rw-r--r-- | eclass/vala.eclass | 4 | ||||
-rw-r--r-- | eclass/xorg-2.eclass | 29 | ||||
-rw-r--r-- | eclass/xorg-3.eclass | 29 |
19 files changed, 637 insertions, 523 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz Binary files differindex 4ec89dd88ad6..387980174060 100644 --- a/eclass/Manifest.gz +++ b/eclass/Manifest.gz diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass index 9c46d3a1c215..11a9f29e6253 100644 --- a/eclass/acct-group.eclass +++ b/eclass/acct-group.eclass @@ -59,7 +59,8 @@ readonly ACCT_GROUP_NAME # @REQUIRED # @DESCRIPTION: # Preferred GID for the new group. This variable is obligatory, and its -# value must be unique across all group packages. +# value must be unique across all group packages. This can be overriden +# in make.conf through ACCT_GROUP_<UPPERCASE_USERNAME>_ID variable. # # Overlays should set this to -1 to dynamically allocate GID. Using -1 # in ::gentoo is prohibited by policy. @@ -91,25 +92,33 @@ acct-group_pkg_pretend() { # verify ACCT_GROUP_ID [[ -n ${ACCT_GROUP_ID} ]] || die "Ebuild error: ACCT_GROUP_ID must be set!" - [[ ${ACCT_GROUP_ID} -eq -1 ]] && return - [[ ${ACCT_GROUP_ID} -ge 0 ]] || die "Ebuild errors: ACCT_GROUP_ID=${ACCT_GROUP_ID} invalid!" + [[ ${ACCT_GROUP_ID} -ge -1 ]] || die "Ebuild error: ACCT_GROUP_ID=${ACCT_GROUP_ID} invalid!" + local group_id=${ACCT_GROUP_ID} + + # check for the override + local override_name=${ACCT_GROUP_NAME^^} + local override_var=ACCT_GROUP_${override_name//-/_}_ID + if [[ -n ${!override_var} ]]; then + group_id=${!override_var} + [[ ${group_id} -ge -1 ]] || die "${override_var}=${group_id} invalid!" + fi # check for ACCT_GROUP_ID collisions early - if [[ -n ${ACCT_GROUP_ENFORCE_ID} ]]; then - local group_by_id=$(egetgroupname "${ACCT_GROUP_ID}") + if [[ ${group_id} -ne -1 && -n ${ACCT_GROUP_ENFORCE_ID} ]]; then + local group_by_id=$(egetgroupname "${group_id}") local group_by_name=$(egetent group "${ACCT_GROUP_NAME}") if [[ -n ${group_by_id} ]]; then if [[ ${group_by_id} != ${ACCT_GROUP_NAME} ]]; then eerror "The required GID is already taken by another group." - eerror " GID: ${ACCT_GROUP_ID}" + eerror " GID: ${group_id}" eerror " needed for: ${ACCT_GROUP_NAME}" eerror " current group: ${group_by_id}" - die "GID ${ACCT_GROUP_ID} taken already" + die "GID ${group_id} taken already" fi elif [[ -n ${group_by_name} ]]; then eerror "The requested group exists already with wrong GID." eerror " groupname: ${ACCT_GROUP_NAME}" - eerror " requested GID: ${ACCT_GROUP_ID}" + eerror " requested GID: ${group_id}" eerror " current entry: ${group_by_name}" die "Group ${ACCT_GROUP_NAME} exists with wrong GID" fi @@ -122,11 +131,21 @@ acct-group_pkg_pretend() { acct-group_src_install() { debug-print-function ${FUNCNAME} "${@}" + # check for the override + local override_name=${ACCT_GROUP_NAME^^} + local override_var=ACCT_GROUP_${override_name//-/_}_ID + if [[ -n ${!override_var} ]]; then + ewarn "${override_var}=${!override_var} override in effect, support will not be provided." + _ACCT_GROUP_ID=${!override_var} + else + _ACCT_GROUP_ID=${ACCT_GROUP_ID} + fi + insinto /usr/lib/sysusers.d newins - ${CATEGORY}-${ACCT_GROUP_NAME}.conf < <( printf "g\t%q\t%q\n" \ "${ACCT_GROUP_NAME}" \ - "${ACCT_GROUP_ID/#-*/-}" + "${_ACCT_GROUP_ID/#-*/-}" ) } @@ -137,7 +156,7 @@ acct-group_pkg_preinst() { debug-print-function ${FUNCNAME} "${@}" enewgroup ${ACCT_GROUP_ENFORCE_ID:+-F} "${ACCT_GROUP_NAME}" \ - "${ACCT_GROUP_ID}" + "${_ACCT_GROUP_ID}" } fi diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass index 47890e48409a..ee4358b5c75c 100644 --- a/eclass/acct-user.eclass +++ b/eclass/acct-user.eclass @@ -67,11 +67,17 @@ readonly ACCT_USER_NAME # @REQUIRED # @DESCRIPTION: # Preferred UID for the new user. This variable is obligatory, and its -# value must be unique across all user packages. +# value must be unique across all user packages. This can be overriden +# in make.conf through ACCT_USER_<UPPERCASE_USERNAME>_ID variable. # # Overlays should set this to -1 to dynamically allocate UID. Using -1 # in ::gentoo is prohibited by policy. +# @ECLASS-VARIABLE: _ACCT_USER_ALREADY_EXISTS +# @INTERNAL +# @DESCRIPTION: +# Status variable which indicates if user already exists. + # @ECLASS-VARIABLE: ACCT_USER_ENFORCE_ID # @DESCRIPTION: # If set to a non-null value, the eclass will require the user to have @@ -79,10 +85,18 @@ readonly ACCT_USER_NAME # the UID is taken by another user, the install will fail. : ${ACCT_USER_ENFORCE_ID:=} +# @ECLASS-VARIABLE: ACCT_USER_NO_MODIFY +# @DEFAULT_UNSET +# @DESCRIPTION: +# If set to a non-null value, the eclass will not make any changes +# to an already existing user. +: ${ACCT_USER_NO_MODIFY:=} + # @ECLASS-VARIABLE: ACCT_USER_SHELL # @DESCRIPTION: # The shell to use for the user. If not specified, a 'nologin' variant -# for the system is used. +# for the system is used. This can be overriden in make.conf through +# ACCT_USER_<UPPERCASE_USERNAME>_SHELL variable. : ${ACCT_USER_SHELL:=-1} # @ECLASS-VARIABLE: ACCT_USER_HOME @@ -90,6 +104,8 @@ readonly ACCT_USER_NAME # The home directory for the user. If not specified, /dev/null is used. # The directory will be created with appropriate permissions if it does # not exist. When updating, existing home directory will not be moved. +# This can be overriden in make.conf through +# ACCT_USER_<UPPERCASE_USERNAME>_HOME variable. : ${ACCT_USER_HOME:=/dev/null} # @ECLASS-VARIABLE: ACCT_USER_HOME_OWNER @@ -97,11 +113,14 @@ readonly ACCT_USER_NAME # @DESCRIPTION: # The ownership to use for the home directory, in chown ([user][:group]) # syntax. Defaults to the newly created user, and its primary group. +# This can be overriden in make.conf through +# ACCT_USER_<UPPERCASE_USERNAME>_HOME_OWNER variable. # @ECLASS-VARIABLE: ACCT_USER_HOME_PERMS # @DESCRIPTION: # The permissions to use for the home directory, in chmod (octal -# or verbose) form. +# or verbose) form. This can be overriden in make.conf through +# ACCT_USER_<UPPERCASE_USERNAME>_HOME_PERMS variable. : ${ACCT_USER_HOME_PERMS:=0755} # @ECLASS-VARIABLE: ACCT_USER_GROUPS @@ -110,6 +129,12 @@ readonly ACCT_USER_NAME # List of groups the user should belong to. This must be a bash # array. The first group specified is the user's primary group, while # the remaining groups (if any) become supplementary groups. +# +# This can be overriden in make.conf through +# ACCT_USER_<UPPERCASE_USERNAME>_GROUPS variable, or appended to +# via ACCT_USER_<UPPERCASE_USERNAME>_GROUPS_ADD. Please note that +# due to technical limitations, the override variables are not arrays +# but space-separated lists. # << Boilerplate ebuild variables >> @@ -152,7 +177,7 @@ acct-user_add_deps() { eislocked() { [[ $# -eq 1 ]] || die "usage: ${FUNCNAME} <user>" - if [[ ${EUID} != 0 ]] ; then + if [[ ${EUID} != 0 ]]; then einfo "Insufficient privileges to execute ${FUNCNAME[0]}" return 0 fi @@ -189,7 +214,7 @@ eislocked() { elockuser() { [[ $# -eq 1 ]] || die "usage: ${FUNCNAME} <user>" - if [[ ${EUID} != 0 ]] ; then + if [[ ${EUID} != 0 ]]; then einfo "Insufficient privileges to execute ${FUNCNAME[0]}" return 0 fi @@ -232,7 +257,7 @@ elockuser() { eunlockuser() { [[ $# -eq 1 ]] || die "usage: ${FUNCNAME} <user>" - if [[ ${EUID} != 0 ]] ; then + if [[ ${EUID} != 0 ]]; then einfo "Insufficient privileges to execute ${FUNCNAME[0]}" return 0 fi @@ -284,25 +309,33 @@ acct-user_pkg_pretend() { # verify ACCT_USER_ID [[ -n ${ACCT_USER_ID} ]] || die "Ebuild error: ACCT_USER_ID must be set!" - [[ ${ACCT_USER_ID} -eq -1 ]] && return - [[ ${ACCT_USER_ID} -ge 0 ]] || die "Ebuild errors: ACCT_USER_ID=${ACCT_USER_ID} invalid!" + [[ ${ACCT_USER_ID} -ge -1 ]] || die "Ebuild error: ACCT_USER_ID=${ACCT_USER_ID} invalid!" + local user_id=${ACCT_USER_ID} + + # check for the override + local override_name=${ACCT_USER_NAME^^} + local override_var=ACCT_USER_${override_name//-/_}_ID + if [[ -n ${!override_var} ]]; then + user_id=${!override_var} + [[ ${user_id} -ge -1 ]] || die "${override_var}=${user_id} invalid!" + fi # check for ACCT_USER_ID collisions early - if [[ -n ${ACCT_USER_ENFORCE_ID} ]]; then - local user_by_id=$(egetusername "${ACCT_USER_ID}") + if [[ ${user_id} -ne -1 && -n ${ACCT_USER_ENFORCE_ID} ]]; then + local user_by_id=$(egetusername "${user_id}") local user_by_name=$(egetent passwd "${ACCT_USER_NAME}") if [[ -n ${user_by_id} ]]; then if [[ ${user_by_id} != ${ACCT_USER_NAME} ]]; then eerror "The required UID is already taken by another user." - eerror " UID: ${ACCT_USER_ID}" + eerror " UID: ${user_id}" eerror " needed for: ${ACCT_USER_NAME}" eerror " current user: ${user_by_id}" - die "UID ${ACCT_USER_ID} taken already" + die "UID ${user_id} taken already" fi elif [[ -n ${user_by_name} ]]; then eerror "The requested user exists already with wrong UID." eerror " username: ${ACCT_USER_NAME}" - eerror " requested UID: ${ACCT_USER_ID}" + eerror " requested UID: ${user_id}" eerror " current entry: ${user_by_name}" die "Username ${ACCT_USER_NAME} exists with wrong UID" fi @@ -316,23 +349,48 @@ acct-user_pkg_pretend() { acct-user_src_install() { debug-print-function ${FUNCNAME} "${@}" - if [[ ${ACCT_USER_HOME} != /dev/null ]]; then + # serialize for override support + local ACCT_USER_GROUPS=${ACCT_USER_GROUPS[*]} + + # support make.conf overrides + local override_name=${ACCT_USER_NAME^^} + override_name=${override_name//-/_} + local var + for var in ACCT_USER_{ID,SHELL,HOME{,_OWNER,_PERMS},GROUPS}; do + local var_name=ACCT_USER_${override_name}_${var#ACCT_USER_} + if [[ -n ${!var_name} ]]; then + ewarn "${var_name}=${!var_name} override in effect, support will not be provided." + else + var_name=${var} + fi + declare -g "_${var}=${!var_name}" + done + var_name=ACCT_USER_${override_name}_GROUPS_ADD + if [[ -n ${!var_name} ]]; then + ewarn "${var_name}=${!var_name} override in effect, support will not be provided." + _ACCT_USER_GROUPS+=" ${!var_name}" + fi + + # deserialize into an array + local groups=( ${_ACCT_USER_GROUPS} ) + + if [[ ${_ACCT_USER_HOME} != /dev/null ]]; then # note: we can't set permissions here since the user isn't # created yet - keepdir "${ACCT_USER_HOME}" + keepdir "${_ACCT_USER_HOME}" fi insinto /usr/lib/sysusers.d newins - ${CATEGORY}-${ACCT_USER_NAME}.conf < <( printf "u\t%q\t%q\t%q\t%q\t%q\n" \ "${ACCT_USER_NAME}" \ - "${ACCT_USER_ID/#-*/-}:${ACCT_USER_GROUPS[0]}" \ + "${_ACCT_USER_ID/#-*/-}:${groups[0]}" \ "${DESCRIPTION//[:,=]/;}" \ - "${ACCT_USER_HOME}" \ - "${ACCT_USER_SHELL/#-*/-}" - if [[ ${#ACCT_USER_GROUPS[@]} -gt 1 ]]; then + "${_ACCT_USER_HOME}" \ + "${_ACCT_USER_SHELL/#-*/-}" + if [[ ${#groups[@]} -gt 1 ]]; then printf "m\t${ACCT_USER_NAME}\t%q\n" \ - "${ACCT_USER_GROUPS[@]:1}" + "${groups[@]:1}" fi ) } @@ -344,26 +402,33 @@ acct-user_src_install() { acct-user_pkg_preinst() { debug-print-function ${FUNCNAME} "${@}" - local groups=${ACCT_USER_GROUPS[*]} + # check if user already exists + _ACCT_USER_ALREADY_EXISTS= + if [[ -n $(egetent passwd "${ACCT_USER_NAME}") ]]; then + _ACCT_USER_ALREADY_EXISTS=1 + fi + readonly _ACCT_USER_ALREADY_EXISTS + enewuser ${ACCT_USER_ENFORCE_ID:+-F} -M "${ACCT_USER_NAME}" \ - "${ACCT_USER_ID}" "${ACCT_USER_SHELL}" "${ACCT_USER_HOME}" \ - "${groups// /,}" + "${_ACCT_USER_ID}" "${_ACCT_USER_SHELL}" "${_ACCT_USER_HOME}" \ + "${_ACCT_USER_GROUPS// /,}" - if [[ ${ACCT_USER_HOME} != /dev/null ]]; then + if [[ ${_ACCT_USER_HOME} != /dev/null ]]; then # default ownership to user:group - if [[ -z ${ACCT_USER_HOME_OWNER} ]]; then - ACCT_USER_HOME_OWNER=${ACCT_USER_NAME}:${ACCT_USER_GROUPS[0]} + if [[ -z ${_ACCT_USER_HOME_OWNER} ]]; then + local group_array=( ${_ACCT_USER_GROUPS} ) + _ACCT_USER_HOME_OWNER=${ACCT_USER_NAME}:${group_array[0]} fi # Path might be missing due to INSTALL_MASK, etc. # https://bugs.gentoo.org/691478 - if [[ ! -e "${ED}/${ACCT_USER_HOME#/}" ]]; then + if [[ ! -e "${ED}/${_ACCT_USER_HOME#/}" ]]; then eerror "Home directory is missing from the installation image:" - eerror " ${ACCT_USER_HOME}" + eerror " ${_ACCT_USER_HOME}" eerror "Check INSTALL_MASK for entries that would cause this." - die "${ACCT_USER_HOME} does not exist" + die "${_ACCT_USER_HOME} does not exist" fi - fowners "${ACCT_USER_HOME_OWNER}" "${ACCT_USER_HOME}" - fperms "${ACCT_USER_HOME_PERMS}" "${ACCT_USER_HOME}" + fowners "${_ACCT_USER_HOME_OWNER}" "${_ACCT_USER_HOME}" + fperms "${_ACCT_USER_HOME_PERMS}" "${_ACCT_USER_HOME}" fi } @@ -374,16 +439,23 @@ acct-user_pkg_preinst() { acct-user_pkg_postinst() { debug-print-function ${FUNCNAME} "${@}" - if [[ ${EUID} != 0 ]] ; then + if [[ ${EUID} != 0 ]]; then einfo "Insufficient privileges to execute ${FUNCNAME[0]}" return 0 fi + if [[ -n ${ACCT_USER_NO_MODIFY} && -n ${_ACCT_USER_ALREADY_EXISTS} ]]; then + eunlockuser "${ACCT_USER_NAME}" + + ewarn "User ${ACCT_USER_NAME} already exists; Not touching existing user" + ewarn "due to set ACCT_USER_NO_MODIFY." + return 0 + fi + # NB: eset* functions check current value - esethome "${ACCT_USER_NAME}" "${ACCT_USER_HOME}" - esetshell "${ACCT_USER_NAME}" "${ACCT_USER_SHELL}" - local groups=${ACCT_USER_GROUPS[*]} - esetgroups "${ACCT_USER_NAME}" "${groups// /,}" + esethome "${ACCT_USER_NAME}" "${_ACCT_USER_HOME}" + esetshell "${ACCT_USER_NAME}" "${_ACCT_USER_SHELL}" + esetgroups "${ACCT_USER_NAME}" "${_ACCT_USER_GROUPS// /,}" # comment field can not contain colons esetcomment "${ACCT_USER_NAME}" "${DESCRIPTION//[:,=]/;}" eunlockuser "${ACCT_USER_NAME}" @@ -395,7 +467,7 @@ acct-user_pkg_postinst() { acct-user_pkg_prerm() { debug-print-function ${FUNCNAME} "${@}" - if [[ ${EUID} != 0 ]] ; then + if [[ ${EUID} != 0 ]]; then einfo "Insufficient privileges to execute ${FUNCNAME[0]}" return 0 fi diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass index d7ce23bfdf35..08c72cd77953 100644 --- a/eclass/autotools.eclass +++ b/eclass/autotools.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: autotools.eclass @@ -54,6 +54,8 @@ inherit libtool # CONSTANT! # The latest major unstable and stable version/slot of automake available # on each arch. +# Only add unstable version if it is in a different slot than latest stable +# version. # List latest unstable version first to boost testing adoption rate because # most package manager dependency resolver will pick the first suitable # version. @@ -65,7 +67,7 @@ inherit libtool # Do NOT change this variable in your ebuilds! # If you want to force a newer minor version, you can specify the correct # WANT value by using a colon: <PV>:<WANT_AUTOMAKE> -_LATEST_AUTOMAKE=( 1.16.1:1.16 1.15.1:1.15 ) +_LATEST_AUTOMAKE=( 1.16.2-r1:1.16 ) _automake_atom="sys-devel/automake" _autoconf_atom="sys-devel/autoconf" @@ -136,6 +138,12 @@ unset _automake_atom _autoconf_atom # Additional options to pass to automake during # eautoreconf call. +# @ECLASS-VARIABLE: AT_NOEAUTOHEADER +# @DEFAULT_UNSET +# @DESCRIPTION: +# Don't run eautoheader command if set to 'yes'; only used to work around +# packages that don't want their headers being modified. + # @ECLASS-VARIABLE: AT_NOEAUTOMAKE # @DEFAULT_UNSET # @DESCRIPTION: @@ -236,7 +244,7 @@ eautoreconf() { else eautoconf --force fi - eautoheader + [[ ${AT_NOEAUTOHEADER} != "yes" ]] && eautoheader [[ ${AT_NOEAUTOMAKE} != "yes" ]] && FROM_EAUTORECONF="yes" eautomake ${AM_OPTS} if [[ ${AT_NOELIBTOOLIZE} != "yes" ]] ; then @@ -359,16 +367,16 @@ eautoconf() { # Install config.guess and config.sub which are required by many macros # in Autoconf >=2.70. - local gnuconfig + local _gnuconfig case ${EAPI:-0} in 0|1|2|3|4|5|6) - gnuconfig="${EPREFIX}/usr/share/gnuconfig" + _gnuconfig="${EPREFIX}/usr/share/gnuconfig" ;; *) - gnuconfig="${BROOT}/usr/share/gnuconfig" + _gnuconfig="${BROOT}/usr/share/gnuconfig" ;; esac - cp "${gnuconfig}"/config.{guess,sub} . || die + cp "${_gnuconfig}"/config.{guess,sub} . || die autotools_run_tool --at-m4flags autoconf "$@" } diff --git a/eclass/db.eclass b/eclass/db.eclass index 9a246d18979a..96669c6d8938 100644 --- a/eclass/db.eclass +++ b/eclass/db.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: db.eclass @@ -23,13 +23,15 @@ db_fix_so() { cd "${LIB}" || die # first clean up old symlinks - find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*so' -delete || die - find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*so.[23]' -delete || die + local soext=$(get_libname) + find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"${soext#.}" -delete || die + soext=$(get_libname "[23]") + find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"${soext#.}" -delete || die find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -delete || die # now rebuild all the correct ones local ext - for ext in so a; do + for ext in so dylib a; do for name in libdb libdb_{cxx,tcl,java,sql,stl}; do target="$(find . -maxdepth 1 -type f -name "${name}-*.${ext}" |sort -V |tail -n 1)" [[ -n "${target}" ]] && ln -sf ${target//.\//} ${name}.${ext} @@ -37,17 +39,17 @@ db_fix_so() { done; # db[23] gets some extra-special stuff - if [[ -f libdb1.so.2 ]]; then - ln -sf libdb1.so.2 libdb.so.2 - ln -sf libdb1.so.2 libdb1.so - ln -sf libdb1.so.2 libdb-1.so + if [[ -f libdb1$(get_libname 2) ]]; then + ln -sf libdb1$(get_libname 2) libdb$(get_libname 2) + ln -sf libdb1$(get_libname 2) libdb1$(get_libname) + ln -sf libdb1$(get_libname 2) libdb-1$(get_libname) fi # what do we do if we ever get 3.3 ? local i for i in libdb libdb_{cxx,tcl,java,sql,stl}; do - if [[ -f ${i}-3.2.so ]]; then - ln -sf ${i}-3.2.so ${i}-3.so - ln -sf ${i}-3.2.so ${i}.so.3 + if [[ -f $i-3.2$(get_libname) ]]; then + ln -sf $i-3.2$(get_libname) $i-3$(get_libname) + ln -sf $i-3.2$(get_libname) $i$(get_libname 3) fi done @@ -143,8 +145,10 @@ db_src_install_usrlibcleanup() { mv "${LIB}/libdb_cxx.a" "${LIB}/libdb_cxx-${SLOT}.a" || die fi - find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*so' -delete || die - find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*so.[23]' -delete || die + local soext=$(get_libname) + find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"${soext#.}" -delete || die + soext=$(get_libname "[23]") + find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"${soext#.}" -delete || die einfo "removing unversioned static archives" find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -delete || die diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass new file mode 100644 index 000000000000..9ab65b097b32 --- /dev/null +++ b/eclass/dist-kernel-utils.eclass @@ -0,0 +1,161 @@ +# Copyright 2020-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: dist-kernel-utils.eclass +# @MAINTAINER: +# Distribution Kernel Project <dist-kernel@gentoo.org> +# @AUTHOR: +# Michał Górny <mgorny@gentoo.org> +# @SUPPORTED_EAPIS: 7 +# @BLURB: Utility functions related to Distribution Kernels +# @DESCRIPTION: +# This eclass provides various utility functions related to Distribution +# Kernels. + +if [[ ! ${_DIST_KERNEL_UTILS} ]]; then + +case "${EAPI:-0}" in + 0|1|2|3|4|5|6) + die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" + ;; + 7) + ;; + *) + die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" + ;; +esac + +# @FUNCTION: dist-kernel_build_initramfs +# @USAGE: <output> <version> +# @DESCRIPTION: +# Build an initramfs for the kernel. <output> specifies the absolute +# path where initramfs will be created, while <version> specifies +# the kernel version, used to find modules. +# +# Note: while this function uses dracut at the moment, other initramfs +# variants may be supported in the future. +dist-kernel_build_initramfs() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${#} -eq 2 ]] || die "${FUNCNAME}: invalid arguments" + local output=${1} + local version=${2} + + local rel_image_path=$(dist-kernel_get_image_path) + local image=${output%/*}/${rel_image_path##*/} + + local args=( + --force + # if uefi=yes is used, dracut needs to locate the kernel image + --kernel-image "${image}" + + # positional arguments + "${output}" "${version}" + ) + + ebegin "Building initramfs via dracut" + dracut "${args[@]}" + eend ${?} || die -n "Building initramfs failed" +} + +# @FUNCTION: dist-kernel_get_image_path +# @DESCRIPTION: +# Get relative kernel image path specific to the current ${ARCH}. +dist-kernel_get_image_path() { + case ${ARCH} in + amd64|x86) + echo arch/x86/boot/bzImage + ;; + arm64) + echo arch/arm64/boot/Image.gz + ;; + arm) + echo arch/arm/boot/zImage + ;; + ppc64) + # ./ is required because of ${image_path%/*} + # substitutions in the code + echo ./vmlinux + ;; + *) + die "${FUNCNAME}: unsupported ARCH=${ARCH}" + ;; + esac +} + +# @FUNCTION: dist-kernel_install_kernel +# @USAGE: <version> <image> <system.map> +# @DESCRIPTION: +# Install kernel using installkernel tool. <version> specifies +# the kernel version, <image> full path to the image, <system.map> +# full path to System.map. +dist-kernel_install_kernel() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${#} -eq 3 ]] || die "${FUNCNAME}: invalid arguments" + local version=${1} + local image=${2} + local map=${3} + + # if dracut is used in uefi=yes mode, initrd will actually + # be a combined kernel+initramfs UEFI executable. we can easily + # recognize it by PE magic (vs cpio for a regular initramfs) + local initrd=${image%/*}/initrd + local magic + [[ -s ${initrd} ]] && read -n 2 magic < "${initrd}" + if [[ ${magic} == MZ ]]; then + einfo "Combined UEFI kernel+initramfs executable found" + # install the combined executable in place of kernel + image=${initrd}.uefi + mv "${initrd}" "${image}" || die + # put an empty file in place of initrd. installing a duplicate + # file would waste disk space, and removing it entirely provokes + # kernel-install to regenerate it via dracut. + > "${initrd}" + fi + + ebegin "Installing the kernel via installkernel" + # note: .config is taken relatively to System.map; + # initrd relatively to bzImage + installkernel "${version}" "${image}" "${map}" + eend ${?} || die -n "Installing the kernel failed" +} + +# @FUNCTION: dist-kernel_reinstall_initramfs +# @USAGE: <kv-dir> <kv-full> +# @DESCRIPTION: +# Rebuild and install initramfs for the specified dist-kernel. +# <kv-dir> is the kernel source directory (${KV_DIR} from linux-info), +# while <kv-full> is the full kernel version (${KV_FULL}). +# The function will determine whether <kernel-dir> is actually +# a dist-kernel, and whether initramfs was used. +# +# This function is to be used in pkg_postinst() of ebuilds installing +# kernel modules that are included in the initramfs. +dist-kernel_reinstall_initramfs() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${#} -eq 2 ]] || die "${FUNCNAME}: invalid arguments" + local kernel_dir=${1} + local ver=${2} + + local image_path=${kernel_dir}/$(dist-kernel_get_image_path) + local initramfs_path=${image_path%/*}/initrd + if [[ ! -f ${image_path} ]]; then + eerror "Kernel install missing, image not found:" + eerror " ${image_path}" + eerror "Initramfs will not be updated. Please reinstall your kernel." + return + fi + if [[ ! -f ${initramfs_path} ]]; then + einfo "No initramfs found at ${initramfs_path}" + return + fi + + dist-kernel_build_initramfs "${initramfs_path}" "${ver}" + dist-kernel_install_kernel "${ver}" "${image_path}" \ + "${kernel_dir}/System.map" +} + +_DIST_KERNEL_UTILS=1 +fi diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass index 99279ba58a99..249f038fa107 100644 --- a/eclass/kernel-build.eclass +++ b/eclass/kernel-build.eclass @@ -1,4 +1,4 @@ -# Copyright 2020 Gentoo Authors +# Copyright 2020-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: kernel-build.eclass @@ -117,7 +117,7 @@ kernel-build_src_test() { local ver="${PV}${KV_LOCALVERSION}" kernel-install_test "${ver}" \ - "${WORKDIR}/build/$(kernel-install_get_image_path)" \ + "${WORKDIR}/build/$(dist-kernel_get_image_path)" \ "${T}/lib/modules/${ver}" } @@ -173,7 +173,7 @@ kernel-build_src_install() { # install the kernel and files needed for module builds insinto "/usr/src/linux-${ver}" doins build/{System.map,Module.symvers} - local image_path=$(kernel-install_get_image_path) + local image_path=$(dist-kernel_get_image_path) cp -p "build/${image_path}" "${ED}/usr/src/linux-${ver}/${image_path}" || die # building modules fails with 'vmlinux has no symtab?' if stripped diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index e826626e13f2..b8109f47d0bf 100644 --- a/eclass/kernel-install.eclass +++ b/eclass/kernel-install.eclass @@ -1,4 +1,4 @@ -# Copyright 2020 Gentoo Authors +# Copyright 2020-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: kernel-install.eclass @@ -40,7 +40,7 @@ case "${EAPI:-0}" in ;; esac -inherit mount-boot toolchain-funcs +inherit dist-kernel-utils mount-boot toolchain-funcs SLOT="${PV}" IUSE="+initramfs test" @@ -70,70 +70,6 @@ BDEPEND=" x86? ( app-emulation/qemu[qemu_softmmu_targets_i386] ) )" -# @FUNCTION: kernel-install_build_initramfs -# @USAGE: <output> <version> -# @DESCRIPTION: -# Build an initramfs for the kernel. <output> specifies the absolute -# path where initramfs will be created, while <version> specifies -# the kernel version, used to find modules. -kernel-install_build_initramfs() { - debug-print-function ${FUNCNAME} "${@}" - - [[ ${#} -eq 2 ]] || die "${FUNCNAME}: invalid arguments" - local output=${1} - local version=${2} - - ebegin "Building initramfs via dracut" - dracut --force "${output}" "${version}" - eend ${?} || die "Building initramfs failed" -} - -# @FUNCTION: kernel-install_get_image_path -# @DESCRIPTION: -# Get relative kernel image path specific to the current ${ARCH}. -kernel-install_get_image_path() { - case ${ARCH} in - amd64|x86) - echo arch/x86/boot/bzImage - ;; - arm64) - echo arch/arm64/boot/Image.gz - ;; - arm) - echo arch/arm/boot/zImage - ;; - ppc64) - # ./ is required because of ${image_path%/*} - # substitutions in the code - echo ./vmlinux - ;; - *) - die "${FUNCNAME}: unsupported ARCH=${ARCH}" - ;; - esac -} - -# @FUNCTION: kernel-install_install_kernel -# @USAGE: <version> <image> <system.map> -# @DESCRIPTION: -# Install kernel using installkernel tool. <version> specifies -# the kernel version, <image> full path to the image, <system.map> -# full path to System.map. -kernel-install_install_kernel() { - debug-print-function ${FUNCNAME} "${@}" - - [[ ${#} -eq 3 ]] || die "${FUNCNAME}: invalid arguments" - local version=${1} - local image=${2} - local map=${3} - - ebegin "Installing the kernel via installkernel" - # note: .config is taken relatively to System.map; - # initrd relatively to bzImage - installkernel "${version}" "${image}" "${map}" - eend ${?} || die "Installing the kernel failed" -} - # @FUNCTION: kernel-install_update_symlink # @USAGE: <target> <version> # @DESCRIPTION: @@ -372,7 +308,7 @@ kernel-install_pkg_pretend() { elog "If you decide to install linux-firmware later, you can rebuild" elog "the initramfs via issuing a command equivalent to:" elog - elog " emerge --config ${CATEGORY}/${PN}" + elog " emerge --config ${CATEGORY}/${PN}:${SLOT}" fi fi } @@ -395,32 +331,64 @@ kernel-install_pkg_preinst() { # (no-op) } -# @FUNCTION: kernel-install_pkg_postinst +# @FUNCTION: kernel-install_install_all +# @USAGE: <ver> # @DESCRIPTION: -# Build an initramfs for the kernel, install it and update -# the /usr/src/linux symlink. -kernel-install_pkg_postinst() { +# Build an initramfs for the kernel and install the kernel. This is +# called from pkg_postinst() and pkg_config(). <ver> is the full +# kernel version. +kernel-install_install_all() { debug-print-function ${FUNCNAME} "${@}" - if [[ -z ${ROOT} ]]; then - mount-boot_pkg_preinst + [[ ${#} -eq 1 ]] || die "${FUNCNAME}: invalid arguments" + local ver=${1} - local ver="${PV}${KV_LOCALVERSION}" - local image_path=$(kernel-install_get_image_path) + local success= + # not an actual loop but allows error handling with 'break' + while :; do + nonfatal mount-boot_check_status || break + + local image_path=$(dist-kernel_get_image_path) if use initramfs; then # putting it alongside kernel image as 'initrd' makes # kernel-install happier - kernel-install_build_initramfs \ + nonfatal dist-kernel_build_initramfs \ "${EROOT}/usr/src/linux-${ver}/${image_path%/*}/initrd" \ - "${ver}" + "${ver}" || break fi - kernel-install_install_kernel "${ver}" \ + nonfatal dist-kernel_install_kernel "${ver}" \ "${EROOT}/usr/src/linux-${ver}/${image_path}" \ - "${EROOT}/usr/src/linux-${ver}/System.map" + "${EROOT}/usr/src/linux-${ver}/System.map" || break + + success=1 + break + done + + if [[ ! ${success} ]]; then + eerror + eerror "The kernel files were copied to disk successfully but the kernel" + eerror "was not deployed successfully. Once you resolve the problems," + eerror "please run the equivalent of the following command to try again:" + eerror + eerror " emerge --config ${CATEGORY}/${PN}:${SLOT}" + die "Kernel install failed, please fix the problems and run emerge --config ${CATEGORY}/${PN}:${SLOT}" fi +} + +# @FUNCTION: kernel-install_pkg_postinst +# @DESCRIPTION: +# Build an initramfs for the kernel, install it and update +# the /usr/src/linux symlink. +kernel-install_pkg_postinst() { + debug-print-function ${FUNCNAME} "${@}" + local ver="${PV}${KV_LOCALVERSION}" kernel-install_update_symlink "${EROOT}/usr/src/linux" "${ver}" + + if [[ -z ${ROOT} ]]; then + kernel-install_install_all "${ver}" + fi } # @FUNCTION: kernel-install_pkg_prerm @@ -441,7 +409,7 @@ kernel-install_pkg_postrm() { if [[ -z ${ROOT} ]] && use initramfs; then local ver="${PV}${KV_LOCALVERSION}" - local image_path=$(kernel-install_get_image_path) + local image_path=$(dist-kernel_get_image_path) ebegin "Removing initramfs" rm -f "${EROOT}/usr/src/linux-${ver}/${image_path%/*}/initrd" && find "${EROOT}/usr/src/linux-${ver}" -depth -type d -empty -delete @@ -455,21 +423,7 @@ kernel-install_pkg_postrm() { kernel-install_pkg_config() { [[ -z ${ROOT} ]] || die "ROOT!=/ not supported currently" - mount-boot_pkg_preinst - - local ver="${PV}${KV_LOCALVERSION}" - local image_path=$(kernel-install_get_image_path) - if use initramfs; then - # putting it alongside kernel image as 'initrd' makes - # kernel-install happier - kernel-install_build_initramfs \ - "${EROOT}/usr/src/linux-${ver}/${image_path%/*}/initrd" \ - "${ver}" - fi - - kernel-install_install_kernel "${ver}" \ - "${EROOT}/usr/src/linux-${ver}/${image_path}" \ - "${EROOT}/usr/src/linux-${ver}/System.map" + kernel-install_install_all "${PV}${KV_LOCALVERSION}" } _KERNEL_INSTALL_ECLASS=1 diff --git a/eclass/lua-utils.eclass b/eclass/lua-utils.eclass index 100be14cb08a..0589318ef519 100644 --- a/eclass/lua-utils.eclass +++ b/eclass/lua-utils.eclass @@ -344,6 +344,76 @@ _lua_export() { done } +# @FUNCTION: lua_enable_tests +# @USAGE: <test-runner> <test-directory> +# @DESCRIPTION: +# Set up IUSE, RESTRICT, BDEPEND and src_test() for running tests +# with the specified test runner. Also copies the current value +# of RDEPEND to test?-BDEPEND. The test-runner argument must be one of: +# +# - busted: dev-lua/busted +# +# Additionally, a second argument can be passed after <test-runner>, +# so <test-runner> will use that directory to search for tests. +# If not passed, a default directory of <test-runner> will be used. +# +# - busted: spec +# +# This function is meant as a helper for common use cases, and it only +# takes care of basic setup. You still need to list additional test +# dependencies manually. If you have uncommon use case, you should +# not use it and instead enable tests manually. +# +# This function must be called in global scope, after RDEPEND has been +# declared. Take care not to overwrite the variables set by it. +lua_enable_tests() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${#} -ge 1 ]] || die "${FUNCNAME} takes at least one argument: test-runner (test-directory)" + local test_directory + local test_pkg + case ${1} in + busted) + test_directory="${2:-spec}" + test_pkg="dev-lua/busted" + if [[ ! ${_LUA_SINGLE_R0} ]]; then + eval "lua_src_test() { + busted --lua=\"\${ELUA}\" --output=\"plainTerminal\" \"${test_directory}\" || die \"Tests fail with \${ELUA}\" + }" + src_test() { + lua_foreach_impl lua_src_test + } + else + eval "src_test() { + busted --lua=\"\${ELUA}\" --output=\"plainTerminal\" \"${test_directory}\" || die \"Tests fail with \${ELUA}\" + }" + fi + ;; + *) + die "${FUNCNAME}: unsupported argument: ${1}" + esac + + local test_deps=${RDEPEND} + if [[ -n ${test_pkg} ]]; then + if [[ ! ${_LUA_SINGLE_R0} ]]; then + test_deps+=" ${test_pkg}[${LUA_USEDEP}]" + else + test_deps+=" $(lua_gen_cond_dep " + ${test_pkg}[\${LUA_USEDEP}] + ")" + fi + fi + if [[ -n ${test_deps} ]]; then + IUSE+=" test" + RESTRICT+=" !test? ( test )" + BDEPEND+=" test? ( ${test_deps} )" + fi + + # we need to ensure successful return in case we're called last, + # otherwise Portage may wrongly assume sourcing failed + return 0 +} + # @FUNCTION: lua_get_CFLAGS # @USAGE: [<impl>] # @DESCRIPTION: diff --git a/eclass/mount-boot.eclass b/eclass/mount-boot.eclass index 00b367793252..2b07160231a6 100644 --- a/eclass/mount-boot.eclass +++ b/eclass/mount-boot.eclass @@ -1,9 +1,10 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: mount-boot.eclass # @MAINTAINER: # base-system@gentoo.org +# @SUPPORTED_EAPIS: 6 7 # @BLURB: functions for packages that install files into /boot # @DESCRIPTION: # This eclass is really only useful for bootloaders. @@ -13,7 +14,7 @@ # error if it can't. It does nothing if /boot isn't a separate partition. case ${EAPI:-0} in - 4|5|6|7) ;; + 6|7) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac @@ -48,10 +49,11 @@ mount-boot_is_disabled() { # @INTERNAL # @DESCRIPTION: # Check if /boot is sane, i.e., mounted as read-write if on a separate -# partition. Die if conditions are not fulfilled. +# partition. Die if conditions are not fulfilled. If nonfatal is used, +# the function will return a non-zero status instead. mount-boot_check_status() { # Get out fast if possible. - mount-boot_is_disabled && return + mount-boot_is_disabled && return 0 # note that /dev/BOOT is in the Gentoo default /etc/fstab file local fstabstate=$(awk '!/^[[:blank:]]*#|^\/dev\/BOOT/ && $2 == "/boot" \ @@ -59,7 +61,7 @@ mount-boot_check_status() { if [[ -z ${fstabstate} ]] ; then einfo "Assuming you do not have a separate /boot partition." - return + return 0 fi local procstate=$(awk '$2 == "/boot" { split($4, a, ","); \ @@ -69,18 +71,21 @@ mount-boot_check_status() { if [[ -z ${procstate} ]] ; then eerror "Your boot partition is not mounted at /boot." eerror "Please mount it and retry." - die "/boot not mounted" + die -n "/boot not mounted" + return 1 fi if [[ ${procstate} == ro ]] ; then eerror "Your boot partition, detected as being mounted at /boot," \ "is read-only." eerror "Please remount it as read-write and retry." - die "/boot mounted read-only" + die -n "/boot mounted read-only" + return 2 fi einfo "Your boot partition was detected as being mounted at /boot." einfo "Files will be installed there for ${PN} to function correctly." + return 0 } mount-boot_pkg_pretend() { diff --git a/eclass/nvidia-driver.eclass b/eclass/nvidia-driver.eclass index a2206c5e7894..65fa9092ca27 100644 --- a/eclass/nvidia-driver.eclass +++ b/eclass/nvidia-driver.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: nvidia-driver.eclass @@ -6,16 +6,40 @@ # David Seifert <soap@gentoo.org> # @AUTHOR: # Original author: Doug Goldstein <cardoe@gentoo.org> +# @SUPPORTED_EAPIS: 7 # @BLURB: Provide useful messages for nvidia-drivers # @DESCRIPTION: # Provide useful messages for nvidia-drivers based on currently installed # Nvidia GPU and Linux kernel. +# @ECLASS-VARIABLE: NV_KV_MAX_PLUS +# @REQUIRED +# @DESCRIPTION: +# Two component version specifier for the strict upper bound on the +# usable kernel version. +# +# Example: +# @CODE +# NV_KV_MAX_PLUS="5.11" +# @CODE +# +# means that only kernels (strictly) below 5.11 are supported by the driver +# in question. + +case ${EAPI:-0} in + [0-6]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;; + 7) ;; + *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;; +esac + +if [[ ! ${_NVIDIA_DRIVER_ECLASS} ]]; then +_NVIDIA_DRIVER_ECLASS=1 + inherit readme.gentoo-r1 DESCRIPTION="NVIDIA Accelerated Graphics Driver" HOMEPAGE="https://www.nvidia.com/Download/Find.aspx" -DEPEND="sys-apps/pciutils" +BDEPEND="sys-apps/pciutils" RESTRICT="bindist mirror test" # Variables for readme.gentoo.eclass: @@ -28,95 +52,22 @@ This ebuild installs a kernel module and X driver. Both must match explicitly in their version. This means, if you restart X, you must modprobe -r nvidia before starting it back up -To use the NVIDIA GLX, run \"eselect opengl set nvidia\" - To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\" NVIDIA has requested that any bug reports submitted have the output of nvidia-bug-report.sh included. " -# the data below is derived from -# http://us.download.nvidia.com/XFree86/Linux-x86_64/396.18/README/supportedchips.html - -drv_71xx=" - 0020 0028 0029 002c 002d 00a0 0100 0101 0103 0150 0151 0152 0153 -" - -drv_96xx=" - 0110 0111 0112 0113 0170 0171 0172 0173 0174 0175 0176 0177 0178 0179 017a - 017c 017d 0181 0182 0183 0185 0188 018a 018b 018c 01a0 01f0 0200 0201 0202 - 0203 0250 0251 0253 0258 0259 025b 0280 0281 0282 0286 0288 0289 028c -" - -drv_173x=" - 00fa 00fb 00fc 00fd 00fe 0301 0302 0308 0309 0311 0312 0314 031a 031b 031c - 0320 0321 0322 0323 0324 0325 0326 0327 0328 032a 032b 032c 032d 0330 0331 - 0332 0333 0334 0338 033f 0341 0342 0343 0344 0347 0348 034c 034e -" - -drv_304x=" - 0040 0041 0042 0043 0044 0045 0046 0047 0048 004e 0090 0091 0092 0093 0095 - 0098 0099 009d 00c0 00c1 00c2 00c3 00c8 00c9 00cc 00cd 00ce 00f1 00f2 00f3 - 00f4 00f5 00f6 00f8 00f9 0140 0141 0142 0143 0144 0145 0146 0147 0148 0149 - 014a 014c 014d 014e 014f 0160 0161 0162 0163 0164 0165 0166 0167 0168 0169 - 016a 01d0 01d1 01d2 01d3 01d6 01d7 01d8 01da 01db 01dc 01dd 01de 01df 0211 - 0212 0215 0218 0221 0222 0240 0241 0242 0244 0245 0247 0290 0291 0292 0293 - 0294 0295 0297 0298 0299 029a 029b 029c 029d 029e 029f 02e0 02e1 02e2 02e3 - 02e4 038b 0390 0391 0392 0393 0394 0395 0397 0398 0399 039c 039e 03d0 03d1 - 03d2 03d5 03d6 0531 0533 053a 053b 053e 07e0 07e1 07e2 07e3 07e5 -" - -drv_340x=" - 0191 0193 0194 0197 019d 019e 0400 0401 0402 0403 0404 0405 0406 0407 0408 - 0409 040a 040b 040c 040d 040e 040f 0410 0420 0421 0422 0423 0424 0425 0426 - 0427 0428 0429 042a 042b 042c 042d 042e 042f 05e0 05e1 05e2 05e3 05e6 05e7 - 05e7 05e7 05e7 05e7 05e7 05ea 05eb 05ed 05f8 05f9 05fd 05fe 05ff 0600 0601 - 0602 0603 0604 0605 0606 0607 0608 0609 0609 060a 060b 060c 060d 060f 0610 - 0611 0612 0613 0614 0615 0617 0618 0619 061a 061b 061c 061d 061e 061f 0621 - 0622 0623 0625 0626 0627 0628 062a 062b 062c 062d 062e 062e 0630 0631 0632 - 0635 0637 0638 063a 0640 0641 0643 0644 0645 0646 0647 0648 0649 0649 064a - 064b 064c 0651 0652 0652 0653 0654 0654 0654 0655 0656 0658 0659 065a 065b - 065c 06e0 06e1 06e2 06e3 06e4 06e5 06e6 06e7 06e8 06e8 06e9 06ea 06eb 06ec - 06ef 06f1 06f8 06f9 06f9 06fa 06fb 06fd 06ff 06ff 0840 0844 0845 0846 0847 - 0848 0849 084a 084b 084c 084d 084f 0860 0861 0862 0863 0864 0865 0866 0866 - 0867 0868 0869 086a 086c 086d 086e 086f 0870 0871 0872 0872 0873 0873 0874 - 0876 087a 087d 087e 087f 08a0 08a2 08a3 08a4 08a5 0a20 0a22 0a23 0a26 0a27 - 0a28 0a29 0a2a 0a2b 0a2c 0a2d 0a32 0a34 0a35 0a38 0a3c 0a60 0a62 0a63 0a64 - 0a65 0a66 0a67 0a68 0a69 0a6a 0a6c 0a6e 0a6e 0a6f 0a70 0a70 0a70 0a71 0a72 - 0a73 0a73 0a73 0a74 0a74 0a75 0a75 0a76 0a78 0a7a 0a7a 0a7a 0a7a 0a7a 0a7a - 0a7a 0a7a 0a7a 0a7a 0a7a 0a7c 0ca0 0ca2 0ca3 0ca4 0ca5 0ca7 0ca8 0ca9 0cac - 0caf 0cb0 0cb1 0cbc 10c0 10c3 10c5 10d8 -" - -drv_390x=" - 06c0 06c4 06ca 06cd 06d1 06d2 06d8 06d9 06da 06dc 06dd 06de 06df 0dc0 0dc4 - 0dc5 0dc6 0dcd 0dce 0dd1 0dd2 0dd3 0dd6 0dd8 0dda 0de0 0de1 0de2 0de3 0de4 - 0de5 0de7 0de8 0de9 0dea 0deb 0dec 0ded 0dee 0def 0df0 0df1 0df2 0df3 0df4 - 0df5 0df6 0df7 0df8 0df9 0dfa 0dfc 0e22 0e23 0e24 0e30 0e31 0e3a 0e3b 0f00 - 0f01 0f02 0f03 1040 1042 1048 1049 104a 104b 104c 1050 1051 1052 1054 1055 - 1056 1057 1058 1059 105a 105b 107c 107d 1080 1081 1082 1084 1086 1087 1088 - 1089 108b 1091 1094 1096 109a 109b 1140 1200 1201 1203 1205 1206 1207 1208 - 1210 1211 1212 1213 1241 1243 1244 1245 1246 1247 1248 1249 124b 124d 1251 -" - -mask_71xx=">=x11-drivers/nvidia-drivers-72.0.0" -mask_96xx=">=x11-drivers/nvidia-drivers-97.0.0" -mask_173x=">=x11-drivers/nvidia-drivers-177.0.0" -mask_304x=">=x11-drivers/nvidia-drivers-305.0.0" -mask_340x=">=x11-drivers/nvidia-drivers-341.0.0" -mask_390x=">=x11-drivers/nvidia-drivers-391.0.0" - # @FUNCTION: nvidia-driver_get_gpu # @DESCRIPTION: # Retrieve the PCI device ID for each Nvidia GPU you have nvidia-driver_get_gpu() { local NVIDIA_CARD=$( - [ -x /usr/sbin/lspci ] && /usr/sbin/lspci -d 10de: -n \ + [[ -x ${BROOT}/usr/sbin/lspci ]] && "${BROOT}"/usr/sbin/lspci -d 10de: -n \ | awk -F'[: ]' '/ 03[0-9][0-9]: /{print $6}' ) - if [ -n "${NVIDIA_CARD}" ]; then + if [[ -n ${NVIDIA_CARD} ]]; then echo "${NVIDIA_CARD}" else echo 0000 @@ -128,50 +79,83 @@ nvidia-driver_get_mask() { local nvidia_gpu drv for nvidia_gpu in ${nvidia_gpus}; do - for drv in ${drv_71xx}; do - if [ "x${nvidia_gpu}" = "x${drv}" ]; then - echo "${mask_71xx}" + # the data below is derived from + # https://us.download.nvidia.com/XFree86/Linux-x86_64/396.18/README/supportedchips.html + + if has ${nvidia_gpu} \ + 0020 0028 0029 002c 002d 00a0 0100 0101 0103 0150 0151 0152 0153; then + echo ">=x11-drivers/nvidia-drivers-72.0.0" return 0 - fi - done + fi - for drv in ${drv_96xx}; do - if [ "x${nvidia_gpu}" = "x${drv}" ]; then - echo "${mask_96xx}" + if has ${nvidia_gpu} \ + 0110 0111 0112 0113 0170 0171 0172 0173 0174 0175 0176 0177 0178 0179 017a \ + 017c 017d 0181 0182 0183 0185 0188 018a 018b 018c 01a0 01f0 0200 0201 0202 \ + 0203 0250 0251 0253 0258 0259 025b 0280 0281 0282 0286 0288 0289 028c; then + echo ">=x11-drivers/nvidia-drivers-97.0.0" return 0 - fi - done + fi - for drv in ${drv_173x}; do - if [ "x${nvidia_gpu}" = "x${drv}" ]; then - echo "${mask_173x}" + if has ${nvidia_gpu} \ + 00fa 00fb 00fc 00fd 00fe 0301 0302 0308 0309 0311 0312 0314 031a 031b 031c \ + 0320 0321 0322 0323 0324 0325 0326 0327 0328 032a 032b 032c 032d 0330 0331 \ + 0332 0333 0334 0338 033f 0341 0342 0343 0344 0347 0348 034c 034e; then + echo ">=x11-drivers/nvidia-drivers-177.0.0" return 0 - fi - done + fi - for drv in ${drv_304x}; do - if [ "x${nvidia_gpu}" = "x${drv}" ]; then - echo "${mask_304x}" + if has ${nvidia_gpu} \ + 0040 0041 0042 0043 0044 0045 0046 0047 0048 004e 0090 0091 0092 0093 0095 \ + 0098 0099 009d 00c0 00c1 00c2 00c3 00c8 00c9 00cc 00cd 00ce 00f1 00f2 00f3 \ + 00f4 00f5 00f6 00f8 00f9 0140 0141 0142 0143 0144 0145 0146 0147 0148 0149 \ + 014a 014c 014d 014e 014f 0160 0161 0162 0163 0164 0165 0166 0167 0168 0169 \ + 016a 01d0 01d1 01d2 01d3 01d6 01d7 01d8 01da 01db 01dc 01dd 01de 01df 0211 \ + 0212 0215 0218 0221 0222 0240 0241 0242 0244 0245 0247 0290 0291 0292 0293 \ + 0294 0295 0297 0298 0299 029a 029b 029c 029d 029e 029f 02e0 02e1 02e2 02e3 \ + 02e4 038b 0390 0391 0392 0393 0394 0395 0397 0398 0399 039c 039e 03d0 03d1 \ + 03d2 03d5 03d6 0531 0533 053a 053b 053e 07e0 07e1 07e2 07e3 07e5; then + echo ">=x11-drivers/nvidia-drivers-305.0.0" return 0 - fi - done + fi - for drv in ${drv_340x}; do - if [ "x${nvidia_gpu}" = "x${drv}" ]; then - echo "${mask_340x}" + if has ${nvidia_gpu} \ + 0191 0193 0194 0197 019d 019e 0400 0401 0402 0403 0404 0405 0406 0407 0408 \ + 0409 040a 040b 040c 040d 040e 040f 0410 0420 0421 0422 0423 0424 0425 0426 \ + 0427 0428 0429 042a 042b 042c 042d 042e 042f 05e0 05e1 05e2 05e3 05e6 05e7 \ + 05e7 05e7 05e7 05e7 05e7 05ea 05eb 05ed 05f8 05f9 05fd 05fe 05ff 0600 0601 \ + 0602 0603 0604 0605 0606 0607 0608 0609 0609 060a 060b 060c 060d 060f 0610 \ + 0611 0612 0613 0614 0615 0617 0618 0619 061a 061b 061c 061d 061e 061f 0621 \ + 0622 0623 0625 0626 0627 0628 062a 062b 062c 062d 062e 062e 0630 0631 0632 \ + 0635 0637 0638 063a 0640 0641 0643 0644 0645 0646 0647 0648 0649 0649 064a \ + 064b 064c 0651 0652 0652 0653 0654 0654 0654 0655 0656 0658 0659 065a 065b \ + 065c 06e0 06e1 06e2 06e3 06e4 06e5 06e6 06e7 06e8 06e8 06e9 06ea 06eb 06ec \ + 06ef 06f1 06f8 06f9 06f9 06fa 06fb 06fd 06ff 06ff 0840 0844 0845 0846 0847 \ + 0848 0849 084a 084b 084c 084d 084f 0860 0861 0862 0863 0864 0865 0866 0866 \ + 0867 0868 0869 086a 086c 086d 086e 086f 0870 0871 0872 0872 0873 0873 0874 \ + 0876 087a 087d 087e 087f 08a0 08a2 08a3 08a4 08a5 0a20 0a22 0a23 0a26 0a27 \ + 0a28 0a29 0a2a 0a2b 0a2c 0a2d 0a32 0a34 0a35 0a38 0a3c 0a60 0a62 0a63 0a64 \ + 0a65 0a66 0a67 0a68 0a69 0a6a 0a6c 0a6e 0a6e 0a6f 0a70 0a70 0a70 0a71 0a72 \ + 0a73 0a73 0a73 0a74 0a74 0a75 0a75 0a76 0a78 0a7a 0a7a 0a7a 0a7a 0a7a 0a7a \ + 0a7a 0a7a 0a7a 0a7a 0a7a 0a7c 0ca0 0ca2 0ca3 0ca4 0ca5 0ca7 0ca8 0ca9 0cac \ + 0caf 0cb0 0cb1 0cbc 10c0 10c3 10c5 10d8; then + echo ">=x11-drivers/nvidia-drivers-341.0.0" return 0 - fi - done + fi - for drv in ${drv_390x}; do - if [ "x${nvidia_gpu}" = "x${drv}" ]; then - echo "${mask_390x}" + if has ${nvidia_gpu} \ + 06c0 06c4 06ca 06cd 06d1 06d2 06d8 06d9 06da 06dc 06dd 06de 06df 0dc0 0dc4 \ + 0dc5 0dc6 0dcd 0dce 0dd1 0dd2 0dd3 0dd6 0dd8 0dda 0de0 0de1 0de2 0de3 0de4 \ + 0de5 0de7 0de8 0de9 0dea 0deb 0dec 0ded 0dee 0def 0df0 0df1 0df2 0df3 0df4 \ + 0df5 0df6 0df7 0df8 0df9 0dfa 0dfc 0e22 0e23 0e24 0e30 0e31 0e3a 0e3b 0f00 \ + 0f01 0f02 0f03 1040 1042 1048 1049 104a 104b 104c 1050 1051 1052 1054 1055 \ + 1056 1057 1058 1059 105a 105b 107c 107d 1080 1081 1082 1084 1086 1087 1088 \ + 1089 108b 1091 1094 1096 109a 109b 1140 1200 1201 1203 1205 1206 1207 1208 \ + 1210 1211 1212 1213 1241 1243 1244 1245 1246 1247 1248 1249 124b 124d 1251; then + echo ">=x11-drivers/nvidia-drivers-391.0.0" return 0 - fi - done + fi done - echo '' return 1 } @@ -179,9 +163,9 @@ nvidia-driver_get_mask() { # @DESCRIPTION: # Prints out a warning if the driver does not work with the installed GPU nvidia-driver_check_gpu() { - local nvidia_mask="$(nvidia-driver_get_mask)" + local nvidia_mask=$(nvidia-driver_get_mask) - if [ -n "${nvidia_mask}" ]; then + if [[ -n ${nvidia_mask} ]]; then if ver_test "${nvidia_mask##*-}" -lt "${PV}" ; then ewarn "***** WARNING *****" ewarn @@ -191,46 +175,40 @@ nvidia-driver_check_gpu() { ewarn "perform the following steps:" ewarn ewarn "Add the following mask entry to the local package.mask file:" - if [ -d "${ROOT}/etc/portage/package.mask" ]; then - ewarn "echo \"${nvidia_mask}\" > /etc/portage/package.mask/nvidia-drivers" + if [[ -d ${EROOT}/etc/portage/package.mask ]]; then + ewarn "echo \"${nvidia_mask}\" > ${EROOT}/etc/portage/package.mask/nvidia-drivers" else - ewarn "echo \"${nvidia_mask}\" >> /etc/portage/package.mask" + ewarn "echo \"${nvidia_mask}\" >> ${EROOT}/etc/portage/package.mask" fi ewarn ewarn "Failure to perform the steps above could result in a non-working" ewarn "X setup." ewarn ewarn "For more information please read:" - ewarn "http://www.nvidia.com/object/IO_32667.html" + ewarn "https://www.nvidia.com/object/IO_32667.html" fi fi } nvidia-driver_check_kernel() { - if kernel_is ge $(ver_cut 1 ${NV_KV_MAX_PLUS}) $(ver_cut 2 ${NV_KV_MAX_PLUS}); then + if kernel_is ge ${NV_KV_MAX_PLUS/./ }; then ewarn "Gentoo supports kernels which are supported by NVIDIA" ewarn "which are limited to the following kernels:" ewarn "<sys-kernel/gentoo-sources-${NV_KV_MAX_PLUS}" - ewarn "<sys-kernel/vanilla-sources-${NV_KV_MAX_PLUS}" - ewarn "" - ewarn "You are free to utilize eapply_user to provide whatever" - ewarn "support you feel is appropriate, but will not receive" - ewarn "support as a result of those changes." - ewarn "" + ewarn "<sys-kernel/gentoo-kernel-${NV_KV_MAX_PLUS}" + ewarn + ewarn "You are free to apply custom patches via /etc/portage/patches" + ewarn "to provide whatever support you feel is appropriate, but will" + ewarn "not receive support as a result of those changes." + ewarn ewarn "Do not file a bug report about this." - ewarn "" + ewarn fi check_extra_config } nvidia-driver_check() { - if use amd64 && has_multilib_profile && \ - [ "${DEFAULT_ABI}" != "amd64" ]; then - eerror "This ebuild doesn't currently support changing your default ABI" - die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}" - fi - # Since Nvidia ships many different series of drivers, we need to give the user # some kind of guidance as to what version they should install. This tries # to point the user in the right direction but can't be perfect. check @@ -239,3 +217,5 @@ nvidia-driver_check() { use driver && use kernel_linux && nvidia-driver_check_kernel } + +fi diff --git a/eclass/office-ext-r1.eclass b/eclass/office-ext-r1.eclass index 298f958a13aa..a1649ac8d6aa 100644 --- a/eclass/office-ext-r1.eclass +++ b/eclass/office-ext-r1.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: office-ext-r1.eclass @@ -6,21 +6,18 @@ # The office team <office@gentoo.org> # @AUTHOR: # Tomáš Chvátal <scarabeus@gentoo.org> -# @SUPPORTED_EAPIS: 5 6 7 -# @BLURB: Eclass for installing libreoffice/openoffice extensions +# @SUPPORTED_EAPIS: 5 7 +# @BLURB: Eclass for installing libreoffice extensions # @DESCRIPTION: -# Eclass for easing maintenance of libreoffice/openoffice extensions. +# Eclass for easing maintenance of libreoffice extensions. case "${EAPI:-0}" in - 5|6) inherit multilib ;; - 7) ;; + 5) inherit eutils multilib ;; + 7) inherit eutils ;; *) die "EAPI=${EAPI} is not supported" ;; esac -# eutils.eclass: emktemp -inherit eutils - -OEXT_EXPORTED_FUNCTIONS="src_unpack src_install pkg_postinst pkg_prerm" +EXPORT_FUNCTIONS src_unpack src_install # @ECLASS-VARIABLE: OFFICE_REQ_USE # @DESCRIPTION: @@ -43,9 +40,9 @@ fi # # Example: # @CODE -# OFFICE_IMPLEMENTATIONS=( "libreoffice" "openoffice" ) +# OFFICE_IMPLEMENTATIONS=( "libreoffice" ) # @CODE -[[ -z ${OFFICE_IMPLEMENTATIONS} ]] && OFFICE_IMPLEMENTATIONS=( "libreoffice" "openoffice" ) +[[ -z ${OFFICE_IMPLEMENTATIONS} ]] && OFFICE_IMPLEMENTATIONS=( "libreoffice" ) # @ECLASS-VARIABLE: OFFICE_EXTENSIONS # @REQUIRED @@ -76,14 +73,7 @@ RDEPEND="" for i in ${OFFICE_IMPLEMENTATIONS[@]}; do IUSE+=" office_implementation_${i}" - if [[ ${i} == "openoffice" ]]; then - # special only binary - RDEPEND+=" - office_implementation_openoffice? ( - app-office/openoffice-bin${OFFICE_REQ_USE} - ) - " - else + if [[ ${i} == "libreoffice" ]]; then RDEPEND+=" office_implementation_${i}? ( || ( @@ -123,12 +113,12 @@ office-ext-r1_src_unpack() { if [[ -f "${OFFICE_EXTENSIONS_LOCATION}/${i}" ]] ; then case ${i} in *.oxt) - mkdir -p "${WORKDIR}/${i}/" - pushd "${WORKDIR}/${i}/" > /dev/null - echo ">>> Unpacking "${OFFICE_EXTENSIONS_LOCATION}/${i}" to ${PWD}" + mkdir -p "${WORKDIR}/${i}/" || die + pushd "${WORKDIR}/${i}/" > /dev/null || die + einfo "Unpacking "${OFFICE_EXTENSIONS_LOCATION}/${i}" to ${PWD}" unzip -qo ${OFFICE_EXTENSIONS_LOCATION}/${i} assert "failed unpacking ${OFFICE_EXTENSIONS_LOCATION}/${i}" - popd > /dev/null + popd > /dev/null || die ;; *) unpack ${i} ;; esac @@ -147,97 +137,12 @@ office-ext-r1_src_install() { for i in ${OFFICE_IMPLEMENTATIONS[@]}; do if use office_implementation_${i}; then - if [[ ${i} == openoffice ]]; then - # OOO needs to use uno because direct deployment segfaults. - # This is bug by their side, but i don't want to waste time - # fixing it myself. - insinto /usr/$(get_libdir)/${i}/share/extension/install - for j in ${OFFICE_EXTENSIONS[@]}; do - doins ${OFFICE_EXTENSIONS_LOCATION}/${j} - done - else - for j in ${OFFICE_EXTENSIONS[@]}; do - pushd "${WORKDIR}/${j}/" > /dev/null - insinto /usr/$(get_libdir)/${i}/share/extensions/${j/.oxt/} - doins -r * - popd > /dev/null - done - fi + for j in ${OFFICE_EXTENSIONS[@]}; do + pushd "${WORKDIR}/${j}/" > /dev/null || die + insinto /usr/$(get_libdir)/${i}/share/extensions/${j/.oxt/} + doins -r * + popd > /dev/null || die + done fi done } - -#### OPENOFFICE COMPAT CODE - -UNOPKG_BINARY="/usr/lib64/openoffice/program/unopkg" - -# @FUNCTION: office-ext-r1_add_extension -# @DESCRIPTION: -# Install the extension into the libreoffice/openoffice. -office-ext-r1_add_extension() { - debug-print-function ${FUNCNAME} "$@" - local ext=$1 - local tmpdir=$(emktemp -d) - - debug-print "${FUNCNAME}: ${UNOPKG_BINARY} add --shared \"${ext}\"" - ebegin "Adding office extension: \"${ext}\"" - ${UNOPKG_BINARY} add --suppress-license \ - --shared "${ext}" \ - "-env:UserInstallation=file:///${tmpdir}" \ - "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1" - eend $? - ${UNOPKG_BINARY} list --shared > /dev/null - rm -r "${tmpdir}" || dir "failed to clean up" -} - -# @FUNCTION: office-ext-r1_remove_extension -# @DESCRIPTION: -# Remove the extension from the libreoffice/openoffice. -office-ext-r1_remove_extension() { - debug-print-function ${FUNCNAME} "$@" - local ext=$1 - local tmpdir=$(mktemp -d --tmpdir="${T}") - - debug-print "${FUNCNAME}: ${UNOPKG_BINARY} remove --shared \"${ext}\"" - ebegin "Removing office extension: \"${ext}\"" - ${UNOPKG_BINARY} remove --suppress-license \ - --shared "${ext}" \ - "-env:UserInstallation=file:///${tmpdir}" \ - "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1" - eend $? - ${UNOPKG_BINARY} list --shared > /dev/null - rm -r "${tmpdir}" || dir "failed to clean up" -} - -# @FUNCTION: office-ext-r1_pkg_postinst -# @DESCRIPTION: -# Add the extensions to the openoffice. -office-ext-r1_pkg_postinst() { - if in_iuse office_implementation_openoffice && use office_implementation_openoffice; then - debug-print-function ${FUNCNAME} "$@" - debug-print "Extensions: ${OFFICE_EXTENSIONS[@]}" - local i - - for i in ${OFFICE_EXTENSIONS[@]}; do - office-ext-r1_add_extension "/usr/lib64/openoffice/share/extension/install/${i}" - done - fi -} - -# @FUNCTION: office-ext-r1_pkg_prerm -# @DESCRIPTION: -# Remove the extensions from the openoffice. -office-ext-r1_pkg_prerm() { - if in_iuse office_implementation_openoffice && use office_implementation_openoffice; then - debug-print-function ${FUNCNAME} "$@" - debug-print "Extensions: ${OFFICE_EXTENSIONS[@]}" - local i - - for i in ${OFFICE_EXTENSIONS[@]}; do - office-ext-r1_remove_extension "${i}" - done - fi -} - -EXPORT_FUNCTIONS ${OEXT_EXPORTED_FUNCTIONS} -unset OEXT_EXPORTED_FUNCTIONS diff --git a/eclass/optfeature.eclass b/eclass/optfeature.eclass index 1943ae37bf5e..e13fc3eba811 100644 --- a/eclass/optfeature.eclass +++ b/eclass/optfeature.eclass @@ -32,11 +32,13 @@ optfeature() { debug-print-function ${FUNCNAME} "$@" local i j msg + local -a arr local desc=$1 local flag=0 shift for i; do - for j in ${i}; do + read -r -d '' -a arr <<<"${i}" + for j in "${arr[@]}"; do if has_version "${j}"; then flag=1 else @@ -50,8 +52,9 @@ optfeature() { done if [[ ${flag} -eq 0 ]]; then for i; do + read -r -d '' -a arr <<<"${i}" msg=" " - for j in ${i}; do + for j in "${arr[@]}"; do msg+=" ${j} and" done msg="${msg:0: -4} for ${desc}" diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 9c8b6a14d2ac..6d482aa106c0 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.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: python-utils-r1.eclass @@ -41,7 +41,7 @@ inherit toolchain-funcs _PYTHON_ALL_IMPLS=( pypy3 python2_7 - python3_6 python3_7 python3_8 python3_9 + python3_7 python3_8 python3_9 ) readonly _PYTHON_ALL_IMPLS @@ -53,7 +53,7 @@ _PYTHON_HISTORICAL_IMPLS=( jython2_7 pypy pypy1_{8,9} pypy2_0 python2_{5,6} - python3_{1,2,3,4,5} + python3_{1..6} ) readonly _PYTHON_HISTORICAL_IMPLS @@ -69,38 +69,6 @@ readonly _PYTHON_HISTORICAL_IMPLS # which can involve revisions of this eclass that support a different # set of Python implementations. -# @FUNCTION: _python_impl_supported -# @USAGE: <impl> -# @INTERNAL -# @DESCRIPTION: -# Check whether the implementation <impl> (PYTHON_COMPAT-form) -# is still supported. -# -# Returns 0 if the implementation is valid and supported. If it is -# unsupported, returns 1 -- and the caller should ignore the entry. -# If it is invalid, dies with an appopriate error messages. -_python_impl_supported() { - debug-print-function ${FUNCNAME} "${@}" - - [[ ${#} -eq 1 ]] || die "${FUNCNAME}: takes exactly 1 argument (impl)." - - local impl=${1} - - # keep in sync with _PYTHON_ALL_IMPLS! - # (not using that list because inline patterns shall be faster) - case "${impl}" in - python2_7|python3_[6789]|pypy3) - return 0 - ;; - jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[56]|python3_[12345]) - return 1 - ;; - *) - [[ ${PYTHON_COMPAT_NO_STRICT} ]] && return 1 - die "Invalid implementation in PYTHON_COMPAT: ${impl}" - esac -} - # @FUNCTION: _python_verify_patterns # @USAGE: <pattern>... # @INTERNAL @@ -149,10 +117,26 @@ _python_set_impls() { if [[ $(declare -p PYTHON_COMPAT) != "declare -a"* ]]; then die 'PYTHON_COMPAT must be an array.' fi - for i in "${PYTHON_COMPAT[@]}"; do - # trigger validity checks - _python_impl_supported "${i}" - done + if [[ ! ${PYTHON_COMPAT_NO_STRICT} ]]; then + for i in "${PYTHON_COMPAT[@]}"; do + # check for incorrect implementations + # we're using pattern matching as an optimization + # please keep them in sync with _PYTHON_ALL_IMPLS + # and _PYTHON_HISTORICAL_IMPLS + case ${i} in + jython2_7|pypy|pypy1_[89]|pypy2_0|pypy3|python2_[5-7]|python3_[1-9]) + ;; + *) + if has "${i}" "${_PYTHON_ALL_IMPLS[@]}" \ + "${_PYTHON_HISTORICAL_IMPLS[@]}" + then + die "Mis-synced patterns in _python_set_impls: missing ${i}" + else + die "Invalid implementation in PYTHON_COMPAT: ${i}" + fi + esac + done + fi local supp=() unsupp=() diff --git a/eclass/qt5-build.eclass b/eclass/qt5-build.eclass index dce88d642cc0..99fe5db77053 100644 --- a/eclass/qt5-build.eclass +++ b/eclass/qt5-build.eclass @@ -112,9 +112,6 @@ BDEPEND=" if [[ ${PN} != qttest ]]; then DEPEND+=" test? ( ~dev-qt/qttest-${PV} )" fi -if ver_test ${PV} -lt 5.15.2; then - RDEPEND+=" dev-qt/qtchooser" -fi ###### Phase functions ###### diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 86b87ec173d4..eb8223ec6ac0 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -183,24 +183,6 @@ test_fix_shebang '#!/usr/bin/foo' python2.7 FAIL # regression test for bug #522080 test_fix_shebang '#!/usr/bin/python ' python2.7 '#!/usr/bin/python2.7 ' -# make sure we don't break pattern matching -test_is "_python_impl_supported python2_5" 1 -test_is "_python_impl_supported python2_6" 1 -test_is "_python_impl_supported python2_7" 0 -test_is "_python_impl_supported python3_1" 1 -test_is "_python_impl_supported python3_2" 1 -test_is "_python_impl_supported python3_3" 1 -test_is "_python_impl_supported python3_4" 1 -test_is "_python_impl_supported python3_5" 1 -test_is "_python_impl_supported python3_6" 0 -test_is "_python_impl_supported python3_7" 0 -test_is "_python_impl_supported python3_8" 0 -test_is "_python_impl_supported pypy1_8" 1 -test_is "_python_impl_supported pypy1_9" 1 -test_is "_python_impl_supported pypy2_0" 1 -test_is "_python_impl_supported pypy" 1 -test_is "_python_impl_supported pypy3" 0 - # check _python_impl_matches behavior test_is "_python_impl_matches python2_7 -2" 0 test_is "_python_impl_matches python3_6 -2" 1 diff --git a/eclass/vala.eclass b/eclass/vala.eclass index 52899f163dcf..88c5231286ab 100644 --- a/eclass/vala.eclass +++ b/eclass/vala.eclass @@ -102,7 +102,7 @@ vala_best_api_version() { u=$(_vala_use_depend) for v in $(vala_api_versions); do - has_version "dev-lang/vala:${v}${u}" && echo "${v}" && return + has_version $([[ $EAPI == [1-6] ]] || echo -b) "dev-lang/vala:${v}${u}" && echo "${v}" && return done } @@ -136,7 +136,7 @@ vala_src_prepare() { fi if [[ ${version} ]]; then - has_version "dev-lang/vala:${version}" || die "No installed vala:${version}" + has_version $([[ $EAPI == [1-6] ]] || echo -b) "dev-lang/vala:${version}" || die "No installed vala:${version}" else version=$(vala_best_api_version) [[ ${version} ]] || die "No installed vala in $(vala_depend)" diff --git a/eclass/xorg-2.eclass b/eclass/xorg-2.eclass index f3b282e1a111..99b1f891b998 100644 --- a/eclass/xorg-2.eclass +++ b/eclass/xorg-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: xorg-2.eclass @@ -168,27 +168,6 @@ fi # If we're a driver package, then enable DRIVER case [[ ${PN} == xf86-video-* || ${PN} == xf86-input-* ]] && DRIVER="yes" -# @ECLASS-VARIABLE: XORG_STATIC -# @DESCRIPTION: -# Enables static-libs useflag. Set to no, if your package gets: -# -# QA: configure: WARNING: unrecognized options: --disable-static -: ${XORG_STATIC:="yes"} - -# Add static-libs useflag where useful. -if [[ ${XORG_STATIC} == yes \ - && ${FONT} != yes \ - && ${CATEGORY} != app-doc \ - && ${CATEGORY} != x11-apps \ - && ${CATEGORY} != x11-drivers \ - && ${CATEGORY} != media-fonts \ - && ${PN} != util-macros \ - && ${PN} != xbitmaps \ - && ${PN} != xorg-cf-files \ - && ${PN/xcursor} = ${PN} ]]; then - IUSE+=" static-libs" -fi - DEPEND+=" virtual/pkgconfig" # @ECLASS-VARIABLE: XORG_DRI @@ -440,9 +419,15 @@ xorg-2_src_configure() { local selective_werror="--disable-selective-werror" fi + # Check if package supports disabling of static libraries + if grep -q -s "able-static" ${ECONF_SOURCE:-.}/configure; then + local no_static="--disable-static" + fi + local myeconfargs=( ${dep_track} ${selective_werror} + ${no_static} ${FONT_OPTIONS} "${xorgconfadd[@]}" ) diff --git a/eclass/xorg-3.eclass b/eclass/xorg-3.eclass index ece4d97b4339..811168ead986 100644 --- a/eclass/xorg-3.eclass +++ b/eclass/xorg-3.eclass @@ -169,28 +169,6 @@ if [[ ${FONT} == yes ]]; then FONT_DIR=${FONT_DIR/type1/Type1} FONT_DIR=${FONT_DIR/speedo/Speedo} fi - -# @ECLASS-VARIABLE: XORG_STATIC -# @DESCRIPTION: -# Enables static-libs useflag. Set to no, if your package gets: -# -# QA: configure: WARNING: unrecognized options: --disable-static -: ${XORG_STATIC:="yes"} - -# Add static-libs useflag where useful. -if [[ ${XORG_STATIC} == yes \ - && ${FONT} != yes \ - && ${CATEGORY} != app-doc \ - && ${CATEGORY} != x11-apps \ - && ${CATEGORY} != x11-drivers \ - && ${CATEGORY} != media-fonts \ - && ${PN} != util-macros \ - && ${PN} != xbitmaps \ - && ${PN} != xorg-cf-files \ - && ${PN/xcursor} = ${PN} ]]; then - IUSE+=" static-libs" -fi - BDEPEND+=" virtual/pkgconfig" # @ECLASS-VARIABLE: XORG_DRI @@ -391,9 +369,15 @@ xorg-3_src_configure() { local selective_werror="--disable-selective-werror" fi + # Check if package supports disabling of static libraries + if grep -q -s "able-static" ${ECONF_SOURCE:-.}/configure; then + local no_static="--disable-static" + fi + local econfargs=( ${dep_track} ${selective_werror} + ${no_static} ${FONT_OPTIONS} "${xorgconfadd[@]}" ) @@ -446,6 +430,7 @@ xorg-3_src_install() { multilib-minimal_src_install "$@" else emake DESTDIR="${D}" "${install_args[@]}" "$@" install || die "emake install failed" + einstalldocs fi # Many X11 libraries unconditionally install developer documentation |