eclass: Drop unused eclasses

This commit is contained in:
Krzesimir Nowak 2022-02-25 16:46:50 +01:00
parent b36a5b1630
commit 810eb3ef34
13 changed files with 0 additions and 2921 deletions

View File

@ -1,684 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: apache-2.eclass
# @MAINTAINER:
# polynomial-c@gentoo.org
# @SUPPORTED_EAPIS: 5 6 7
# @BLURB: Provides a common set of functions for apache-2.x ebuilds
# @DESCRIPTION:
# This eclass handles apache-2.x ebuild functions such as LoadModule generation
# and inter-module dependency checking.
inherit autotools flag-o-matic multilib ssl-cert user toolchain-funcs eapi7-ver
[[ ${CATEGORY}/${PN} != www-servers/apache ]] \
&& die "Do not use this eclass with anything else than www-servers/apache ebuilds!"
case ${EAPI:-0} in
0|1|2|3|4)
die "This eclass is banned for EAPI<5"
;;
esac
# settings which are version specific go in here:
case $(ver_cut 1-2) in
2.4)
DEFAULT_MPM_THREADED="event" #509922
CDEPEND=">=dev-libs/apr-1.5.1:=
!www-apache/mod_macro" #492578 #477702
;;
2.2)
DEFAULT_MPM_THREADED="worker"
CDEPEND=">=dev-libs/apr-1.4.5:=" #368651
;;
*)
die "Unknown MAJOR.MINOR apache version."
;;
esac
# ==============================================================================
# INTERNAL VARIABLES
# ==============================================================================
# @ECLASS-VARIABLE: GENTOO_PATCHNAME
# @DESCRIPTION:
# This internal variable contains the prefix for the patch tarball.
# Defaults to the full name and version (including revision) of the package.
# If you want to override this in an ebuild, use:
# ORIG_PR="(revision of Gentoo stuff you want)"
# GENTOO_PATCHNAME="gentoo-${PN}-${PV}${ORIG_PR:+-${ORIG_PR}}"
[[ -n "${GENTOO_PATCHNAME}" ]] || GENTOO_PATCHNAME="gentoo-${PF}"
# @ECLASS-VARIABLE: GENTOO_PATCHDIR
# @DESCRIPTION:
# This internal variable contains the working directory where patches and config
# files are located.
# Defaults to the patchset name appended to the working directory.
[[ -n "${GENTOO_PATCHDIR}" ]] || GENTOO_PATCHDIR="${WORKDIR}/${GENTOO_PATCHNAME}"
# @VARIABLE: GENTOO_DEVELOPER
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains the name of the
# gentoo developer who created the patch tarball
# @VARIABLE: GENTOO_PATCHSTAMP
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains the date the patch
# tarball was created at in YYYYMMDD format
# @VARIABLE: GENTOO_PATCH_A
# @DESCRIPTION:
# This variable should contain the entire filename of patch tarball.
# Defaults to the name of the patchset, with a datestamp.
[[ -n "${GENTOO_PATCH_A}" ]] || GENTOO_PATCH_A="${GENTOO_PATCHNAME}-${GENTOO_PATCHSTAMP}.tar.bz2"
SRC_URI="mirror://apache/httpd/httpd-${PV}.tar.bz2
https://dev.gentoo.org/~${GENTOO_DEVELOPER}/dist/apache/${GENTOO_PATCH_A}"
# @VARIABLE: IUSE_MPMS_FORK
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains a list of forking
# (i.e. non-threaded) MPMs
# @VARIABLE: IUSE_MPMS_THREAD
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains a list of threaded
# MPMs
# @VARIABLE: IUSE_MODULES
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains a list of available
# built-in modules
IUSE_MPMS="${IUSE_MPMS_FORK} ${IUSE_MPMS_THREAD}"
IUSE="${IUSE} debug doc gdbm ldap libressl selinux ssl static suexec threads"
for module in ${IUSE_MODULES} ; do
IUSE="${IUSE} apache2_modules_${module}"
done
_apache2_set_mpms() {
local mpm
local ompm
for mpm in ${IUSE_MPMS} ; do
IUSE="${IUSE} apache2_mpms_${mpm}"
REQUIRED_USE+=" apache2_mpms_${mpm}? ("
for ompm in ${IUSE_MPMS} ; do
if [[ "${mpm}" != "${ompm}" ]] ; then
REQUIRED_USE+=" !apache2_mpms_${ompm}"
fi
done
if has ${mpm} ${IUSE_MPMS_FORK} ; then
REQUIRED_USE+=" !threads"
else
REQUIRED_USE+=" threads"
fi
REQUIRED_USE+=" )"
done
if [[ "$(ver_cut 1-2)" != 2.2 ]] ; then
REQUIRED_USE+=" apache2_mpms_prefork? ( !apache2_modules_http2 )"
fi
}
_apache2_set_mpms
unset -f _apache2_set_mpms
DEPEND="${CDEPEND}
dev-lang/perl
=dev-libs/apr-util-1*:=[gdbm=,ldap?]
dev-libs/libpcre
apache2_modules_deflate? ( sys-libs/zlib )
apache2_modules_mime? ( app-misc/mime-types )
gdbm? ( sys-libs/gdbm:= )
ldap? ( =net-nds/openldap-2* )
ssl? (
!libressl? ( >=dev-libs/openssl-1.0.2:0= )
libressl? ( dev-libs/libressl:0= )
)
!=www-servers/apache-1*"
RDEPEND+=" ${DEPEND}
selinux? ( sec-policy/selinux-apache )"
PDEPEND="~app-admin/apache-tools-${PV}"
S="${WORKDIR}/httpd-${PV}"
# @VARIABLE: MODULE_DEPENDS
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains a space-separated
# list of dependency tokens each with a module and the module it depends on
# separated by a colon
# now extend REQUIRED_USE to reflect the module dependencies to portage
_apache2_set_module_depends() {
local dep
for dep in ${MODULE_DEPENDS} ; do
REQUIRED_USE+=" apache2_modules_${dep%:*}? ( apache2_modules_${dep#*:} )"
done
}
_apache2_set_module_depends
unset -f _apache2_set_module_depends
# ==============================================================================
# INTERNAL FUNCTIONS
# ==============================================================================
# @ECLASS-VARIABLE: MY_MPM
# @DESCRIPTION:
# This internal variable contains the selected MPM after a call to setup_mpm()
# @FUNCTION: setup_mpm
# @DESCRIPTION:
# This internal function makes sure that only one of APACHE2_MPMS was selected
# or a default based on USE=threads is selected if APACHE2_MPMS is empty
setup_mpm() {
MY_MPM=""
for x in ${IUSE_MPMS} ; do
if use apache2_mpms_${x} ; then
# there can at most be one MPM selected because of REQUIRED_USE constraints
MY_MPM=${x}
elog
elog "Selected MPM: ${MY_MPM}"
elog
break
fi
done
if [[ -z "${MY_MPM}" ]] ; then
if use threads ; then
MY_MPM=${DEFAULT_MPM_THREADED}
elog
elog "Selected default threaded MPM: ${MY_MPM}"
elog
else
MY_MPM=prefork
elog
elog "Selected default MPM: ${MY_MPM}"
elog
fi
fi
}
# @VARIABLE: MODULE_CRITICAL
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains a space-separated
# list of modules critical for the default apache. A user may still
# disable these modules for custom minimal installation at their own risk.
# @FUNCTION: check_module_critical
# @DESCRIPTION:
# This internal function warns the user about modules critical for the default
# apache configuration.
check_module_critical() {
local unsupported=0
for m in ${MODULE_CRITICAL} ; do
if ! has ${m} ${MY_MODS[@]} ; then
ewarn "Module '${m}' is required in the default apache configuration."
unsupported=1
fi
done
if [[ ${unsupported} -ne 0 ]] ; then
ewarn
ewarn "You have disabled one or more required modules"
ewarn "for the default apache configuration."
ewarn "Although this is not an error, please be"
ewarn "aware that this setup is UNSUPPORTED."
ewarn
fi
}
# @ECLASS-VARIABLE: MY_CONF
# @DESCRIPTION:
# This internal variable contains the econf options for the current module
# selection after a call to setup_modules()
# @ECLASS-VARIABLE: MY_MODS
# @DESCRIPTION:
# This internal variable contains a sorted, space separated list of currently
# selected modules after a call to setup_modules()
# @FUNCTION: setup_modules
# @DESCRIPTION:
# This internal function selects all built-in modules based on USE flags and
# APACHE2_MODULES USE_EXPAND flags
setup_modules() {
local mod_type=
if use static ; then
mod_type="static"
else
mod_type="shared"
fi
MY_CONF=( --enable-so=static )
MY_MODS=()
if use ldap ; then
MY_CONF+=( --enable-authnz_ldap=${mod_type} --enable-ldap=${mod_type} )
MY_MODS+=( ldap authnz_ldap )
else
MY_CONF+=( --disable-authnz_ldap --disable-ldap )
fi
if use ssl ; then
MY_CONF+=( --with-ssl --enable-ssl=${mod_type} )
MY_MODS+=( ssl )
else
MY_CONF+=( --without-ssl --disable-ssl )
fi
if use suexec ; then
elog "You can manipulate several configure options of suexec"
elog "through the following environment variables:"
elog
elog " SUEXEC_SAFEPATH: Default PATH for suexec (default: '${EPREFIX}/usr/local/bin:${EPREFIX}/usr/bin:${EPREFIX}/bin')"
if { ver_test ${PV} -ge 2.4.34 && ! use suexec-syslog ; } || ver_test ${PV} -lt 2.4.34 ; then
elog " SUEXEC_LOGFILE: Path to the suexec logfile (default: '${EPREFIX}/var/log/apache2/suexec_log')"
fi
elog " SUEXEC_CALLER: Name of the user Apache is running as (default: apache)"
elog " SUEXEC_DOCROOT: Directory in which suexec will run scripts (default: '${EPREFIX}/var/www')"
elog " SUEXEC_MINUID: Minimum UID, which is allowed to run scripts via suexec (default: 1000)"
elog " SUEXEC_MINGID: Minimum GID, which is allowed to run scripts via suexec (default: 100)"
elog " SUEXEC_USERDIR: User subdirectories (like /home/user/html) (default: public_html)"
elog " SUEXEC_UMASK: Umask for the suexec process (default: 077)"
elog
MY_CONF+=( --with-suexec-safepath="${SUEXEC_SAFEPATH:-${EPREFIX}/usr/local/bin:${EPREFIX}/usr/bin:${EPREFIX}/bin}" )
if ver_test ${PV} -ge 2.4.34 ; then
MY_CONF+=( $(use_with !suexec-syslog suexec-logfile "${SUEXEC_LOGFILE:-${EPREFIX}/var/log/apache2/suexec_log}") )
MY_CONF+=( $(use_with suexec-syslog) )
if use suexec-syslog && use suexec-caps ; then
MY_CONF+=( --enable-suexec-capabilities )
fi
else
MY_CONF+=( --with-suexec-logfile="${SUEXEC_LOGFILE:-${EPREFIX}/var/log/apache2/suexec_log}" )
fi
MY_CONF+=( --with-suexec-bin="${EPREFIX}/usr/sbin/suexec" )
MY_CONF+=( --with-suexec-userdir=${SUEXEC_USERDIR:-public_html} )
MY_CONF+=( --with-suexec-caller=${SUEXEC_CALLER:-apache} )
MY_CONF+=( --with-suexec-docroot="${SUEXEC_DOCROOT:-${EPREFIX}/var/www}" )
MY_CONF+=( --with-suexec-uidmin=${SUEXEC_MINUID:-1000} )
MY_CONF+=( --with-suexec-gidmin=${SUEXEC_MINGID:-100} )
MY_CONF+=( --with-suexec-umask=${SUEXEC_UMASK:-077} )
MY_CONF+=( --enable-suexec=${mod_type} )
MY_MODS+=( suexec )
else
MY_CONF+=( --disable-suexec )
fi
for x in ${IUSE_MODULES} ; do
if use apache2_modules_${x} ; then
MY_CONF+=( --enable-${x}=${mod_type} )
MY_MODS+=( ${x} )
else
MY_CONF+=( --disable-${x} )
fi
done
# sort and uniquify MY_MODS
MY_MODS=( $(echo ${MY_MODS[@]} | tr ' ' '\n' | sort -u) )
check_module_critical
}
# @VARIABLE: MODULE_DEFINES
# @DESCRIPTION:
# This variable needs to be set in the ebuild and contains a space-separated
# list of tokens each mapping a module to a runtime define which can be
# specified in APACHE2_OPTS in /etc/conf.d/apache2 to enable this particular
# module.
# @FUNCTION: generate_load_module
# @DESCRIPTION:
# This internal function generates the LoadModule lines for httpd.conf based on
# the current module selection and MODULE_DEFINES
generate_load_module() {
local endit=0 mod_lines= mod_dir="${ED%/}/usr/$(get_libdir)/apache2/modules"
if use static; then
sed -i -e "/%%LOAD_MODULE%%/d" \
"${GENTOO_PATCHDIR}"/conf/httpd.conf
return
fi
for m in ${MY_MODS[@]} ; do
if [[ -e "${mod_dir}/mod_${m}.so" ]] ; then
for def in ${MODULE_DEFINES} ; do
if [[ "${m}" == "${def%:*}" ]] ; then
mod_lines="${mod_lines}\n<IfDefine ${def#*:}>"
endit=1
fi
done
mod_lines="${mod_lines}\nLoadModule ${m}_module modules/mod_${m}.so"
if [[ ${endit} -ne 0 ]] ; then
mod_lines="${mod_lines}\n</IfDefine>"
endit=0
fi
fi
done
sed -i -e "s:%%LOAD_MODULE%%:${mod_lines}:" \
"${GENTOO_PATCHDIR}"/conf/httpd.conf
}
# @FUNCTION: check_upgrade
# @DESCRIPTION:
# This internal function checks if the previous configuration file for built-in
# modules exists in ROOT and prevents upgrade in this case. Users are supposed
# to convert this file to the new APACHE2_MODULES USE_EXPAND variable and remove
# it afterwards.
check_upgrade() {
if [[ -e "${EROOT}"etc/apache2/apache2-builtin-mods ]]; then
eerror "The previous configuration file for built-in modules"
eerror "(${EROOT}etc/apache2/apache2-builtin-mods) exists on your"
eerror "system."
eerror
eerror "Please read https://wiki.gentoo.org/wiki/Project:Apache/Upgrading"
eerror "for detailed information how to convert this file to the new"
eerror "APACHE2_MODULES USE_EXPAND variable."
eerror
die "upgrade not possible with existing ${ROOT}etc/apache2/apache2-builtin-mods"
fi
}
# ==============================================================================
# EXPORTED FUNCTIONS
# ==============================================================================
# @FUNCTION: apache-2_pkg_setup
# @DESCRIPTION:
# This function selects built-in modules, the MPM and other configure options,
# creates the apache user and group and informs about CONFIG_SYSVIPC being
# needed (we don't depend on kernel sources and therefore cannot check).
apache-2_pkg_setup() {
check_upgrade
# setup apache user and group
enewgroup apache 81
enewuser apache 81 -1 /var/www apache
setup_mpm
setup_modules
if use debug; then
MY_CONF+=( --enable-exception-hook )
fi
elog "Please note that you need SysV IPC support in your kernel."
elog "Make sure CONFIG_SYSVIPC=y is set."
elog
if use userland_BSD; then
elog "On BSD systems you need to add the following line to /boot/loader.conf:"
elog " accf_http_load=\"YES\""
if use ssl ; then
elog " accf_data_load=\"YES\""
fi
elog
fi
}
# @FUNCTION: apache-2_src_prepare
# @DESCRIPTION:
# This function applies patches, configures a custom file-system layout and
# rebuilds the configure scripts.
apache-2_src_prepare() {
#fix prefix in conf files etc (bug #433736)
use !prefix || sed -e "s@/\(usr\|var\|etc\|run\)/@${EPREFIX}&@g" \
-i "${GENTOO_PATCHDIR}"/conf/httpd.conf "${GENTOO_PATCHDIR}"/scripts/* \
"${GENTOO_PATCHDIR}"/docs/*.example "${GENTOO_PATCHDIR}"/patches/*.layout \
"${GENTOO_PATCHDIR}"/init/* "${GENTOO_PATCHDIR}"/conf/vhosts.d/* \
"${GENTOO_PATCHDIR}"/conf/modules.d/* || die
# 03_all_gentoo-apache-tools.patch injects -Wl,-z,now, which is not a good
# idea for everyone
case ${CHOST} in
*-linux-gnu|*-solaris*|*-freebsd*)
# do nothing, these use GNU binutils
:
;;
*-darwin*)
sed -i -e 's/-Wl,-z,now/-Wl,-bind_at_load/g' \
"${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch
;;
*)
# patch it out to be like upstream
sed -i -e 's/-Wl,-z,now//g' \
"${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch
;;
esac
# Use correct multilib libdir in gentoo patches
sed -i -e "s:/usr/lib:/usr/$(get_libdir):g" \
"${GENTOO_PATCHDIR}"/{conf/httpd.conf,init/*,patches/config.layout} \
|| die "libdir sed failed"
if [[ "${EAPI}" -ge 6 ]] ; then
default
eapply "${GENTOO_PATCHDIR}"/patches/*.patch
else
epatch "${GENTOO_PATCHDIR}"/patches/*.patch
fi
if [[ ${EAPI} = 5 ]] ; then
# Handle patches from ebuild's PATCHES array if one is given
if [[ -n "${PATCHES}" ]] ; then
local patchestype=$(declare -p PATCHES 2>&-)
if [[ "${patchestype}" != "declare -a PATCHES="* ]] ; then
die "Declaring PATCHES as a variable is forbidden. Please use an array instead."
fi
epatch "${PATCHES[@]}"
fi
# Handle user patches
epatch_user
fi
# Don't rename configure.in _before_ any possible user patches!
if [[ -f "configure.in" ]] ; then
mv configure.{in,ac} || die
fi
# setup the filesystem layout config
cat "${GENTOO_PATCHDIR}"/patches/config.layout >> "${S}"/config.layout || \
die "Failed preparing config.layout!"
sed -i -e "s:version:${PF}:g" "${S}"/config.layout
# apache2.8 instead of httpd.8 (bug #194828)
mv docs/man/{httpd,apache2}.8
sed -i -e 's/httpd\.8/apache2.8/g' Makefile.in
# patched-in MPMs need the build environment rebuilt
sed -i -e '/sinclude/d' configure.ac
AT_M4DIR=build eautoreconf
# ${T} must be not group-writable, else grsec TPE will block it
chmod g-w "${T}"
# This package really should upgrade to using pcre's .pc file.
cat <<-\EOF >"${T}"/pcre-config
#!/bin/bash
flags=()
for flag; do
if [[ ${flag} == "--version" ]]; then
flags+=( --modversion )
else
flags+=( "${flag}" )
fi
done
exec ${PKG_CONFIG} libpcre "${flags[@]}"
EOF
chmod a+x "${T}"/pcre-config
}
# @FUNCTION: apache-2_src_configure
# @DESCRIPTION:
# This function adds compiler flags and runs econf and emake based on MY_MPM and
# MY_CONF
apache-2_src_configure() {
tc-export PKG_CONFIG
# Sanity check in case people have bad mounts/TPE settings. #500928
if ! "${T}"/pcre-config --help >/dev/null ; then
eerror "Could not execute ${T}/pcre-config; do you have bad mount"
eerror "permissions in ${T} or have TPE turned on in your kernel?"
die "check your runtime settings #500928"
fi
# Instead of filtering --as-needed (bug #128505), append --no-as-needed
# Thanks to Harald van Dijk
append-ldflags $(no-as-needed)
# peruser MPM debugging with -X is nearly impossible
if has peruser ${IUSE_MPMS} && use apache2_mpms_peruser ; then
use debug && append-flags -DMPM_PERUSER_DEBUG
fi
# econf overwrites the stuff from config.layout, so we have to put them into
# our myconf line too
MY_CONF+=(
--includedir="${EPREFIX}"/usr/include/apache2
--libexecdir="${EPREFIX}"/usr/$(get_libdir)/apache2/modules
--datadir="${EPREFIX}"/var/www/localhost
--sysconfdir="${EPREFIX}"/etc/apache2
--localstatedir="${EPREFIX}"/var
--with-mpm=${MY_MPM}
--with-apr="${SYSROOT}${EPREFIX}"/usr
--with-apr-util="${SYSROOT}${EPREFIX}"/usr
--with-pcre="${T}"/pcre-config
--with-z="${EPREFIX}"/usr
--with-port=80
--with-program-name=apache2
--enable-layout=Gentoo
)
ac_cv_path_PKGCONFIG=${PKG_CONFIG} \
econf "${MY_CONF[@]}"
sed -i -e 's:apache2\.conf:httpd.conf:' include/ap_config_auto.h || die
}
# @FUNCTION: apache-2_src_install
# @DESCRIPTION:
# This function runs `emake install' and generates, installs and adapts the gentoo
# specific configuration files found in the tarball
apache-2_src_install() {
emake DESTDIR="${D}" MKINSTALLDIRS="mkdir -p" install
# install our configuration files
keepdir /etc/apache2/vhosts.d
keepdir /etc/apache2/modules.d
generate_load_module
insinto /etc/apache2
doins -r "${GENTOO_PATCHDIR}"/conf/*
use apache2_modules_mime_magic && doins docs/conf/magic
insinto /etc/logrotate.d
newins "${GENTOO_PATCHDIR}"/scripts/apache2-logrotate apache2
# generate a sane default APACHE2_OPTS
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO"
use doc && APACHE2_OPTS+=" -D MANUAL"
use ssl && APACHE2_OPTS+=" -D SSL -D SSL_DEFAULT_VHOST"
use suexec && APACHE2_OPTS+=" -D SUEXEC"
if has negotiation ${APACHE2_MODULES} && use apache2_modules_negotiation; then
APACHE2_OPTS+=" -D LANGUAGE"
fi
sed -i -e "s:APACHE2_OPTS=\".*\":APACHE2_OPTS=\"${APACHE2_OPTS}\":" \
"${GENTOO_PATCHDIR}"/init/apache2.confd || die
newconfd "${GENTOO_PATCHDIR}"/init/apache2.confd apache2
newinitd "${GENTOO_PATCHDIR}"/init/apache2.initd apache2
# install apache2ctl wrapper for our init script if available
if test -e "${GENTOO_PATCHDIR}"/scripts/apache2ctl; then
exeinto /usr/sbin
doexe "${GENTOO_PATCHDIR}"/scripts/apache2ctl
else
dosym /etc/init.d/apache2 /usr/sbin/apache2ctl
fi
# provide legacy symlink for apxs, bug 177697
dosym apxs /usr/sbin/apxs2
# install some documentation
dodoc ABOUT_APACHE CHANGES LAYOUT README README.platforms VERSIONING
dodoc "${GENTOO_PATCHDIR}"/docs/*
# drop in a convenient link to the manual
if use doc ; then
sed -i -e "s:VERSION:${PVR}:" "${ED%/}/etc/apache2/modules.d/00_apache_manual.conf"
docompress -x /usr/share/doc/${PF}/manual # 503640
else
rm -f "${ED%/}/etc/apache2/modules.d/00_apache_manual.conf"
rm -Rf "${ED%/}/usr/share/doc/${PF}/manual"
fi
# the default icons and error pages get stored in
# /usr/share/apache2/{error,icons}
dodir /usr/share/apache2
mv -f "${ED%/}/var/www/localhost/error" "${ED%/}/usr/share/apache2/error"
mv -f "${ED%/}/var/www/localhost/icons" "${ED%/}/usr/share/apache2/icons"
rm -rf "${ED%/}/var/www/localhost/"
eend $?
# set some sane permissions for suexec
if use suexec ; then
local needs_adjustment="$(ver_test ${PV} -ge 2.4.34 && { { ! use suexec-syslog || ! use suexec-caps ; } && echo true || echo false ; } || echo true)"
if ${needs_adjustment} ; then
fowners 0:${SUEXEC_CALLER:-apache} /usr/sbin/suexec
fperms 4710 /usr/sbin/suexec
# provide legacy symlink for suexec, bug 177697
dosym /usr/sbin/suexec /usr/sbin/suexec2
fi
fi
# empty dirs
for i in /var/lib/dav /var/log/apache2 /var/cache/apache2 ; do
keepdir ${i}
fowners apache:apache ${i}
fperms 0750 ${i}
done
}
# @FUNCTION: apache-2_pkg_postinst
# @DESCRIPTION:
# This function creates test certificates if SSL is enabled and installs the
# default index.html to /var/www/localhost if it does not exist. We do this here
# because the default webroot is a copy of the files that exist elsewhere and we
# don't want them to be managed/removed by portage when apache is upgraded.
apache-2_pkg_postinst() {
if use ssl && [[ ! -e "${EROOT}/etc/ssl/apache2/server.pem" ]]; then
SSL_ORGANIZATION="${SSL_ORGANIZATION:-Apache HTTP Server}"
install_cert /etc/ssl/apache2/server
ewarn
ewarn "The location of SSL certificates has changed. If you are"
ewarn "upgrading from ${CATEGORY}/${PN}-2.2.13 or earlier (or remerged"
ewarn "*any* apache version), you might want to move your old"
ewarn "certificates from /etc/apache2/ssl/ to /etc/ssl/apache2/ and"
ewarn "update your config files."
ewarn
fi
if [[ ! -e "${EROOT}/var/www/localhost" ]] ; then
mkdir -p "${EROOT}/var/www/localhost/htdocs"
echo "<html><body><h1>It works!</h1></body></html>" > "${EROOT}/var/www/localhost/htdocs/index.html"
fi
echo
elog "Attention: cgi and cgid modules are now handled via APACHE2_MODULES flags"
elog "in make.conf. Make sure to enable those in order to compile them."
elog "In general, you should use 'cgid' with threaded MPMs and 'cgi' otherwise."
echo
}
EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_install pkg_postinst

View File

@ -1,214 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# DEPRECATED
# This eclass has been deprecated and must not be used by any new
# ebuilds or eclasses. Replacements for particular phase functions
# in EAPI 2+:
#
# base_src_unpack() - default (or unpacker_src_unpack if unpacker.eclass
# was inherited)
# base_src_prepare() - inherit eutils, inline:
# epatch "${PATCHES[@]}" # if PATCHES defined as array
# epatch ${PATCHES} # if PATCHES defined as string
# epatch_user
# base_src_configure() - default
# base_src_compile() - default
# base_src_install() - default
# base_src_install_docs() - einstalldocs from eutils.eclass
# @ECLASS: base.eclass
# @MAINTAINER:
# QA Team <qa@gentoo.org>
# @AUTHOR:
# Original author: Dan Armak <danarmak@gentoo.org>
# @SUPPORTED_EAPIS: 0 1 2 3 4 5
# @BLURB: The base eclass defines some default functions and variables.
# @DESCRIPTION:
# The base eclass defines some default functions and variables.
if [[ -z ${_BASE_ECLASS} ]]; then
_BASE_ECLASS=1
inherit eutils
BASE_EXPF="src_unpack src_compile src_install"
case "${EAPI:-0}" in
0|1) ;;
2|3|4|5) BASE_EXPF+=" src_prepare src_configure" ;;
*) die "${ECLASS}.eclass is banned in EAPI ${EAPI}";;
esac
EXPORT_FUNCTIONS ${BASE_EXPF}
# @ECLASS-VARIABLE: DOCS
# @DEFAULT_UNSET
# @DESCRIPTION:
# Array containing documents passed to dodoc command.
#
# DOCS=( "${S}/doc/document.txt" "${S}/doc/doc_folder/" )
# @ECLASS-VARIABLE: HTML_DOCS
# @DEFAULT_UNSET
# @DESCRIPTION:
# Array containing documents passed to dohtml command.
#
# HTML_DOCS=( "${S}/doc/document.html" "${S}/doc/html_folder/" )
# @ECLASS-VARIABLE: PATCHES
# @DEFAULT_UNSET
# @DESCRIPTION:
# PATCHES array variable containing all various patches to be applied.
# This variable is expected to be defined in global scope of ebuild.
# Make sure to specify the full path. This variable is utilised in
# src_unpack/src_prepare phase based on EAPI.
#
# NOTE: if using patches folders with special file suffixes you have to
# define one additional variable EPATCH_SUFFIX="something"
#
# PATCHES=( "${FILESDIR}/mypatch.patch" "${FILESDIR}/patches_folder/" )
# @FUNCTION: base_src_unpack
# @DESCRIPTION:
# The base src_unpack function, which is exported.
# Calls also src_prepare with eapi older than 2.
base_src_unpack() {
debug-print-function $FUNCNAME "$@"
pushd "${WORKDIR}" > /dev/null
if [[ $(type -t unpacker_src_unpack) == "function" ]] ; then
unpacker_src_unpack
elif [[ -n ${A} ]] ; then
unpack ${A}
fi
has src_prepare ${BASE_EXPF} || base_src_prepare
popd > /dev/null
}
# @FUNCTION: base_src_prepare
# @DESCRIPTION:
# The base src_prepare function, which is exported
# EAPI is greater or equal to 2. Here the PATCHES array is evaluated.
base_src_prepare() {
debug-print-function $FUNCNAME "$@"
debug-print "$FUNCNAME: PATCHES=$PATCHES"
local patches_failed=0
pushd "${S}" > /dev/null
if [[ "$(declare -p PATCHES 2>/dev/null 2>&1)" == "declare -a"* ]]; then
for x in "${PATCHES[@]}"; do
debug-print "$FUNCNAME: applying patch from ${x}"
if [[ -d "${x}" ]]; then
# Use standardized names and locations with bulk patching
# Patch directory is ${WORKDIR}/patch
# See epatch() in eutils.eclass for more documentation
EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
# in order to preserve normal EPATCH_SOURCE value that can
# be used other way than with base eclass store in local
# variable and restore later
oldval=${EPATCH_SOURCE}
EPATCH_SOURCE=${x}
EPATCH_FORCE=yes
epatch
EPATCH_SOURCE=${oldval}
elif [[ -f "${x}" ]]; then
epatch "${x}"
else
ewarn "QA: File or directory \"${x}\" does not exist."
ewarn "QA: Check your PATCHES array or add missing file/directory."
patches_failed=1
fi
done
[[ ${patches_failed} -eq 1 ]] && die "Some patches failed. See above messages."
else
for x in ${PATCHES}; do
debug-print "$FUNCNAME: patching from ${x}"
epatch "${x}"
done
fi
# Apply user patches
debug-print "$FUNCNAME: applying user patches"
epatch_user
popd > /dev/null
}
# @FUNCTION: base_src_configure
# @DESCRIPTION:
# The base src_configure function, which is exported when
# EAPI is greater or equal to 2. Runs basic econf.
base_src_configure() {
debug-print-function $FUNCNAME "$@"
# there is no pushd ${S} so we can override its place where to run
[[ -x ${ECONF_SOURCE:-.}/configure ]] && econf "$@"
}
# @FUNCTION: base_src_compile
# @DESCRIPTION:
# The base src_compile function, calls src_configure with
# EAPI older than 2.
base_src_compile() {
debug-print-function $FUNCNAME "$@"
has src_configure ${BASE_EXPF} || base_src_configure
base_src_make "$@"
}
# @FUNCTION: base_src_make
# @DESCRIPTION:
# Actual function that runs emake command.
base_src_make() {
debug-print-function $FUNCNAME "$@"
if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
emake "$@" || die "died running emake, $FUNCNAME"
fi
}
# @FUNCTION: base_src_install
# @DESCRIPTION:
# The base src_install function. Runs make install and
# installs documents and html documents from DOCS and HTML_DOCS
# arrays.
base_src_install() {
debug-print-function $FUNCNAME "$@"
emake DESTDIR="${D}" "$@" install || die "died running make install, $FUNCNAME"
base_src_install_docs
}
# @FUNCTION: base_src_install_docs
# @DESCRIPTION:
# Actual function that install documentation from
# DOCS and HTML_DOCS arrays.
base_src_install_docs() {
debug-print-function $FUNCNAME "$@"
local x
pushd "${S}" > /dev/null
if [[ "$(declare -p DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then
for x in "${DOCS[@]}"; do
debug-print "$FUNCNAME: docs: creating document from ${x}"
dodoc "${x}" || die "dodoc failed"
done
fi
if [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then
for x in "${HTML_DOCS[@]}"; do
debug-print "$FUNCNAME: docs: creating html document from ${x}"
dohtml -r "${x}" || die "dohtml failed"
done
fi
popd > /dev/null
}
fi

View File

@ -1,141 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: cannadic.eclass
# @MAINTAINER:
# cjk@gentoo.org
# @AUTHOR:
# Mamoru KOMACHI <usata@gentoo.org>
# @BLURB: Function for Canna compatible dictionaries
# @DESCRIPTION:
# The cannadic eclass is used for installation and setup of Canna
# compatible dictionaries within the Portage system.
inherit eutils
EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_postrm src_install
HOMEPAGE="http://canna.osdn.jp/" # you need to change this!
SRC_URI="mirror://gentoo/${P}.tar.gz"
DICSDIRFILE="${FILESDIR}/*.dics.dir"
CANNADICS="${CANNADICS}" # (optional)
# You don't need to modify these
CANNADIC_CANNA_DIR="${EROOT:-${ROOT}}"var/lib/canna/dic/canna
CANNADIC_DICS_DIR="${EROOT:-${ROOT}}"var/lib/canna/dic/dics.d
readonly CANNADIC_CANNA_DIR CANNADIC_DICS_DIR
# @FUNCTION: cannadic_pkg_setup
# @DESCRIPTION:
# Sets up ${CANNADIC_CANNA_DIR}
cannadic_pkg_setup() {
keepdir "${CANNADIC_CANNA_DIR}"
fowners bin:bin "${CANNADIC_CANNA_DIR}"
fperms 0775 "${CANNADIC_CANNA_DIR}"
}
# @FUNCTION: cannadic-install
# @DESCRIPTION:
# Installs dictionaries to ${CANNADIC_CANNA_DIR}
cannadic-install() {
insinto "${CANNADIC_CANNA_DIR}"
insopts -m 0664 -o bin -g bin
doins "${@}"
}
# @FUNCTION: dicsdir-install
# @DESCRIPTION:
# Installs dics.dir from ${DICSDIRFILE}
dicsdir-install() {
insinto "${CANNADIC_DICS_DIR}"
doins "${DICSDIRFILE}"
}
# @FUNCTION: cannadic_src_install
# @DESCRIPTION:
# Installs all dictionaries under ${WORKDIR}
# plus dics.dir and docs
cannadic_src_install() {
local f
for f in *.c[btl]d *.t; do
if [[ -s "${f}" ]]; then
cannadic-install "${f}"
fi
done 2> /dev/null
dicsdir-install || die
einstalldocs
}
# @FUNCTION: update-cannadic-dir
# @DESCRIPTION:
# Updates dics.dir for Canna Server, script for this part taken from Debian GNU/Linux
#
# compiles dics.dir files for Canna Server
# Copyright 2001 ISHIKAWA Mutsumi
# Licensed under the GNU General Public License, version 2. See the file
# /usr/portage/license/GPL-2 or <http://www.gnu.org/copyleft/gpl.txt>.
update-cannadic-dir() {
einfo
einfo "Updating dics.dir for Canna ..."
einfo
# write new dics.dir file in case we are interrupted
cat <<-EOF > "${CANNADIC_CANNA_DIR}"/dics.dir.update-new
# dics.dir -- automatically generated file by Portage.
# DO NOT EDIT BY HAND.
EOF
local f
for f in "${CANNADIC_DICS_DIR}"/*.dics.dir; do
echo "# ${f}" >> "${CANNADIC_CANNA_DIR}"/dics.dir.update-new
cat "${f}" >> "${CANNADIC_CANNA_DIR}"/dics.dir.update-new
einfo "Added ${f}."
done
mv "${CANNADIC_CANNA_DIR}"/dics.dir.update-new "${CANNADIC_CANNA_DIR}"/dics.dir
einfo
einfo "Done."
einfo
}
# @FUNCTION: cannadic_pkg_postinst
# @DESCRIPTION:
# Updates dics.dir and print out notice after install
cannadic_pkg_postinst() {
update-cannadic-dir
einfo
einfo "Please restart cannaserver to fit the changes."
einfo "You need to modify your config file (~/.canna) to enable dictionaries."
if [[ -n "${CANNADICS}" ]]; then
einfo "e.g) add $(for d in ${CANNADICS}; do echo -n "\"${d}\" "; done)to section use-dictionary()."
einfo "For details, see documents under /usr/share/doc/${PF}."
fi
einfo "If you do not have ~/.canna, you can find sample files in /usr/share/canna."
ewarn "If you are upgrading from existing dictionary, you may need to recreate"
ewarn "user dictionary if you have one."
einfo
}
# @FUNCTION: cannadic_pkg_postrm
# @DESCRIPTION:
# Updates dics.dir and print out notice after uninstall
cannadic_pkg_postrm() {
update-cannadic-dir
einfo
einfo "Please restart cannaserver to fit changes."
einfo "and modify your config file (~/.canna) to disable dictionary."
if [[ -n "${CANNADICS}" ]]; then
einfo "e.g) delete $(for d in ${CANNADICS}; do echo -n "\"${d}\" "; done)from section use-dictionary()."
fi
einfo
}

View File

@ -1,308 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: cdrom.eclass
# @MAINTAINER:
# games@gentoo.org
# @BLURB: Functions for CD-ROM handling
# @DESCRIPTION:
# Acquire CD(s) for those lovely CD-based emerges. Yes, this violates
# the whole "non-interactive" policy, but damnit I want CD support!
#
# Do not call these functions in pkg_* phases like pkg_setup as they
# should not be used for binary packages. Most packages using this
# eclass will require RESTRICT="bindist" but the point still stands.
# The functions are generally called in src_unpack.
if [[ -z ${_CDROM_ECLASS} ]]; then
_CDROM_ECLASS=1
inherit portability
# @ECLASS-VARIABLE: CDROM_OPTIONAL
# @DEFAULT_UNSET
# @DESCRIPTION:
# By default, the eclass sets PROPERTIES="interactive" on the assumption
# that people will be using these. If your package optionally supports
# disc-based installs then set this to "yes" and we'll set things
# conditionally based on USE="cdinstall".
if [[ ${CDROM_OPTIONAL} == "yes" ]] ; then
IUSE="cdinstall"
PROPERTIES="cdinstall? ( interactive )"
else
PROPERTIES="interactive"
fi
# @FUNCTION: cdrom_get_cds
# @USAGE: <cd1 file>[:alt cd1 file] [cd2 file[:alt cd2 file]] [...]
# @DESCRIPTION:
# Attempt to locate a CD based upon a file that is on the CD.
#
# If the data spans multiple discs then additional arguments can be
# given to check for more files. Call cdrom_load_next_cd() to scan for
# the next disc in the set.
#
# Sometimes it is necessary to support alternative CD "sets" where the
# contents differ. Alternative files for each disc can be appended to
# each argument, separated by the : character. This feature is
# frequently used to support installing from an existing installation.
# Note that after the first disc is detected, the set is locked so
# cdrom_load_next_cd() will only scan for files in that specific set on
# subsequent discs.
#
# The given files can be within named subdirectories. It is not
# necessary to specify different casings of the same filename as
# matching is done case-insensitively. Filenames can include special
# characters such as spaces. Only : is not allowed.
#
# If you don't want each disc to be referred to as "CD #1", "CD #2",
# etc. then you can optionally provide your own names. Set CDROM_NAME
# for a single disc, CDROM_NAMES as an array for multiple discs, or
# individual CDROM_NAME_# variables for each disc starting from 1.
#
# Despite what you may have seen in older ebuilds, it has never been
# possible to provide per-set disc names. This would not make sense as
# all the names are initially displayed before the first disc has been
# detected. As a workaround, you can redefine the name variable(s)
# after the first disc has been detected.
#
# This function ends with a cdrom_load_next_cd() call to scan for the
# first disc. For more details about variables read and written by this
# eclass, see that function's description.
cdrom_get_cds() {
unset CDROM_SET
export CDROM_CURRENT_CD=0
export CDROM_NUM_CDS="${#}"
local i
for i in $(seq ${#}); do
export CDROM_CHECK_${i}="${!i}"
done
# If the user has set CD_ROOT or CD_ROOT_1, don't bother informing
# them about which discs are needed as they presumably already know.
if [[ -n ${CD_ROOT}${CD_ROOT_1} ]] ; then
:
# Single disc info.
elif [[ ${#} -eq 1 ]] ; then
einfo "This ebuild will need the ${CDROM_NAME:-CD for ${PN}}"
echo
einfo "If you do not have the CD, but have the data files"
einfo "mounted somewhere on your filesystem, just export"
einfo "the variable CD_ROOT so that it points to the"
einfo "directory containing the files."
echo
einfo "For example:"
einfo "export CD_ROOT=/mnt/cdrom"
echo
# Multi disc info.
else
_cdrom_set_names
einfo "This package may need access to ${#} CDs."
local cdcnt
for cdcnt in $(seq ${#}); do
local var=CDROM_NAME_${cdcnt}
[[ ! -z ${!var} ]] && einfo " CD ${cdcnt}: ${!var}"
done
echo
einfo "If you do not have the CDs, but have the data files"
einfo "mounted somewhere on your filesystem, just export"
einfo "the following variables so they point to the right place:"
einfo $(printf "CD_ROOT_%d " $(seq ${#}))
echo
einfo "Or, if you have all the files in the same place, or"
einfo "you only have one CD, you can export CD_ROOT"
einfo "and that place will be used as the same data source"
einfo "for all the CDs."
echo
einfo "For example:"
einfo "export CD_ROOT=/mnt/cdrom"
echo
fi
# Scan for the first disc.
cdrom_load_next_cd
}
# @FUNCTION: cdrom_load_next_cd
# @DESCRIPTION:
# If multiple arguments were given to cdrom_get_cds() then you can call
# this function to scan for the next disc. This function is also called
# implicitly to scan for the first disc.
#
# The file(s) given to cdrom_get_cds() are scanned for on any mounted
# filesystem that resembles optical media. If no match is found then
# the user is prompted to insert and mount the disc and press enter to
# rescan. This will loop continuously until a match is found or the
# user aborts with Ctrl+C.
#
# The user can override the scan location by setting CD_ROOT for a
# single disc, CD_ROOT if multiple discs are merged into the same
# directory tree (useful for existing installations), or individual
# CD_ROOT_# variables for each disc starting from 1. If no match is
# found then the function dies with an error as a rescan will not help
# in this instance.
#
# Users wanting to set CD_ROOT or CD_ROOT_# for specific packages
# persistently can do so using Portage's /etc/portage/env feature.
#
# Regardless of which scanning method is used, several variables are set
# by this function for you to use:
#
# CDROM_ROOT: Root path of the detected disc.
# CDROM_MATCH: Path of the matched file, relative to CDROM_ROOT.
# CDROM_ABSMATCH: Absolute path of the matched file.
# CDROM_SET: The matching set number, starting from 0.
#
# The casing of CDROM_MATCH may not be the same as the argument given to
# cdrom_get_cds() as matching is done case-insensitively. You should
# therefore use this variable (or CDROM_ABSMATCH) when performing file
# operations to ensure the file is found. Use newins rather than doins
# to keep the final result consistent and take advantage of Bash
# case-conversion features like ${FOO,,}.
#
# Chances are that you'll need more than just the matched file from each
# disc though. You should not assume the casing of these files either
# but dealing with this goes beyond the scope of this ebuild. For a
# good example, see games-action/descent2-data, which combines advanced
# globbing with advanced tar features to concisely deal with
# case-insensitive matching, case conversion, file moves, and
# conditional exclusion.
#
# Copying directly from a mounted disc using doins/newins will remove
# any read-only permissions but be aware of these when copying to an
# intermediate directory first. Attempting to clean a build directory
# containing read-only files as a non-root user will result in an error.
# If you're using tar as suggested above then you can easily work around
# this with --mode=u+w.
#
# Note that you can only go forwards in the disc list, so make sure you
# only call this function when you're done using the current disc.
#
# If you cd to any location within CDROM_ROOT then remember to leave the
# directory before calling this function again, otherwise the user won't
# be able to unmount the current disc.
cdrom_load_next_cd() {
local showedmsg=0 showjolietmsg=0
unset CDROM_ROOT
((++CDROM_CURRENT_CD))
_cdrom_set_names
while true ; do
local i cdset
: CD_ROOT_${CDROM_CURRENT_CD}
export CDROM_ROOT=${CD_ROOT:-${!_}}
local var="CDROM_CHECK_${CDROM_CURRENT_CD}"
IFS=: read -r -a cdset -d "" <<< "${!var}"
for i in $(seq ${CDROM_SET:-0} ${CDROM_SET:-$((${#cdset[@]} - 1))}); do
local f=${cdset[${i}]} point= node= fs= opts=
if [[ -z ${CDROM_ROOT} ]] ; then
while read point node fs opts ; do
has "${fs}" cd9660 iso9660 udf || continue
point=${point//\040/ }
export CDROM_MATCH=$(_cdrom_glob_match "${point}" "${f}")
[[ -z ${CDROM_MATCH} ]] && continue
export CDROM_ROOT=${point}
done <<< "$(get_mounts)"
else
export CDROM_MATCH=$(_cdrom_glob_match "${CDROM_ROOT}" "${f}")
fi
if [[ -n ${CDROM_MATCH} ]] ; then
export CDROM_ABSMATCH=${CDROM_ROOT}/${CDROM_MATCH}
export CDROM_SET=${i}
break 2
fi
done
# If we get here then we were unable to locate a match. If
# CDROM_ROOT is non-empty then this implies that a CD_ROOT
# variable was given and we should therefore abort immediately.
if [[ -n ${CDROM_ROOT} ]] ; then
die "unable to locate CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}"
fi
if [[ ${showedmsg} -eq 0 ]] ; then
if [[ ${CDROM_NUM_CDS} -eq 1 ]] ; then
einfo "Please insert+mount the ${CDROM_NAME:-CD for ${PN}} now !"
else
local var="CDROM_NAME_${CDROM_CURRENT_CD}"
if [[ -z ${!var} ]] ; then
einfo "Please insert+mount CD #${CDROM_CURRENT_CD} for ${PN} now !"
else
einfo "Please insert+mount the ${!var} now !"
fi
fi
showedmsg=1
fi
einfo "Press return to scan for the CD again"
einfo "or hit CTRL+C to abort the emerge."
if [[ ${showjolietmsg} -eq 0 ]] ; then
showjolietmsg=1
else
echo
ewarn "If you are having trouble with the detection"
ewarn "of your CD, it is possible that you do not have"
ewarn "Joliet support enabled in your kernel. Please"
ewarn "check that CONFIG_JOLIET is enabled in your kernel."
fi
read || die "something is screwed with your system"
done
einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}"
}
# @FUNCTION: _cdrom_glob_match
# @USAGE: <root directory> <path>
# @INTERNAL
# @DESCRIPTION:
# Locates the given path ($2) within the given root directory ($1)
# case-insensitively and returns the first actual matching path. This
# eclass previously used "find -iname" but it only checked the file
# case-insensitively and not the directories. There is "find -ipath"
# but this does not intelligently skip non-matching paths, making it
# slow. Case-insensitive matching can only be applied to patterns so
# extended globbing is used to turn regular strings into patterns. All
# special characters are escaped so don't worry about breaking this.
_cdrom_glob_match() {
# The following line turns this:
# foo*foo/bar bar/baz/file.zip
#
# Into this:
# ?(foo\*foo)/?(bar\ bar)/?(baz)/?(file\.zip)
#
# This turns every path component into an escaped extended glob
# pattern to allow case-insensitive matching. Globs cannot span
# directories so each component becomes an individual pattern.
local p=\?\($(sed -e 's:[^A-Za-z0-9/]:\\\0:g' -e 's:/:)/?(:g' <<< "$2" || die)\)
(
cd "$1" 2>/dev/null || return
shopt -s extglob nocaseglob nullglob || die
# The first person to make this work without an eval wins a
# cookie. It breaks without it when spaces are present.
eval "ARRAY=( ${p%\?()} )"
echo ${ARRAY[0]}
)
}
# @FUNCTION: _cdrom_set_names
# @INTERNAL
# @DESCRIPTION:
# Populate CDROM_NAME_# variables with the CDROM_NAMES array.
_cdrom_set_names() {
if [[ -n ${CDROM_NAMES} ]] ; then
local i
for i in $(seq ${#CDROM_NAMES[@]}); do
export CDROM_NAME_${i}="${CDROM_NAMES[$((${i} - 1))]}"
done
fi
}
fi

View File

@ -1,234 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: common-lisp-3.eclass
# @MAINTAINER:
# Common Lisp project <common-lisp@gentoo.org>
# @BLURB: functions to support the installation of Common Lisp libraries
# @DESCRIPTION:
# Since Common Lisp libraries share similar structure, this eclass aims
# to provide a simple way to write ebuilds with these characteristics.
inherit eutils
# @ECLASS-VARIABLE: CLIMPLEMENTATIONS
# @DESCRIPTION:
# Common Lisp implementations
CLIMPLEMENTATIONS="sbcl clisp clozurecl cmucl ecls gcl abcl"
# @ECLASS-VARIABLE: CLSOURCEROOT
# @DESCRIPTION:
# Default path of Common Lisp libraries sources. Sources will
# be installed into ${CLSOURCEROOT}/${CLPACKAGE}.
CLSOURCEROOT="${ROOT%/}"/usr/share/common-lisp/source
# @ECLASS-VARIABLE: CLSYSTEMROOT
# @DESCRIPTION:
# Default path to find any asdf file. Any asdf files will be
# symlinked in ${CLSYSTEMROOT}/${CLSYSTEM} as they may be in
# an arbitrarily deeply nested directory under ${CLSOURCEROOT}/${CLPACKAGE}.
CLSYSTEMROOT="${ROOT%/}"/usr/share/common-lisp/systems
# @ECLASS-VARIABLE: CLPACKAGE
# @DESCRIPTION:
# Default package name. To override, set these after inheriting this eclass.
CLPACKAGE="${PN}"
PDEPEND="virtual/commonlisp"
EXPORT_FUNCTIONS src_compile src_install
# @FUNCTION: common-lisp-3_src_compile
# @DESCRIPTION:
# Since there's nothing to build in most cases, default doesn't do
# anything.
common-lisp-3_src_compile() {
true;
}
# @FUNCTION: absolute-path-p
# @DESCRIPTION:
# Returns true if ${1} is an absolute path.
absolute-path-p() {
[[ $# -eq 1 ]] || die "${FUNCNAME[0]} must receive one argument"
[[ ${1} == /* ]]
}
# @FUNCTION: common-lisp-install-one-source
# @DESCRIPTION:
# Installs ${2} source file in ${3} inside CLSOURCEROOT/CLPACKAGE.
common-lisp-install-one-source() {
[[ $# -eq 3 ]] || die "${FUNCNAME[0]} must receive exactly three arguments"
local fpredicate=${1}
local source=${2}
local target="${CLSOURCEROOT}/${CLPACKAGE}/${3}"
if absolute-path-p "${source}" ; then
die "Cannot install files with absolute path: ${source}"
fi
if ${fpredicate} "${source}" ; then
insinto "${target}"
doins "${source}" || die "Failed to install ${source} into $(dirname "${target}")"
fi
}
# @FUNCTION: lisp-file-p
# @DESCRIPTION:
# Returns true if ${1} is lisp source file.
lisp-file-p() {
[[ $# -eq 1 ]] || die "${FUNCNAME[0]} must receive one argument"
[[ ${1} =~ \.(lisp|lsp|cl)$ ]]
}
# @FUNCTION: common-lisp-get-fpredicate
# @DESCRIPTION:
# Outputs the corresponding predicate to check files of type ${1}.
common-lisp-get-fpredicate() {
[[ $# -eq 1 ]] || die "${FUNCNAME[0]} must receive one argument"
local ftype=${1}
case ${ftype} in
"lisp") echo "lisp-file-p" ;;
"all" ) echo "true" ;;
* ) die "Unknown filetype specifier ${ftype}" ;;
esac
}
# @FUNCTION: common-lisp-install-sources
# @USAGE: common-lisp-install-sources path [<other_paths>...]
# @DESCRIPTION:
# Recursively install lisp sources of type ${2} if ${1} is -t or
# Lisp by default. When given a directory, it will be recursively
# scanned for Lisp source files with suffixes: .lisp, .lsp or .cl.
common-lisp-install-sources() {
local ftype="lisp"
if [[ ${1} == "-t" ]] ; then
ftype=${2}
shift ; shift
fi
[[ $# -ge 1 ]] || die "${FUNCNAME[0]} must receive one non-option argument"
local fpredicate=$(common-lisp-get-fpredicate "${ftype}")
for path in "${@}" ; do
if [[ -f ${path} ]] ; then
common-lisp-install-one-source ${fpredicate} "${path}" "$(dirname "${path}")"
elif [[ -d ${path} ]] ; then
common-lisp-install-sources -t ${ftype} $(find "${path}" -type f)
else
die "${path} is neither a regular file nor a directory"
fi
done
}
# @FUNCTION: common-lisp-install-one-asdf
# @DESCRIPTION:
# Installs ${1} asdf file in CLSOURCEROOT/CLPACKAGE and symlinks it in
# CLSYSTEMROOT.
common-lisp-install-one-asdf() {
[[ $# != 1 ]] && die "${FUNCNAME[0]} must receive exactly one argument"
# the suffix «.asd» is optional
local source=${1/.asd}.asd
common-lisp-install-one-source true "${source}" "$(dirname "${source}")"
local target="${CLSOURCEROOT%/}/${CLPACKAGE}/${source}"
dosym "${target}" "${CLSYSTEMROOT%/}/$(basename ${target})"
}
# @FUNCTION: common-lisp-install-asdf
# @USAGE: common-lisp-install-asdf path [<other_paths>...]
# @DESCRIPTION:
# Installs all ASDF files and creates symlinks in CLSYSTEMROOT.
# When given a directory, it will be recursively scanned for ASDF
# files with extension .asd.
common-lisp-install-asdf() {
dodir "${CLSYSTEMROOT}"
[[ $# = 0 ]] && set - ${CLSYSTEMS}
[[ $# = 0 ]] && set - $(find . -type f -name \*.asd)
for sys in "${@}" ; do
common-lisp-install-one-asdf ${sys}
done
}
# @FUNCTION: common-lisp-3_src_install
# @DESCRIPTION:
# Recursively install Lisp sources, asdf files and most common doc files.
common-lisp-3_src_install() {
common-lisp-install-sources .
common-lisp-install-asdf
for i in AUTHORS README* HEADER TODO* CHANGELOG Change[lL]og CHANGES BUGS CONTRIBUTORS *NEWS* ; do
[[ -f ${i} ]] && dodoc ${i}
done
}
# @FUNCTION: common-lisp-find-lisp-impl
# @USAGE: common-lisp-find-lisp-impl
# @DESCRIPTION:
# Outputs an installed Common Lisp implementation. Transverses
# CLIMPLEMENTATIONS to find it.
common-lisp-find-lisp-impl() {
for lisp in ${CLIMPLEMENTATIONS} ; do
[[ "$(best_version dev-lisp/${lisp})" ]] && echo "${lisp}" && return
done
die "No CommonLisp implementation found"
}
# @FUNCTION: common-lisp-export-impl-args
# @USAGE: common-lisp-export-impl-args <lisp-implementation>
# @DESCRIPTION:
# Export a few variables containing the switches necessary
# to make the CL implementation perform basic functions:
# * CL_BINARY: Common Lisp implementation
# * CL_NORC: don't load syste-wide or user-specific initfiles
# * CL_LOAD: load a certain file
# * CL_EVAL: eval a certain expression at startup
common-lisp-export-impl-args() {
if [[ $# != 1 ]]; then
eerror "Usage: ${FUNCNAME[0]} lisp-implementation"
die "${FUNCNAME[0]}: wrong number of arguments: $#"
fi
CL_BINARY="${1}"
case "${CL_BINARY}" in
sbcl)
CL_NORC="--sysinit /dev/null --userinit /dev/null"
CL_LOAD="--load"
CL_EVAL="--eval"
;;
clisp)
CL_NORC="-norc"
CL_LOAD="-i"
CL_EVAL="-x"
;;
clozure | clozurecl | ccl | openmcl)
CL_BINARY="ccl"
CL_NORC="--no-init"
CL_LOAD="--load"
CL_EVAL="--eval"
;;
cmucl)
CL_NORC="-nositeinit -noinit"
CL_LOAD="-load"
CL_EVAL="-eval"
;;
ecl | ecls)
CL_BINARY="ecl"
CL_NORC="-norc"
CL_LOAD="-load"
CL_EVAL="-eval"
;;
abcl)
CL_NORC="--noinit"
CL_LOAD="--load"
CL_EVAL="--eval"
;;
*)
die "${CL_BINARY} is not supported by ${0}"
;;
esac
export CL_BINARY CL_NORC CL_LOAD CL_EVAL
}

View File

@ -1,582 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: cvs.eclass
# @MAINTAINER:
# vapier@gentoo.org (and anyone who wants to help)
# @BLURB: This eclass provides generic cvs fetching functions
# @DESCRIPTION:
# This eclass provides the generic cvs fetching functions. To use this from an
# ebuild, set the ECLASS VARIABLES as specified below in your ebuild before
# inheriting. Then either leave the default src_unpack or extend over
# cvs_src_unpack. If you find that you need to call the cvs_* functions
# directly, I'd be interested to hear about it.
if [[ -z ${_CVS_ECLASS} ]]; then
_CVS_ECLASS=1
inherit eutils
# TODO:
# Implement more auth types (gserver?, kserver?)
# Support additional remote shells with `ext' authentication (does
# anyone actually need to use it with anything other than SSH?)
# Users shouldn't change these settings! The ebuild/eclass inheriting
# this eclass will take care of that. If you want to set the global
# KDE cvs ebuilds' settings, see the comments in kde-source.eclass.
# @ECLASS-VARIABLE: ECVS_CVS_COMPRESS
# @DESCRIPTION:
# Set the default compression level. Has no effect when ECVS_CVS_COMMAND
# is defined by ebuild/user.
: ${ECVS_CVS_COMPRESS:=-z1}
# @ECLASS-VARIABLE: ECVS_CVS_OPTIONS
# @DESCRIPTION:
# Additional options to the cvs commands. Has no effect when ECVS_CVS_COMMAND
# is defined by ebuild/user.
: ${ECVS_CVS_OPTIONS:=-q -f}
# @ECLASS-VARIABLE: ECVS_CVS_COMMAND
# @DESCRIPTION:
# CVS command to run
#
# You can set, for example, "cvs -t" for extensive debug information
# on the cvs connection. The default of "cvs -q -f -z4" means to be
# quiet, to disregard the ~/.cvsrc config file and to use maximum
# compression.
: ${ECVS_CVS_COMMAND:=cvs ${ECVS_CVS_OPTIONS} ${ECVS_CVS_COMPRESS}}
# @ECLASS-VARIABLE: ECVS_UP_OPTS
# @DESCRIPTION:
# CVS options given after the cvs update command. Don't remove "-dP" or things
# won't work.
: ${ECVS_UP_OPTS:=-dP}
# @ECLASS-VARIABLE: ECVS_CO_OPTS
# @DEFAULT_UNSET
# @DESCRIPTION:
# CVS options given after the cvs checkout command.
# @ECLASS-VARIABLE: ECVS_OFFLINE
# @DESCRIPTION:
# Set this variable to a non-empty value to disable the automatic updating of
# a CVS source tree. This is intended to be set outside the cvs source
# tree by users.
: ${ECVS_OFFLINE:=${EVCS_OFFLINE}}
# @ECLASS-VARIABLE: ECVS_LOCAL
# @DEFAULT_UNSET
# @DESCRIPTION:
# If this is set, the CVS module will be fetched non-recursively.
# Refer to the information in the CVS man page regarding the -l
# command option (not the -l global option).
# @ECLASS-VARIABLE: ECVS_LOCALNAME
# @DEFAULT_UNSET
# @DESCRIPTION:
# Local name of checkout directory
#
# This is useful if the module on the server is called something
# common like 'driver' or is nested deep in a tree, and you don't like
# useless empty directories.
#
# WARNING: Set this only from within ebuilds! If set in your shell or
# some such, things will break because the ebuild won't expect it and
# have e.g. a wrong $S setting.
# @ECLASS-VARIABLE: ECVS_TOP_DIR
# @DESCRIPTION:
# The directory under which CVS modules are checked out.
: ${ECVS_TOP_DIR:="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/cvs-src"}
# @ECLASS-VARIABLE: ECVS_SERVER
# @DESCRIPTION:
# CVS path
#
# The format is "server:/dir", e.g. "anoncvs.kde.org:/home/kde".
# Remove the other parts of the full CVSROOT, which might look like
# ":pserver:anonymous@anoncvs.kde.org:/home/kde"; this is generated
# using other settings also.
#
# Set this to "offline" to disable fetching (i.e. to assume the module
# is already checked out in ECVS_TOP_DIR).
: ${ECVS_SERVER:="offline"}
# @ECLASS-VARIABLE: ECVS_MODULE
# @REQUIRED
# @DESCRIPTION:
# The name of the CVS module to be fetched
#
# This must be set when cvs_src_unpack is called. This can include
# several directory levels, i.e. "foo/bar/baz"
#[[ -z ${ECVS_MODULE} ]] && die "$ECLASS: error: ECVS_MODULE not set, cannot continue"
# @ECLASS-VARIABLE: ECVS_DATE
# @DEFAULT_UNSET
# @DESCRIPTION:
# The date of the checkout. See the -D date_spec option in the cvs
# man page for more details.
# @ECLASS-VARIABLE: ECVS_BRANCH
# @DEFAULT_UNSET
# @DESCRIPTION:
# The name of the branch/tag to use
#
# The default is "HEAD". The following default _will_ reset your
# branch checkout to head if used.
#: ${ECVS_BRANCH:="HEAD"}
# @ECLASS-VARIABLE: ECVS_AUTH
# @DESCRIPTION:
# Authentication method to use
#
# Possible values are "pserver" and "ext". If `ext' authentication is
# used, the remote shell to use can be specified in CVS_RSH (SSH is
# used by default). Currently, the only supported remote shell for
# `ext' authentication is SSH.
#
# Armando Di Cianno <fafhrd@gentoo.org> 2004/09/27
# - Added "no" as a server type, which uses no AUTH method, nor
# does it login
# e.g.
# "cvs -danoncvs@savannah.gnu.org:/cvsroot/backbone co System"
# ( from gnustep-apps/textedit )
: ${ECVS_AUTH:="pserver"}
# @ECLASS-VARIABLE: ECVS_USER
# @DESCRIPTION:
# Username to use for authentication on the remote server.
: ${ECVS_USER:="anonymous"}
# @ECLASS-VARIABLE: ECVS_PASS
# @DEFAULT_UNSET
# @DESCRIPTION:
# Password to use for authentication on the remote server
# @ECLASS-VARIABLE: ECVS_SSH_HOST_KEY
# @DEFAULT_UNSET
# @DESCRIPTION:
# If SSH is used for `ext' authentication, use this variable to
# specify the host key of the remote server. The format of the value
# should be the same format that is used for the SSH known hosts file.
#
# WARNING: If a SSH host key is not specified using this variable, the
# remote host key will not be verified.
# @ECLASS-VARIABLE: ECVS_CLEAN
# @DEFAULT_UNSET
# @DESCRIPTION:
# Set this to get a clean copy when updating (passes the
# -C option to cvs update)
# @ECLASS-VARIABLE: ECVS_RUNAS
# @DEFAULT_UNSET
# @DESCRIPTION:
# Specifies an alternate (non-root) user to use to run cvs. Currently
# b0rked and wouldn't work with portage userpriv anyway without
# special magic.
# : ${ECVS_RUNAS:=$(whoami)}
# add cvs to deps
# ssh is used for ext auth
# sudo is used to run as a specified user
DEPEND="dev-vcs/cvs"
[[ -n ${ECVS_RUNAS} ]] && DEPEND+=" app-admin/sudo"
if [[ ${ECVS_AUTH} == "ext" ]] ; then
#default to ssh
[[ -z ${CVS_RSH} ]] && export CVS_RSH="ssh"
if [[ ${CVS_RSH} != "ssh" ]] ; then
die "Support for ext auth with clients other than ssh has not been implemented yet"
fi
DEPEND+=" net-misc/openssh"
fi
# called from cvs_src_unpack
cvs_fetch() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
# Make these options local variables so that the global values are
# not affected by modifications in this function.
local ECVS_COMMAND=${ECVS_COMMAND}
local ECVS_UP_OPTS=${ECVS_UP_OPTS}
local ECVS_CO_OPTS=${ECVS_CO_OPTS}
debug-print-function ${FUNCNAME} "$@"
# Update variables that are modified by ebuild parameters, which
# should be effective every time cvs_fetch is called, and not just
# every time cvs.eclass is inherited
# Handle parameter for local (non-recursive) fetching
if [[ -n ${ECVS_LOCAL} ]] ; then
ECVS_UP_OPTS+=" -l"
ECVS_CO_OPTS+=" -l"
fi
# Handle ECVS_BRANCH option
#
# Because CVS auto-switches branches, we just have to pass the
# correct -rBRANCH option when updating.
if [[ -n ${ECVS_BRANCH} ]] ; then
ECVS_UP_OPTS+=" -r${ECVS_BRANCH}"
ECVS_CO_OPTS+=" -r${ECVS_BRANCH}"
fi
# Handle ECVS_LOCALNAME, which specifies the local directory name
# to use. Note that the -d command option is not equivalent to
# the global -d option.
if [[ ${ECVS_LOCALNAME} != "${ECVS_MODULE}" ]] ; then
ECVS_CO_OPTS+=" -d ${ECVS_LOCALNAME}"
fi
if [[ -n ${ECVS_CLEAN} ]] ; then
ECVS_UP_OPTS+=" -C"
fi
if [[ -n ${ECVS_DATE} ]] ; then
ECVS_CO_OPTS+=" -D ${ECVS_DATE}"
ECVS_UP_OPTS+=" -D ${ECVS_DATE}"
fi
# It would be easiest to always be in "run-as mode", logic-wise,
# if sudo didn't ask for a password even when sudo'ing to `whoami`.
if [[ -z ${ECVS_RUNAS} ]] ; then
run=""
else
run="sudo -u ${ECVS_RUNAS}"
fi
# Create the top dir if needed
if [[ ! -d ${ECVS_TOP_DIR} ]] ; then
# Note that the addwrite statements in this block are only
# there to allow creating ECVS_TOP_DIR; we allow writing
# inside it separately.
# This is because it's simpler than trying to find out the
# parent path of the directory, which would need to be the
# real path and not a symlink for things to work (so we can't
# just remove the last path element in the string)
debug-print "${FUNCNAME}: checkout mode. creating cvs directory"
addwrite /foobar
addwrite /
${run} mkdir -p "/${ECVS_TOP_DIR}"
export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}"
fi
# In case ECVS_TOP_DIR is a symlink to a dir, get the real path,
# otherwise addwrite() doesn't work.
cd -P "${ECVS_TOP_DIR}" >/dev/null
ECVS_TOP_DIR=$(pwd)
# Disable the sandbox for this dir
addwrite "${ECVS_TOP_DIR}"
# Chown the directory and all of its contents
if [[ -n ${ECVS_RUNAS} ]] ; then
${run} chown -R "${ECVS_RUNAS}" "/${ECVS_TOP_DIR}"
fi
# Determine the CVS command mode (checkout or update)
if [[ ! -d ${ECVS_TOP_DIR}/${ECVS_LOCALNAME}/CVS ]] ; then
mode=checkout
else
mode=update
fi
# Our server string (i.e. CVSROOT) without the password so it can
# be put in Root
local connection="${ECVS_AUTH}"
if [[ ${ECVS_AUTH} == "no" ]] ; then
local server="${ECVS_USER}@${ECVS_SERVER}"
else
[[ -n ${ECVS_PROXY} ]] && connection+=";proxy=${ECVS_PROXY}"
[[ -n ${ECVS_PROXY_PORT} ]] && connection+=";proxyport=${ECVS_PROXY_PORT}"
local server=":${connection}:${ECVS_USER}@${ECVS_SERVER}"
fi
# Switch servers automagically if needed
if [[ ${mode} == "update" ]] ; then
cd "/${ECVS_TOP_DIR}/${ECVS_LOCALNAME}"
local oldserver=$(${run} cat CVS/Root)
if [[ ${server} != "${oldserver}" ]] ; then
einfo "Changing the CVS server from ${oldserver} to ${server}:"
debug-print "${FUNCNAME}: Changing the CVS server from ${oldserver} to ${server}:"
einfo "Searching for CVS directories ..."
local cvsdirs=$(${run} find . -iname CVS -print)
debug-print "${FUNCNAME}: CVS directories found:"
debug-print "${cvsdirs}"
einfo "Modifying CVS directories ..."
local x
for x in ${cvsdirs} ; do
debug-print "In ${x}"
${run} echo "${server}" > "${x}/Root"
done
fi
fi
# Prepare a cvspass file just for this session, we don't want to
# mess with ~/.cvspass
touch "${T}/cvspass"
export CVS_PASSFILE="${T}/cvspass"
if [[ -n ${ECVS_RUNAS} ]] ; then
chown "${ECVS_RUNAS}" "${T}/cvspass"
fi
# The server string with the password in it, for login (only used for pserver)
cvsroot_pass=":${connection}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}"
# Ditto without the password, for checkout/update after login, so
# that the CVS/Root files don't contain the password in plaintext
if [[ ${ECVS_AUTH} == "no" ]] ; then
cvsroot_nopass="${ECVS_USER}@${ECVS_SERVER}"
else
cvsroot_nopass=":${connection}:${ECVS_USER}@${ECVS_SERVER}"
fi
# Commands to run
cmdlogin=( ${run} ${ECVS_CVS_COMMAND} -d "${cvsroot_pass}" login )
cmdupdate=( ${run} ${ECVS_CVS_COMMAND} -d "${cvsroot_nopass}" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME} )
cmdcheckout=( ${run} ${ECVS_CVS_COMMAND} -d "${cvsroot_nopass}" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE} )
# Execute commands
cd "${ECVS_TOP_DIR}"
if [[ ${ECVS_AUTH} == "pserver" ]] ; then
einfo "Running ${cmdlogin[*]}"
"${cmdlogin[@]}" || die "cvs login command failed"
if [[ ${mode} == "update" ]] ; then
einfo "Running ${cmdupdate[*]}"
"${cmdupdate[@]}" || die "cvs update command failed"
elif [[ ${mode} == "checkout" ]] ; then
einfo "Running ${cmdcheckout[*]}"
"${cmdcheckout[@]}" || die "cvs checkout command failed"
fi
elif [[ ${ECVS_AUTH} == "ext" || ${ECVS_AUTH} == "no" ]] ; then
# Hack to support SSH password authentication
# Backup environment variable values
local CVS_ECLASS_ORIG_CVS_RSH="${CVS_RSH}"
if [[ ${SSH_ASKPASS+set} == "set" ]] ; then
local CVS_ECLASS_ORIG_SSH_ASKPASS="${SSH_ASKPASS}"
else
unset CVS_ECLASS_ORIG_SSH_ASKPASS
fi
if [[ ${DISPLAY+set} == "set" ]] ; then
local CVS_ECLASS_ORIG_DISPLAY="${DISPLAY}"
else
unset CVS_ECLASS_ORIG_DISPLAY
fi
if [[ ${CVS_RSH} == "ssh" ]] ; then
# Force SSH to use SSH_ASKPASS by creating python wrapper
export CVS_RSH="${T}/cvs_sshwrapper"
cat > "${CVS_RSH}"<<EOF
#!${EPREFIX}/usr/bin/python
import fcntl
import os
import sys
try:
fd = os.open('/dev/tty', 2)
TIOCNOTTY=0x5422
try:
fcntl.ioctl(fd, TIOCNOTTY)
except:
pass
os.close(fd)
except:
pass
newarglist = sys.argv[:]
EOF
# disable X11 forwarding which causes .xauth access violations
# - 20041205 Armando Di Cianno <fafhrd@gentoo.org>
echo "newarglist.insert(1, '-oClearAllForwardings=yes')" \
>> "${CVS_RSH}"
echo "newarglist.insert(1, '-oForwardX11=no')" \
>> "${CVS_RSH}"
# Handle SSH host key checking
local CVS_ECLASS_KNOWN_HOSTS="${T}/cvs_ssh_known_hosts"
echo "newarglist.insert(1, '-oUserKnownHostsFile=${CVS_ECLASS_KNOWN_HOSTS}')" \
>> "${CVS_RSH}"
if [[ -z ${ECVS_SSH_HOST_KEY} ]] ; then
ewarn "Warning: The SSH host key of the remote server will not be verified."
einfo "A temporary known hosts list will be used."
local CVS_ECLASS_STRICT_HOST_CHECKING="no"
touch "${CVS_ECLASS_KNOWN_HOSTS}"
else
local CVS_ECLASS_STRICT_HOST_CHECKING="yes"
echo "${ECVS_SSH_HOST_KEY}" > "${CVS_ECLASS_KNOWN_HOSTS}"
fi
echo -n "newarglist.insert(1, '-oStrictHostKeyChecking=" \
>> "${CVS_RSH}"
echo "${CVS_ECLASS_STRICT_HOST_CHECKING}')" \
>> "${CVS_RSH}"
echo "os.execv('${EPREFIX}/usr/bin/ssh', newarglist)" \
>> "${CVS_RSH}"
chmod a+x "${CVS_RSH}"
# Make sure DISPLAY is set (SSH will not use SSH_ASKPASS
# if DISPLAY is not set)
: ${DISPLAY:="DISPLAY"}
export DISPLAY
# Create a dummy executable to echo ${ECVS_PASS}
export SSH_ASKPASS="${T}/cvs_sshechopass"
if [[ ${ECVS_AUTH} != "no" ]] ; then
echo -en "#!/bin/bash\necho \"${ECVS_PASS}\"\n" \
> "${SSH_ASKPASS}"
else
echo -en "#!/bin/bash\nreturn\n" \
> "${SSH_ASKPASS}"
fi
chmod a+x "${SSH_ASKPASS}"
fi
if [[ ${mode} == "update" ]] ; then
einfo "Running ${cmdupdate[*]}"
"${cmdupdate[@]}" || die "cvs update command failed"
elif [[ ${mode} == "checkout" ]] ; then
einfo "Running ${cmdcheckout[*]}"
"${cmdcheckout[@]}" || die "cvs checkout command failed"
fi
# Restore environment variable values
export CVS_RSH="${CVS_ECLASS_ORIG_CVS_RSH}"
if [[ ${CVS_ECLASS_ORIG_SSH_ASKPASS+set} == "set" ]] ; then
export SSH_ASKPASS="${CVS_ECLASS_ORIG_SSH_ASKPASS}"
else
unset SSH_ASKPASS
fi
if [[ ${CVS_ECLASS_ORIG_DISPLAY+set} == "set" ]] ; then
export DISPLAY="${CVS_ECLASS_ORIG_DISPLAY}"
else
unset DISPLAY
fi
fi
# Restore ownership. Not sure why this is needed, but someone
# added it in the orig ECVS_RUNAS stuff.
if [[ -n ${ECVS_RUNAS} ]] ; then
chown $(whoami) "${T}/cvspass"
fi
}
# @FUNCTION: cvs_src_unpack
# @DESCRIPTION:
# The cvs src_unpack function, which will be exported
cvs_src_unpack() {
debug-print-function ${FUNCNAME} "$@"
debug-print "${FUNCNAME}: init:
ECVS_CVS_COMMAND=${ECVS_CVS_COMMAND}
ECVS_UP_OPTS=${ECVS_UP_OPTS}
ECVS_CO_OPTS=${ECVS_CO_OPTS}
ECVS_TOP_DIR=${ECVS_TOP_DIR}
ECVS_SERVER=${ECVS_SERVER}
ECVS_USER=${ECVS_USER}
ECVS_PASS=${ECVS_PASS}
ECVS_MODULE=${ECVS_MODULE}
ECVS_LOCAL=${ECVS_LOCAL}
ECVS_RUNAS=${ECVS_RUNAS}
ECVS_LOCALNAME=${ECVS_LOCALNAME}"
[[ -z ${ECVS_MODULE} ]] && die "ERROR: CVS module not set, cannot continue."
local ECVS_LOCALNAME=${ECVS_LOCALNAME:-${ECVS_MODULE}}
local sanitized_pn=$(echo "${PN}" | LC_ALL=C sed -e 's:[^A-Za-z0-9_]:_:g')
local offline_pkg_var="ECVS_OFFLINE_${sanitized_pn}"
if [[ -n ${!offline_pkg_var}${ECVS_OFFLINE} ]] || [[ ${ECVS_SERVER} == "offline" ]] ; then
# We're not required to fetch anything; the module already
# exists and shouldn't be updated.
if [[ -d ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} ]] ; then
debug-print "${FUNCNAME}: offline mode"
else
debug-print "${FUNCNAME}: Offline mode specified but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found, exiting with error"
die "ERROR: Offline mode specified, but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found. Aborting."
fi
elif [[ -n ${ECVS_SERVER} ]] ; then # ECVS_SERVER!=offline --> real fetching mode
einfo "Fetching CVS module ${ECVS_MODULE} into ${ECVS_TOP_DIR} ..."
cvs_fetch
else # ECVS_SERVER not set
die "ERROR: CVS server not specified, cannot continue."
fi
einfo "Copying ${ECVS_MODULE} from ${ECVS_TOP_DIR} ..."
debug-print "Copying module ${ECVS_MODULE} local_mode=${ECVS_LOCAL} from ${ECVS_TOP_DIR} ..."
# This is probably redundant, but best to make sure.
mkdir -p "${WORKDIR}/${ECVS_LOCALNAME}"
if [[ -n ${ECVS_LOCAL} ]] ; then
cp -f "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}"/* "${WORKDIR}/${ECVS_LOCALNAME}"
else
cp -Rf "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}" "${WORKDIR}/${ECVS_LOCALNAME}/.."
fi
# Not exactly perfect, but should be pretty close #333773
export ECVS_VERSION=$(
find "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}/" -ipath '*/CVS/Entries' -exec cat {} + | \
LC_ALL=C sort | \
sha1sum | \
awk '{print $1}'
)
# If the directory is empty, remove it; empty directories cannot
# exist in cvs. This happens when, for example, kde-source
# requests module/doc/subdir which doesn't exist. Still create
# the empty directory in workdir though.
if [[ $(ls -A "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}") == "CVS" ]] ; then
debug-print "${FUNCNAME}: removing empty CVS directory ${ECVS_LOCALNAME}"
rm -rf "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}"
fi
# Implement some of base_src_unpack's functionality; note however
# that base.eclass may not have been inherited!
if [[ -n ${PATCHES} ]] ; then
debug-print "${FUNCNAME}: PATCHES=${PATCHES}, S=${S}, autopatching"
cd "${S}"
epatch ${PATCHES}
# Make sure we don't try to apply patches more than once,
# since cvs_src_unpack is usually called several times from
# e.g. kde-source_src_unpack
export PATCHES=""
fi
einfo "CVS module ${ECVS_MODULE} is now in ${WORKDIR}"
}
EXPORT_FUNCTIONS src_unpack
fi

View File

@ -1,195 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: db.eclass
# @MAINTAINER:
# base-system@gentoo.org
# @BLURB: Internal eclass used by sys-libs/db ebuilds
inherit eutils multilib multiprocessing
IUSE="doc test examples"
EXPORT_FUNCTIONS src_test
DEPEND="test? ( >=dev-lang/tcl-8.4 )"
RDEPEND=""
db_fix_so() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
LIB="${EROOT}/usr/$(get_libdir)"
cd "${LIB}"
# first clean up old symlinks
find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*so' -exec rm \{} \;
find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*so.[23]' -exec rm \{} \;
find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -exec rm \{} \;
# now rebuild all the correct ones
for ext in so a; do
for name in libdb libdb_{cxx,tcl,java,sql,stl}; do
target=`find . -maxdepth 1 -type f -name "${name}-*.${ext}" |sort -n |tail -n 1`
[ -n "${target}" ] && ln -sf ${target//.\//} ${name}.${ext}
done;
done;
# db[23] gets some extra-special stuff
if [ -f libdb1.so.2 ]; then
ln -sf libdb1.so.2 libdb.so.2
ln -sf libdb1.so.2 libdb1.so
ln -sf libdb1.so.2 libdb-1.so
fi
# what do we do if we ever get 3.3 ?
for i in libdb libdb_{cxx,tcl,java,sql,stl}; do
if [ -f $i-3.2.so ]; then
ln -sf $i-3.2.so $i-3.so
ln -sf $i-3.2.so $i.so.3
fi
done
# do the same for headers now
# but since there are only two of them, just overwrite them
cd "${EROOT}"/usr/include
target=`find . -maxdepth 1 -type d -name 'db[0-9]*' | sort -n |cut -d/ -f2- | tail -n1`
if [ -n "${target}" ] && [ -e "${target}/db.h" ] && ( ! [[ -e db.h ]] || [[ -h db.h ]] ); then
einfo "Creating db.h symlinks to ${target}"
ln -sf "${target}"/db.h .
ln -sf "${target}"/db_185.h .
elif [ ! -e "${target}/db.h" ]; then
if [ -n "${target}" ]; then
ewarn "Could not find ${target}/db.h"
elif [ -h db.h ]; then
einfo "Apparently you just removed the last instance of $PN. Removing the symlinks"
rm -f db.h db_185.h
fi
fi
}
db_src_install_doc() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
# not everybody wants this wad of documentation as it is primarily API docs
if use doc; then
dodir /usr/share/doc/${PF}/html
mv "${ED}"/usr/docs/* "${ED}"/usr/share/doc/${PF}/html/
rm -rf "${ED}"/usr/docs
else
rm -rf "${ED}"/usr/docs
fi
db_src_install_examples
}
db_src_install_examples() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
if use examples ; then
local langs="c cxx stl"
[[ "${IUSE/java}" != "${IUSE}" ]] \
&& use java \
&& langs="${langs} java"
for i in $langs ; do
destdir="/usr/share/doc/${PF}/"
src="${S}/../examples_${i}/"
if [ -f "${src}" ]; then
dodir "${destdir}"
cp -ra "${src}" "${ED}${destdir}/"
fi
done
fi
}
db_src_install_usrbinslot() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
# slot all program names to avoid overwriting
for fname in "${ED}"/usr/bin/db*
do
dn="$(dirname "${fname}")"
bn="$(basename "${fname}")"
bn="${bn/db/db${SLOT}}"
mv "${fname}" "${dn}/${bn}" || \
die "Failed to rename ${fname} to ${dn}/${bn}"
done
}
db_src_install_headerslot() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
# install all headers in a slotted location
dodir /usr/include/db${SLOT}
mv "${ED}"/usr/include/*.h "${ED}"/usr/include/db${SLOT}/
}
db_src_install_usrlibcleanup() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
LIB="${ED}/usr/$(get_libdir)"
# Clean out the symlinks so that they will not be recorded in the
# contents (bug #60732)
if [ "${ED}" = "" ]; then
die "Calling clean_links while \$ED not defined"
fi
if [ -e "${LIB}"/libdb.a ] && [ ! -e "${LIB}"/libdb-${SLOT}.a ]; then
einfo "Moving libdb.a to a versioned name"
mv "${LIB}/libdb.a" "${LIB}/libdb-${SLOT}.a"
fi
if [ -e "${LIB}"/libdb_cxx.a ] && [ ! -e "${LIB}"/libdb_cxx-${SLOT}.a ]; then
einfo "Moving libdb_cxx.a to a versioned name"
mv "${LIB}/libdb_cxx.a" "${LIB}/libdb_cxx-${SLOT}.a"
fi
find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*so' -exec rm \{} \;
find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*so.[23]' -exec rm \{} \;
einfo "removing unversioned static archives"
find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -exec rm \{} \;
rm -f \
"${ED}"/usr/include/{db,db_185}.h \
"${LIB}"/libdb{,_{cxx,sql,stl,java,tcl}}.a
}
db_src_test() {
if [[ $UID -eq 0 ]]; then
M="You must run the testsuite as non-root, skipping"
ewarn "${M}"
elog "${M}"
return 0
fi
if use tcl; then
einfo "Running sys-libs/db testsuite"
ewarn "This can take 6+ hours on modern machines"
# Fix stuff that fails with relative paths, and upstream moving files
# around...
local test_parallel=''
for t in \
"${S}"/test/parallel.tcl \
"${S}"/../test/parallel.tcl \
"${S}"/test/tcl/parallel.tcl \
"${S}"/../test/tcl/parallel.tcl \
; do
[[ -f "${t}" ]] && test_parallel="${t}" && break
done
sed -ri \
-e '/regsub .test_path ./s,(regsub),#\1,g' \
-e '/regsub .src_root ./s,(regsub),#\1,g' \
-e '/regsub .tcl_utils ./s,(regsub),#\1,g' \
"${test_parallel}"
cd "${S}"
for t in \
../test/test.tcl \
../test/tcl/test.tcl \
; do
[[ -f "${t}" ]] && testbase="${t}" && break
done
echo "source ${t}" > testrunner.tcl
echo "run_parallel $(makeopts_jobs) run_std" >> testrunner.tcl
tclsh testrunner.tcl
egrep -qs '^FAIL' ALL.OUT* && die "Some tests failed, please see ${S}/ALL.OUT*"
else
eerror "You must have USE=tcl to run the sys-libs/db testsuite."
fi
}

View File

@ -1,39 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: fdo-mime.eclass
# @MAINTAINER:
# freedesktop-bugs@gentoo.org
# @AUTHOR:
# Original author: foser <foser@gentoo.org>
# @BLURB: Utility eclass to update the desktop mime info as laid out in the freedesktop specs & implementations
# @DESCRIPTION:
# This eclass is DEPRECATED. Please use xdg-utils or xdg instead.
# @FUNCTION: fdo-mime_desktop_database_update
# @DESCRIPTION:
# Updates the desktop database.
# Generates a list of mimetypes linked to applications that can handle them
fdo-mime_desktop_database_update() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
if [ -x "${EPREFIX}/usr/bin/update-desktop-database" ]
then
einfo "Updating desktop mime database ..."
"${EPREFIX}/usr/bin/update-desktop-database" -q "${EROOT}usr/share/applications"
fi
}
# @FUNCTION: fdo-mime_mime_database_update
# @DESCRIPTION:
# Update the mime database.
# Creates a general list of mime types from several sources
fdo-mime_mime_database_update() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
if [ -x "${EPREFIX}/usr/bin/update-mime-database" ]
then
einfo "Updating shared mime info database ..."
"${EPREFIX}/usr/bin/update-mime-database" "${EROOT}usr/share/mime"
fi
}

View File

@ -1,31 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: kodi-addon.eclass
# @MAINTAINER:
# candrews@gentoo.org
# @SUPPORTED_EAPIS: 4 5 6
# @BLURB: Helper for correct building and (importantly) installing Kodi addon packages.
# @DESCRIPTION:
# Provides a src_configure function for correct CMake configuration
inherit multilib cmake-utils
case "${EAPI:-0}" in
4|5|6)
EXPORT_FUNCTIONS src_configure
;;
*) die "EAPI=${EAPI} is not supported" ;;
esac
# @FUNCTION: kodi-addon_src_configure
# @DESCRIPTION:
# Configure handling for Kodi addons
kodi-addon_src_configure() {
mycmakeargs+=(
-DCMAKE_INSTALL_LIBDIR=$(get_libdir)/kodi
)
cmake-utils_src_configure
}

View File

@ -1,61 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: mate-desktop.org.eclass
# @MAINTAINER:
# mate@gentoo.org
# @AUTHOR:
# Authors: NP-Hardass <NP-Hardass@gentoo.org> based upon the gnome.org eclass.
# @SUPPORTED_EAPIS: 6
# @BLURB: Helper eclass for mate-desktop.org hosted archives
# @DESCRIPTION:
# Provide a default SRC_URI and EGIT_REPO_URI for MATE packages as well as
# exporting some useful values like the MATE_BRANCH
# EAPIs < 6 are banned.
case "${EAPI:-0}" in
6) ;;
*) die "EAPI=${EAPI:-0} is not supported" ;;
esac
if [[ ${PV} == 9999 ]]; then
inherit git-r3
fi
inherit versionator
# @ECLASS-VARIABLE: MATE_TARBALL_SUFFIX
# @INTERNAL
# @DESCRIPTION:
# All projects hosted on mate-desktop.org provide tarballs as tar.xz.
# Undefined in live ebuilds.
[[ ${PV} != 9999 ]] && : ${MATE_TARBALL_SUFFIX:="xz"}
# @ECLASS-VARIABLE: MATE_DESKTOP_ORG_PN
# @DESCRIPTION:
# Name of the package as hosted on mate-desktop.org.
# Leave unset if package name matches PN.
: ${MATE_DESKTOP_ORG_PN:=$PN}
# @ECLASS-VARIABLE: MATE_DESKTOP_ORG_PV
# @DESCRIPTION:
# Package version string as listed on mate-desktop.org.
# Leave unset if package version string matches PV.
: ${MATE_DESKTOP_ORG_PV:=$PV}
# @ECLASS-VARIABLE: MATE_BRANCH
# @DESCRIPTION:
# Major and minor numbers of the version number, unless live.
# If live ebuild, will be set to '9999'.
: ${MATE_BRANCH:=$(get_version_component_range 1-2)}
# Set SRC_URI or EGIT_REPO_URI based on whether live
if [[ ${PV} == 9999 ]]; then
EGIT_REPO_URI="https://github.com/mate-desktop/${MATE_DESKTOP_ORG_PN}.git"
SRC_URI=""
else
SRC_URI="https://pub.mate-desktop.org/releases/${MATE_BRANCH}/${MATE_DESKTOP_ORG_PN}-${MATE_DESKTOP_ORG_PV}.tar.${MATE_TARBALL_SUFFIX}"
fi
# Set HOMEPAGE for all ebuilds
HOMEPAGE="https://mate-desktop.org"

View File

@ -1,176 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
inherit multibuild postgres
EXPORT_FUNCTIONS pkg_setup src_prepare src_compile src_install src_test
# @ECLASS: postgres-multi.eclass
# @MAINTAINER:
# PostgreSQL <pgsql-bugs@gentoo.org>
# @AUTHOR: Aaron W. Swenson <titanofold@gentoo.org>
# @SUPPORTED_EAPIS: 5 6
# @BLURB: An eclass to build PostgreSQL-related packages against multiple slots
# @DESCRIPTION:
# postgres-multi enables ebuilds, particularly PostgreSQL extensions, to
# build and install for one or more PostgreSQL slots as specified by
# POSTGRES_TARGETS use flags.
case ${EAPI:-0} in
5|6) ;;
*) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
esac
# @ECLASS-VARIABLE: POSTGRES_COMPAT
# @REQUIRED
# @DESCRIPTION:
# A Bash array containing a list of compatible PostgreSQL slots as
# defined by the developer. Must be declared before inheriting this
# eclass. Example:
#@CODE
#POSTGRES_COMPAT=( 9.2 9.3 9.4 9.5 9.6 10 )
#POSTGRES_COMPAT=( 9.{2,3} 9.{4..6} 10 ) # Same as previous
#@CODE
if ! declare -p POSTGRES_COMPAT &>/dev/null; then
die 'Required variable POSTGRES_COMPAT not declared.'
fi
# @ECLASS-VARIABLE: _POSTGRES_INTERSECT_SLOTS
# @INTERNAL
# @DESCRIPTION:
# A Bash array containing the intersect of POSTGRES_TARGETS and
# POSTGRES_COMPAT.
export _POSTGRES_INTERSECT_SLOTS=( )
# @FUNCTION: _postgres-multi_multibuild_wrapper
# @USAGE: <command> [arg ...]
# @INTERNAL
# @DESCRIPTION:
# For the given variant, set the values of the PG_SLOT, PG_CONFIG, and
# PKG_CONFIG_PATH environment variables accordingly and replace any
# appearance of @PG_SLOT@ in the command and arguments with value of
# ${PG_SLOT}.
_postgres-multi_multibuild_wrapper() {
debug-print-function ${FUNCNAME} "${@}"
export PG_SLOT=${MULTIBUILD_VARIANT}
export PG_CONFIG=$(which pg_config${MULTIBUILD_VARIANT//./})
if [[ -n ${PKG_CONFIG_PATH} ]] ; then
PKG_CONFIG_PATH="$(${PG_CONFIG} --libdir)/pkgconfig:${PKG_CONFIG_PATH}"
else
PKG_CONFIG_PATH="$(${PG_CONFIG} --libdir)/pkgconfig"
fi
export PKG_CONFIG_PATH
$(echo "${@}" | sed "s/@PG_SLOT@/${PG_SLOT}/g")
}
# @FUNCTION: postgres-multi_foreach
# @USAGE: <command> [arg ...]
# @DESCRIPTION:
# Run the given command in the package's build directory for each
# PostgreSQL slot in the intersect of POSTGRES_TARGETS and
# POSTGRES_COMPAT. The PG_CONFIG and PKG_CONFIG_PATH environment
# variables are updated on each iteration to point to the matching
# pg_config command and pkg-config metadata files, respectively, for the
# current slot. Any appearance of @PG_SLOT@ in the command or arguments
# will be substituted with the slot (e.g., 9.5) of the current
# iteration.
postgres-multi_foreach() {
local MULTIBUILD_VARIANTS=("${_POSTGRES_INTERSECT_SLOTS[@]}")
multibuild_foreach_variant \
_postgres-multi_multibuild_wrapper run_in_build_dir ${@}
}
# @FUNCTION: postgres-multi_forbest
# @USAGE: <command> [arg ...]
# @DESCRIPTION:
# Run the given command in the package's build directory for the highest
# slot in the intersect of POSTGRES_COMPAT and POSTGRES_TARGETS. The
# PG_CONFIG and PKG_CONFIG_PATH environment variables are set to the
# matching pg_config command and pkg-config metadata files,
# respectively. Any appearance of @PG_SLOT@ in the command or arguments
# will be substituted with the matching slot (e.g., 9.5).
postgres-multi_forbest() {
# POSTGRES_COMPAT is reverse sorted once in postgres.eclass so
# element 0 has the highest slot version.
local MULTIBUILD_VARIANTS=("${_POSTGRES_INTERSECT_SLOTS[0]}")
multibuild_foreach_variant \
_postgres-multi_multibuild_wrapper run_in_build_dir ${@}
}
# @FUNCTION: postgres-multi_pkg_setup
# @DESCRIPTION:
# Initialize internal environment variable(s). This is required if
# pkg_setup() is declared in the ebuild.
postgres-multi_pkg_setup() {
local user_slot
# _POSTGRES_COMPAT is created in postgres.eclass
for user_slot in "${_POSTGRES_COMPAT[@]}"; do
use "postgres_targets_postgres${user_slot/\./_}" && \
_POSTGRES_INTERSECT_SLOTS+=( "${user_slot}" )
done
if [[ "${#_POSTGRES_INTERSECT_SLOTS[@]}" -eq "0" ]]; then
die "One of the postgres_targets_postgresSL_OT use flags must be enabled"
fi
einfo "Multibuild variants: ${_POSTGRES_INTERSECT_SLOTS[@]}"
}
# @FUNCTION: postgres-multi_src_prepare
# @DESCRIPTION:
# Calls eapply_user then copies ${S} into a build directory for each
# intersect of POSTGRES_TARGETS and POSTGRES_COMPAT.
postgres-multi_src_prepare() {
if [[ "${#_POSTGRES_INTERSECT_SLOTS[@]}" -eq "0" ]]; then
eerror "Internal array _POSTGRES_INTERSECT_SLOTS is empty."
die "Did you forget to call postgres-multi_pkg_setup?"
fi
# Check that the slot has been emerged (Should be prevented by
# Portage, but won't be caught by /usr/bin/ebuild)
local slot
for slot in ${_POSTGRES_INTERSECT_SLOTS[@]} ; do
if [[ -z $(which pg_config${slot/.} 2> /dev/null) ]] ; then
eerror
eerror "postgres_targets_postgres${slot/.} use flag is enabled, but hasn't been emerged."
eerror
die "a postgres_targets use flag is enabled, but not emerged"
fi
done
case ${EAPI:-0} in
0|1|2|3|4|5) epatch_user ;;
6) eapply_user ;;
esac
local MULTIBUILD_VARIANT
local MULTIBUILD_VARIANTS=("${_POSTGRES_INTERSECT_SLOTS[@]}")
multibuild_copy_sources
}
# @FUNCTION: postgres-multi_src_compile
# @DESCRIPTION:
# Runs `emake' in each build directory
postgres-multi_src_compile() {
postgres-multi_foreach emake
}
# @FUNCTION: postgres-multi_src_install
# @DESCRIPTION:
# Runs `emake install DESTDIR="${D}"' in each build directory.
postgres-multi_src_install() {
postgres-multi_foreach emake install DESTDIR="${D}"
}
# @FUNCTION: postgres-multi_src_test
# @DESCRIPTION:
# Runs `emake installcheck' in each build directory.
postgres-multi_src_test() {
postgres-multi_foreach emake installcheck
}

View File

@ -1,103 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: sgml-catalog.eclass
# @MAINTAINER:
# No maintainer <maintainer-needed@gentoo.org>
# @AUTHOR:
# Author Matthew Turk <satai@gentoo.org>
# @BLURB: Functions for installing SGML catalogs
case ${EAPI:-0} in
0|1|2|3|4|5) inherit base ;;
*) ;;
esac
DEPEND=">=app-text/sgml-common-0.6.3-r2"
# @ECLASS-VARIABLE: SGML_TOINSTALL
# @DESCRIPTION:
# An array of catalogs, arranged in pairs.
# Each pair consists of a centralized catalog followed by an ordinary catalog.
SGML_TOINSTALL=()
# @FUNCTION: sgml-catalog_cat_include
# @USAGE: <centralized catalog> <ordinary catalog>
# @DESCRIPTION:
# Appends a catalog pair to the SGML_TOINSTALL array.
sgml-catalog_cat_include() {
debug-print function $FUNCNAME $*
SGML_TOINSTALL+=("$1" "$2")
}
# @FUNCTION: sgml-catalog_cat_doinstall
# @USAGE: <centralized catalog> <ordinary catalog>
# @DESCRIPTION:
# Adds an ordinary catalog to a centralized catalog.
sgml-catalog_cat_doinstall() {
debug-print function $FUNCNAME $*
has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
"${EPREFIX}"/usr/bin/install-catalog --add "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
}
# @FUNCTION: sgml-catalog_cat_doremove
# @USAGE: <centralized catalog> <ordinary catalog>
# @DESCRIPTION:
# Removes an ordinary catalog from a centralized catalog.
sgml-catalog_cat_doremove() {
debug-print function $FUNCNAME $*
has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
"${EPREFIX}"/usr/bin/install-catalog --remove "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
}
sgml-catalog_pkg_postinst() {
debug-print function $FUNCNAME $*
has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
set -- "${SGML_TOINSTALL[@]}"
while (( $# )); do
if [[ ! -e "${EPREFIX}$2" ]]; then
ewarn "${EPREFIX}$2 doesn't appear to exist, although it ought to!"
shift 2
continue
fi
einfo "Now adding ${EPREFIX}$2 to ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
sgml-catalog_cat_doinstall "$1" "$2"
shift 2
done
sgml-catalog_cleanup
}
sgml-catalog_pkg_prerm() {
sgml-catalog_cleanup
}
sgml-catalog_pkg_postrm() {
debug-print function $FUNCNAME $*
has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
set -- "${SGML_TOINSTALL[@]}"
while (( $# )); do
einfo "Now removing ${EPREFIX}$2 from ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
sgml-catalog_cat_doremove "$1" "$2"
shift 2
done
}
sgml-catalog_cleanup() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
if [ -e "${EPREFIX}/usr/bin/gensgmlenv" ]
then
einfo Regenerating SGML environment variables ...
gensgmlenv
grep -v export "${EPREFIX}/etc/sgml/sgml.env" > "${EPREFIX}/etc/env.d/93sgmltools-lite"
fi
}
sgml-catalog_src_compile() {
return
}
EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm

View File

@ -1,153 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: vim-spell.eclass
# @MAINTAINER:
# Vim Maintainers <vim@gentoo.org>
# @AUTHOR:
# Ciaran McCreesh <ciaranm@gentoo.org>
# @BLURB: Eclass for managing Vim spell files.
# @DESCRIPTION:
# How to make a vim spell file package using prebuilt spell lists
# from upstream (${CODE} is the language's two letter code):
#
# * Get the ${CODE}.*.spl, ${CODE}.*.sug (if your language has them) and
# README_${CODE}.txt files. Currently they're at
# ftp://ftp.vim.org/pub/vim/unstable/runtime/spell/ (except for English,
# which should be taken from CVS instead).
#
# * Stick them in vim-spell-${CODE}-$(date --iso | tr -d - ).tar.bz2 . Make sure
# that they're in the appropriately named subdirectory to avoid having to mess
# with S=.
#
# * Upload the tarball to the Gentoo mirrors.
#
# * Add your spell file to package.mask next to the other vim things. Vim
# Project members will handle unmasking your spell packages when vim comes out
# of package.mask.
#
# * Create the app-vim/vim-spell-${CODE} package. You should base your ebuild
# upon app-vim/vim-spell-en. You will need to change VIM_SPELL_LANGUAGE,
# KEYWORDS and LICENSE. Check the license carefully! The README will tell
# you what it is.
#
# * Don't forget metadata.xml. You should list the Vim project and yourself
# as maintainers. There is no need to join the Vim project just for spell
# files. Here's an example of a metadata.xml file:
#
# <?xml version="1.0" encoding="UTF-8"?>
# <!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
# <pkgmetadata>
# <maintainer type="person">
# <email>your@email.tld</email>
# <name>Your Name</name>
# </maintainer>
# <maintainer type="project">
# <email>vim@gentoo.org</email>
# <name>Vim Maintainers</name>
# </maintainer>
#
# <longdescription lang="en">
# Vim spell files for French (fr). Supported character sets are
# UTF-8 and latin1.
# </longdescription>
# </pkgmetadata>
#
# * Send an email to vim@gentoo.org to let us know.
#
# Don't forget to update your package as necessary.
#
# If there isn't an upstream-provided pregenerated spell file for your language
# yet, read :help spell.txt from inside vim for instructions on how to create
# spell files. It's best to let upstream know if you've generated spell files
# for another language rather than keeping them Gentoo-specific.
inherit eutils
EXPORT_FUNCTIONS src_install pkg_postinst
SRC_URI="mirror://gentoo/${P}.tar.bz2"
SLOT="0"
# @ECLASS-VARIABLE: VIM_SPELL_LANGUAGE
# @DESCRIPTION:
# This variable defines the language for the spell package being
# installed.
# The default value is "English".
: ${VIM_SPELL_LANGUAGE:="English"}
# @ECLASS-VARIABLE: VIM_SPELL_LOCALE
# @INTERNAL
# @DESCRIPTION:
# This variable defines the locale for the current ebuild.
# The default value is ${PN} stripped of the "vim-spell-" string.
: ${VIM_SPELL_LOCALE:="${PN/vim-spell-/}"}
# @ECLASS-VARIABLE: VIM_SPELL_DIRECTORY
# @INTERNAL
# @DESCRIPTION:
# This variable defines the path to Vim spell files.
: ${VIM_SPELL_DIRECTORY:="${EPREFIX}/usr/share/vim/vimfiles/spell/"}
# @ECLASS-VARIABLE: DESCRIPTION
# @DESCRIPTION:
# This variable defines the DESCRIPTION for Vim spell ebuilds.
: ${DESCRIPTION:="vim spell files: ${VIM_SPELL_LANGUAGE} (${VIM_SPELL_LOCALE})"}
# @ECLASS-VARIABLE: HOMEPAGE
# @DESCRIPTION:
# This variable defines the HOMEPAGE for Vim spell ebuilds.
: ${HOMEPAGE:="https://www.vim.org"}
# @FUNCTION: vim-spell_src_install
# @DESCRIPTION:
# This function installs Vim spell files.
vim-spell_src_install() {
dodir "${VIM_SPELL_DIRECTORY}"
insinto "${VIM_SPELL_DIRECTORY}"
local had_spell_file=
local f
for f in *.spl; do
if [[ -f "${f}" ]]; then
doins "${f}"
had_spell_file="yes"
fi
done
for f in *.sug; do
if [[ -f "${f}" ]]; then
doins "${f}"
fi
done
for f in README*; do
dodoc "${f}"
done
[[ -z "${had_spell_file}" ]] && die "Didn't install any spell files?"
}
# @FUNCTION: vim-spell_pkg_postinst
# @DESCRIPTION:
# This function displays installed Vim spell files.
vim-spell_pkg_postinst() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
echo
elog "To enable ${VIM_SPELL_LANGUAGE} spell checking, use"
elog " :setlocal spell spelllang=${VIM_SPELL_LOCALE}"
echo
elog "The following (Vim internal, not file) encodings are supported for"
elog "this language:"
local f enc
for f in "${EROOT}${VIM_SPELL_DIRECTORY}/${VIM_SPELL_LOCALE}".*.spl; do
enc="${f##*/${VIM_SPELL_LOCALE}.}"
enc="${enc%.spl}"
[[ -z "${enc}" ]] && continue
elog " ${enc}"
done
echo
elog "For further documentation, use:"
elog " :help spell"
echo
}