diff --git a/sdk_container/src/third_party/portage-stable/eclass/epatch.eclass b/sdk_container/src/third_party/portage-stable/eclass/epatch.eclass deleted file mode 100644 index c42aef8e80..0000000000 --- a/sdk_container/src/third_party/portage-stable/eclass/epatch.eclass +++ /dev/null @@ -1,380 +0,0 @@ -# Copyright 1999-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# @ECLASS: epatch.eclass -# @MAINTAINER: -# base-system@gentoo.org -# @SUPPORTED_EAPIS: 6 -# @BLURB: easy patch application functions -# @DEPRECATED: eapply from EAPI 7 -# @DESCRIPTION: -# An eclass providing epatch and epatch_user functions to easily apply -# patches to ebuilds. Mostly superseded by eapply* in EAPI 6. - -if [[ -z ${_EPATCH_ECLASS} ]]; then - -case ${EAPI} in - 6) ;; - *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; -esac - -inherit estack - -# @VARIABLE: EPATCH_SOURCE -# @DESCRIPTION: -# Default directory to search for patches. -EPATCH_SOURCE="${WORKDIR}/patch" -# @VARIABLE: EPATCH_SUFFIX -# @DESCRIPTION: -# Default extension for patches (do not prefix the period yourself). -EPATCH_SUFFIX="patch.bz2" -# @VARIABLE: EPATCH_OPTS -# @DESCRIPTION: -# Options to pass to patch. Meant for ebuild/package-specific tweaking -# such as forcing the patch level (-p#) or fuzz (-F#) factor. Note that -# for single patch tweaking, you can also pass flags directly to epatch. -EPATCH_OPTS="" -# @VARIABLE: EPATCH_COMMON_OPTS -# @DESCRIPTION: -# Common options to pass to `patch`. You probably should never need to -# change these. If you do, please discuss it with base-system first to -# be sure. -# @CODE -# -g0 - keep RCS, ClearCase, Perforce and SCCS happy #24571 -# --no-backup-if-mismatch - do not leave .orig files behind -# -E - automatically remove empty files -# @CODE -EPATCH_COMMON_OPTS="-g0 -E --no-backup-if-mismatch" -# @VARIABLE: EPATCH_EXCLUDE -# @DESCRIPTION: -# List of patches not to apply. Note this is only file names, -# and not the full path. Globs accepted. -EPATCH_EXCLUDE="" -# @VARIABLE: EPATCH_MULTI_MSG -# @DESCRIPTION: -# Change the printed message for multiple patches. -EPATCH_MULTI_MSG="Applying various patches (bugfixes/updates) ..." -# @VARIABLE: EPATCH_FORCE -# @DESCRIPTION: -# Only require patches to match EPATCH_SUFFIX rather than the extended -# arch naming style. -EPATCH_FORCE="no" -# @VARIABLE: EPATCH_USER_EXCLUDE -# @DEFAULT_UNSET -# @DESCRIPTION: -# List of patches not to apply. Note this is only file names, -# and not the full path. Globs accepted. - -# @FUNCTION: epatch -# @USAGE: [options] [patches] [dirs of patches] -# @DESCRIPTION: -# epatch is designed to greatly simplify the application of patches. It can -# process patch files directly, or directories of patches. The patches may be -# compressed (bzip/gzip/etc...) or plain text. You generally need not specify -# the -p option as epatch will automatically attempt -p0 to -p4 until things -# apply successfully. -# -# If you do not specify any patches/dirs, then epatch will default to the -# directory specified by EPATCH_SOURCE. -# -# Any options specified that start with a dash will be passed down to patch -# for this specific invocation. As soon as an arg w/out a dash is found, then -# arg processing stops. -# -# When processing directories, epatch will apply all patches that match: -# @CODE -# if ${EPATCH_FORCE} != "yes" -# ??_${ARCH}_foo.${EPATCH_SUFFIX} -# else -# *.${EPATCH_SUFFIX} -# @CODE -# The leading ?? are typically numbers used to force consistent patch ordering. -# The arch field is used to apply patches only for the host architecture with -# the special value of "all" means apply for everyone. Note that using values -# other than "all" is highly discouraged -- you should apply patches all the -# time and let architecture details be detected at configure/compile time. -# -# If EPATCH_SUFFIX is empty, then no period before it is implied when searching -# for patches to apply. -# -# Refer to the other EPATCH_xxx variables for more customization of behavior. -epatch() { - _epatch_draw_line() { - # create a line of same length as input string - [[ -z $1 ]] && set "$(printf "%65s" '')" - echo "${1//?/=}" - } - - unset P4CONFIG P4PORT P4USER # keep perforce at bay #56402 - - # First process options. We localize the EPATCH_OPTS setting - # from above so that we can pass it on in the loop below with - # any additional values the user has specified. - local EPATCH_OPTS=( ${EPATCH_OPTS[*]} ) - while [[ $# -gt 0 ]] ; do - case $1 in - -*) EPATCH_OPTS+=( "$1" ) ;; - *) break ;; - esac - shift - done - - # Let the rest of the code process one user arg at a time -- - # each arg may expand into multiple patches, and each arg may - # need to start off with the default global EPATCH_xxx values - if [[ $# -gt 1 ]] ; then - local m - for m in "$@" ; do - epatch "${m}" - done - return 0 - fi - - local SINGLE_PATCH="no" - # no args means process ${EPATCH_SOURCE} - [[ $# -eq 0 ]] && set -- "${EPATCH_SOURCE}" - - if [[ -f $1 ]] ; then - SINGLE_PATCH="yes" - set -- "$1" - # Use the suffix from the single patch (localize it); the code - # below will find the suffix for us - local EPATCH_SUFFIX=$1 - - elif [[ -d $1 ]] ; then - # We have to force sorting to C so that the wildcard expansion is consistent #471666. - evar_push_set LC_COLLATE C - # Some people like to make dirs of patches w/out suffixes (vim). - set -- "$1"/*${EPATCH_SUFFIX:+."${EPATCH_SUFFIX}"} - evar_pop - - elif [[ -f ${EPATCH_SOURCE}/$1 ]] ; then - # Re-use EPATCH_SOURCE as a search dir - epatch "${EPATCH_SOURCE}/$1" - return $? - - else - # sanity check ... if it isn't a dir or file, wtf man ? - [[ $# -ne 0 ]] && EPATCH_SOURCE=$1 - echo - eerror "Cannot find \$EPATCH_SOURCE! Value for \$EPATCH_SOURCE is:" - eerror - eerror " ${EPATCH_SOURCE}" - eerror " ( ${EPATCH_SOURCE##*/} )" - echo - die "Cannot find \$EPATCH_SOURCE!" - fi - - # Now that we know we're actually going to apply something, merge - # all of the patch options back in to a single variable for below. - EPATCH_OPTS="${EPATCH_COMMON_OPTS} ${EPATCH_OPTS[*]}" - - local PIPE_CMD - case ${EPATCH_SUFFIX##*\.} in - xz) PIPE_CMD="xz -dc" ;; - lzma) PIPE_CMD="lzma -dc" ;; - bz2) PIPE_CMD="bzip2 -dc" ;; - gz|Z|z) PIPE_CMD="gzip -dc" ;; - ZIP|zip) PIPE_CMD="unzip -p" ;; - *) ;; - esac - - [[ ${SINGLE_PATCH} == "no" ]] && einfo "${EPATCH_MULTI_MSG}" - - local x - for x in "$@" ; do - # If the patch dir given contains subdirs, or our EPATCH_SUFFIX - # didn't match anything, ignore continue on - [[ ! -f ${x} ]] && continue - - local patchname=${x##*/} - - # Apply single patches, or forced sets of patches, or - # patches with ARCH dependent names. - # ???_arch_foo.patch - # Else, skip this input altogether - local a=${patchname#*_} # strip the ???_ - a=${a%%_*} # strip the _foo.patch - if ! [[ ${SINGLE_PATCH} == "yes" || \ - ${EPATCH_FORCE} == "yes" || \ - ${a} == all || \ - ${a} == ${ARCH} ]] - then - continue - fi - - # Let people filter things dynamically - if [[ -n ${EPATCH_EXCLUDE}${EPATCH_USER_EXCLUDE} ]] ; then - # let people use globs in the exclude - eshopts_push -o noglob - - local ex - for ex in ${EPATCH_EXCLUDE} ; do - if [[ ${patchname} == ${ex} ]] ; then - einfo " Skipping ${patchname} due to EPATCH_EXCLUDE ..." - eshopts_pop - continue 2 - fi - done - - for ex in ${EPATCH_USER_EXCLUDE} ; do - if [[ ${patchname} == ${ex} ]] ; then - einfo " Skipping ${patchname} due to EPATCH_USER_EXCLUDE ..." - eshopts_pop - continue 2 - fi - done - - eshopts_pop - fi - - if [[ ${SINGLE_PATCH} == "yes" ]] ; then - ebegin "Applying ${patchname}" - else - ebegin " ${patchname}" - fi - - # Handle aliased patch command #404447 #461568 - local patch="patch" - eval $(alias patch 2>/dev/null | sed 's:^alias ::') - - # most of the time, there will only be one run per unique name, - # but if there are more, make sure we get unique log filenames - local STDERR_TARGET="${T}/${patchname}.out" - if [[ -e ${STDERR_TARGET} ]] ; then - STDERR_TARGET="${T}/${patchname}-$$.out" - fi - - printf "***** %s *****\nPWD: %s\nPATCH TOOL: %s -> %s\nVERSION INFO:\n%s\n\n" \ - "${patchname}" \ - "${PWD}" \ - "${patch}" \ - "$(type -P "${patch}")" \ - "$(${patch} --version)" \ - > "${STDERR_TARGET}" - - # Decompress the patch if need be - local count=0 - local PATCH_TARGET - if [[ -n ${PIPE_CMD} ]] ; then - PATCH_TARGET="${T}/$$.patch" - echo "PIPE_COMMAND: ${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> "${STDERR_TARGET}" - - if ! (${PIPE_CMD} "${x}" > "${PATCH_TARGET}") >> "${STDERR_TARGET}" 2>&1 ; then - echo - eerror "Could not extract patch!" - #die "Could not extract patch!" - count=5 - break - fi - else - PATCH_TARGET=${x} - fi - - # Check for absolute paths in patches. If sandbox is disabled, - # people could (accidentally) patch files in the root filesystem. - # Or trigger other unpleasantries #237667. So disallow -p0 on - # such patches. - local abs_paths=$(grep -E -n '^[-+]{3} /' "${PATCH_TARGET}" | awk '$2 != "/dev/null" { print }') - if [[ -n ${abs_paths} ]] ; then - count=1 - printf "NOTE: skipping -p0 due to absolute paths in patch:\n%s\n" "${abs_paths}" >> "${STDERR_TARGET}" - fi - # Similar reason, but with relative paths. - local rel_paths=$(grep -E -n '^[-+]{3} [^ ]*[.][.]/' "${PATCH_TARGET}") - if [[ -n ${rel_paths} ]] ; then - echo - eerror "Rejected Patch: ${patchname}!" - eerror " ( ${PATCH_TARGET} )" - eerror - eerror "Your patch uses relative paths '../':" - eerror "${rel_paths}" - echo - die "you need to fix the relative paths in patch" - fi - - # Dynamically detect the correct -p# ... i'm lazy, so shoot me :/ - local patch_cmd - while [[ ${count} -lt 5 ]] ; do - patch_cmd="${patch} -p${count} ${EPATCH_OPTS}" - - # Generate some useful debug info ... - ( - _epatch_draw_line "***** ${patchname} *****" - echo - echo "PATCH COMMAND: ${patch_cmd} --dry-run -f < '${PATCH_TARGET}'" - echo - _epatch_draw_line "***** ${patchname} *****" - ${patch_cmd} --dry-run -f < "${PATCH_TARGET}" 2>&1 - ret=$? - echo - echo "patch program exited with status ${ret}" - exit ${ret} - ) >> "${STDERR_TARGET}" - - if [ $? -eq 0 ] ; then - ( - _epatch_draw_line "***** ${patchname} *****" - echo - echo "ACTUALLY APPLYING ${patchname} ..." - echo "PATCH COMMAND: ${patch_cmd} < '${PATCH_TARGET}'" - echo - _epatch_draw_line "***** ${patchname} *****" - ${patch_cmd} < "${PATCH_TARGET}" 2>&1 - ret=$? - echo - echo "patch program exited with status ${ret}" - exit ${ret} - ) >> "${STDERR_TARGET}" - - if [ $? -ne 0 ] ; then - echo - eerror "A dry-run of patch command succeeded, but actually" - eerror "applying the patch failed!" - #die "Real world sux compared to the dreamworld!" - count=5 - fi - break - fi - - : $(( count++ )) - done - - (( EPATCH_N_APPLIED_PATCHES++ )) - - # if we had to decompress the patch, delete the temp one - if [[ -n ${PIPE_CMD} ]] ; then - rm -f "${PATCH_TARGET}" - fi - - if [[ ${count} -ge 5 ]] ; then - echo - eerror "Failed patch: ${patchname}!" - eerror " ( ${PATCH_TARGET} )" - eerror - eerror "Include in your bug report the contents of:" - eerror - eerror " ${STDERR_TARGET}" - echo - die "Failed patch: ${patchname}!" - fi - - # if everything worked, delete the full debug patch log - rm -f "${STDERR_TARGET}" - - # then log away the exact stuff for people to review later - cat <<-EOF >> "${T}/epatch.log" - PATCH: ${x} - CMD: ${patch_cmd} - PWD: ${PWD} - - EOF - eend 0 - done - - [[ ${SINGLE_PATCH} == "no" ]] && einfo "Done with patching" - : # everything worked -} - -_EPATCH_ECLASS=1 -fi #_EPATCH_ECLASS diff --git a/sdk_container/src/third_party/portage-stable/eclass/eutils.eclass b/sdk_container/src/third_party/portage-stable/eclass/eutils.eclass deleted file mode 100644 index bdcc7e110f..0000000000 --- a/sdk_container/src/third_party/portage-stable/eclass/eutils.eclass +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 1999-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# @ECLASS: eutils.eclass -# @MAINTAINER: -# base-system@gentoo.org -# @SUPPORTED_EAPIS: 6 -# @BLURB: many extra (but common) functions that are used in ebuilds -# @DEPRECATED: native package manager functions, more specific eclasses -# @DEAD - -if [[ -z ${_EUTILS_ECLASS} ]]; then -_EUTILS_ECLASS=1 - -# implicitly inherited (now split) eclasses -case ${EAPI} in - 6) inherit desktop edos2unix epatch eqawarn estack ltprune multilib \ - preserve-libs strip-linguas toolchain-funcs vcs-clean wrapper ;; - *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; -esac -fi diff --git a/sdk_container/src/third_party/portage-stable/eclass/ltprune.eclass b/sdk_container/src/third_party/portage-stable/eclass/ltprune.eclass deleted file mode 100644 index 51f5aaabfe..0000000000 --- a/sdk_container/src/third_party/portage-stable/eclass/ltprune.eclass +++ /dev/null @@ -1,177 +0,0 @@ -# Copyright 1999-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# @DEAD -# @ECLASS: ltprune.eclass -# @MAINTAINER: -# Michał Górny -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 -# @BLURB: Smart .la file pruning -# @DEPRECATED: none -# @DESCRIPTION: -# A function to locate and remove unnecessary .la files. -# -# Discouraged. Whenever possible, please use much simpler: -# @CODE -# find "${ED}" -type f -name '*.la' -delete || die -# @CODE - -if [[ -z ${_LTPRUNE_ECLASS} ]]; then - -case ${EAPI:-0} in - 0|1|2|3|4|5|6) - ;; - *) - die "${ECLASS}: banned in EAPI=${EAPI}; use 'find' instead";; -esac - -inherit toolchain-funcs - -# @FUNCTION: prune_libtool_files -# @USAGE: [--all|--modules] -# @DESCRIPTION: -# Locate unnecessary libtool files (.la) and libtool static archives -# (.a) and remove them from installation image. -# -# By default, .la files are removed whenever the static linkage can -# either be performed using pkg-config or doesn't introduce additional -# flags. -# -# If '--modules' argument is passed, .la files for modules (plugins) are -# removed as well. This is usually useful when the package installs -# plugins and the plugin loader does not use .la files. -# -# If '--all' argument is passed, all .la files are removed without -# performing any heuristic on them. You shouldn't ever use that, -# and instead report a bug in the algorithm instead. -# -# The .a files are only removed whenever corresponding .la files state -# that they should not be linked to, i.e. whenever these files -# correspond to plugins. -# -# Note: if your package installs both static libraries and .pc files -# which use variable substitution for -l flags, you need to add -# pkg-config to your DEPEND. -prune_libtool_files() { - debug-print-function ${FUNCNAME} "$@" - - local removing_all removing_modules opt - for opt; do - case "${opt}" in - --all) - removing_all=1 - removing_modules=1 - ;; - --modules) - removing_modules=1 - ;; - *) - die "Invalid argument to ${FUNCNAME}(): ${opt}" - esac - done - - local f - local queue=() - while IFS= read -r -d '' f; do # for all .la files - local archivefile=${f/%.la/.a} - - # The following check is done by libtool itself. - # It helps us avoid removing random files which match '*.la', - # see bug #468380. - if ! sed -n -e '/^# Generated by .*libtool/q0;4q1' "${f}"; then - continue - fi - - [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed' - local reason= pkgconfig_scanned= - local snotlink=$(sed -n -e 's:^shouldnotlink=::p' "${f}") - - if [[ ${snotlink} == yes ]]; then - - # Remove static libs we're not supposed to link against. - if [[ -f ${archivefile} ]]; then - einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)" - queue+=( "${archivefile}" ) - fi - - # The .la file may be used by a module loader, so avoid removing it - # unless explicitly requested. - if [[ ${removing_modules} ]]; then - reason='module' - fi - - else - - # Remove .la files when: - # - user explicitly wants us to remove all .la files, - # - respective static archive doesn't exist, - # - they are covered by a .pc file already, - # - they don't provide any new information (no libs & no flags). - - if [[ ${removing_all} ]]; then - reason='requested' - elif [[ ! -f ${archivefile} ]]; then - reason='no static archive' - elif [[ ! $(sed -nre \ - "s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" \ - "${f}") ]]; then - reason='no libs & flags' - else - if [[ ! ${pkgconfig_scanned} ]]; then - # Create a list of all .pc-covered libs. - local pc_libs=() - if [[ ! ${removing_all} ]]; then - local pc - local tf=${T}/prune-lt-files.pc - local pkgconf=$(tc-getPKG_CONFIG) - - while IFS= read -r -d '' pc; do # for all .pc files - local arg libs - - # Use pkg-config if available (and works), - # fallback to sed. - if ${pkgconf} --exists "${pc}" &>/dev/null; then - sed -e '/^Requires:/d' "${pc}" > "${tf}" - libs=$(${pkgconf} --libs "${tf}") - else - libs=$(sed -ne 's/^Libs://p' "${pc}") - fi - - for arg in ${libs}; do - if [[ ${arg} == -l* ]]; then - if [[ ${arg} == '*$*' ]]; then - eerror "${FUNCNAME}: variable substitution likely failed in ${pc}" - eerror "(arg: ${arg})" - eerror "Most likely, you need to add virtual/pkgconfig to DEPEND." - die "${FUNCNAME}: unsubstituted variable found in .pc" - fi - - pc_libs+=( lib${arg#-l}.la ) - fi - done - done < <(find "${D}" -type f -name '*.pc' -print0) - - rm -f "${tf}" - fi - - pkgconfig_scanned=1 - fi # pkgconfig_scanned - - has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc' - fi # removal due to .pc - - fi # shouldnotlink==no - - if [[ ${reason} ]]; then - einfo "Removing unnecessary ${f#${D%/}} (${reason})" - queue+=( "${f}" ) - fi - done < <(find "${D}" -xtype f -name '*.la' -print0) - - if [[ ${queue[@]} ]]; then - rm -f "${queue[@]}" - fi -} - -_LTPRUNE_ECLASS=1 -fi #_LTPRUNE_ECLASS