From 623ee73d661e5ed8475cb264511f683407d87365 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 12 Apr 2020 03:41:30 +0100 Subject: gentoo Easter resync : 12.04.2020 --- eclass/Manifest.gz | Bin 36295 -> 36452 bytes eclass/acct-group.eclass | 2 +- eclass/acct-user.eclass | 2 +- eclass/autotools.eclass | 4 +- eclass/bash-completion-r1.eclass | 4 +- eclass/cargo.eclass | 2 +- eclass/check-reqs.eclass | 4 +- eclass/cmake.eclass | 9 - eclass/desktop.eclass | 8 +- eclass/distutils-r1.eclass | 33 +--- eclass/ecm.eclass | 28 +-- eclass/fcaps.eclass | 12 +- eclass/fixheadtails.eclass | 4 +- eclass/flag-o-matic.eclass | 53 ++++-- eclass/font.eclass | 36 ++-- eclass/gnome2-utils.eclass | 48 +++-- eclass/go-module.eclass | 387 ++++++++++++++++++++++++++++++++++----- eclass/gstreamer.eclass | 4 +- eclass/java-utils-2.eclass | 2 +- eclass/kde.org.eclass | 3 +- eclass/kde5-functions.eclass | 6 + eclass/kde5.eclass | 10 +- eclass/leechcraft.eclass | 14 +- eclass/linux-info.eclass | 14 +- eclass/linux-mod.eclass | 2 +- eclass/meson.eclass | 4 + eclass/multilib.eclass | 15 +- eclass/office-ext-r1.eclass | 7 +- eclass/python-any-r1.eclass | 30 +-- eclass/python-r1.eclass | 23 +-- eclass/python-single-r1.eclass | 18 +- eclass/python-utils-r1.eclass | 242 ++++++++---------------- eclass/qt5-build.eclass | 55 +++--- eclass/tests/distutils-r1.sh | 2 +- eclass/tests/multilib.sh | 65 +++++++ eclass/tests/python-utils-r1.sh | 33 +--- eclass/texlive-common.eclass | 14 +- eclass/texlive-module.eclass | 6 +- eclass/toolchain.eclass | 81 +++++--- eclass/waf-utils.eclass | 22 ++- 40 files changed, 804 insertions(+), 504 deletions(-) create mode 100755 eclass/tests/multilib.sh (limited to 'eclass') diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz index 2794fb0adf40..d45340dacba2 100644 Binary files a/eclass/Manifest.gz and b/eclass/Manifest.gz differ diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass index 0b943454a92e..5550e4a2fb10 100644 --- a/eclass/acct-group.eclass +++ b/eclass/acct-group.eclass @@ -75,7 +75,7 @@ readonly ACCT_GROUP_NAME # << Boilerplate ebuild variables >> : ${DESCRIPTION:="System group: ${ACCT_GROUP_NAME}"} : ${SLOT:=0} -: ${KEYWORDS:=alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris} +: ${KEYWORDS:=alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris} S=${WORKDIR} diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass index e3ec3966035d..b66fbbf9d0c2 100644 --- a/eclass/acct-user.eclass +++ b/eclass/acct-user.eclass @@ -115,7 +115,7 @@ readonly ACCT_USER_NAME # << Boilerplate ebuild variables >> : ${DESCRIPTION:="System user: ${ACCT_USER_NAME}"} : ${SLOT:=0} -: ${KEYWORDS:=alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris} +: ${KEYWORDS:=alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris} S=${WORKDIR} diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass index 9df0e1b93663..625abd0e9d12 100644 --- a/eclass/autotools.eclass +++ b/eclass/autotools.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2018 Gentoo Foundation +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: autotools.eclass @@ -512,7 +512,7 @@ autotools_run_tool() { fi if ${m4flags} ; then - set -- "${1}" $(autotools_m4dir_include) "${@:2}" $(autotools_m4sysdir_include) + set -- "${1}" $(autotools_m4dir_include) $(autotools_m4sysdir_include) "${@:2}" fi # If the caller wants to probe something, then let them do it directly. diff --git a/eclass/bash-completion-r1.eclass b/eclass/bash-completion-r1.eclass index 7a69f485a74f..636371df9d6b 100644 --- a/eclass/bash-completion-r1.eclass +++ b/eclass/bash-completion-r1.eclass @@ -91,7 +91,7 @@ get_bashhelpersdir() { } # @FUNCTION: dobashcomp -# @USAGE: file [...] +# @USAGE: [...] # @DESCRIPTION: # Install bash-completion files passed as args. Has EAPI-dependant failure # behavior (like doins). @@ -106,7 +106,7 @@ dobashcomp() { } # @FUNCTION: newbashcomp -# @USAGE: file newname +# @USAGE: # @DESCRIPTION: # Install bash-completion file under a new name. Has EAPI-dependant failure # behavior (like newins). diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass index 6776a4b03ac6..6f7ffdb626b4 100644 --- a/eclass/cargo.eclass +++ b/eclass/cargo.eclass @@ -39,7 +39,7 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo" # @DESCRIPTION: # Generates the URIs to put in SRC_URI to help fetch dependencies. cargo_crate_uris() { - local -r regex='^(.*)-([0-9]+\.[0-9]+\.[0-9]+.*)$' + local -r regex='^([a-zA-Z0-9_\-]+)-([0-9]+\.[0-9]+\.[0-9]+.*)$' local crate for crate in "$@"; do local name version url diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass index 192d6fa740dc..a45cbd15fee7 100644 --- a/eclass/check-reqs.eclass +++ b/eclass/check-reqs.eclass @@ -1,4 +1,4 @@ -# Copyright 2004-2019 Gentoo Authors +# Copyright 2004-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: check-reqs.eclass @@ -109,7 +109,7 @@ check-reqs_prepare() { -z ${CHECKREQS_DISK_VAR} ]]; then eerror "Set some check-reqs eclass variables if you want to use it." eerror "If you are user and see this message file a bug against the package." - die "${FUNCNAME}: check-reqs eclass called but not actualy used!" + die "${FUNCNAME}: check-reqs eclass called but not actually used!" fi } diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass index 160f40b1cf8e..3da3b9aeb555 100644 --- a/eclass/cmake.eclass +++ b/eclass/cmake.eclass @@ -371,15 +371,6 @@ cmake_src_configure() { # Fix xdg collision with sandbox xdg_environment_reset - # @SEE CMAKE_BUILD_TYPE - if [[ ${CMAKE_BUILD_TYPE} = Gentoo ]]; then - # Handle release builds - if ! in_iuse debug || ! use debug; then - local CPPFLAGS=${CPPFLAGS} - append-cppflags -DNDEBUG - fi - fi - # Prepare Gentoo override rules (set valid compiler, append CPPFLAGS etc.) local build_rules=${BUILD_DIR}/gentoo_rules.cmake diff --git a/eclass/desktop.eclass b/eclass/desktop.eclass index 6fc72ab8ec03..7d5c0f0f9a26 100644 --- a/eclass/desktop.eclass +++ b/eclass/desktop.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2018 Gentoo Foundation +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: desktop.eclass @@ -10,7 +10,7 @@ if [[ -z ${_DESKTOP_ECLASS} ]]; then _DESKTOP_ECLASS=1 # @FUNCTION: make_desktop_entry -# @USAGE: make_desktop_entry(, [name], [icon], [type], [fields]) +# @USAGE: [name] [icon] [type] [fields] # @DESCRIPTION: # Make a .desktop file. # @@ -162,8 +162,8 @@ make_desktop_entry() { else local desktop_name="${PN}-${slot}" fi - local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop" - #local desktop=${T}/${exec%% *:-${desktop_name}}.desktop + local desktop="${exec%%[[:space:]]*}" + desktop="${T}/${desktop##*/}-${desktop_name}.desktop" # Don't append another ";" when a valid category value is provided. type=${type%;}${type:+;} diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 27ca236ccf5f..fd6c0193d12e 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -40,8 +40,8 @@ # as well. Thus, all the variables defined and documented there are # relevant to the packages using distutils-r1. # -# For more information, please see the wiki: -# https://wiki.gentoo.org/wiki/Project:Python/distutils-r1 +# For more information, please see the Python Guide: +# https://dev.gentoo.org/~mgorny/python-guide/ case "${EAPI:-0}" in 0|1|2|3|4) @@ -120,10 +120,10 @@ _distutils_set_globals() { local bdep=${rdep} if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then - local sdep="dev-python/setuptools[${PYTHON_USEDEP}]" + local sdep=">=dev-python/setuptools-42.0.2[${PYTHON_USEDEP}]" else local sdep="$(python_gen_cond_dep ' - dev-python/setuptools[${PYTHON_MULTI_USEDEP}] + >=dev-python/setuptools-42.0.2[${PYTHON_MULTI_USEDEP}] ')" fi @@ -355,7 +355,7 @@ distutils_enable_sphinx() { if grep -F -q 'sphinx.ext.autodoc' "${confpy}"; then die "distutils_enable_sphinx: --no-autodoc passed but sphinx.ext.autodoc found in ${confpy}" fi - else + elif [[ -z ${_DISTUTILS_SPHINX_PLUGINS[@]} ]]; then if ! grep -F -q 'sphinx.ext.autodoc' "${confpy}"; then die "distutils_enable_sphinx: sphinx.ext.autodoc not found in ${confpy}, pass --no-autodoc" fi @@ -771,13 +771,11 @@ _distutils-r1_wrap_scripts() { local path=${1} local bindir=${2} - local PYTHON_SCRIPTDIR - python_export PYTHON_SCRIPTDIR - + local scriptdir=$(python_get_scriptdir) local f python_files=() non_python_files=() - if [[ -d ${path}${PYTHON_SCRIPTDIR} ]]; then - for f in "${path}${PYTHON_SCRIPTDIR}"/*; do + if [[ -d ${path}${scriptdir} ]]; then + for f in "${path}${scriptdir}"/*; do [[ -d ${f} ]] && die "Unexpected directory: ${f}" debug-print "${FUNCNAME}: found executable at ${f#${path}/}" @@ -894,9 +892,7 @@ distutils-r1_python_install() { ${shopt_save} if [[ -n ${pypy_dirs} ]]; then - local cmd=die - [[ ${EAPI} == [45] ]] && cmd=eqawarn - "${cmd}" "Package installs 'share' in PyPy prefix, see bug #465546." + die "Package installs 'share' in PyPy prefix, see bug #465546." fi if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then @@ -922,8 +918,6 @@ distutils-r1_python_install_all() { ) docompress -x "/usr/share/doc/${PF}/examples" fi - - _DISTUTILS_DEFAULT_CALLED=1 } # @FUNCTION: distutils-r1_run_phase @@ -1146,21 +1140,12 @@ distutils-r1_src_install() { _distutils-r1_run_foreach_impl distutils-r1_python_install fi - local _DISTUTILS_DEFAULT_CALLED - if declare -f python_install_all >/dev/null; then _distutils-r1_run_common_phase python_install_all else _distutils-r1_run_common_phase distutils-r1_python_install_all fi - if [[ ! ${_DISTUTILS_DEFAULT_CALLED} ]]; then - local cmd=die - [[ ${EAPI} == [45] ]] && cmd=eqawarn - - "${cmd}" "QA: python_install_all() didn't call distutils-r1_python_install_all" - fi - _distutils-r1_check_namespace_pth } diff --git a/eclass/ecm.eclass b/eclass/ecm.eclass index 2892b0e0e942..0e3c64b0a2ad 100644 --- a/eclass/ecm.eclass +++ b/eclass/ecm.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2019 Gentoo Authors +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: ecm.eclass @@ -218,27 +218,6 @@ case ${ECM_DESIGNERPLUGIN} in ;; esac -# @ECLASS-VARIABLE: KDE_DESIGNERPLUGIN -# @DESCRIPTION: -# If set to "false", do nothing. -# Otherwise, add "designer" to IUSE to toggle build of designer plugins -# and add the necessary BDEPEND. -# TODO: drop after KDE Applications 19.08.3 removal -: ${KDE_DESIGNERPLUGIN:=false} -case ${KDE_DESIGNERPLUGIN} in - true) - IUSE+=" designer" - BDEPEND+=" - designer? ( >=kde-frameworks/kdesignerplugin-${KFMIN}:${KFSLOT} ) - " - ;; - false) ;; - *) - eerror "Unknown value for \${KDE_DESIGNERPLUGIN}" - die "Value ${KDE_DESIGNERPLUGIN} is not supported" - ;; -esac - case ${ECM_EXAMPLES} in true) IUSE+=" examples" @@ -545,11 +524,6 @@ ecm_src_configure() { cmakeargs+=( -DBUILD_DESIGNERPLUGIN=$(usex designer) ) fi - # TODO: drop after KDE Applications 19.08.3 removal - if in_iuse designer && [[ ${KDE_DESIGNERPLUGIN} != false ]] ; then - cmakeargs+=( $(cmake_use_find_package designer KF5DesignerPlugin) ) - fi - if [[ ${ECM_QTHELP} = true ]]; then cmakeargs+=( -DBUILD_QCH=$(usex doc) ) fi diff --git a/eclass/fcaps.eclass b/eclass/fcaps.eclass index 467f955f5e9a..0bb23f8cca70 100644 --- a/eclass/fcaps.eclass +++ b/eclass/fcaps.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: fcaps.eclass @@ -34,7 +34,10 @@ _FCAPS_ECLASS=1 IUSE="+filecaps" # We can't use libcap-ng atm due to #471414. -DEPEND="filecaps? ( sys-libs/libcap )" +case "${EAPI:-0}" in + [0-6]) DEPEND="filecaps? ( sys-libs/libcap )" ;; + *) BDEPEND="filecaps? ( sys-libs/libcap )" ;; +esac # @ECLASS-VARIABLE: FILECAPS # @DEFAULT_UNSET @@ -78,6 +81,11 @@ DEPEND="filecaps? ( sys-libs/libcap )" fcaps() { debug-print-function ${FUNCNAME} "$@" + if [[ ${EUID} != 0 ]] ; then + einfo "Insufficient privileges to execute ${FUNCNAME}, skipping." + return 0 + fi + # Process the user options first. local owner='root' local group='0' diff --git a/eclass/fixheadtails.eclass b/eclass/fixheadtails.eclass index c19d33924aab..475b182843a5 100644 --- a/eclass/fixheadtails.eclass +++ b/eclass/fixheadtails.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2014 Gentoo Foundation +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: fixheadtails.eclass @@ -8,8 +8,6 @@ # Original author John Mylchreest # @BLURB: functions to replace obsolete head/tail with POSIX compliant ones -DEPEND=">=sys-apps/sed-4" - _do_sed_fix() { einfo " - fixed $1" sed -i \ diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass index 5cc58f9e9392..0c67ec9f7a76 100644 --- a/eclass/flag-o-matic.eclass +++ b/eclass/flag-o-matic.eclass @@ -56,7 +56,9 @@ setup-allowed-flags() { -mno-faster-structs -mfaster-structs -m32 -m64 -mx32 -mabi -mlittle-endian -mbig-endian -EL -EB -fPIC -mlive-g0 -mcmodel -mstack-bias -mno-stack-bias -msecure-plt '-m*-toc' -mfloat-abi - -mfix-r10000 -mno-fix-r10000 -mthumb -marm + -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 + -mfix-rm7000 -mno-fix-rm7000 -mfix-r10000 -mno-fix-r10000 + -mr10k-cache-barrier -mthumb -marm # gcc 4.5 -mno-fma4 -mno-movbe -mno-xop -mno-lwp @@ -392,6 +394,7 @@ filter-mfpmath() { # Strip *FLAGS of everything except known good/safe flags. This runs over all # flags returned by all_flag_vars(). strip-flags() { + [[ $# -ne 0 ]] && die "strip-flags takes no arguments" local x y var local ALLOWED_FLAGS @@ -433,43 +436,50 @@ test-flag-PROG() { local lang=$2 shift 2 - [[ -z ${comp} || -z $1 ]] && return 1 + if [[ -z ${comp} ]]; then + return 1 + fi + if [[ -z $1 ]]; then + return 1 + fi # verify selected compiler exists before using it comp=($(tc-get${comp})) # 'comp' can already contain compiler options. # 'type' needs a binary name - type -p ${comp[0]} >/dev/null || return 1 + if ! type -p ${comp[0]} >/dev/null; then + return 1 + fi # Set up test file. local in_src in_ext cmdline_extra=() case "${lang}" in # compiler/assembler only c) - in_ext='.c' + in_ext='c' in_src='int main(void) { return 0; }' cmdline_extra+=(-xc -c) ;; c++) - in_ext='.cc' + in_ext='cc' in_src='int main(void) { return 0; }' cmdline_extra+=(-xc++ -c) ;; f77) - in_ext='.f' + in_ext='f' # fixed source form in_src=' end' cmdline_extra+=(-xf77 -c) ;; f95) - in_ext='.f90' + in_ext='f90' in_src='end' cmdline_extra+=(-xf95 -c) ;; # C compiler/assembler/linker c+ld) - in_ext='.c' + in_ext='c' in_src='int main(void) { return 0; }' cmdline_extra+=(-xc) ;; @@ -477,8 +487,19 @@ test-flag-PROG() { local test_in=${T}/test-flag.${in_ext} local test_out=${T}/test-flag.exe - printf "%s\n" "${in_src}" > "${test_in}" || return 1 - + printf "%s\n" "${in_src}" > "${test_in}" || die "Failed to create '${test_in}'" + + # Currently we rely on warning-free output of a compiler + # before the flag to see if a flag prduces any warnings. + # This has a few drawbacks: + # - if compiler already generates warnings we filter out + # every single flag: bug #712488 + # - if user actually wants to see warnings we just strip + # them regardless of warnings type. + # + # We can add more selective detection of no-op flags via + # '-Werror=ignored-optimization-argument' and similar error options + # similar to what we are doing with '-Qunused-arguments'. local cmdline=( "${comp[@]}" # Clang will warn about unknown gcc flags but exit 0. @@ -618,6 +639,7 @@ test_version_info() { # @DESCRIPTION: # Strip {C,CXX,F,FC}FLAGS of any flags not supported by the active toolchain. strip-unsupported-flags() { + [[ $# -ne 0 ]] && die "strip-unsupported-flags takes no arguments" export CFLAGS=$(test-flags-CC ${CFLAGS}) export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS}) export FFLAGS=$(test-flags-F77 ${FFLAGS}) @@ -630,6 +652,7 @@ strip-unsupported-flags() { # @DESCRIPTION: # Find and echo the value for a particular flag. Accepts shell globs. get-flag() { + [[ $# -ne 1 ]] && die "usage: " local f var findflag="$1" # this code looks a little flaky but seems to work for @@ -648,18 +671,11 @@ get-flag() { return 1 } -has_m64() { - die "${FUNCNAME}: don't use this anymore" -} - -has_m32() { - die "${FUNCNAME}: don't use this anymore" -} - # @FUNCTION: replace-sparc64-flags # @DESCRIPTION: # Sets mcpu to v8 and uses the original value as mtune if none specified. replace-sparc64-flags() { + [[ $# -ne 0 ]] && die "replace-sparc64-flags takes no arguments" local SPARC64_CPUS="ultrasparc3 ultrasparc v9" if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]; then @@ -743,6 +759,7 @@ raw-ldflags() { # @FUNCTION: no-as-needed # @RETURN: Flag to disable asneeded behavior for use with append-ldflags. no-as-needed() { + [[ $# -ne 0 ]] && die "no-as-needed takes no arguments" case $($(tc-getLD) -v 2>&1 /dev/null) == "declare -a"* ]]; then + # recreate the directory structure if FONT_S is an array + for dir in "${FONT_S[@]}"; do + pushd "${dir}" > /dev/null || die "pushd ${dir} failed" + insinto "${FONTDIR}/${dir#"${S}"}" + for suffix in ${FONT_SUFFIX}; do + doins *.${suffix} + done + font_xfont_config "${dir}" + popd > /dev/null || die + done + elif [[ ${FONT_S/ } != "${FONT_S}" ]]; then + # backwards compatibility code, can be removed after 2021-02-14 + eqawarn "Using a space-separated list for FONT_S is deprecated." + eqawarn "Use a bash array instead if there are multiple directories." for dir in ${FONT_S}; do - pushd "${dir}" > /dev/null + pushd "${dir}" > /dev/null || die "pushd ${dir} failed" insinto "${FONTDIR}/${dir//${S}/}" for suffix in ${FONT_SUFFIX}; do doins *.${suffix} done font_xfont_config "${dir}" - popd > /dev/null + popd > /dev/null || die done else - pushd "${FONT_S}" > /dev/null + pushd "${FONT_S:-${S}}" > /dev/null \ + || die "pushd ${FONT_S:-${S}} failed" insinto "${FONTDIR}" for suffix in ${FONT_SUFFIX}; do doins *.${suffix} done font_xfont_config - popd > /dev/null + popd > /dev/null || die fi font_fontconfig diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass index 06683a7467f8..06643db0f605 100644 --- a/eclass/gnome2-utils.eclass +++ b/eclass/gnome2-utils.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2019 Gentoo Authors +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: gnome2-utils.eclass @@ -15,8 +15,9 @@ # * scrollkeeper (old Gnome help system) management [[ ${EAPI:-0} == [012345] ]] && inherit multilib -[[ ${EAPI:-0} == [0123456] ]] && inherit eutils -inherit xdg-utils +# eutils.eclass: emktemp +# xdg-utils.eclass: xdg_environment_reset, xdg_icon_cache_update +inherit eutils xdg-utils case "${EAPI:-0}" in 0|1|2|3|4|5|6|7) ;; @@ -122,7 +123,7 @@ gnome2_gconf_savelist() { # This function should be called from pkg_postinst. gnome2_gconf_install() { has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" - local updater="${EROOT}${GCONFTOOL_BIN}" + local updater="${EROOT%/}${GCONFTOOL_BIN}" if [[ ! -x "${updater}" ]]; then debug-print "${updater} is not executable" @@ -136,15 +137,15 @@ gnome2_gconf_install() { # We are ready to install the GCONF Scheme now unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL - export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")" + export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT%/}/;")" einfo "Installing GNOME 2 GConf schemas" local F for F in ${GNOME2_ECLASS_SCHEMAS}; do - if [[ -e "${EROOT}${F}" ]]; then + if [[ -e "${EROOT%/}/${F}" ]]; then debug-print "Installing schema: ${F}" - "${updater}" --makefile-install-rule "${EROOT}${F}" 1>/dev/null + "${updater}" --makefile-install-rule "${EROOT%/}/${F}" 1>/dev/null fi done @@ -163,7 +164,7 @@ gnome2_gconf_install() { # database. gnome2_gconf_uninstall() { has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" - local updater="${EROOT}${GCONFTOOL_BIN}" + local updater="${EROOT%/}${GCONFTOOL_BIN}" if [[ ! -x "${updater}" ]]; then debug-print "${updater} is not executable" @@ -176,15 +177,15 @@ gnome2_gconf_uninstall() { fi unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL - export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")" + export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT%/}/;")" einfo "Uninstalling GNOME 2 GConf schemas" local F for F in ${GNOME2_ECLASS_SCHEMAS}; do - if [[ -e "${EROOT}${F}" ]]; then + if [[ -e "${EROOT%/}/${F}" ]]; then debug-print "Uninstalling gconf schema: ${F}" - "${updater}" --makefile-uninstall-rule "${EROOT}${F}" 1>/dev/null + "${updater}" --makefile-uninstall-rule "${EROOT%/}/${F}" 1>/dev/null fi done @@ -266,7 +267,7 @@ gnome2_scrollkeeper_savelist() { # This function should be called from pkg_postinst and pkg_postrm. gnome2_scrollkeeper_update() { has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" - local updater="${EROOT}${SCROLLKEEPER_UPDATE_BIN}" + local updater="${EROOT%/}${SCROLLKEEPER_UPDATE_BIN}" if [[ ! -x "${updater}" ]] ; then debug-print "${updater} is not executable" @@ -279,7 +280,7 @@ gnome2_scrollkeeper_update() { fi ebegin "Updating scrollkeeper database ..." - "${updater}" -q -p "${EROOT}${SCROLLKEEPER_DIR}" + "${updater}" -q -p "${EROOT%/}${SCROLLKEEPER_DIR}" eend $? } @@ -297,13 +298,12 @@ gnome2_schemas_savelist() { } # @FUNCTION: gnome2_schemas_update -# @USAGE: gnome2_schemas_update # @DESCRIPTION: # Updates GSettings schemas. # This function should be called from pkg_postinst and pkg_postrm. gnome2_schemas_update() { has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" - local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}" + local updater="${EROOT%/}${GLIB_COMPILE_SCHEMAS}" if [[ ! -x ${updater} ]]; then debug-print "${updater} is not executable" @@ -328,16 +328,15 @@ gnome2_gdk_pixbuf_savelist() { } # @FUNCTION: gnome2_gdk_pixbuf_update -# @USAGE: gnome2_gdk_pixbuf_update # @DESCRIPTION: # Updates gdk-pixbuf loader cache if GNOME2_ECLASS_GDK_PIXBUF_LOADERS has some. # This function should be called from pkg_postinst and pkg_postrm. gnome2_gdk_pixbuf_update() { has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" - local updater="${EROOT}/usr/bin/${CHOST}-gdk-pixbuf-query-loaders" + local updater="${EROOT%/}/usr/bin/${CHOST}-gdk-pixbuf-query-loaders" if [[ ! -x ${updater} ]]; then - updater="${EROOT}/usr/bin/gdk-pixbuf-query-loaders" + updater="${EROOT%/}/usr/bin/gdk-pixbuf-query-loaders" fi if [[ ! -x ${updater} ]]; then @@ -354,13 +353,12 @@ gnome2_gdk_pixbuf_update() { local tmp_file=$(emktemp) ${updater} 1> "${tmp_file}" && chmod 0644 "${tmp_file}" && - cp -f "${tmp_file}" "${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache" && + cp -f "${tmp_file}" "${EROOT%/}/usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache" && rm "${tmp_file}" # don't replace this with mv, required for SELinux support eend $? } # @FUNCTION: gnome2_query_immodules_gtk2 -# @USAGE: gnome2_query_immodules_gtk2 # @DESCRIPTION: # Updates gtk2 immodules/gdk-pixbuf loaders listing. gnome2_query_immodules_gtk2() { @@ -368,13 +366,12 @@ gnome2_query_immodules_gtk2() { [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-2.0 ebegin "Updating gtk2 input method module cache" - GTK_IM_MODULE_FILE="${EROOT}usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" \ + GTK_IM_MODULE_FILE="${EROOT%/}/usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" \ "${updater}" --update-cache eend $? } # @FUNCTION: gnome2_query_immodules_gtk3 -# @USAGE: gnome2_query_immodules_gtk3 # @DESCRIPTION: # Updates gtk3 immodules/gdk-pixbuf loaders listing. gnome2_query_immodules_gtk3() { @@ -382,22 +379,21 @@ gnome2_query_immodules_gtk3() { [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-3.0 ebegin "Updating gtk3 input method module cache" - GTK_IM_MODULE_FILE="${EROOT}usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache" \ + GTK_IM_MODULE_FILE="${EROOT%/}/usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache" \ "${updater}" --update-cache eend $? } # @FUNCTION: gnome2_giomodule_cache_update -# @USAGE: gnome2_giomodule_cache_update # @DESCRIPTION: # Updates glib's gio modules cache. # This function should be called from pkg_postinst and pkg_postrm. gnome2_giomodule_cache_update() { has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" - local updater="${EROOT}/usr/bin/${CHOST}-gio-querymodules" + local updater="${EROOT%/}/usr/bin/${CHOST}-gio-querymodules" if [[ ! -x ${updater} ]]; then - updater="${EROOT}/usr/bin/gio-querymodules" + updater="${EROOT%/}/usr/bin/gio-querymodules" fi if [[ ! -x ${updater} ]]; then diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass index 80ff2902b3ad..17d37494f15f 100644 --- a/eclass/go-module.eclass +++ b/eclass/go-module.eclass @@ -4,28 +4,29 @@ # @ECLASS: go-module.eclass # @MAINTAINER: # William Hubbs +# @AUTHOR: +# William Hubbs +# Robin H. Johnson # @SUPPORTED_EAPIS: 7 # @BLURB: basic eclass for building software written as go modules # @DESCRIPTION: -# This eclass provides basic settings and functions -# needed by all software written in the go programming language that uses -# go modules. -# -# You will know the software you are packaging uses modules because -# it will have files named go.sum and go.mod in its top-level source -# directory. If it does not have these files, use the golang-* eclasses. +# This eclass provides basic settings and functions needed by all software +# written in the go programming language that uses modules. # -# If it has these files and a directory named vendor in its top-level -# source directory, you only need to inherit the eclass since upstream -# is vendoring the dependencies. +# If the software you are packaging has a file named go.mod in its top +# level directory, it uses modules and your ebuild should inherit this +# eclass. If it does not, your ebuild should use the golang-* eclasses. # -# If it does not have a vendor directory, you should use the EGO_VENDOR -# variable and the go-module_vendor_uris function as shown in the -# example below to handle dependencies. +# If, besides go.mod, your software has a directory named vendor in its +# top level directory, the only thing you need to do is inherit the +# eclass. If there is no vendor directory, you need to also populate +# EGO_SUM and call go-module_set_globals as discussed below. # # Since Go programs are statically linked, it is important that your ebuild's # LICENSE= setting includes the licenses of all statically linked # dependencies. So please make sure it is accurate. +# You can use a utility like dev-util/golicense (network connectivity is +# required) to extract this information from the compiled binary. # # @EXAMPLE: # @@ -33,19 +34,21 @@ # # inherit go-module # -# EGO_VENDOR=( -# "github.com/xenolf/lego 6cac0ea7d8b28c889f709ec7fa92e92b82f490dd" -# "golang.org/x/crypto 453249f01cfeb54c3d549ddb75ff152ca243f9d8 github.com/golang/crypto" +# EGO_SUM=( +# "github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod" +# "github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59" # ) # +# go-module_set_globals +# # SRC_URI="https://github.com/example/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz -# $(go-module_vendor_uris)" +# ${EGO_SUM_SRC_URI}" # # @CODE case ${EAPI:-0} in 7) ;; - *) die "${ECLASS} API in EAPI ${EAPI} not yet established." + *) die "${ECLASS} EAPI ${EAPI} is not supported." esac if [[ -z ${_GO_MODULE} ]]; then @@ -54,6 +57,12 @@ _GO_MODULE=1 BDEPEND=">=dev-lang/go-1.12" +# Workaround for pkgcheck false positive: https://github.com/pkgcore/pkgcheck/issues/214 +# MissingUnpackerDep: version ...: missing BDEPEND="app-arch/unzip" +# Added here rather than to each affected package, so it can be cleaned up just +# once when pkgcheck is improved. +BDEPEND+=" app-arch/unzip" + # Force go to build in module mode. # In this mode the GOPATH environment variable is ignored. # this will become the default in the future. @@ -64,41 +73,69 @@ export GO111MODULE=on export GOCACHE="${T}/go-build" # The following go flags should be used for all builds. -# -mod=vendor stopps downloading of dependencies from the internet. # -v prints the names of packages as they are compiled # -x prints commands as they are executed -export GOFLAGS="-mod=vendor -v -x" +# -mod=readonly do not update go.mod/go.sum but fail if updates are needed +# -mod=vendor use the vendor directory instead of downloading dependencies +export GOFLAGS="-v -x -mod=readonly" # Do not complain about CFLAGS etc since go projects do not use them. QA_FLAGS_IGNORED='.*' # Go packages should not be stripped with strip(1). -RESTRICT="strip" +RESTRICT+=" strip" EXPORT_FUNCTIONS src_unpack pkg_postinst +# @ECLASS-VARIABLE: EGO_SUM +# @DESCRIPTION: +# This is an array based on the go.sum content from inside the target package. +# Each array entry must be quoted and contain information from a single +# line from go.sum. +# +# The format of go.sum is described upstream here: +# https://tip.golang.org/cmd/go/#hdr-Module_authentication_using_go_sum +# +# For inclusion in EGO_SUM, the h1: value and other future extensions SHOULD be +# omitted at this time. The EGO_SUM parser will accept them for ease of ebuild +# creation. +# +# h1: is the Hash1 structure used by upstream Go +# The Hash1 is MORE stable than Gentoo distfile hashing, and upstream warns +# that it's conceptually possible for the Hash1 value to remain stable while +# the upstream zipfiles change. Here are examples that do NOT change the h1: +# hash, but do change a regular checksum over all bytes of the file: +# - Differing mtimes within zipfile +# - Differing filename ordering with the zipfile +# - Differing zipfile compression parameters +# - Differing zipfile extra fields +# +# For Gentoo usage, the authors of this eclass feel that the h1: hash should +# NOT be included in the EGO_SUM at this time in order to reduce size of the +# ebuilds. This position will be reconsidered in future when a Go module +# distfile collision comes to light, where the Hash1 value of two distfiles is +# the same, but checksums over the file as a byte stream consider the files to +# be different. +# +# This decision does NOT weaken Go module security, as Go will verify the +# go.sum copy of the Hash1 values during building of the package. + # @ECLASS-VARIABLE: EGO_VENDOR # @DESCRIPTION: -# This variable contains a list of vendored packages. -# The items of this array are strings that contain the -# import path and the git commit hash for a vendored package. -# If the import path does not start with github.com, the third argument -# can be used to point to a github repository. +# This variable is deprecated and should no longer be used. Please +# convert your ebuilds to use EGO_SUM. # @FUNCTION: go-module_vendor_uris # @DESCRIPTION: -# Convert the information in EGO_VENDOR to a format suitable for -# SRC_URI. -# A call to this function should be added to SRC_URI in your ebuild if -# the upstream package does not include vendored dependencies. +# This function is deprecated. go-module_vendor_uris() { local hash import line repo x for line in "${EGO_VENDOR[@]}"; do read -r import hash repo x <<< "${line}" - if [[ -n $x ]]; then + if [[ -n ${x} ]]; then eerror "Trailing information in EGO_VENDOR in ${P}.ebuild" eerror "${line}" - eerror "Trailing information is: \"$x\"" + eerror "Trailing information is: \"${x}\"" die "Invalid EGO_VENDOR format" fi : "${repo:=${import}}" @@ -106,18 +143,226 @@ go-module_vendor_uris() { done } +# @ECLASS-VARIABLE: _GOMODULE_GOPROXY_BASEURI +# @DESCRIPTION: +# Golang module proxy service to fetch module files from. Note that the module +# proxy generally verifies modules via the Hash1 code. +# +# Users in China may find some mirrors in the default list blocked, and should +# explicitly set an entry in /etc/portage/mirrors for goproxy to +# https://goproxy.cn/ or another mirror that is not blocked in China. +# See https://arslan.io/2019/08/02/why-you-should-use-a-go-module-proxy/ for +# further details +# +# This variable is NOT intended for user-level configuration of mirrors, but +# rather to cover go modules that might exist only on specific Goproxy +# servers for non-technical reasons. +# +# This variable should NOT be present in user-level configuration e.g. +# /etc/portage/make.conf, as it will violate metadata immutability! +# +# I am considering removing this and just hard coding mirror://goproxy +# below, so please do not rely on it. +: "${_GOMODULE_GOPROXY_BASEURI:=mirror://goproxy/}" + +# @ECLASS-VARIABLE: _GOMODULE_GOSUM_REVERSE_MAP +# @DESCRIPTION: +# Mapping back from Gentoo distfile name to upstream distfile path. +# Associative array to avoid O(N*M) performance when populating the GOPROXY +# directory structure. +declare -A -g _GOMODULE_GOSUM_REVERSE_MAP + +# @FUNCTION: go-module_set_globals +# @DESCRIPTION: +# Convert the information in EGO_SUM for other usage in the ebuild. +# - Populates EGO_SUM_SRC_URI that can be added to SRC_URI +# - Exports _GOMODULE_GOSUM_REVERSE_MAP which provides reverse mapping from +# distfile back to the relative part of SRC_URI, as needed for +# GOPROXY=file:///... +go-module_set_globals() { + local line exts + # for tracking go.sum errors + local error_in_gosum=0 + local -a gosum_errorlines + # used make SRC_URI easier to read + local newline=$'\n' + + # Now parse EGO_SUM + for line in "${EGO_SUM[@]}"; do + local module version modfile version_modfile kvs x + read -r module version_modfile kvs <<< "${line}" + # kvs contains the hash and may contain other data from + # upstream in the future. We do not currently use any of this data. + + # Split 'v0.3.0/go.mod' into 'v0.3.0' and '/go.mod' + # It might NOT have the trailing /go.mod + IFS=/ read -r version modfile x <<<"${version_modfile}" + # Reject multiple slashes + if [[ -n ${x} ]]; then + error_in_gosum=1 + gosum_errorlines+=( "Bad version: ${version_modfile}" ) + continue + fi + + # The modfile variable should be either empty or '/go.mod' + # There is a chance that upstream Go might add something else here in + # the future, and we should be prepared to capture it. + # The .info files do not need to be downloaded, they will be created + # based on the .mod file. + # See https://github.com/golang/go/issues/35922#issuecomment-584824275 + exts=() + local errormsg='' + case "${modfile}" in + '') exts=( zip ) ;; + 'go.mod'|'/go.mod') exts=( mod ) ;; + *) errormsg="Unknown modfile: line='${line}', modfile='${modfile}'" ;; + esac + + # If it was a bad entry, restart the loop + if [[ -n ${errormsg} ]]; then + error_in_gosum=1 + gosum_errorlines+=( "${errormsg} line='${line}', modfile='${modfile}'" ) + continue + fi + + _dir=$(_go-module_gomod_encode "${module}") + + for _ext in "${exts[@]}" ; do + # Relative URI within a GOPROXY for a file + _reluri="${_dir}/@v/${version}.${_ext}" + # SRC_URI: LHS entry + _uri="${_GOMODULE_GOPROXY_BASEURI}/${_reluri}" +# _uri="mirror://goproxy/${_reluri}" + # SRC_URI: RHS entry, encode any slash in the path as + # %2F in the filename + _distfile="${_reluri//\//%2F}" + + EGO_SUM_SRC_URI+=" ${_uri} -> ${_distfile}${newline}" + _GOMODULE_GOSUM_REVERSE_MAP["${_distfile}"]="${_reluri}" + done + done + + if [[ ${error_in_gosum} != 0 ]]; then + eerror "Trailing information in EGO_SUM in ${P}.ebuild" + for line in "${gosum_errorlines[@]}" ; do + eerror "${line}" + done + die "Invalid EGO_SUM format" + fi + + # Ensure these variables are not changed past this point + readonly EGO_SUM + readonly EGO_SUM_SRC_URI + readonly _GOMODULE_GOSUM_REVERSE_MAP + + # Set the guard that we are safe + _GO_MODULE_SET_GLOBALS_CALLED=1 +} + # @FUNCTION: go-module_src_unpack # @DESCRIPTION: +# - If EGO_VENDOR is set, use the deprecated function to unpack the base +# tarballs and the tarballs indicated in EGO_VENDOR to the correct +# locations. +# - Otherwise, if EGO_SUM is set, unpack the base tarball(s) and set up the +# local go proxy. +# - Otherwise do a normal unpack. +go-module_src_unpack() { + if [[ "${#EGO_VENDOR[@]}" -gt 0 ]]; then + _go-module_src_unpack_vendor + elif [[ "${#EGO_SUM[@]}" -gt 0 ]]; then + _go-module_src_unpack_gosum + else + default + fi +} + +# @FUNCTION: _go-module_src_unpack_gosum +# @DESCRIPTION: +# Populate a GOPROXY directory hierarchy with distfiles from EGO_SUM and +# unpack the base distfiles. +# +# Exports GOPROXY environment variable so that Go calls will source the +# directory correctly. +_go-module_src_unpack_gosum() { + # shellcheck disable=SC2120 + debug-print-function "${FUNCNAME}" "$@" + + if [[ ! ${_GO_MODULE_SET_GLOBALS_CALLED} ]]; then + die "go-module_set_globals must be called in global scope" + fi + + local goproxy_dir="${T}/go-proxy" + mkdir -p "${goproxy_dir}" || die + + # For each Golang module distfile, look up where it's supposed to go, and + # symlink into place. + local f + local goproxy_mod_dir + for f in ${A}; do + goproxy_mod_path="${_GOMODULE_GOSUM_REVERSE_MAP["${f}"]}" + if [[ -n "${goproxy_mod_path}" ]]; then + debug-print-function "Populating go proxy for ${goproxy_mod_path}" + # Build symlink hierarchy + goproxy_mod_dir=$( dirname "${goproxy_dir}"/"${goproxy_mod_path}" ) + mkdir -p "${goproxy_mod_dir}" || die + ln -sf "${DISTDIR}"/"${f}" "${goproxy_dir}/${goproxy_mod_path}" || + die "Failed to ln" + local v=${goproxy_mod_path} + v="${v%.mod}" + v="${v%.zip}" + v="${v//*\/}" + _go-module_gosum_synthesize_files "${goproxy_mod_dir}" "${v}" + else + unpack "$f" + fi + done + export GOPROXY="file://${goproxy_dir}" + + # Validate the gosum now + _go-module_src_unpack_verify_gosum +} + +# @FUNCTION: _go-module_gosum_synthesize_files +# @DESCRIPTION: +# Given a path & version, populate all Goproxy metadata files which aren't +# needed to be downloaded directly. +# - .../@v/${version}.info +# - .../@v/list +_go-module_gosum_synthesize_files() { + local target=$1 + local version=$2 + # 'go get' doesn't care about the hash of the .info files, they + # just need a 'version' element! + # This saves a download of a tiny file + # The .time key is omitted, because that is the time a module was added + # to the upstream goproxy, and not metadata about the module itself. + cat >"${target}/${version}.info" <<-EOF + { + "Version": "${version}", + "shortName": "${version}", + "Name": "${version}" + } + EOF + listfile="${target}"/list + if ! grep -sq -x -e "${version}" "${listfile}" 2>/dev/null; then + echo "${version}" >>"${listfile}" + fi +} + +# @FUNCTION: _go-module_src_unpack_vendor +# @DESCRIPTION: # Extract all archives in ${a} which are not nentioned in ${EGO_VENDOR} # to their usual locations then extract all archives mentioned in # ${EGO_VENDOR} to ${S}/vendor. -go-module_src_unpack() { - debug-print-function ${FUNCNAME} "$@" +_go-module_src_unpack_vendor() { + # shellcheck disable=SC2120 + debug-print-function "${FUNCNAME}" "$@" local f hash import line repo tarball vendor_tarballs x vendor_tarballs=() for line in "${EGO_VENDOR[@]}"; do read -r import hash repo x <<< "${line}" - if [[ -n $x ]]; then + if [[ -n ${x} ]]; then eerror "Trailing information in EGO_VENDOR in ${P}.ebuild" eerror "${line}" die "Invalid EGO_VENDOR format" @@ -125,10 +370,10 @@ go-module_src_unpack() { : "${repo:=${import}}" vendor_tarballs+=("${repo//\//-}-${hash}.tar.gz") done - for f in $A; do - [[ -n ${vendor_tarballs[*]} ]] && has "$f" "${vendor_tarballs[@]}" && + for f in ${A}; do + [[ -n ${vendor_tarballs[*]} ]] && has "${f}" "${vendor_tarballs[@]}" && continue - unpack "$f" + unpack "${f}" done [[ -z ${vendor_tarballs[*]} ]] && return @@ -143,6 +388,39 @@ go-module_src_unpack() { -f "${DISTDIR}/${tarball}" || die eend done + # replace GOFLAGS if EGO_VENDOR is being used + [[ ${#EGO_VENDOR[@]} -gt 0 ]] && + GOFLAGS="-v -x -mod=vendor" + eqawarn "${P}.ebuild: EGO_VENDOR will be removed in the future." + eqawarn "Please request that the author migrate to EGO_SUM." +} + +# @FUNCTION: _go-module_src_unpack_verify_gosum +# @DESCRIPTION: +# Validate the Go modules declared by EGO_SUM are sufficient to cover building +# the package, without actually building it yet. +_go-module_src_unpack_verify_gosum() { + # shellcheck disable=SC2120 + debug-print-function "${FUNCNAME}" "$@" + + if [[ ! ${_GO_MODULE_SET_GLOBALS_CALLED} ]]; then + die "go-module_set_globals must be called in global scope" + fi + + cd "${S}" + + # Cleanup the modules before starting anything else + # This will print 'downloading' messages, but it's accessing content from + # the $GOPROXY file:/// URL! + einfo "Tidying go.mod/go.sum" + go mod tidy >/dev/null + + # This used to call 'go get' to verify by fetching everything from the main + # go.mod. However 'go get' also turns out to recursively try to fetch + # everything in dependencies, even materials that are used only for tests + # of the dependencies, or code generation. + # If EGO_SUM is missing an entry now, it will fail during the build process + # rather than this helper function. } # @FUNCTION: go-module_live_vendor @@ -150,13 +428,14 @@ go-module_src_unpack() { # This function is used in live ebuilds to vendor the dependencies when # upstream doesn't vendor them. go-module_live_vendor() { - debug-print-function ${FUNCNAME} "$@" + debug-print-function "${FUNCNAME}" "$@" + # shellcheck disable=SC2086 has live ${PROPERTIES} || die "${FUNCNAME} only allowed in live ebuilds" [[ "${EBUILD_PHASE}" == unpack ]] || die "${FUNCNAME} only allowed in src_unpack" - [[ -d "${S}"/vendor ]] || + [[ -d "${S}"/vendor ]] && die "${FUNCNAME} only allowed when upstream isn't vendoring" pushd "${S}" >& /dev/null || die @@ -168,7 +447,7 @@ go-module_live_vendor() { # @DESCRIPTION: # Display a warning about security updates for Go programs. go-module_pkg_postinst() { - debug-print-function ${FUNCNAME} "$@" + debug-print-function "${FUNCNAME}" "$@" [[ -n ${REPLACING_VERSIONS} ]] && return 0 ewarn "${PN} is written in the Go programming language." ewarn "Since this language is statically linked, security" @@ -179,4 +458,30 @@ go-module_pkg_postinst() { ewarn "stable tree." } +# @FUNCTION: _go-module_gomod_encode +# @DESCRIPTION: +# Encode the name(path) of a Golang module in the format expected by Goproxy. +# +# Upper letters are replaced by their lowercase version with a '!' prefix. +# +_go-module_gomod_encode() { + ## Python: + # return re.sub('([A-Z]{1})', r'!\1', s).lower() + + ## Sed: + ## This uses GNU Sed extension \l to downcase the match + #echo "${module}" |sed 's,[A-Z],!\l&,g' + # + # Bash variant: + debug-print-function "${FUNCNAME}" "$@" + #local re input lower + re='(.*)([A-Z])(.*)' + input="${1}" + while [[ ${input} =~ ${re} ]]; do + lower='!'"${BASH_REMATCH[2],}" + input="${BASH_REMATCH[1]}${lower}${BASH_REMATCH[3]}" + done + echo "${input}" +} + fi diff --git a/eclass/gstreamer.eclass b/eclass/gstreamer.eclass index 319f88128518..e592d726863d 100644 --- a/eclass/gstreamer.eclass +++ b/eclass/gstreamer.eclass @@ -139,7 +139,7 @@ gstreamer_get_plugins() { } # @FUNCTION: gstreamer_get_plugin_dir -# @USAGE: gstreamer_get_plugin_dir [] +# @USAGE: [build_dir] # @INTERNAL # @DESCRIPTION: # Finds plugin build directory and output it. @@ -161,7 +161,7 @@ gstreamer_get_plugin_dir() { } # @FUNCTION: gstreamer_system_link -# @USAGE: gstreamer_system_link gst-libs/gst/audio:gstreamer-audio [...] +# @USAGE: [...] # @DESCRIPTION: # Walks through makefiles in order to make sure build will link against system # libraries. diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass index 1e46e9b55780..29f13e031f48 100644 --- a/eclass/java-utils-2.eclass +++ b/eclass/java-utils-2.eclass @@ -266,7 +266,7 @@ java-pkg_addres() { } # @FUNCTION: java-pkg_rm_files -# @USAGE: java-pkg_rm_files File1.java File2.java ... +# @USAGE: [File2.java] ... # @DESCRIPTION: # Remove unneeded files in ${S}. # diff --git a/eclass/kde.org.eclass b/eclass/kde.org.eclass index 2776b5b972f2..bb9bd618eb2e 100644 --- a/eclass/kde.org.eclass +++ b/eclass/kde.org.eclass @@ -110,10 +110,9 @@ _kde.org_calculate_src_uri() { if [[ ${KDE_RELEASE_SERVICE} = true ]]; then case ${PV} in ??.??.[6-9]? ) - _src_uri+="unstable/applications/${PV}/src/" + _src_uri+="unstable/release-service/${PV}/src/" RESTRICT+=" mirror" ;; - 19.08.3? ) _src_uri+="stable/applications/${PV}/src/" ;; *) _src_uri+="stable/release-service/${PV}/src/" ;; esac fi diff --git a/eclass/kde5-functions.eclass b/eclass/kde5-functions.eclass index bbb8d6d90f25..df63e517bef8 100644 --- a/eclass/kde5-functions.eclass +++ b/eclass/kde5-functions.eclass @@ -1,6 +1,7 @@ # Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +# @DEAD # @ECLASS: kde5-functions.eclass # @MAINTAINER: # kde@gentoo.org @@ -15,6 +16,11 @@ if [[ -z ${_KDE5_FUNCTIONS_ECLASS} ]]; then _KDE5_FUNCTIONS_ECLASS=1 +if [[ -z ${_KDE5_ECLASS} ]]; then + eerror "This DEAD eclass must not be inherited directly by an ebuild." + die "Removal due on 2020-04-16." +fi + case ${EAPI} in 7) ;; *) die "EAPI=${EAPI:-0} is not supported" ;; diff --git a/eclass/kde5.eclass b/eclass/kde5.eclass index 884d4b4a47d5..0b8aa82ecf70 100644 --- a/eclass/kde5.eclass +++ b/eclass/kde5.eclass @@ -1,6 +1,7 @@ # Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +# @DEAD # @ECLASS: kde5.eclass # @MAINTAINER: # kde@gentoo.org @@ -239,11 +240,16 @@ _kde5_strip_handbook_translations() { # @FUNCTION: cmake_use_find_package # @USAGE: # @DESCRIPTION: -# Compatibility alias for cmake.eclass -> cmake.eclass +# Compatibility alias for cmake-utils.eclass -> cmake.eclass cmake-utils_use_find_package() { cmake_use_find_package "$@" ; } +_kde5_really_dead() { + eqawarn "${CATEGORY}/${PN} is using DEAD kde5.eclass that will be removed" + eqawarn "on 2020-04-16. Read PORTING notes inside kde5.eclass and kde5-functions.eclass." +} + # @FUNCTION: kde5_pkg_pretend # @DESCRIPTION: # Checks if the active compiler meets the minimum version requirements. @@ -261,6 +267,7 @@ kde5_pkg_pretend() { # Checks if the active compiler meets the minimum version requirements. kde5_pkg_setup() { debug-print-function ${FUNCNAME} "$@" + _kde5_really_dead case ${KDE_AUTODEPS} in false) ;; *) ecm_pkg_setup ;; @@ -411,6 +418,7 @@ kde5_pkg_preinst() { # Updates the various XDG caches (icon, desktop, mime) if necessary. kde5_pkg_postinst() { debug-print-function ${FUNCNAME} "$@" + _kde5_really_dead case ${KDE_AUTODEPS} in false) xdg_pkg_postinst ;; *) ecm_pkg_postinst ;; diff --git a/eclass/leechcraft.eclass b/eclass/leechcraft.eclass index 16b4f8d4c93e..c53f6712d863 100644 --- a/eclass/leechcraft.eclass +++ b/eclass/leechcraft.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # # @ECLASS: leechcraft.eclass @@ -22,18 +22,16 @@ # Only EAPI >=6 is supported case ${EAPI:-0} in - 6|7) ;; + 6) inherit cmake-utils ;; + 7) inherit cmake ;; *) die "EAPI not supported, bug ebuild mantainer" ;; esac -inherit cmake-utils - if [[ ${PV} == 9999 ]]; then EGIT_REPO_URI="https://github.com/0xd34df00d/leechcraft.git" inherit git-r3 else - DEPEND="app-arch/xz-utils" SRC_URI="https://dist.leechcraft.org/LeechCraft/${PV}/leechcraft-${PV}.tar.xz" S="${WORKDIR}/leechcraft-${PV}" fi @@ -41,6 +39,12 @@ fi HOMEPAGE="https://leechcraft.org/" LICENSE="Boost-1.0" +DEPEND=" + dev-qt/qtcore:5 + dev-qt/qtgui:5 +" +RDEPEND="${DEPEND}" + # @ECLASS-VARIABLE: LEECHCRAFT_PLUGIN_CATEGORY # @DEFAULT_UNSET # @DESCRIPTION: diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass index 98ec0ac8dabe..44eebcf52a92 100644 --- a/eclass/linux-info.eclass +++ b/eclass/linux-info.eclass @@ -159,7 +159,7 @@ qeerror() { qout eerror "${@}" ; } # --------------------------------------- # @FUNCTION: getfilevar -# @USAGE: variable configfile +# @USAGE: # @RETURN: the value of the variable # @DESCRIPTION: # It detects the value of the variable defined in the file configfile. This is @@ -195,7 +195,7 @@ getfilevar() { } # @FUNCTION: getfilevar_noexec -# @USAGE: variable configfile +# @USAGE: # @RETURN: the value of the variable # @DESCRIPTION: # It detects the value of the variable defined in the file configfile. @@ -310,7 +310,7 @@ require_configured_kernel() { } # @FUNCTION: linux_chkconfig_present -# @USAGE: option +# @USAGE: