summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-02-10 21:05:55 +0000
committerV3n3RiX <venerix@redcorelinux.org>2020-02-10 21:05:55 +0000
commit71deace00d1a2b091313fe137ab7092418c6f87c (patch)
tree9f1f0dee23e13658e52f49437befe78427148c51 /eclass
parent29aabba0ea759c6a2864ff5631735b67ee38e5e0 (diff)
gentoo resync : 10.02.2020
Diffstat (limited to 'eclass')
-rw-r--r--eclass/Manifest.gzbin36791 -> 36636 bytes
-rw-r--r--eclass/distutils-r1.eclass38
-rw-r--r--eclass/epunt-cxx.eclass4
-rw-r--r--eclass/fox.eclass232
-rw-r--r--eclass/git-2.eclass613
-rw-r--r--eclass/latex-package.eclass136
-rw-r--r--eclass/python-single-r1.eclass161
-rw-r--r--eclass/rpm.eclass2
-rw-r--r--eclass/scons-utils.eclass7
-rwxr-xr-xeclass/tests/distutils-r1.sh12
-rw-r--r--eclass/texlive-common.eclass78
-rw-r--r--eclass/texlive-module.eclass176
-rw-r--r--eclass/toolchain.eclass76
-rw-r--r--eclass/user-info.eclass158
-rw-r--r--eclass/user.eclass149
15 files changed, 451 insertions, 1391 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz
index f09bce481c81..7a149c7af13e 100644
--- a/eclass/Manifest.gz
+++ b/eclass/Manifest.gz
Binary files differ
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index a840769cdecf..e546aadfa4a7 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.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: distutils-r1.eclass
@@ -117,15 +117,23 @@ _distutils_set_globals() {
local rdep=${PYTHON_DEPS}
local bdep=${rdep}
+ if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+ local sdep="dev-python/setuptools[${PYTHON_USEDEP}]"
+ else
+ local sdep="$(python_gen_cond_dep '
+ dev-python/setuptools[${PYTHON_MULTI_USEDEP}]
+ ')"
+ fi
+
case ${DISTUTILS_USE_SETUPTOOLS} in
no|manual)
;;
bdepend)
- bdep+=" dev-python/setuptools[${PYTHON_USEDEP}]"
+ bdep+=" ${sdep}"
;;
rdepend)
- bdep+=" dev-python/setuptools[${PYTHON_USEDEP}]"
- rdep+=" dev-python/setuptools[${PYTHON_USEDEP}]"
+ bdep+=" ${sdep}"
+ rdep+=" ${sdep}"
;;
*)
die "Invalid DISTUTILS_USE_SETUPTOOLS=${DISTUTILS_USE_SETUPTOOLS}"
@@ -387,16 +395,16 @@ distutils_enable_tests() {
debug-print-function ${FUNCNAME} "${@}"
[[ ${#} -eq 1 ]] || die "${FUNCNAME} takes exactly one argument: test-runner"
- local test_deps
+ local test_pkg
case ${1} in
nose)
- test_deps="dev-python/nose[${PYTHON_USEDEP}]"
+ test_pkg="dev-python/nose"
python_test() {
nosetests -v || die "Tests fail with ${EPYTHON}"
}
;;
pytest)
- test_deps="dev-python/pytest[${PYTHON_USEDEP}]"
+ test_pkg="dev-python/pytest"
python_test() {
pytest -vv || die "Tests fail with ${EPYTHON}"
}
@@ -416,13 +424,23 @@ distutils_enable_tests() {
die "${FUNCNAME}: unsupported argument: ${1}"
esac
- if [[ -n ${test_deps} || -n ${RDEPEND} ]]; then
+ local test_deps=${RDEPEND}
+ if [[ -n ${test_pkg} ]]; then
+ if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+ test_deps+=" ${test_pkg}[${PYTHON_USEDEP}]"
+ else
+ test_deps+=" $(python_gen_cond_dep "
+ ${test_pkg}[\${PYTHON_MULTI_USEDEP}]
+ ")"
+ fi
+ fi
+ if [[ -n ${test_deps} ]]; then
IUSE+=" test"
RESTRICT+=" !test? ( test )"
if [[ ${EAPI} == [56] ]]; then
- DEPEND+=" test? ( ${test_deps} ${RDEPEND} )"
+ DEPEND+=" test? ( ${test_deps} )"
else
- BDEPEND+=" test? ( ${test_deps} ${RDEPEND} )"
+ BDEPEND+=" test? ( ${test_deps} )"
fi
fi
diff --git a/eclass/epunt-cxx.eclass b/eclass/epunt-cxx.eclass
index 30802af340b0..1696faea0134 100644
--- a/eclass/epunt-cxx.eclass
+++ b/eclass/epunt-cxx.eclass
@@ -1,6 +1,10 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+# @DEAD
+# No consumers, this eclass is not useful anymore, as a functioning
+# C++ compiler is required nowadays. Removal in 15 days.
+
# @ECLASS: epunt-cxx.eclass
# @MAINTAINER:
# base-system@gentoo.org
diff --git a/eclass/fox.eclass b/eclass/fox.eclass
deleted file mode 100644
index b40f8273d15c..000000000000
--- a/eclass/fox.eclass
+++ /dev/null
@@ -1,232 +0,0 @@
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-# @DEAD
-# All consumers were last rited. Removal in 30 days.
-
-# @ECLASS: fox.eclass
-# @MAINTAINER:
-# maintainer-needed@gentoo.org
-# @BLURB: Functionality required the FOX Toolkit and it's applications
-# @DESCRIPTION:
-# This eclass allows building SLOT-able FOX Toolkit installations
-# (x11-libs/fox: headers, libs, and docs), which are by design
-# parallel-installable, while installing only one version of the utils
-# (dev-util/reswrap) and apps (app-editors/adie, sci-calculators/calculator,
-# x11-misc/pathfinder, and x11-misc/shutterbug).
-#
-# Version numbering follows the kernel-style odd-even minor version
-# designation. Even-number minor versions are API stable, which patch
-# releases aimed mostly at the library; apps generally won't need to be
-# bumped for a patch release.
-#
-# Odd-number versions are development branches with their own SLOT and
-# are API unstable; changes are made to the apps, and likely need to be
-# bumped together with the library.
-#
-# Here are sample [R]DEPENDs for the fox apps
-# 1.6: 'x11-libs/fox:1.6'
-# 1.7: '~x11-libs/fox-${PV}'
-#
-# EAPI phase trickery borrowed from enlightenment.eclass
-
-inherit autotools versionator desktop
-
-
-FOX_EXPF="src_unpack src_compile src_install pkg_postinst"
-case "${EAPI:-0}" in
- 2|3|4|5) FOX_EXPF+=" src_prepare src_configure" ;;
- *) ;;
-esac
-EXPORT_FUNCTIONS ${FOX_EXPF}
-
-# @ECLASS-VARIABLE: FOX_PV
-# @DESCRIPTION:
-# The version of the FOX Toolkit provided or required by the package
-: ${FOX_PV:=${PV}}
-
-# @ECLASS-VARIABLE: FOXVER
-# @INTERNAL
-# @DESCRIPTION:
-# The major.minor version of FOX_PV, usually acts as $SLOT and is used in
-# building the applications
-FOXVER=$(get_version_component_range 1-2 ${FOX_PV})
-
-# @ECLASS-VARIABLE: FOX_APPS
-# @INTERNAL
-# @DESCRIPTION:
-# The applications originally packaged in the FOX Toolkit
-FOX_APPS="adie calculator pathfinder shutterbug"
-
-# @ECLASS-VARIABLE: FOXCONF
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Set this to add additional configuration options during src_configure
-
-DESCRIPTION="C++ Toolkit for developing Graphical User Interfaces easily and effectively"
-HOMEPAGE="http://www.fox-toolkit.org/"
-SRC_URI="ftp://ftp.fox-toolkit.org/pub/fox-${FOX_PV}.tar.gz"
-
-IUSE="debug doc profile"
-
-if [[ ${PN} != fox ]] ; then
- FOX_COMPONENT="${FOX_COMPONENT:-${PN}}"
-fi
-
-if [[ -z ${FOX_COMPONENT} ]] ; then
- DOXYGEN_DEP="doc? ( app-doc/doxygen )"
-fi
-
-if [[ ${PN} != reswrap ]] ; then
- RESWRAP_DEP="dev-util/reswrap"
-fi
-
-DEPEND="${DOXYGEN_DEP}
- ${RESWRAP_DEP}
- >=sys-apps/sed-4"
-
-S="${WORKDIR}/fox-${FOX_PV}"
-
-fox_src_unpack() {
- unpack ${A}
- cd "${S}"
-
- has src_prepare ${FOX_EXPF} || fox_src_prepare
-}
-
-fox_src_prepare() {
- # fox changed from configure.in to configure.am in 1.6.38
- local confFile="configure.ac"
- [[ -r "configure.in" ]] && confFile="configure.in"
-
- # Respect system CXXFLAGS
- sed -i -e 's:CXXFLAGS=""::' $confFile || die "sed ${confFile} error"
-
- # don't strip binaries
- sed -i -e '/LDFLAGS="-s ${LDFLAGS}"/d' $confFile || die "sed ${confFile} error"
-
- # don't build apps from top-level (i.e. x11-libs/fox)
- # utils == reswrap
- local d
- for d in ${FOX_APPS} utils windows ; do
- sed -i -e "s:${d}::" Makefile.am || die "sed Makefile.am error"
- done
-
- # use the installed reswrap for everything else
- for d in ${FOX_APPS} chart controlpanel tests ; do
- [[ -d ${d} ]] &&
- (sed -i -e 's:$(top_builddir)/utils/reswrap:reswrap:' \
- ${d}/Makefile.am || die "sed ${d}/Makefile.am error")
- done
-
- # use the installed headers and library for apps
- for d in ${FOX_APPS} ; do
- sed -i \
- -e "s:-I\$(top_srcdir)/include -I\$(top_builddir)/include:-I\$(includedir)/fox-${FOXVER}:" \
- -e 's:$(top_builddir)/src/libFOX:-lFOX:' \
- -e 's:$(top_builddir)/lib/libFOX:-lFOX:' \
- -e 's:\.la::' \
- ${d}/Makefile.am || die "sed ${d}/Makefile.am error"
- done
-
- eautoreconf
-}
-
-fox_src_configure() {
- use debug && FOXCONF+=" --enable-debug" \
- || FOXCONF+=" --enable-release"
-
- econf ${FOXCONF} \
- $(use_with profile profiling)
-}
-
-
-fox_src_compile() {
- has src_configure ${FOX_EXPF} || fox_src_configure
-
- cd "${S}/${FOX_COMPONENT}"
- emake || die "compile error"
-
- # build class reference docs (FOXVER >= 1.2)
- if use doc && [[ -z ${FOX_COMPONENT} ]] ; then
- emake -C "${S}"/doc docs || die "doxygen error"
- fi
-}
-
-fox_src_install() {
- cd "${S}/${FOX_COMPONENT}"
-
- emake install \
- DESTDIR="${D}" \
- htmldir=/usr/share/doc/${PF}/html \
- artdir=/usr/share/doc/${PF}/html/art \
- screenshotsdir=/usr/share/doc/${PF}/html/screenshots \
- || die "install error"
-
- # create desktop menu items for apps
- case ${FOX_COMPONENT} in
- adie)
- newicon big_gif.gif adie.gif
- make_desktop_entry adie "Adie Text Editor" adie.gif
- ;;
- calculator)
- newicon bigcalc.gif foxcalc.gif
- make_desktop_entry calculator "FOX Calculator" foxcalc.gif
- ;;
- pathfinder)
- newicon iconpath.gif pathfinder.gif
- make_desktop_entry PathFinder "PathFinder" pathfinder.gif "FileManager"
- ;;
- shutterbug)
- doicon shutterbug.gif
- make_desktop_entry shutterbug "ShutterBug" shutterbug.gif "Graphics"
- ;;
- esac
-
- for doc in ADDITIONS AUTHORS LICENSE_ADDENDUM README TRACING ; do
- [ -f $doc ] && dodoc $doc
- done
-
- # remove documentation if USE=-doc
- use doc || rm -fr "${D}/usr/share/doc/${PF}/html"
-
- # install class reference docs if USE=doc
- if use doc && [[ -z ${FOX_COMPONENT} ]] ; then
- dohtml -r "${S}/doc/ref"
- fi
-
- # slot fox-config
- if [[ -f ${D}/usr/bin/fox-config ]] ; then
- mv "${D}/usr/bin/fox-config" "${D}/usr/bin/fox-${FOXVER}-config" \
- || die "failed to install fox-config"
- fi
-}
-
-fox_pkg_postinst() {
- if [ -z "${FOX_COMPONENT}" ] ; then
- echo
- einfo "Multiple versions of the FOX Toolkit library may now be installed"
- einfo "in parallel SLOTs on the same system."
- einfo
- einfo "The reswrap utility and the applications included in the FOX Toolkit"
- einfo "(adie, calculator, pathfinder, shutterbug) are now available as"
- einfo "separate ebuilds."
- echo
-
- if version_is_at_least "1.7.25"; then
- einfo "Fox versions after 1.7.25 ships a pkg-config file called fox17.pc"
- einfo "instead of the previous fox-config tool."
- einfo "You now get all info via pkg-config:"
- einfo
- einfo "pkg-config fox17 --libs (etc.)"
- else
- einfo "The fox-config script has been installed as fox-${FOXVER}-config."
- einfo "The fox-wrapper package is used to direct calls to fox-config"
- einfo "to the correct versioned script, based on the WANT_FOX variable."
- einfo "For example:"
- einfo
- einfo " WANT_FOX=\"${FOXVER}\" fox-config <options>"
- fi
- einfo
- fi
-}
diff --git a/eclass/git-2.eclass b/eclass/git-2.eclass
deleted file mode 100644
index ecc260d0e9b2..000000000000
--- a/eclass/git-2.eclass
+++ /dev/null
@@ -1,613 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# @DEAD
-# All consumers were last rited. Removal in 14 days.
-
-# @ECLASS: git-2.eclass
-# @MAINTAINER:
-# maintainer-needed@gentoo.org
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5
-# @BLURB: Eclass for fetching and unpacking git repositories.
-# @DESCRIPTION:
-# Eclass for easing maintenance of live ebuilds using git as remote repository.
-# Eclass support working with git submodules and branching.
-#
-# This eclass is DEPRECATED. Please use git-r3 instead.
-
-case ${EAPI:-0} in
- 0|1|2|3|4|5) ;;
- *) die "${ECLASS}.eclass is banned in EAPI ${EAPI}";;
-esac
-
-# This eclass support all EAPIs.
-EXPORT_FUNCTIONS src_unpack
-
-PROPERTIES+=" live"
-
-DEPEND="dev-vcs/git"
-
-# @ECLASS-VARIABLE: EGIT_SOURCEDIR
-# @DESCRIPTION:
-# This variable specifies destination where the cloned
-# data are copied to.
-#
-# EGIT_SOURCEDIR="${S}"
-
-# @ECLASS-VARIABLE: EGIT_STORE_DIR
-# @DESCRIPTION:
-# Storage directory for git sources.
-#
-# EGIT_STORE_DIR="${DISTDIR}/egit-src"
-
-# @ECLASS-VARIABLE: EGIT_HAS_SUBMODULES
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# If non-empty this variable enables support for git submodules in our
-# checkout. Also this makes the checkout to be non-bare for now.
-
-# @ECLASS-VARIABLE: EGIT_OPTIONS
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Variable specifying additional options for fetch command.
-
-# @ECLASS-VARIABLE: EGIT_MASTER
-# @DESCRIPTION:
-# Variable for specifying master branch.
-# Useful when upstream don't have master branch or name it differently.
-#
-# EGIT_MASTER="master"
-
-# @ECLASS-VARIABLE: EGIT_PROJECT
-# @DESCRIPTION:
-# Variable specifying name for the folder where we check out the git
-# repository. Value of this variable should be unique in the
-# EGIT_STORE_DIR as otherwise you would override another repository.
-#
-# EGIT_PROJECT="${EGIT_REPO_URI##*/}"
-
-# @ECLASS-VARIABLE: EGIT_DIR
-# @DESCRIPTION:
-# Directory where we want to store the git data.
-# This variable should not be overridden.
-#
-# EGIT_DIR="${EGIT_STORE_DIR}/${EGIT_PROJECT}"
-
-# @ECLASS-VARIABLE: EGIT_REPO_URI
-# @REQUIRED
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# URI for the repository
-# e.g. http://foo, git://bar
-#
-# It can be overridden via env using packagename_LIVE_REPO
-# variable.
-#
-# Support multiple values:
-# EGIT_REPO_URI="git://a/b.git http://c/d.git"
-
-# @ECLASS-VARIABLE: EVCS_OFFLINE
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# If non-empty this variable prevents performance of any online
-# operations.
-
-# @ECLASS-VARIABLE: EGIT_BRANCH
-# @DESCRIPTION:
-# Variable containing branch name we want to check out.
-# It can be overridden via env using packagename_LIVE_BRANCH
-# variable.
-#
-# EGIT_BRANCH="${EGIT_MASTER}"
-
-# @ECLASS-VARIABLE: EGIT_COMMIT
-# @DESCRIPTION:
-# Variable containing commit hash/tag we want to check out.
-# It can be overridden via env using packagename_LIVE_COMMIT
-# variable.
-#
-# EGIT_COMMIT="${EGIT_BRANCH}"
-
-# @ECLASS-VARIABLE: EGIT_REPACK
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# If non-empty this variable specifies that repository will be repacked to
-# save space. However this can take a REALLY LONG time with VERY big
-# repositories.
-
-# @ECLASS-VARIABLE: EGIT_PRUNE
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# If non-empty this variable enables pruning all loose objects on each fetch.
-# This is useful if upstream rewinds and rebases branches often.
-
-# @ECLASS-VARIABLE: EGIT_NONBARE
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# If non-empty this variable specifies that all checkouts will be done using
-# non bare repositories. This is useful if you can't operate with bare
-# checkouts for some reason.
-
-# @ECLASS-VARIABLE: EGIT_NOUNPACK
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# If non-empty this variable bans unpacking of ${A} content into the srcdir.
-# Default behavior is to unpack ${A} content.
-
-# @FUNCTION: git-2_init_variables
-# @INTERNAL
-# @DESCRIPTION:
-# Internal function initializing all git variables.
-# We define it in function scope so user can define
-# all the variables before and after inherit.
-git-2_init_variables() {
- debug-print-function ${FUNCNAME} "$@"
-
- local esc_pn liverepo livebranch livecommit
- esc_pn=${PN//[-+]/_}
-
- : ${EGIT_SOURCEDIR="${S}"}
-
- : ${EGIT_STORE_DIR:="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/egit-src"}
-
- : ${EGIT_HAS_SUBMODULES:=}
-
- : ${EGIT_OPTIONS:=}
-
- : ${EGIT_MASTER:=master}
-
- liverepo=${esc_pn}_LIVE_REPO
- EGIT_REPO_URI=${!liverepo:-${EGIT_REPO_URI}}
- [[ ${EGIT_REPO_URI} ]] || die "EGIT_REPO_URI must have some value"
-
- : ${EVCS_OFFLINE:=}
-
- livebranch=${esc_pn}_LIVE_BRANCH
- [[ ${!livebranch} ]] && ewarn "QA: using \"${esc_pn}_LIVE_BRANCH\" variable, you won't get any support"
- EGIT_BRANCH=${!livebranch:-${EGIT_BRANCH:-${EGIT_MASTER}}}
-
- livecommit=${esc_pn}_LIVE_COMMIT
- [[ ${!livecommit} ]] && ewarn "QA: using \"${esc_pn}_LIVE_COMMIT\" variable, you won't get any support"
- EGIT_COMMIT=${!livecommit:-${EGIT_COMMIT:-${EGIT_BRANCH}}}
-
- : ${EGIT_REPACK:=}
-
- : ${EGIT_PRUNE:=}
-}
-
-# @FUNCTION: git-2_submodules
-# @INTERNAL
-# @DESCRIPTION:
-# Internal function wrapping the submodule initialisation and update.
-git-2_submodules() {
- debug-print-function ${FUNCNAME} "$@"
- if [[ ${EGIT_HAS_SUBMODULES} ]]; then
- if [[ ${EVCS_OFFLINE} ]]; then
- # for submodules operations we need to be online
- debug-print "${FUNCNAME}: not updating submodules in offline mode"
- return 1
- fi
-
- debug-print "${FUNCNAME}: working in \"${1}\""
- pushd "${EGIT_DIR}" > /dev/null || die
-
- debug-print "${FUNCNAME}: git submodule init"
- git submodule init || die
- debug-print "${FUNCNAME}: git submodule sync"
- git submodule sync || die
- debug-print "${FUNCNAME}: git submodule update"
- git submodule update || die
-
- popd > /dev/null || die
- fi
-}
-
-# @FUNCTION: git-2_branch
-# @INTERNAL
-# @DESCRIPTION:
-# Internal function that changes branch for the repo based on EGIT_COMMIT and
-# EGIT_BRANCH variables.
-git-2_branch() {
- debug-print-function ${FUNCNAME} "$@"
-
- local branchname src
-
- debug-print "${FUNCNAME}: working in \"${EGIT_SOURCEDIR}\""
- pushd "${EGIT_SOURCEDIR}" > /dev/null || die
-
- local branchname=branch-${EGIT_BRANCH} src=origin/${EGIT_BRANCH}
- if [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]]; then
- branchname=tree-${EGIT_COMMIT}
- src=${EGIT_COMMIT}
- fi
- debug-print "${FUNCNAME}: git checkout -b ${branchname} ${src}"
- git checkout -b ${branchname} ${src} \
- || die "${FUNCNAME}: changing the branch failed"
-
- popd > /dev/null || die
-}
-
-# @FUNCTION: git-2_gc
-# @INTERNAL
-# @DESCRIPTION:
-# Internal function running garbage collector on checked out tree.
-git-2_gc() {
- debug-print-function ${FUNCNAME} "$@"
-
- local args
-
- if [[ ${EGIT_REPACK} || ${EGIT_PRUNE} ]]; then
- pushd "${EGIT_DIR}" > /dev/null || die
- ebegin "Garbage collecting the repository"
- [[ ${EGIT_PRUNE} ]] && args='--prune'
- debug-print "${FUNCNAME}: git gc ${args}"
- git gc ${args}
- eend $?
- popd > /dev/null || die
- fi
-}
-
-# @FUNCTION: git-2_prepare_storedir
-# @INTERNAL
-# @DESCRIPTION:
-# Internal function preparing directory where we are going to store SCM
-# repository.
-git-2_prepare_storedir() {
- debug-print-function ${FUNCNAME} "$@"
-
- local clone_dir
-
- # initial clone, we have to create master git storage directory and play
- # nicely with sandbox
- if [[ ! -d ${EGIT_STORE_DIR} ]]; then
- debug-print "${FUNCNAME}: Creating git main storage directory"
- addwrite /
- mkdir -m 775 -p "${EGIT_STORE_DIR}" \
- || die "${FUNCNAME}: can't mkdir \"${EGIT_STORE_DIR}\""
- fi
-
- # allow writing into EGIT_STORE_DIR
- addwrite "${EGIT_STORE_DIR}"
-
- # calculate git.eclass store dir for data
- # We will try to clone the old repository,
- # and we will remove it if we don't need it anymore.
- EGIT_OLD_CLONE=
- if [[ ${EGIT_STORE_DIR} == */egit-src ]]; then
- local old_store_dir=${EGIT_STORE_DIR/%egit-src/git-src}
- local old_location=${old_store_dir}/${EGIT_PROJECT:-${PN}}
-
- if [[ -d ${old_location} ]]; then
- EGIT_OLD_CLONE=${old_location}
- # required to remove the old clone
- addwrite "${old_store_dir}"
- fi
- fi
-
- # calculate the proper store dir for data
- # If user didn't specify the EGIT_DIR, we check if he did specify
- # the EGIT_PROJECT or get the folder name from EGIT_REPO_URI.
- EGIT_REPO_URI=${EGIT_REPO_URI%/}
- if [[ ! ${EGIT_DIR} ]]; then
- if [[ ${EGIT_PROJECT} ]]; then
- clone_dir=${EGIT_PROJECT}
- else
- local strippeduri=${EGIT_REPO_URI%/.git}
- clone_dir=${strippeduri##*/}
- fi
- EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir}
-
- if [[ ${EGIT_OLD_CLONE} && ! -d ${EGIT_DIR} ]]; then
- elog "${FUNCNAME}: ${CATEGORY}/${PF} will be cloned from old location."
- elog "It will be necessary to rebuild the package to fetch updates."
- EGIT_REPO_URI="${EGIT_OLD_CLONE} ${EGIT_REPO_URI}"
- fi
- fi
- export EGIT_DIR=${EGIT_DIR}
- debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"."
-}
-
-# @FUNCTION: git-2_move_source
-# @INTERNAL
-# @DESCRIPTION:
-# Internal function moving sources from the EGIT_DIR to EGIT_SOURCEDIR dir.
-git-2_move_source() {
- debug-print-function ${FUNCNAME} "$@"
-
- debug-print "${FUNCNAME}: ${MOVE_COMMAND} \"${EGIT_DIR}\" \"${EGIT_SOURCEDIR}\""
- pushd "${EGIT_DIR}" > /dev/null || die
- mkdir -p "${EGIT_SOURCEDIR}" \
- || die "${FUNCNAME}: failed to create ${EGIT_SOURCEDIR}"
- ${MOVE_COMMAND} "${EGIT_SOURCEDIR}" \
- || die "${FUNCNAME}: sync to \"${EGIT_SOURCEDIR}\" failed"
- popd > /dev/null || die
-}
-
-# @FUNCTION: git-2_initial_clone
-# @INTERNAL
-# @DESCRIPTION:
-# Internal function running initial clone on specified repo_uri.
-git-2_initial_clone() {
- debug-print-function ${FUNCNAME} "$@"
-
- local repo_uri
-
- EGIT_REPO_URI_SELECTED=""
- for repo_uri in ${EGIT_REPO_URI}; do
- debug-print "${FUNCNAME}: git clone ${EGIT_LOCAL_OPTIONS} \"${repo_uri}\" \"${EGIT_DIR}\""
- if git clone ${EGIT_LOCAL_OPTIONS} "${repo_uri}" "${EGIT_DIR}"; then
- # global variable containing the repo_name we will be using
- debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\""
- EGIT_REPO_URI_SELECTED="${repo_uri}"
- break
- fi
- done
-
- [[ ${EGIT_REPO_URI_SELECTED} ]] \
- || die "${FUNCNAME}: can't fetch from ${EGIT_REPO_URI}"
-}
-
-# @FUNCTION: git-2_update_repo
-# @INTERNAL
-# @DESCRIPTION:
-# Internal function running update command on specified repo_uri.
-git-2_update_repo() {
- debug-print-function ${FUNCNAME} "$@"
-
- local repo_uri
-
- if [[ ${EGIT_LOCAL_NONBARE} ]]; then
- # checkout master branch and drop all other local branches
- git checkout ${EGIT_MASTER} || die "${FUNCNAME}: can't checkout master branch ${EGIT_MASTER}"
- for x in $(git branch | grep -v "* ${EGIT_MASTER}" | tr '\n' ' '); do
- debug-print "${FUNCNAME}: git branch -D ${x}"
- git branch -D ${x} > /dev/null
- done
- fi
-
- EGIT_REPO_URI_SELECTED=""
- for repo_uri in ${EGIT_REPO_URI}; do
- # git urls might change, so reset it
- git config remote.origin.url "${repo_uri}"
-
- debug-print "${EGIT_UPDATE_CMD}"
- if ${EGIT_UPDATE_CMD} > /dev/null; then
- # global variable containing the repo_name we will be using
- debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\""
- EGIT_REPO_URI_SELECTED="${repo_uri}"
- break
- fi
- done
-
- [[ ${EGIT_REPO_URI_SELECTED} ]] \
- || die "${FUNCNAME}: can't update from ${EGIT_REPO_URI}"
-}
-
-# @FUNCTION: git-2_fetch
-# @INTERNAL
-# @DESCRIPTION:
-# Internal function fetching repository from EGIT_REPO_URI and storing it in
-# specified EGIT_STORE_DIR.
-git-2_fetch() {
- debug-print-function ${FUNCNAME} "$@"
-
- local oldsha cursha repo_type
-
- [[ ${EGIT_LOCAL_NONBARE} ]] && repo_type="non-bare repository" || repo_type="bare repository"
-
- if [[ ! -d ${EGIT_DIR} ]]; then
- git-2_initial_clone
- pushd "${EGIT_DIR}" > /dev/null || die
- cursha=$(git rev-parse ${UPSTREAM_BRANCH})
- echo "GIT NEW clone -->"
- echo " repository: ${EGIT_REPO_URI_SELECTED}"
- echo " at the commit: ${cursha}"
-
- popd > /dev/null || die
- elif [[ ${EVCS_OFFLINE} ]]; then
- pushd "${EGIT_DIR}" > /dev/null || die
- cursha=$(git rev-parse ${UPSTREAM_BRANCH})
- echo "GIT offline update -->"
- echo " repository: $(git config remote.origin.url)"
- echo " at the commit: ${cursha}"
- popd > /dev/null || die
- else
- pushd "${EGIT_DIR}" > /dev/null || die
- oldsha=$(git rev-parse ${UPSTREAM_BRANCH})
- git-2_update_repo
- cursha=$(git rev-parse ${UPSTREAM_BRANCH})
-
- # fetch updates
- echo "GIT update -->"
- echo " repository: ${EGIT_REPO_URI_SELECTED}"
- # write out message based on the revisions
- if [[ "${oldsha}" != "${cursha}" ]]; then
- echo " updating from commit: ${oldsha}"
- echo " to commit: ${cursha}"
- else
- echo " at the commit: ${cursha}"
- fi
-
- # print nice statistic of what was changed
- git --no-pager diff --stat ${oldsha}..${UPSTREAM_BRANCH}
- popd > /dev/null || die
- fi
- # export the version the repository is at
- export EGIT_VERSION="${cursha}"
- # log the repo state
- [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]] \
- && echo " commit: ${EGIT_COMMIT}"
- echo " branch: ${EGIT_BRANCH}"
- echo " storage directory: \"${EGIT_DIR}\""
- echo " checkout type: ${repo_type}"
-
- # Cleanup after git.eclass
- if [[ ${EGIT_OLD_CLONE} ]]; then
- einfo "${FUNCNAME}: removing old clone in ${EGIT_OLD_CLONE}."
- rm -rf "${EGIT_OLD_CLONE}"
- fi
-}
-
-# @FUNCTION: git_bootstrap
-# @INTERNAL
-# @DESCRIPTION:
-# Internal function that runs bootstrap command on unpacked source.
-git-2_bootstrap() {
- debug-print-function ${FUNCNAME} "$@"
-
- # @ECLASS-VARIABLE: EGIT_BOOTSTRAP
- # @DESCRIPTION:
- # Command to be executed after checkout and clone of the specified
- # repository.
- # enviroment the package will fail if there is no update, thus in
- # combination with --keep-going it would lead in not-updating
- # pakcages that are up-to-date.
- if [[ ${EGIT_BOOTSTRAP} ]]; then
- pushd "${EGIT_SOURCEDIR}" > /dev/null || die
- einfo "Starting bootstrap"
-
- if [[ -f ${EGIT_BOOTSTRAP} ]]; then
- # we have file in the repo which we should execute
- debug-print "${FUNCNAME}: bootstraping with file \"${EGIT_BOOTSTRAP}\""
-
- if [[ -x ${EGIT_BOOTSTRAP} ]]; then
- eval "./${EGIT_BOOTSTRAP}" \
- || die "${FUNCNAME}: bootstrap script failed"
- else
- eerror "\"${EGIT_BOOTSTRAP}\" is not executable."
- eerror "Report upstream, or bug ebuild maintainer to remove bootstrap command."
- die "\"${EGIT_BOOTSTRAP}\" is not executable"
- fi
- else
- # we execute some system command
- debug-print "${FUNCNAME}: bootstraping with commands \"${EGIT_BOOTSTRAP}\""
-
- eval "${EGIT_BOOTSTRAP}" \
- || die "${FUNCNAME}: bootstrap commands failed"
- fi
-
- einfo "Bootstrap finished"
- popd > /dev/null || die
- fi
-}
-
-# @FUNCTION: git-2_migrate_repository
-# @INTERNAL
-# @DESCRIPTION:
-# Internal function migrating between bare and normal checkout repository.
-# This is based on usage of EGIT_SUBMODULES, at least until they
-# start to work with bare checkouts sanely.
-# This function also set some global variables that differ between
-# bare and non-bare checkout.
-git-2_migrate_repository() {
- debug-print-function ${FUNCNAME} "$@"
-
- local bare returnstate
-
- # first find out if we have submodules
- # or user explicitly wants us to use non-bare clones
- if ! [[ ${EGIT_HAS_SUBMODULES} || ${EGIT_NONBARE} ]]; then
- bare=1
- fi
-
- # test if we already have some repo and if so find out if we have
- # to migrate the data
- if [[ -d ${EGIT_DIR} ]]; then
- if [[ ${bare} && -d ${EGIT_DIR}/.git ]]; then
- debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" to bare copy"
-
- ebegin "Converting \"${EGIT_DIR}\" from non-bare to bare copy"
- mv "${EGIT_DIR}/.git" "${EGIT_DIR}.bare"
- export GIT_DIR="${EGIT_DIR}.bare"
- git config core.bare true > /dev/null
- returnstate=$?
- unset GIT_DIR
- rm -rf "${EGIT_DIR}"
- mv "${EGIT_DIR}.bare" "${EGIT_DIR}"
- eend ${returnstate}
- elif [[ ! ${bare} && ! -d ${EGIT_DIR}/.git ]]; then
- debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" to non-bare copy"
-
- ebegin "Converting \"${EGIT_DIR}\" from bare to non-bare copy"
- git clone -l "${EGIT_DIR}" "${EGIT_DIR}.nonbare" > /dev/null
- returnstate=$?
- rm -rf "${EGIT_DIR}"
- mv "${EGIT_DIR}.nonbare" "${EGIT_DIR}"
- eend ${returnstate}
- fi
- fi
- if [[ ${returnstate} -ne 0 ]]; then
- debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" failed, removing to start from scratch"
-
- # migration failed, remove the EGIT_DIR to play it safe
- einfo "Migration failed, removing \"${EGIT_DIR}\" to start from scratch."
- rm -rf "${EGIT_DIR}"
- fi
-
- # set various options to work with both targets
- if [[ ${bare} ]]; then
- debug-print "${FUNCNAME}: working in bare repository for \"${EGIT_DIR}\""
- EGIT_LOCAL_OPTIONS+="${EGIT_OPTIONS} --bare"
- MOVE_COMMAND="git clone -l -s -n ${EGIT_DIR// /\\ }"
- EGIT_UPDATE_CMD="git fetch -t -f -u origin ${EGIT_BRANCH}:${EGIT_BRANCH}"
- UPSTREAM_BRANCH="${EGIT_BRANCH}"
- EGIT_LOCAL_NONBARE=
- else
- debug-print "${FUNCNAME}: working in bare repository for non-bare \"${EGIT_DIR}\""
- MOVE_COMMAND="cp -pPR ."
- EGIT_LOCAL_OPTIONS="${EGIT_OPTIONS}"
- EGIT_UPDATE_CMD="git pull -f -u ${EGIT_OPTIONS}"
- UPSTREAM_BRANCH="origin/${EGIT_BRANCH}"
- EGIT_LOCAL_NONBARE="true"
- fi
-}
-
-# @FUNCTION: git-2_cleanup
-# @INTERNAL
-# @DESCRIPTION:
-# Internal function cleaning up all the global variables
-# that are not required after the unpack has been done.
-git-2_cleanup() {
- debug-print-function ${FUNCNAME} "$@"
-
- # Here we can unset only variables that are GLOBAL
- # defined by the eclass, BUT NOT subject to change
- # by user (like EGIT_PROJECT).
- # If ebuild writer polutes his environment it is
- # his problem only.
- unset EGIT_DIR
- unset MOVE_COMMAND
- unset EGIT_LOCAL_OPTIONS
- unset EGIT_UPDATE_CMD
- unset UPSTREAM_BRANCH
- unset EGIT_LOCAL_NONBARE
-}
-
-# @FUNCTION: git-2_src_unpack
-# @DESCRIPTION:
-# Default git src_unpack function.
-git-2_src_unpack() {
- debug-print-function ${FUNCNAME} "$@"
-
- git-2_init_variables
- git-2_prepare_storedir
- git-2_migrate_repository
- git-2_fetch "$@"
- git-2_gc
- git-2_submodules
- git-2_move_source
- git-2_branch
- git-2_bootstrap
- git-2_cleanup
- echo ">>> Unpacked to ${EGIT_SOURCEDIR}"
-
- # Users can specify some SRC_URI and we should
- # unpack the files too.
- if [[ ! ${EGIT_NOUNPACK} ]]; then
- if has ${EAPI:-0} 0 1; then
- [[ ${A} ]] && unpack ${A}
- else
- default_src_unpack
- fi
- fi
-}
diff --git a/eclass/latex-package.eclass b/eclass/latex-package.eclass
index 1a684ef00a66..e24fd1875f47 100644
--- a/eclass/latex-package.eclass
+++ b/eclass/latex-package.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: latex-package.eclass
@@ -7,7 +7,7 @@
# @AUTHOR:
# Matthew Turk <satai@gentoo.org>
# Martin Ehmsen <ehmsen@gentoo.org>
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 7
# @BLURB: An eclass for easy installation of LaTeX packages
# @DESCRIPTION:
# This eClass is designed to be easy to use and implement. The vast majority of
@@ -50,21 +50,21 @@
# signatures EVERY TIME. For this reason, if you are grabbing from the CTAN,
# you must either grab each file individually, or find a place to mirror an
# archive of them. (iBiblio)
-#
-# It inherits base and eutils in EAPI 5 and earlier.
-case ${EAPI:-0} in
- 0|1|2|3|4|5) inherit base eutils ;;
-esac
+if [[ -z ${_LATEX_PACKAGE_ECLASS} ]]; then
+_LATEX_PACKAGE_ECLASS=1
RDEPEND="virtual/latex-base"
DEPEND="${RDEPEND}
>=sys-apps/texinfo-4.2-r5"
+
case ${EAPI:-0} in
- 0|1|2|3|4|5|6) ;;
- 7) BDEPEND="${DEPEND}"; DEPEND="" ;;
- *) die "${ECLASS}: Unknown EAPI ${EAPI}" ;;
+ [0-6])
+ die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
+ 7) ;;
+ *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
esac
+
HOMEPAGE="http://www.tug.org/"
TEXMF="/usr/share/texmf-site"
@@ -81,14 +81,6 @@ SUPPLIER="misc"
# must be set after inherit, as it gets automatically cleared otherwise.
LATEX_DOC_ARGUMENTS=""
-# Kept for backwards compatibility
-latex-package_has_tetex_3() {
- case ${EAPI:-0} in
- 0|1|2|3|4|5) return 0 ;;
- *) die "${FUNCNAME} no longer supported in EAPI ${EAPI}" ;;
- esac
-}
-
# @FUNCTION: latex-package_src_doinstall
# @USAGE: [ module ]
# @DESCRIPTION:
@@ -105,93 +97,94 @@ latex-package_src_doinstall() {
# This actually follows the directions for a "single-user" system
# at http://www.ctan.org/installationadvice/ modified for gentoo.
- [ -z "$1" ] && latex-package_src_install all
+ [[ -z ${1} ]] && latex-package_src_install all
- while [ "$1" ]; do
- case $1 in
+ while [[ ${1} ]]; do
+ case ${1} in
"sh")
- for i in `find . -maxdepth 1 -type f -name "*.${1}"`
- do
- dobin $i || die "dobin $i failed"
- done
+ while read -r -d '' i; do
+ dobin ${i}
+ done < <(find -maxdepth 1 -type f -name "*.${1}")
;;
+
"sty" | "cls" | "fd" | "clo" | "def" | "cfg")
- for i in `find . -maxdepth 1 -type f -name "*.${1}"`
- do
+ while read -r -d '' i; do
insinto ${TEXMF}/tex/latex/${PN}
- doins $i || die "doins $i failed"
- done
+ doins ${i}
+ done < <(find -maxdepth 1 -type f -name "*.${1}")
;;
+
"dvi" | "ps" | "pdf")
- for i in `find . -maxdepth 1 -type f -name "*.${1}"`
- do
+ while read -r -d '' i; do
insinto /usr/share/doc/${PF}
- doins $i || die "doins $i failed"
+ doins ${i}
dosym /usr/share/doc/${PF}/$(basename ${i}) ${TEXMF}/doc/latex/${PN}/${i}
- case "${EAPI:-0}" in
- 0|1|2|3) ;;
- *)
- # prevent compression of symlink target
- docompress -x /usr/share/doc/${PF}/$(basename ${i})
- ;;
- esac
- done
+ docompress -x /usr/share/doc/${PF}/$(basename ${i})
+ done < <(find -maxdepth 1 -type f -name "*.${1}")
;;
+
"tex" | "dtx")
if ! in_iuse doc || use doc ; then
- for i in `find . -maxdepth 1 -type f -name "*.${1}"`
- do
- [ -n "${LATEX_PACKAGE_SKIP}" ] && has ${i##*/} ${LATEX_PACKAGE_SKIP} && continue
- einfo "Making documentation: $i"
- if pdflatex ${LATEX_DOC_ARGUMENTS} --halt-on-error --interaction=nonstopmode $i ; then
- pdflatex ${LATEX_DOC_ARGUMENTS} --halt-on-error --interaction=nonstopmode $i || die
+ while read -r -d '' i; do
+ [[ -n ${LATEX_PACKAGE_SKIP} ]] && \
+ has ${i##*/} ${LATEX_PACKAGE_SKIP} && \
+ continue
+
+ einfo "Making documentation: ${i}"
+ # some macros need compiler called twice, do it here.
+ set -- pdflatex ${LATEX_DOC_ARGUMENTS} --halt-on-error --interaction=nonstopmode ${i}
+ if "${@}"; then
+ "${@}"
else
einfo "pdflatex failed, trying texi2dvi"
- texi2dvi -q -c --language=latex $i || die
+ texi2dvi -q -c --language=latex ${i} || die
fi
- done
+ done < <(find -maxdepth 1 -type f -name "*.${1}")
fi
;;
+
"tfm" | "vf" | "afm")
- for i in `find . -maxdepth 1 -type f -name "*.${1}"`
- do
+ while read -r -d '' i; do
insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN}
- doins $i || die "doins $i failed"
- done
+ doins ${i}
+ done < <(find -maxdepth 1 -type f -name "*.${1}")
;;
+
"pfb")
- for i in `find . -maxdepth 1 -type f -name "*.pfb"`
- do
+ while read -r -d '' i; do
insinto ${TEXMF}/fonts/type1/${SUPPLIER}/${PN}
- doins $i || die "doins $i failed"
- done
+ doins ${i}
+ done < <(find -maxdepth 1 -type f -name "*.pfb")
;;
"ttf")
- for i in `find . -maxdepth 1 -type f -name "*.ttf"`
- do
+ while read -r -d '' i; do
insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN}
- doins $i || die "doins $i failed"
- done
+ doins ${i}
+ done < <(find -maxdepth 1 -type f -name "*.ttf")
;;
"bst")
- for i in `find . -maxdepth 1 -type f -name "*.bst"`
- do
+ while read -r -d '' i; do
insinto ${TEXMF}/bibtex/bst/${PN}
- doins $i || die "doins $i failed"
- done
+ doins ${i}
+ done < <(find -maxdepth 1 -type f -name "*.bst")
;;
+
"styles")
latex-package_src_doinstall sty cls fd clo def cfg bst
;;
+
"doc")
latex-package_src_doinstall tex dtx dvi ps pdf
;;
+
"fonts")
latex-package_src_doinstall tfm vf afm pfb ttf
;;
+
"bin")
latex-package_src_doinstall sh
;;
+
"all")
latex-package_src_doinstall styles fonts bin doc
;;
@@ -206,11 +199,10 @@ latex-package_src_doinstall() {
# relevant files that will be installed
latex-package_src_compile() {
debug-print function $FUNCNAME $*
- for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"`
- do
- einfo "Extracting from $i"
- latex --halt-on-error --interaction=nonstopmode $i || die
- done
+ while read -r -d '' i; do
+ einfo "Extracting from ${i}"
+ latex --halt-on-error --interaction=nonstopmode ${i} || die
+ done < <(find -maxdepth 1 -type f -name "*.ins")
}
# @FUNCTION: latex-package_src_install
@@ -219,9 +211,7 @@ latex-package_src_compile() {
latex-package_src_install() {
debug-print function $FUNCNAME $*
latex-package_src_doinstall all
- if [ -n "${DOCS}" ] ; then
- dodoc ${DOCS}
- fi
+ einstalldocs
}
# @FUNCTION: latex-package_pkg_postinst
@@ -251,3 +241,5 @@ latex-package_rehash() {
}
EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm
+
+fi
diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
index b82c3a29f5c4..739a394ddd18 100644
--- a/eclass/python-single-r1.eclass
+++ b/eclass/python-single-r1.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: python-single-r1.eclass
@@ -89,9 +89,9 @@ EXPORT_FUNCTIONS pkg_setup
#
# It should be noted that in order to preserve metadata immutability,
# PYTHON_COMPAT_OVERRIDE does not affect IUSE nor dependencies.
-# The state of PYTHON_TARGETS and PYTHON_SINGLE_TARGET is ignored,
-# and the implementation in PYTHON_COMPAT_OVERRIDE is built instead.
-# Dependencies need to be satisfied manually.
+# The state of PYTHON_SINGLE_TARGET is ignored, and the implementation
+# in PYTHON_COMPAT_OVERRIDE is built instead. Dependencies need to be
+# satisfied manually.
#
# Example:
# @CODE
@@ -139,29 +139,6 @@ EXPORT_FUNCTIONS pkg_setup
# python_single_target_pypy? ( dev-python/pypy[gdbm] )
# @CODE
-# @ECLASS-VARIABLE: PYTHON_USEDEP
-# @DESCRIPTION:
-# DEPRECATED. Use PYTHON_SINGLE_USEDEP or python_gen_cond_dep with
-# PYTHON_MULTI_USEDEP placeholder instead.
-#
-# This is an eclass-generated USE-dependency string which can be used to
-# depend on another Python package being built for the same Python
-# implementations.
-#
-# The generate USE-flag list is compatible with packages using python-r1,
-# python-single-r1 and python-distutils-ng eclasses. It must not be used
-# on packages using python.eclass.
-#
-# Example use:
-# @CODE
-# RDEPEND="dev-python/foo[${PYTHON_USEDEP}]"
-# @CODE
-#
-# Example value:
-# @CODE
-# python_targets_python2_7(-)?,python_single_target_python3_4(+)?
-# @CODE
-
# @ECLASS-VARIABLE: PYTHON_SINGLE_USEDEP
# @DESCRIPTION:
# This is an eclass-generated USE-dependency string which can be used to
@@ -201,10 +178,8 @@ EXPORT_FUNCTIONS pkg_setup
# @ECLASS-VARIABLE: PYTHON_REQUIRED_USE
# @DESCRIPTION:
-# This is an eclass-generated required-use expression which ensures the following
-# when more than one python implementation is possible:
-# 1. Exactly one PYTHON_SINGLE_TARGET value has been enabled.
-# 2. The selected PYTHON_SINGLE_TARGET value is enabled in PYTHON_TARGETS.
+# This is an eclass-generated required-use expression which ensures
+# that exactly one PYTHON_SINGLE_TARGET value has been enabled.
#
# This expression should be utilized in an ebuild by including it in
# REQUIRED_USE, optionally behind a use flag.
@@ -216,39 +191,28 @@ EXPORT_FUNCTIONS pkg_setup
#
# Example value:
# @CODE
-# python_single_target_python2_7? ( python_targets_python2_7 )
-# python_single_target_python3_3? ( python_targets_python3_3 )
# ^^ ( python_single_target_python2_7 python_single_target_python3_3 )
# @CODE
_python_single_set_globals() {
_python_set_impls
- local flags_mt=( "${_PYTHON_SUPPORTED_IMPLS[@]/#/python_targets_}" )
local flags=( "${_PYTHON_SUPPORTED_IMPLS[@]/#/python_single_target_}" )
- local unflags=( "${_PYTHON_UNSUPPORTED_IMPLS[@]/#/-python_single_target_}" )
if [[ ${#_PYTHON_SUPPORTED_IMPLS[@]} -eq 1 ]]; then
# if only one implementation is supported, use IUSE defaults
# to avoid requesting the user to enable it
- IUSE="+${flags_mt[0]} +${flags[0]}"
+ IUSE="+${flags[0]}"
else
- IUSE="${flags_mt[*]} ${flags[*]}"
+ IUSE="${flags[*]}"
fi
local requse="^^ ( ${flags[*]} )"
- local optflags="${flags_mt[@]/%/(-)?},${unflags[@]/%/(-)},${flags[@]/%/(+)?}"
- local usedep="${optflags// /,}"
local single_flags="${flags[@]/%/(-)?}"
local single_usedep=${single_flags// /,}
local deps= i PYTHON_PKG_DEP
for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
- # The chosen targets need to be in PYTHON_TARGETS as well.
- # This is in order to enforce correct dependencies on packages
- # supporting multiple implementations.
- requse+=" python_single_target_${i}? ( python_targets_${i} )"
-
python_export "${i}" PYTHON_PKG_DEP
# 1) well, python-exec would suffice as an RDEP
# but no point in making this overcomplex, BDEP doesn't hurt anyone
@@ -276,13 +240,6 @@ _python_single_set_globals() {
die "PYTHON_REQUIRED_USE integrity check failed"
fi
- if [[ ${PYTHON_USEDEP} != "${usedep}" ]]; then
- eerror "PYTHON_USEDEP have changed between inherits!"
- eerror "Before: ${PYTHON_USEDEP}"
- eerror "Now : ${usedep}"
- die "PYTHON_USEDEP integrity check failed"
- fi
-
if [[ ${PYTHON_SINGLE_USEDEP} != "${single_usedep}" ]]; then
eerror "PYTHON_SINGLE_USEDEP have changed between inherits!"
eerror "Before: ${PYTHON_SINGLE_USEDEP}"
@@ -292,10 +249,10 @@ _python_single_set_globals() {
else
PYTHON_DEPS=${deps}
PYTHON_REQUIRED_USE=${requse}
- PYTHON_USEDEP=${usedep}
+ PYTHON_USEDEP='%PYTHON_USEDEP-HAS-BEEN-REMOVED%'
PYTHON_SINGLE_USEDEP=${single_usedep}
- readonly PYTHON_DEPS PYTHON_REQUIRED_USE PYTHON_USEDEP \
- PYTHON_SINGLE_USEDEP
+ readonly PYTHON_DEPS PYTHON_REQUIRED_USE PYTHON_SINGLE_USEDEP \
+ PYTHON_USEDEP
fi
}
_python_single_set_globals
@@ -305,45 +262,29 @@ if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
# @FUNCTION: _python_gen_usedep
# @INTERNAL
-# @USAGE: <-s|-u> [<pattern>...]
+# @USAGE: [<pattern>...]
# @DESCRIPTION:
# Output a USE dependency string for Python implementations which
# are both in PYTHON_COMPAT and match any of the patterns passed
# as parameters to the function.
#
-# The first argument specifies USE-dependency type: '-s' for new-style
-# PYTHON_SINGLE_USEDEP, '-u' for backwards-compatible PYTHON_USEDEP.
-#
# The patterns can be either fnmatch-style patterns (matched via bash
# == operator against PYTHON_COMPAT values) or '-2' / '-3' to indicate
# appropriately all enabled Python 2/3 implementations (alike
# python_is_python3). Remember to escape or quote the fnmatch patterns
# to prevent accidental shell filename expansion.
#
-# This is an internal function used to implement python_gen_cond_dep
-# and deprecated python_gen_usedep.
+# This is an internal function used to implement python_gen_cond_dep.
_python_gen_usedep() {
debug-print-function ${FUNCNAME} "${@}"
- local mode=${1}
- shift
local impl matches=()
for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
if _python_impl_matches "${impl}" "${@}"; then
- case ${mode} in
- -s)
- matches+=(
- "python_single_target_${impl}(-)?"
- )
- ;;
- -u)
- matches+=(
- "python_targets_${impl}(-)?"
- "python_single_target_${impl}(+)?"
- )
- ;;
- esac
+ matches+=(
+ "python_single_target_${impl}(-)?"
+ )
fi
done
@@ -353,46 +294,6 @@ _python_gen_usedep() {
echo "${out// /,}"
}
-# @FUNCTION: python_gen_usedep
-# @USAGE: <pattern> [...]
-# @DESCRIPTION:
-# DEPRECATED. Please use python_gen_cond_dep instead.
-#
-# Output a USE dependency string for Python implementations which
-# are both in PYTHON_COMPAT and match any of the patterns passed
-# as parameters to the function.
-#
-# The patterns can be either fnmatch-style patterns (matched via bash
-# == operator against PYTHON_COMPAT values) or '-2' / '-3' to indicate
-# appropriately all enabled Python 2/3 implementations (alike
-# python_is_python3). Remember to escape or quote the fnmatch patterns
-# to prevent accidental shell filename expansion.
-#
-# When all implementations are requested, please use ${PYTHON_USEDEP}
-# instead. Please also remember to set an appropriate REQUIRED_USE
-# to avoid ineffective USE flags.
-#
-# Example:
-# @CODE
-# PYTHON_COMPAT=( python{2_7,3_4} )
-# DEPEND="doc? ( dev-python/epydoc[$(python_gen_usedep 'python2*')] )"
-# @CODE
-#
-# It will cause the dependency to look like:
-# @CODE
-# DEPEND="doc? ( dev-python/epydoc[python_targets_python2_7(-)?,...] )"
-# @CODE
-python_gen_usedep() {
- debug-print-function ${FUNCNAME} "${@}"
-
- # output only once, during some reasonable phase
- # (avoid spamming cache regen runs)
- if [[ ${EBUILD_PHASE} == setup ]]; then
- eqawarn "python_gen_usedep() is deprecated. Please use python_gen_cond_dep instead."
- fi
- _python_gen_usedep -u "${@}"
-}
-
# @FUNCTION: python_gen_useflags
# @USAGE: [<pattern>...]
# @DESCRIPTION:
@@ -444,10 +345,9 @@ python_gen_useflags() {
# to prevent accidental shell filename expansion.
#
# In order to enforce USE constraints on the packages, verbatim
-# '${PYTHON_USEDEP}', '${PYTHON_SINGLE_USEDEP}'
-# and '${PYTHON_MULTI_USEDEP}' (quoted!) may be placed in the dependency
-# specification. It will get expanded within the function into a proper
-# USE dependency string.
+# '${PYTHON_SINGLE_USEDEP}' and '${PYTHON_MULTI_USEDEP}' (quoted!) may
+# be placed in the dependency specification. It will get expanded within
+# the function into a proper USE dependency string.
#
# Example:
# @CODE
@@ -473,15 +373,11 @@ python_gen_cond_dep() {
for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
if _python_impl_matches "${impl}" "${@}"; then
- # substitute ${PYTHON_USEDEP} if used
- # (since python_gen_usedep() will not return ${PYTHON_USEDEP}
- # the code is run at most once)
- if [[ ${dep} == *'${PYTHON_USEDEP}'* ]]; then
- local usedep=$(_python_gen_usedep -u "${@}")
- dep=${dep//\$\{PYTHON_USEDEP\}/${usedep}}
- fi
+ # substitute ${PYTHON_SINGLE_USEDEP} if used
+ # (since python_gen_usedep() will not return
+ # ${PYTHON_SINGLE_USEDEP}, the code is run at most once)
if [[ ${dep} == *'${PYTHON_SINGLE_USEDEP}'* ]]; then
- local usedep=$(_python_gen_usedep -s "${@}")
+ local usedep=$(_python_gen_usedep "${@}")
dep=${dep//\$\{PYTHON_SINGLE_USEDEP\}/${usedep}}
fi
local multi_usedep="python_targets_${impl}(-)"
@@ -586,15 +482,6 @@ python_setup() {
die "More than one implementation in PYTHON_SINGLE_TARGET."
fi
- if ! use "python_targets_${impl}"; then
- eerror "The implementation chosen as PYTHON_SINGLE_TARGET must be added"
- eerror "to PYTHON_TARGETS as well. This is in order to ensure that"
- eerror "dependencies are satisfied correctly. We're sorry"
- eerror "for the inconvenience."
- echo
- die "Build target (${impl}) not in PYTHON_TARGETS."
- fi
-
python_export "${impl}" EPYTHON PYTHON
python_wrapper_setup
fi
@@ -607,7 +494,7 @@ python_setup() {
eerror
eerror "${_PYTHON_SUPPORTED_IMPLS[@]}"
echo
- die "No supported Python implementation in PYTHON_SINGLE_TARGET/PYTHON_TARGETS."
+ die "No supported Python implementation in PYTHON_SINGLE_TARGET."
fi
}
diff --git a/eclass/rpm.eclass b/eclass/rpm.eclass
index c6daecea3651..c39e7f3e0f21 100644
--- a/eclass/rpm.eclass
+++ b/eclass/rpm.eclass
@@ -6,7 +6,7 @@
# base-system@gentoo.org
# @BLURB: convenience class for extracting RPMs
-inherit eutils
+inherit estack eutils
DEPEND=">=app-arch/rpm2targz-9.0.0.3g"
diff --git a/eclass/scons-utils.eclass b/eclass/scons-utils.eclass
index 35cf4e322188..33838e3ec8bb 100644
--- a/eclass/scons-utils.eclass
+++ b/eclass/scons-utils.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: scons-utils.eclass
@@ -126,8 +126,9 @@ if [[ ${_PYTHON_ANY_R1} ]]; then
}
python_check_deps() { scons-utils_python_check_deps; }
elif [[ ${_PYTHON_SINGLE_R1} ]]; then
- # when using python-single-r1, use plain PYTHON_USEDEP API
- BDEPEND="${SCONS_DEPEND}[${PYTHON_USEDEP}]
+ # when using python-single-r1, use PYTHON_MULTI_USEDEP API
+ BDEPEND="
+ $(python_gen_cond_dep "${SCONS_DEPEND}[\${PYTHON_MULTI_USEDEP}]")
${PYTHON_DEPS}"
elif [[ ${EAPI:-0} == [0123456] ]]; then
# in older EAPIs, just force Python 2.7
diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh
index d251f85a5eb1..9ef4562edf1a 100755
--- a/eclass/tests/distutils-r1.sh
+++ b/eclass/tests/distutils-r1.sh
@@ -70,9 +70,9 @@ einfo "empty RDEPEND"
eindent
RDEPEND=""
test-distutils_enable_tests pytest \
- "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/pytest[${PYTHON_USEDEP}] )"
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/pytest[${PYTHON_USEDEP}] )"
test-distutils_enable_tests nose \
- "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/nose[${PYTHON_USEDEP}] )"
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/nose[${PYTHON_USEDEP}] )"
test-distutils_enable_tests unittest \
"${BASE_IUSE}" "" "${BASE_DEPS}"
test-distutils_enable_tests setup.py \
@@ -84,13 +84,13 @@ eindent
BASE_RDEPEND="dev-python/foo[${PYTHON_USEDEP}]"
RDEPEND=${BASE_RDEPEND}
test-distutils_enable_tests pytest \
- "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/pytest[${PYTHON_USEDEP}] ${BASE_RDEPEND} )"
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} dev-python/pytest[${PYTHON_USEDEP}] )"
test-distutils_enable_tests nose \
- "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/nose[${PYTHON_USEDEP}] ${BASE_RDEPEND} )"
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} dev-python/nose[${PYTHON_USEDEP}] )"
test-distutils_enable_tests unittest \
- "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )"
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )"
test-distutils_enable_tests setup.py \
- "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )"
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )"
eoutdent
eoutdent
diff --git a/eclass/texlive-common.eclass b/eclass/texlive-common.eclass
index 593e88558710..2618cba2e1ac 100644
--- a/eclass/texlive-common.eclass
+++ b/eclass/texlive-common.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: texlive-common.eclass
@@ -12,14 +12,15 @@
# Purpose: Provide various functions used by both texlive-core and texlive
# modules.
#
-# Note that this eclass *must* not assume the presence of any standard tex tool
-
-case "${EAPI:-0}" in
- 0|1|2|3|4|5|6)
- die "EAPI='${EAPI}' is not supported anymore"
- ;;
- *)
- ;;
+# Note that this eclass *must* not assume the presence of any standard tex too
+
+if [[ -z ${_TEXLIVE_COMMON_ECLASS} ]]; then
+_TEXLIVE_COMMON_ECLASS=1
+
+case ${EAPI:-0} in
+ [0-6]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
+ 7) ;;
+ *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
esac
TEXMF_PATH=/usr/share/texmf
@@ -35,17 +36,18 @@ TEXMF_VAR_PATH=/var/lib/texmf
texlive-common_handle_config_files() {
# Handle config files properly
- [ -d "${ED}${TEXMF_PATH}" ] || return
- cd "${ED}${TEXMF_PATH}"
- for f in $(find . -name '*.cnf' -type f -o -name '*.cfg' -type f | sed -e "s:\./::g") ; do
- if [ "${f#*config}" != "${f}" -o "${f#doc}" != "${f}" -o "${f#source}" != "${f}" -o "${f#tex}" != "${f}" ] ; then
+ [[ -d ${ED}${TEXMF_PATH} ]] || return
+ cd "${ED}${TEXMF_PATH}" || die
+
+ while read -r -d '' i; do
+ if [[ ${f#*config} != ${f} || ${f#doc} != ${f} || ${f#source} != ${f} || ${f#tex} != ${f} ]] ; then
continue
fi
dodir /etc/texmf/$(dirname ${f}).d
einfo "Moving (and symlinking) ${EPREFIX}${TEXMF_PATH}/${f} to ${EPREFIX}/etc/texmf/$(dirname ${f}).d"
mv "${ED}/${TEXMF_PATH}/${f}" "${ED}/etc/texmf/$(dirname ${f}).d" || die "mv ${f} failed."
dosym /etc/texmf/$(dirname ${f}).d/$(basename ${f}) ${TEXMF_PATH}/${f}
- done
+ done < <(find -name '*.cnf' -type f -o -name '*.cfg' -type f | sed -e "s:\./::g")
}
# @FUNCTION: texlive-common_is_file_present_in_texmf
@@ -54,10 +56,14 @@ texlive-common_handle_config_files() {
# Call it from the directory containing texmf and texmf-dist
texlive-common_is_file_present_in_texmf() {
- local mark="${T}/$1.found"
- [ -d texmf ] && find texmf -name $1 -exec touch "${mark}" \;
- [ -d texmf-dist ] && find texmf-dist -name $1 -exec touch "${mark}" \;
- [ -f "${mark}" ]
+ local mark="${T}/${1}.found"
+ if [[ -d texmf ]]; then
+ find texmf -name ${1} -exec touch ${mark} {} + || die
+ fi
+
+ if [[ -d texmf-dist ]]; then
+ find texmf-dist -name ${1} -exec touch ${mark} {} + || die
+ fi
}
# @FUNCTION: texlive-common_do_symlinks
@@ -73,24 +79,22 @@ texlive-common_is_file_present_in_texmf() {
# also do the fmtutil file parsing.
texlive-common_do_symlinks() {
- while [ $# != 0 ]; do
- case $1 in
+ while [[ ${#} != 0 ]]; do
+ case ${1} in
cont-??|metafun|mptopdf)
- einfo "Symlink $1 skipped (special case)"
+ einfo "Symlink ${1} skipped (special case)"
;;
mf)
- einfo "Symlink $1 -> $2 skipped (texlive-core takes care of it)"
+ einfo "Symlink ${1} -> ${2} skipped (texlive-core takes care of it)"
;;
*)
- if [ $1 = $2 ];
- then
- einfo "Symlink $1 -> $2 skipped"
- elif [ -e "${ED}/usr/bin/$1" -o -L "${ED}/usr/bin/$1" ];
- then
- einfo "Symlink $1 skipped (file exists)"
+ if [[ ${1} == ${2} ]]; then
+ einfo "Symlink ${1} -> ${2} skipped"
+ elif [[ -e ${ED}/usr/bin/${1} || -L ${ED}/usr/bin/${1} ]]; then
+ einfo "Symlink ${1} skipped (file exists)"
else
- einfo "Making symlink from $1 to $2"
- dosym $2 /usr/bin/$1
+ einfo "Making symlink from ${1} to ${2}"
+ dosym ${2} /usr/bin/${1}
fi
;;
esac
@@ -123,11 +127,11 @@ etexlinks() {
# correctly set for the file that it will point to.
dobin_texmf_scripts() {
- while [ $# -gt 0 ] ; do
+ while [[ ${#} -gt 0 ]] ; do
local trg=$(basename ${1} | sed 's,\.[^/]*$,,' | tr '[:upper:]' '[:lower:]')
einfo "Installing ${1} as ${trg} bin wrapper"
- [ -x "${ED}/usr/share/${1}" ] || die "Trying to install a non existing or non executable symlink to /usr/bin: ${1}"
- dosym ../share/${1} /usr/bin/${trg} || die "failed to install ${1} as $trg"
+ [[ -x ${ED}/usr/share/${1} ]] || die "Trying to install a non existing or non executable symlink to /usr/bin: ${1}"
+ dosym ../share/${1} /usr/bin/${trg}
shift
done
}
@@ -140,7 +144,7 @@ dobin_texmf_scripts() {
etexmf-update() {
if has_version 'app-text/texlive-core' ; then
- if [ -z "${ROOT%/}" ] && [ -x "${EPREFIX}"/usr/sbin/texmf-update ] ; then
+ if [[ -z ${ROOT} && -x "${EPREFIX}"/usr/sbin/texmf-update ]] ; then
"${EPREFIX}"/usr/sbin/texmf-update
else
ewarn "Cannot run texmf-update for some reason."
@@ -158,9 +162,9 @@ etexmf-update() {
efmtutil-sys() {
if has_version 'app-text/texlive-core' ; then
- if [ -z "${ROOT%/}" ] && [ -x "${EPREFIX}"/usr/bin/fmtutil-sys ] ; then
+ if [[ -z ${ROOT} && -x "${EPREFIX}"/usr/bin/fmtutil-sys ]] ; then
einfo "Rebuilding formats"
- "${EPREFIX}"/usr/bin/fmtutil-sys --all &> /dev/null
+ "${EPREFIX}"/usr/bin/fmtutil-sys --all &> /dev/null || die
else
ewarn "Cannot run fmtutil-sys for some reason."
ewarn "Your formats might be inconsistent with your installed ${PN} version"
@@ -168,3 +172,5 @@ efmtutil-sys() {
fi
fi
}
+
+fi
diff --git a/eclass/texlive-module.eclass b/eclass/texlive-module.eclass
index 52b26cdca4dc..3f31f35e1abb 100644
--- a/eclass/texlive-module.eclass
+++ b/eclass/texlive-module.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: texlive-module.eclass
@@ -68,13 +68,13 @@
# Information to display about the package.
# e.g. for enabling/disabling a feature
-case "${EAPI:-0}" in
- 0|1|2|3|4|5|6)
- die "EAPI='${EAPI}' is not supported anymore"
- ;;
- *)
- inherit texlive-common
- ;;
+if [[ -z ${_TEXLIVE_MODULE_ECLASS} ]]; then
+_TEXLIVE_MODULE_ECLASS=1
+
+case ${EAPI:-0} in
+ [0-6]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
+ 7) inherit texlive-common ;;
+ *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
esac
HOMEPAGE="http://www.tug.org/texlive/"
@@ -97,14 +97,14 @@ for i in ${TEXLIVE_MODULE_CONTENTS}; do
done
# Forge doc SRC_URI
-[ -n "${TEXLIVE_MODULE_DOC_CONTENTS}" ] && SRC_URI="${SRC_URI} doc? ("
+[[ -n ${TEXLIVE_MODULE_DOC_CONTENTS} ]] && SRC_URI="${SRC_URI} doc? ("
for i in ${TEXLIVE_MODULE_DOC_CONTENTS}; do
SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.${PKGEXT}"
done
-[ -n "${TEXLIVE_MODULE_DOC_CONTENTS}" ] && SRC_URI="${SRC_URI} )"
+[[ -n ${TEXLIVE_MODULE_DOC_CONTENTS} ]] && SRC_URI="${SRC_URI} )"
# Forge source SRC_URI
-if [ -n "${TEXLIVE_MODULE_SRC_CONTENTS}" ] ; then
+if [[ -n ${TEXLIVE_MODULE_SRC_CONTENTS} ]] ; then
SRC_URI="${SRC_URI} source? ("
for i in ${TEXLIVE_MODULE_SRC_CONTENTS}; do
SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.${PKGEXT}"
@@ -122,7 +122,7 @@ IUSE="${IUSE} doc"
# A space separated list of Tex engines that can be made optional.
# e.g. "luatex luajittex"
-if [ -n "${TEXLIVE_MODULE_OPTIONAL_ENGINE}" ] ; then
+if [[ -n ${TEXLIVE_MODULE_OPTIONAL_ENGINE} ]] ; then
for engine in ${TEXLIVE_MODULE_OPTIONAL_ENGINE} ; do
IUSE="${IUSE} +${engine}"
done
@@ -140,10 +140,12 @@ RELOC_TARGET=texmf-dist
texlive-module_src_unpack() {
unpack ${A}
- grep RELOC tlpkg/tlpobj/* | awk '{print $2}' | sed 's#^RELOC/##' > "${T}/reloclist"
- { for i in $(<"${T}/reloclist"); do dirname $i; done; } | uniq > "${T}/dirlist"
+ grep RELOC tlpkg/tlpobj/* | awk '{print $2}' | sed 's#^RELOC/##' > "${T}/reloclist" || die
+ { for i in $(<"${T}/reloclist"); do dirname ${i}; done; } | uniq > "${T}/dirlist"
for i in $(<"${T}/dirlist"); do
- [ -d "${RELOC_TARGET}/${i}" ] || mkdir -p "${RELOC_TARGET}/${i}"
+ if [[ ! -d ${RELOC_TARGET}/${i} ]]; then
+ mkdir -p "${RELOC_TARGET}/${i}" || die
+ fi
done
for i in $(<"${T}/reloclist"); do
mv "${i}" "${RELOC_TARGET}"/$(dirname "${i}") || die "failed to relocate ${i} to ${RELOC_TARGET}/$(dirname ${i})"
@@ -161,14 +163,14 @@ texlive-module_add_format() {
local name engine mode patterns options
eval $@
einfo "Appending to format.${PN}.cnf for $@"
- [ -d texmf-dist/fmtutil ] || mkdir -p texmf-dist/fmtutil
- [ -f texmf-dist/fmtutil/format.${PN}.cnf ] || { echo "# Generated for ${PN} by texlive-module.eclass" > texmf-dist/fmtutil/format.${PN}.cnf; }
- [ -n "${TEXLIVE_MODULE_OPTIONAL_ENGINE}" ] && has ${engine} ${TEXLIVE_MODULE_OPTIONAL_ENGINE} && use !${engine} && mode="disabled"
- if [ "${mode}" = "disabled" ]; then
- printf "#! " >> texmf-dist/fmtutil/format.${PN}.cnf
+ [[ -d texmf-dist/fmtutil ]] || mkdir -p texmf-dist/fmtutil || die
+ [[ -f texmf-dist/fmtutil/format.${PN}.cnf ]] || { echo "# Generated for ${PN} by texlive-module.eclass" > texmf-dist/fmtutil/format.${PN}.cnf; }
+ [[ -n ${TEXLIVE_MODULE_OPTIONAL_ENGINE} ]] && has ${engine} ${TEXLIVE_MODULE_OPTIONAL_ENGINE} && use !${engine} && mode="disabled"
+ if [[ ${mode} = disabled ]]; then
+ printf "#! " >> texmf-dist/fmtutil/format.${PN}.cnf || die
fi
- [ -z "${patterns}" ] && patterns="-"
- printf "${name}\t${engine}\t${patterns}\t${options}\n" >> texmf-dist/fmtutil/format.${PN}.cnf
+ [[ -z ${patterns} ]] && patterns="-"
+ printf "${name}\t${engine}\t${patterns}\t${options}\n" >> texmf-dist/fmtutil/format.${PN}.cnf || die
}
# @FUNCTION: texlive-module_make_language_def_lines
@@ -180,13 +182,13 @@ texlive-module_make_language_def_lines() {
local lefthyphenmin righthyphenmin synonyms name file file_patterns file_exceptions luaspecial
eval $@
einfo "Generating language.def entry for $@"
- [ -z "$lefthyphenmin" ] && lefthyphenmin="2"
- [ -z "$righthyphenmin" ] && righthyphenmin="3"
- echo "\\addlanguage{$name}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def"
- if [ -n "$synonyms" ] ; then
+ [[ -z ${lefthyphenmin} ]] && lefthyphenmin="2"
+ [[ -z ${righthyphenmin} ]] && righthyphenmin="3"
+ echo "\\addlanguage{$name}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def" || die
+ if [[ -n ${synonyms} ]]; then
for i in $(echo $synonyms | tr ',' ' ') ; do
einfo "Generating language.def synonym $i for $@"
- echo "\\addlanguage{$i}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def"
+ echo "\\addlanguage{$i}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def" || die
done
fi
}
@@ -200,11 +202,11 @@ texlive-module_make_language_dat_lines() {
local lefthyphenmin righthyphenmin synonyms name file file_patterns file_exceptions luaspecial
eval $@
einfo "Generating language.dat entry for $@"
- echo "$name $file" >> "${S}/language.${PN}.dat"
- if [ -n "$synonyms" ] ; then
- for i in $(echo $synonyms | tr ',' ' ') ; do
- einfo "Generating language.dat synonym $i for $@"
- echo "=$i" >> "${S}/language.${PN}.dat"
+ echo "$name $file" >> "${S}/language.${PN}.dat" || die
+ if [[ -n ${synonyms} ]]; then
+ for i in $(echo ${synonyms} | tr ',' ' ') ; do
+ einfo "Generating language.dat synonym ${i} for $@"
+ echo "=${i}" >> "${S}/language.${PN}.dat" || die
done
fi
}
@@ -217,7 +219,7 @@ texlive-module_make_language_dat_lines() {
texlive-module_synonyms_to_language_lua_line() {
local prev=""
for i in $(echo $@ | tr ',' ' ') ; do
- printf "${prev} '%s'" $i
+ printf "${prev} '%s'" ${i}
prev=","
done
}
@@ -233,17 +235,27 @@ texlive-module_make_language_lua_lines() {
local lefthyphenmin righthyphenmin synonyms name file file_patterns file_exceptions luaspecial
local dest="${S}/language.${PN}.dat.lua"
eval $@
- [ -z "$lefthyphenmin" ] && lefthyphenmin="2"
- [ -z "$righthyphenmin" ] && righthyphenmin="3"
+ [[ -z ${lefthyphenmin} ]] && lefthyphenmin="2"
+ [[ -z ${righthyphenmin} ]] && righthyphenmin="3"
einfo "Generating language.dat.lua entry for $@"
- printf "\t['%s'] = {\n" "$name" >> "$dest"
- printf "\t\tloader = '%s',\n" "$file" >> "$dest"
- printf "\t\tlefthyphenmin = %s,\n\t\trighthyphenmin = %s,\n" "$lefthyphenmin" "$righthyphenmin" >> "$dest"
- printf "\t\tsynonyms = {%s },\n" "$(texlive-module_synonyms_to_language_lua_line "$synonyms")" >> "$dest"
- [ -n "$file_patterns" ] && printf "\t\tpatterns = '%s',\n" "$file_patterns" >> "$dest"
- [ -n "$file_exceptions" ] && printf "\t\thyphenation = '%s',\n" "$file_exceptions" >> "$dest"
- [ -n "$luaspecial" ] && printf "\t\tspecial = '%s',\n" "$luaspecial" >> "$dest"
- printf "\t},\n" >> "$dest"
+ printf "\t['%s'] = {\n" "${name}" >> "${dest}" || die
+ printf "\t\tloader = '%s',\n" "${file}" >> "${dest}" || die
+ printf "\t\tlefthyphenmin = %s,\n\t\trighthyphenmin = %s,\n" "${lefthyphenmin}" "${righthyphenmin}" >> "${dest}" || die
+ printf "\t\tsynonyms = {%s },\n" "$(texlive-module_synonyms_to_language_lua_line "${synonyms}")" >> "${dest}" || die
+
+ if [[ -n ${file_patterns} ]]; then
+ printf "\t\tpatterns = '%s',\n" "${file_patterns}" >> "${dest}" || die
+ fi
+
+ if [[ -n ${file_exceptions} ]]; then
+ printf "\t\thyphenation = '%s',\n" "${file_exceptions}" >> "${dest}" || die
+ fi
+
+ if [[ -n ${luaspecial} ]]; then
+ printf "\t\tspecial = '%s',\n" "$luaspecial" >> "${dest}" || die
+ fi
+
+ printf "\t},\n" >> "${dest}" || die
}
# @FUNCTION: texlive-module_src_compile
@@ -263,7 +275,7 @@ texlive-module_src_compile() {
# later
for i in "${S}"/tlpkg/tlpobj/*;
do
- grep '^execute ' "${i}" | sed -e 's/^execute //' | tr ' \t' '##' >> "${T}/jobs"
+ grep '^execute ' "${i}" | sed -e 's/^execute //' | tr ' \t' '##' >> "${T}/jobs" || die
done
for i in $(<"${T}/jobs");
@@ -271,7 +283,7 @@ texlive-module_src_compile() {
j="$(echo $i | tr '#' ' ')"
command=${j%% *}
parameter=${j#* }
- case "${command}" in
+ case ${command} in
addMap)
echo "Map ${parameter}" >> "${S}/${PN}.cfg";;
addMixedMap)
@@ -283,14 +295,14 @@ texlive-module_src_compile() {
addDvipdfmMap)
echo "f ${parameter}" >> "${S}/${PN}-config";;
AddHyphen)
- texlive-module_make_language_def_lines "$parameter"
- texlive-module_make_language_dat_lines "$parameter"
- texlive-module_make_language_lua_lines "$parameter"
+ texlive-module_make_language_def_lines ${parameter}
+ texlive-module_make_language_dat_lines ${parameter}
+ texlive-module_make_language_lua_lines ${parameter}
;;
AddFormat)
- texlive-module_add_format "$parameter";;
+ texlive-module_add_format ${parameter};;
BuildFormat)
- einfo "Format $parameter already built.";;
+ einfo "Format ${parameter} already built.";;
BuildLanguageDat)
einfo "Language file $parameter already generated.";;
*)
@@ -304,10 +316,14 @@ texlive-module_src_compile() {
# Build format files
for i in texmf-dist/fmtutil/format*.cnf; do
- if [ -f "${i}" ]; then
+ if [[ -f ${i} ]]; then
einfo "Building format ${i}"
- [ -d texmf-var ] || mkdir texmf-var
- [ -d texmf-var/web2c ] || mkdir texmf-var/web2c
+ if [[ ! -d texmf-var ]]; then
+ mkdir texmf-var || die
+ fi
+ if [[ ! -d texmf-var/web2c ]]; then
+ mkdir texmf-var/web2c || die
+ fi
VARTEXFONTS="${T}/fonts" TEXMFHOME="${S}/texmf:${S}/texmf-dist:${S}/texmf-var"\
env -u TEXINPUTS $fmt_call --cnffile "${i}" --fmtdir "${S}/texmf-var/web2c" --all\
|| die "failed to build format ${i}"
@@ -326,50 +342,64 @@ texlive-module_src_compile() {
texlive-module_src_install() {
for i in texmf-dist/fmtutil/format*.cnf; do
- [ -f "${i}" ] && etexlinks "${i}"
+ [[ -f ${i} ]] && etexlinks "${i}"
done
dodir /usr/share
- if use doc; then
- [ -d texmf-doc ] && cp -pR texmf-doc "${ED}/usr/share/"
+ if use doc && [[ -d texmf-doc ]]; then
+ cp -pR texmf-doc "${ED}/usr/share/" || die
else
- [ -d texmf/doc ] && rm -rf texmf/doc
- [ -d texmf-dist/doc ] && rm -rf texmf-dist/doc
+ if [[ -d texmf-dist/doc ]]; then
+ rm -rf texmf-dist/doc || die
+ fi
+
+ if [[ -d texmf/doc ]]; then
+ rm -rf texmf/doc || die
+ fi
+ fi
+
+ if [[ -d texmf ]]; then
+ cp -pR texmf "${ED}/usr/share/" || die
+ fi
+
+ if [[ -d texmf-dist ]]; then
+ cp -pR texmf-dist "${ED}/usr/share/" || die
fi
- [ -d texmf ] && cp -pR texmf "${ED}/usr/share/"
- [ -d texmf-dist ] && cp -pR texmf-dist "${ED}/usr/share/"
- [ -d tlpkg ] && use source && cp -pR tlpkg "${ED}/usr/share/"
+ if [[ -d tlpkg ]] && use source; then
+ cp -pR tlpkg "${ED}/usr/share/" || die
+ fi
insinto /var/lib/texmf
- [ -d texmf-var ] && doins -r texmf-var/*
+
+ [[ -d texmf-var ]] && doins -r texmf-var/.
insinto /etc/texmf/updmap.d
- [ -f "${S}/${PN}.cfg" ] && doins "${S}/${PN}.cfg"
+ [[ -f ${S}/${PN}.cfg ]] && doins "${S}/${PN}.cfg"
insinto /etc/texmf/dvips.d
- [ -f "${S}/${PN}-config.ps" ] && doins "${S}/${PN}-config.ps"
+ [[ -f ${S}/${PN}-config.ps ]] && doins "${S}/${PN}-config.ps"
insinto /etc/texmf/dvipdfm/config
- [ -f "${S}/${PN}-config" ] && doins "${S}/${PN}-config"
+ [[ -f ${S}/${PN}-config ]] && doins "${S}/${PN}-config"
- if [ -f "${S}/language.${PN}.def" ] ; then
+ if [[ -f ${S}/language.${PN}.def ]] ; then
insinto /etc/texmf/language.def.d
doins "${S}/language.${PN}.def"
fi
- if [ -f "${S}/language.${PN}.dat" ] ; then
+ if [[ -f ${S}/language.${PN}.dat ]] ; then
insinto /etc/texmf/language.dat.d
doins "${S}/language.${PN}.dat"
fi
- if [ -f "${S}/language.${PN}.dat.lua" ] ; then
+ if [[ -f ${S}/language.${PN}.dat.lua ]] ; then
insinto /etc/texmf/language.dat.lua.d
doins "${S}/language.${PN}.dat.lua"
fi
- [ -n "${TEXLIVE_MODULE_BINSCRIPTS}" ] && dobin_texmf_scripts ${TEXLIVE_MODULE_BINSCRIPTS}
- if [ -n "${TEXLIVE_MODULE_BINLINKS}" ] ; then
+ [[ -n ${TEXLIVE_MODULE_BINSCRIPTS} ]] && dobin_texmf_scripts ${TEXLIVE_MODULE_BINSCRIPTS}
+ if [[ -n ${TEXLIVE_MODULE_BINLINKS} ]] ; then
for i in ${TEXLIVE_MODULE_BINLINKS} ; do
- [ -f "${ED}/usr/bin/${i%:*}" ] || die "Trying to install an invalid BINLINK. This should not happen. Please file a bug."
+ [[ -f ${ED}/usr/bin/${i%:*} ]] || die "Trying to install an invalid BINLINK. This should not happen. Please file a bug."
dosym ${i%:*} /usr/bin/${i#*:}
done
fi
@@ -386,7 +416,7 @@ texlive-module_src_install() {
texlive-module_pkg_postinst() {
etexmf-update
- [ -n "${TL_MODULE_INFORMATION}" ] && elog "${TL_MODULE_INFORMATION}"
+ [[ -n ${TL_MODULE_INFORMATION} ]] && elog "${TL_MODULE_INFORMATION}"
}
# @FUNCTION: texlive-module_pkg_postrm
@@ -400,3 +430,5 @@ texlive-module_pkg_postrm() {
}
EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm
+
+fi
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 03e335dac5c5..71c3cbc8c76d 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -67,18 +67,23 @@ tc_version_is_between() {
GCC_PV=${TOOLCHAIN_GCC_PV:-${PV}}
GCC_PVR=${GCC_PV}
[[ ${PR} != "r0" ]] && GCC_PVR=${GCC_PVR}-${PR}
+
+# GCC_RELEASE_VER must always match 'gcc/BASE-VER' value.
+# It's an internal representation of gcc version used for:
+# - versioned paths on disk
+# - 'gcc -dumpversion' output. Must always match <digit>.<digit>.<digit>.
GCC_RELEASE_VER=$(ver_cut 1-3 ${GCC_PV})
+
GCC_BRANCH_VER=$(ver_cut 1-2 ${GCC_PV})
GCCMAJOR=$(ver_cut 1 ${GCC_PV})
GCCMINOR=$(ver_cut 2 ${GCC_PV})
GCCMICRO=$(ver_cut 3 ${GCC_PV})
-# gcc hardcodes it's internal version into gcc/BASE-VER
-# and assumes various directories and tools to have the
-# same name.
-# TODO: once ada ebuilds are fixed turn it to
-# GCC_CONFIG_VER=${GCC_RELEASE_VER}
-GCC_CONFIG_VER=${GCC_CONFIG_VER:-${GCC_RELEASE_VER}}
+# Ideally this variable should allow for custom gentoo versioning
+# of binary and gcc-config names not directly tied to upstream
+# versioning. In practive it's hard to untangle from gcc/BASE-VER
+# (GCC_RELEASE_VER) value.
+GCC_CONFIG_VER=${GCC_RELEASE_VER}
# Pre-release support. Versioning schema:
# 1.0.0_pre9999: live ebuild
@@ -445,60 +450,7 @@ toolchain_src_unpack() {
git-r3_src_unpack
fi
- if [[ -n ${GCC_A_FAKEIT} ]] ; then
- eerror "Please migrate from 'GCC_A_FAKEIT' to 'default_src_unpack()'"
- gcc_quick_unpack
- else
- # Just unpack every tarball from SRC_URI
- default_src_unpack
- fi
-}
-
-gcc_quick_unpack() {
- pushd "${WORKDIR}" > /dev/null
- export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
- export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}}
- export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}}
- export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}}
- export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}}
-
- # Injection point for more tarballs. dev-lang/gnat-gpl uses
- # 'GCC_A_FAKEIT' to specify it's own source and binary tarballs.
- if [[ -n ${GCC_A_FAKEIT} ]] ; then
- unpack ${GCC_A_FAKEIT}
- elif tc_is_live ; then
- : # sources comes from git, not tarball
- elif [[ -n ${SNAPSHOT} ]] ; then
- unpack gcc-${SNAPSHOT}.tar.xz
- else
- if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
- unpack gcc-${GCC_RELEASE_VER}.tar.xz
- else
- unpack gcc-${GCC_RELEASE_VER}.tar.bz2
- fi
- fi
-
- [[ -n ${PATCH_VER} ]] && \
- unpack gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2
-
- [[ -n ${UCLIBC_VER} ]] && \
- unpack gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2
-
- if want_pie ; then
- if [[ -n ${PIE_CORE} ]] ; then
- unpack ${PIE_CORE}
- else
- unpack gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2
- fi
- [[ -n ${SPECS_VER} ]] && \
- unpack gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2
- fi
-
- use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
-
- [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin && unpack "gcc-cygwinports-${CYGWINPORTS_GITREV}.tar.gz"
-
- popd > /dev/null
+ default_src_unpack
}
#---->> src_prepare <<----
@@ -584,9 +536,7 @@ toolchain_src_prepare() {
local actual_version=$(< "${S}"/gcc/BASE-VER)
if [[ "${GCC_RELEASE_VER}" != "${actual_version}" ]] ; then
eerror "'${S}/gcc/BASE-VER' contains '${actual_version}', expected '${GCC_RELEASE_VER}'"
- # TODO: once ada ebuilds are fixed turn it to 'die'
- eerror "Please set GCC_RELEASE_VER to '${actual_version}'"
- echo "${GCC_CONFIG_VER}" > "${S}"/gcc/BASE-VER
+ die "Please set 'TOOLCHAIN_GCC_PV' to '${actual_version}'"
fi
fi
diff --git a/eclass/user-info.eclass b/eclass/user-info.eclass
new file mode 100644
index 000000000000..15e9238ab44b
--- /dev/null
+++ b/eclass/user-info.eclass
@@ -0,0 +1,158 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: user-info.eclass
+# @MAINTAINER:
+# base-system@gentoo.org (Linux)
+# Michał Górny <mgorny@gentoo.org> (NetBSD)
+# @BLURB: Read-only access to user and group information
+
+if [[ -z ${_USER_INFO_ECLASS} ]]; then
+_USER_INFO_ECLASS=1
+
+# @FUNCTION: egetent
+# @USAGE: <database> <key>
+# @DESCRIPTION:
+# Small wrapper for getent (Linux), nidump (< Mac OS X 10.5),
+# dscl (Mac OS X 10.5), and pw (FreeBSD) used in enewuser()/enewgroup().
+#
+# Supported databases: group passwd
+egetent() {
+ local db=$1 key=$2
+
+ [[ $# -ge 3 ]] && die "usage: egetent <database> <key>"
+
+ case ${db} in
+ passwd|group) ;;
+ *) die "sorry, database '${db}' not yet supported; file a bug" ;;
+ esac
+
+ case ${CHOST} in
+ *-freebsd*|*-dragonfly*)
+ case ${db} in
+ passwd) db="user" ;;
+ *) ;;
+ esac
+
+ # lookup by uid/gid
+ local opts
+ if [[ ${key} == [[:digit:]]* ]] ; then
+ [[ ${db} == "user" ]] && opts="-u" || opts="-g"
+ fi
+
+ pw show ${db} ${opts} "${key}" -q
+ ;;
+ *-openbsd*)
+ grep "${key}:\*:" /etc/${db}
+ ;;
+ *)
+ # ignore nscd output if we're not running as root
+ type -p nscd >/dev/null && nscd -i "${db}" 2>/dev/null
+ getent "${db}" "${key}"
+ ;;
+ esac
+}
+
+# @FUNCTION: egetusername
+# @USAGE: <uid>
+# @DESCRIPTION:
+# Gets the username for given UID.
+egetusername() {
+ [[ $# -eq 1 ]] || die "usage: egetusername <uid>"
+
+ egetent passwd "$1" | cut -d: -f1
+}
+
+# @FUNCTION: egetgroupname
+# @USAGE: <gid>
+# @DESCRIPTION:
+# Gets the group name for given GID.
+egetgroupname() {
+ [[ $# -eq 1 ]] || die "usage: egetgroupname <gid>"
+
+ egetent group "$1" | cut -d: -f1
+}
+
+# @FUNCTION: egethome
+# @USAGE: <user>
+# @DESCRIPTION:
+# Gets the home directory for the specified user.
+egethome() {
+ local pos
+
+ [[ $# -eq 1 ]] || die "usage: egethome <user>"
+
+ case ${CHOST} in
+ *-freebsd*|*-dragonfly*)
+ pos=9
+ ;;
+ *) # Linux, NetBSD, OpenBSD, etc...
+ pos=6
+ ;;
+ esac
+
+ egetent passwd "$1" | cut -d: -f${pos}
+}
+
+# @FUNCTION: egetshell
+# @USAGE: <user>
+# @DESCRIPTION:
+# Gets the shell for the specified user.
+egetshell() {
+ local pos
+
+ [[ $# -eq 1 ]] || die "usage: egetshell <user>"
+
+ case ${CHOST} in
+ *-freebsd*|*-dragonfly*)
+ pos=10
+ ;;
+ *) # Linux, NetBSD, OpenBSD, etc...
+ pos=7
+ ;;
+ esac
+
+ egetent passwd "$1" | cut -d: -f${pos}
+}
+
+# @FUNCTION: egetcomment
+# @USAGE: <user>
+# @DESCRIPTION:
+# Gets the comment field for the specified user.
+egetcomment() {
+ local pos
+
+ [[ $# -eq 1 ]] || die "usage: egetcomment <user>"
+
+ case ${CHOST} in
+ *-freebsd*|*-dragonfly*)
+ pos=8
+ ;;
+ *) # Linux, NetBSD, OpenBSD, etc...
+ pos=5
+ ;;
+ esac
+
+ egetent passwd "$1" | cut -d: -f${pos}
+}
+
+# @FUNCTION: egetgroups
+# @USAGE: <user>
+# @DESCRIPTION:
+# Gets all the groups user belongs to. The primary group is returned
+# first, then all supplementary groups. Groups are ','-separated.
+egetgroups() {
+ [[ $# -eq 1 ]] || die "usage: egetgroups <user>"
+
+ local egroups_arr
+ read -r -a egroups_arr < <(id -G -n "$1")
+
+ local g groups=${egroups_arr[0]}
+ # sort supplementary groups to make comparison possible
+ while read -r g; do
+ [[ -n ${g} ]] && groups+=",${g}"
+ done < <(printf '%s\n' "${egroups_arr[@]:1}" | sort)
+ echo "${groups}"
+}
+
+fi
diff --git a/eclass/user.eclass b/eclass/user.eclass
index f433d32bf7ed..9bd0b607eab8 100644
--- a/eclass/user.eclass
+++ b/eclass/user.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: user.eclass
@@ -13,6 +13,8 @@
if [[ -z ${_USER_ECLASS} ]]; then
_USER_ECLASS=1
+inherit user-info
+
# @FUNCTION: _assert_pkg_ebuild_phase
# @INTERNAL
# @USAGE: <calling func name>
@@ -27,49 +29,6 @@ _assert_pkg_ebuild_phase() {
esac
}
-# @FUNCTION: egetent
-# @USAGE: <database> <key>
-# @DESCRIPTION:
-# Small wrapper for getent (Linux), nidump (< Mac OS X 10.5),
-# dscl (Mac OS X 10.5), and pw (FreeBSD) used in enewuser()/enewgroup().
-#
-# Supported databases: group passwd
-egetent() {
- local db=$1 key=$2
-
- [[ $# -ge 3 ]] && die "usage: egetent <database> <key>"
-
- case ${db} in
- passwd|group) ;;
- *) die "sorry, database '${db}' not yet supported; file a bug" ;;
- esac
-
- case ${CHOST} in
- *-freebsd*|*-dragonfly*)
- case ${db} in
- passwd) db="user" ;;
- *) ;;
- esac
-
- # lookup by uid/gid
- local opts
- if [[ ${key} == [[:digit:]]* ]] ; then
- [[ ${db} == "user" ]] && opts="-u" || opts="-g"
- fi
-
- pw show ${db} ${opts} "${key}" -q
- ;;
- *-openbsd*)
- grep "${key}:\*:" /etc/${db}
- ;;
- *)
- # ignore nscd output if we're not running as root
- type -p nscd >/dev/null && nscd -i "${db}" 2>/dev/null
- getent "${db}" "${key}"
- ;;
- esac
-}
-
# @FUNCTION: user_get_nologin
# @INTERNAL
# @DESCRIPTION:
@@ -351,108 +310,6 @@ enewgroup() {
esac
}
-# @FUNCTION: egetusername
-# @USAGE: <uid>
-# @DESCRIPTION:
-# Gets the username for given UID.
-egetusername() {
- [[ $# -eq 1 ]] || die "usage: egetusername <uid>"
-
- egetent passwd "$1" | cut -d: -f1
-}
-
-# @FUNCTION: egetgroupname
-# @USAGE: <gid>
-# @DESCRIPTION:
-# Gets the group name for given GID.
-egetgroupname() {
- [[ $# -eq 1 ]] || die "usage: egetgroupname <gid>"
-
- egetent group "$1" | cut -d: -f1
-}
-
-# @FUNCTION: egethome
-# @USAGE: <user>
-# @DESCRIPTION:
-# Gets the home directory for the specified user.
-egethome() {
- local pos
-
- [[ $# -eq 1 ]] || die "usage: egethome <user>"
-
- case ${CHOST} in
- *-freebsd*|*-dragonfly*)
- pos=9
- ;;
- *) # Linux, NetBSD, OpenBSD, etc...
- pos=6
- ;;
- esac
-
- egetent passwd "$1" | cut -d: -f${pos}
-}
-
-# @FUNCTION: egetshell
-# @USAGE: <user>
-# @DESCRIPTION:
-# Gets the shell for the specified user.
-egetshell() {
- local pos
-
- [[ $# -eq 1 ]] || die "usage: egetshell <user>"
-
- case ${CHOST} in
- *-freebsd*|*-dragonfly*)
- pos=10
- ;;
- *) # Linux, NetBSD, OpenBSD, etc...
- pos=7
- ;;
- esac
-
- egetent passwd "$1" | cut -d: -f${pos}
-}
-
-# @FUNCTION: egetcomment
-# @USAGE: <user>
-# @DESCRIPTION:
-# Gets the comment field for the specified user.
-egetcomment() {
- local pos
-
- [[ $# -eq 1 ]] || die "usage: egetshell <user>"
-
- case ${CHOST} in
- *-freebsd*|*-dragonfly*)
- pos=8
- ;;
- *) # Linux, NetBSD, OpenBSD, etc...
- pos=5
- ;;
- esac
-
- egetent passwd "$1" | cut -d: -f${pos}
-}
-
-# @FUNCTION: egetgroups
-# @USAGE: <user>
-# @DESCRIPTION:
-# Gets all the groups user belongs to. The primary group is returned
-# first, then all supplementary groups. Groups are ','-separated.
-egetgroups() {
- [[ $# -eq 1 ]] || die "usage: egetgroups <user>"
-
- local egroups_arr
- read -r -a egroups_arr < <(id -G -n "$1")
-
- local g groups=${egroups_arr[0]}
- # sort supplementary groups to make comparison possible
- while read -r g; do
- [[ -n ${g} ]] && groups+=",${g}"
- done < <(printf '%s\n' "${egroups_arr[@]:1}" | sort)
- echo "${groups}"
-}
-
# @FUNCTION: esethome
# @USAGE: <user> <homedir>
# @DESCRIPTION: