summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass')
-rw-r--r--eclass/Manifest.gzbin35827 -> 35990 bytes
-rw-r--r--eclass/autotools.eclass2
-rw-r--r--eclass/chromium-2.eclass55
-rw-r--r--eclass/python-utils-r1.eclass30
-rw-r--r--eclass/qmail.eclass168
-rwxr-xr-xeclass/tests/qmail.sh52
6 files changed, 160 insertions, 147 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz
index 99f348ff53e0..75165709e83b 100644
--- a/eclass/Manifest.gz
+++ b/eclass/Manifest.gz
Binary files differ
diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index 837f9e7a9aab..66d4686849db 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -131,7 +131,7 @@ RDEPEND=""
if [[ ${AUTOTOOLS_AUTO_DEPEND} != "no" ]] ; then
case ${EAPI} in
5|6) DEPEND=${AUTOTOOLS_DEPEND} ;;
- 7) BDEPEND=${AUTOTOOLS_DEPEND} ;;
+ *) BDEPEND=${AUTOTOOLS_DEPEND} ;;
esac
fi
__AUTOTOOLS_AUTO_DEPEND=${AUTOTOOLS_AUTO_DEPEND} # See top of eclass
diff --git a/eclass/chromium-2.eclass b/eclass/chromium-2.eclass
index 54df3b1394c7..156ff21e2012 100644
--- a/eclass/chromium-2.eclass
+++ b/eclass/chromium-2.eclass
@@ -6,12 +6,12 @@
# Chromium Project <chromium@gentoo.org>
# @AUTHOR:
# Mike Gilbert <floppym@gentoo.org>
-# @SUPPORTED_EAPIS: 7
+# @SUPPORTED_EAPIS: 7 8
# @BLURB: Shared functions for chromium and google-chrome
case ${EAPI} in
- 7) ;;
- *) die "EAPI=${EAPI:-0} is not supported" ;;
+ 7|8) ;;
+ *) die "${ECLASS}: EAPI=${EAPI:-0} is not supported" ;;
esac
inherit linux-info
@@ -26,7 +26,8 @@ fi
# @FUNCTION: chromium_suid_sandbox_check_kernel_config
# @USAGE:
# @DESCRIPTION:
-# Ensures the system kernel supports features needed for SUID sandbox to work.
+# Ensures the system kernel supports features needed for SUID and User namespaces sandbox
+# to work.
chromium_suid_sandbox_check_kernel_config() {
if [[ "${MERGE_TYPE}" == "source" || "${MERGE_TYPE}" == "binary" ]]; then
# Warn if the kernel does not support features needed for sandboxing.
@@ -50,6 +51,12 @@ chromium_suid_sandbox_check_kernel_config() {
# @DESCRIPTION:
# List of language packs available for this package.
+# @FUNCTION: _chromium_set_l10n_IUSE
+# @USAGE:
+# @INTERNAL
+# @DESCRIPTION:
+# Converts and adds CHROMIUM_LANGS to IUSE. Called automatically if
+# CHROMIUM_LANGS is defined.
_chromium_set_l10n_IUSE() {
local lang
for lang in ${CHROMIUM_LANGS}; do
@@ -105,6 +112,10 @@ chromium_remove_language_paks() {
done
}
+# @FUNCTION: chromium_pkg_die
+# @USAGE:
+# @DESCRIPTION:
+# EBUILD_DEATH_HOOK function to display some warnings/information about build environment.
chromium_pkg_die() {
if [[ "${EBUILD_PHASE}" != "compile" ]]; then
return
@@ -146,40 +157,4 @@ chromium_pkg_die() {
einfo
}
-# @VARIABLE: EGYP_CHROMIUM_COMMAND
-# @DESCRIPTION:
-# Path to the gyp_chromium script.
-: ${EGYP_CHROMIUM_COMMAND:=build/gyp_chromium}
-
-# @VARIABLE: EGYP_CHROMIUM_DEPTH
-# @DESCRIPTION:
-# Depth for egyp_chromium.
-: ${EGYP_CHROMIUM_DEPTH:=.}
-
-# @FUNCTION: egyp_chromium
-# @USAGE: [gyp arguments]
-# @DESCRIPTION:
-# Calls EGYP_CHROMIUM_COMMAND with depth EGYP_CHROMIUM_DEPTH and given
-# arguments. The full command line is echoed for logging.
-egyp_chromium() {
- set -- "${EGYP_CHROMIUM_COMMAND}" --depth="${EGYP_CHROMIUM_DEPTH}" "$@"
- echo "$@"
- "$@"
-}
-
-# @FUNCTION: gyp_use
-# @USAGE: <USE flag> [GYP flag] [true suffix] [false suffix]
-# @DESCRIPTION:
-# If USE flag is set, echo -D[GYP flag]=[true suffix].
-#
-# If USE flag is not set, echo -D[GYP flag]=[false suffix].
-#
-# [GYP flag] defaults to use_[USE flag] with hyphens converted to underscores.
-#
-# [true suffix] defaults to 1. [false suffix] defaults to 0.
-gyp_use() {
- local gypflag="-D${2:-use_${1//-/_}}="
- usex "$1" "${gypflag}" "${gypflag}" "${3-1}" "${4-0}"
-}
-
fi
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index a2b5b6d5d41a..4fedf939c779 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1250,11 +1250,30 @@ build_sphinx() {
HTML_DOCS+=( "${dir}/_build/html/." )
}
+# @VARIABLE: EPYTEST_DESELECT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Specifies an array of tests to be deselected via pytest's --deselect
+# parameter, when calling epytest. The list can include file paths,
+# specific test functions or parametrized test invocations.
+#
+# Note that the listed files will still be subject to collection,
+# i.e. modules imported in global scope will need to be available.
+# If this is undesirable, EPYTEST_IGNORE can be used instead.
+
+# @VARIABLE: EPYTEST_IGNORE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Specifies an array of paths to be ignored via pytest's --ignore
+# parameter, when calling epytest. The listed files will be entirely
+# skipped from test collection.
+
# @FUNCTION: epytest
# @USAGE: [<args>...]
# @DESCRIPTION:
-# Run pytest, passing the standard set of pytest options, followed
-# by user-specified options.
+# Run pytest, passing the standard set of pytest options, then
+# --deselect and --ignore options based on EPYTEST_DESELECT
+# and EPYTEST_IGNORE, then user-specified options.
#
# This command dies on failure and respects nonfatal.
epytest() {
@@ -1274,6 +1293,13 @@ epytest() {
# for end users, as it tends to fail on new warnings from deps
-Wdefault
)
+ local x
+ for x in "${EPYTEST_DESELECT[@]}"; do
+ args+=( --deselect "${x}" )
+ done
+ for x in "${EPYTEST_IGNORE[@]}"; do
+ args+=( --ignore "${x}" )
+ done
set -- "${EPYTHON}" -m pytest "${args[@]}" "${@}"
echo "${@}" >&2
diff --git a/eclass/qmail.eclass b/eclass/qmail.eclass
index 76c612f026f2..33157b7e7871 100644
--- a/eclass/qmail.eclass
+++ b/eclass/qmail.eclass
@@ -4,11 +4,11 @@
# @ECLASS: qmail.eclass
# @MAINTAINER:
# Rolf Eike Beer <eike@sf-mail.de>
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 6 7 8
# @BLURB: common qmail functions
case ${EAPI:-0} in
- [67]) ;;
+ [678]) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -29,52 +29,36 @@ GENQMAIL_S="${WORKDIR}"/genqmail-${GENQMAIL_PV}
QMAIL_SPP_F=qmail-spp-${QMAIL_SPP_PV}.tar.gz
QMAIL_SPP_S="${WORKDIR}"/qmail-spp-${QMAIL_SPP_PV}
-# @FUNCTION: primes
-# @USAGE: <min> <max>
+# @FUNCTION: is_prime
+# @USAGE: <number>
# @DESCRIPTION:
-# Prints a list of primes between min and max inclusive
-# Note: this functions gets very slow when used with large numbers.
-primes() {
- local min=${1} max=${2}
- local result= primelist=2 i p
+# Checks wether a number is a valid prime number for queue split
+is_prime() {
+ local number=${1} i
- [[ ${min} -le 2 ]] && result="${result} 2"
+ if [[ ${number} -lt 7 ]]; then
+ # too small
+ return 1
+ fi
- for ((i = 3; i <= max; i += 2))
+ if [[ $[number % 2] == 0 ]]; then
+ return 1
+ fi
+
+ # let i run up to the square root of number
+ for ((i = 3; i * i <= number; i += 2))
do
- for p in ${primelist}
- do
- [[ $[i % p] == 0 || $[p * p] -gt ${i} ]] && \
- break
- done
- if [[ $[i % p] != 0 ]]
- then
- primelist="${primelist} ${i}"
- [[ ${i} -ge ${min} ]] && \
- result="${result} ${i}"
+ if [[ $[number % i ] == 0 ]]; then
+ return 1
fi
done
- echo ${result}
-}
-
-# @FUNCTION: is_prima
-# @USAGE: <number>
-# @DESCRIPTION:
-# Checks wether a number is a prime number
-is_prime() {
- local number=${1} i
- for i in $(primes ${number} ${number})
- do
- [[ ${i} == ${number} ]] && return 0
- done
- return 1
+ return 0
}
dospp() {
- insinto "${QMAIL_HOME}"/plugins/
- insopts -o root -g "${GROUP_ROOT}" -m 0755
- newins $1 ${2:-$(basename $1)}
+ exeinto "${QMAIL_HOME}"/plugins/
+ newexe ${1} ${2:-$(basename ${1})}
}
# @FUNCTION: dosupervise
@@ -86,17 +70,14 @@ dosupervise() {
local runfile=${2:-${service}} logfile=${3:-${service}-log}
[[ -z "${service}" ]] && die "no service given"
- insopts -o root -g "${GROUP_ROOT}" -m 0755
- diropts -o root -g "${GROUP_ROOT}" -m 0755
-
dodir ${SUPERVISE_DIR}/${service}{,/log}
fperms +t ${SUPERVISE_DIR}/${service}{,/log}
- insinto ${SUPERVISE_DIR}/${service}
- newins ${runfile} run
+ exeinto ${SUPERVISE_DIR}/${service}
+ newexe ${runfile} run
- insinto ${SUPERVISE_DIR}/${service}/log
- newins ${logfile} run
+ exeinto ${SUPERVISE_DIR}/${service}/log
+ newexe ${logfile} run
}
# @FUNCTION: qmail_set_cc
@@ -149,41 +130,45 @@ qmail_spp_src_compile() {
}
qmail_base_install() {
+ # subshell to not leak the install options
+ (
einfo "Setting up basic directory hierarchy"
- diropts -o root -g qmail -m 755
- keepdir "${QMAIL_HOME}"/{,bin,control}
- keepdir "${QMAIL_HOME}"/users
- diropts -o alias -g qmail -m 755
+ diropts -o root -g qmail
+ dodir "${QMAIL_HOME}"/bin
+ keepdir "${QMAIL_HOME}"/{control,users}
+ diropts -o alias -g qmail
keepdir "${QMAIL_HOME}"/alias
einfo "Adding env.d entry for qmail"
doenvd "${GENQMAIL_S}"/conf/99qmail
einfo "Installing all qmail software"
- insinto "${QMAIL_HOME}"/bin
+ exeinto "${QMAIL_HOME}"/bin
- insopts -o root -g qmail -m 755
- doins bouncesaying condredirect config-fast datemail except forward maildir2mbox \
+ exeopts -o root -g qmail
+ doexe bouncesaying condredirect config-fast datemail except forward maildir2mbox \
maildirmake mailsubj predate preline qbiff \
qmail-{inject,qmqpc,qmqpd,qmtpd,qread,qstat,smtpd,tcpok,tcpto,showctl} \
qreceipt sendmail tcp-env
# obsolete tools, install if they are still present
for i in elq maildirwatch pinq qail qsmhook; do
- [[ -x ${i} ]] && doins ${i}
+ [[ -x ${i} ]] && doexe ${i}
done
- use pop3 && doins qmail-pop3d
+ use pop3 && doexe qmail-pop3d
- insopts -o root -g qmail -m 711
- doins qmail-{clean,getpw,local,pw2u,remote,rspawn,send} splogger
- use pop3 && doins qmail-popup
+ exeopts -o root -g qmail -m 711
+ doexe qmail-{clean,getpw,local,pw2u,remote,rspawn,send} splogger
+ use pop3 && doexe qmail-popup
- insopts -o root -g qmail -m 700
- doins qmail-{lspawn,newmrh,newu,start}
+ exeopts -o root -g qmail -m 700
+ doexe qmail-{lspawn,newmrh,newu,start}
- insopts -o qmailq -g qmail -m 4711
- doins qmail-queue
+ exeopts -o qmailq -g qmail -m 4711
+ doexe qmail-queue
+
+ )
declare -F qmail_base_install_hook >/dev/null && \
qmail_base_install_hook
@@ -192,12 +177,10 @@ qmail_base_install() {
qmail_config_install() {
einfo "Installing stock configuration files"
insinto "${QMAIL_HOME}"/control
- insopts -o root -g "${GROUP_ROOT}" -m 644
doins "${GENQMAIL_S}"/control/{conf-*,defaultdelivery}
einfo "Installing configuration sanity checker and launcher"
insinto "${QMAIL_HOME}"/bin
- insopts -o root -g "${GROUP_ROOT}" -m 644
doins "${GENQMAIL_S}"/control/qmail-config-system
declare -F qmail_config_install_hook >/dev/null && \
@@ -224,7 +207,6 @@ qmail_man_install() {
qmail_sendmail_install() {
einfo "Installing sendmail replacement"
- diropts -m 755
dodir /usr/sbin /usr/lib
dosym "${QMAIL_HOME}"/bin/sendmail /usr/sbin/sendmail
@@ -235,12 +217,21 @@ qmail_sendmail_install() {
}
qmail_maildir_install() {
+ # subshell to not leak the install options
+ (
# use the correct maildirmake
# the courier-imap one has some extensions that are nicer
MAILDIRMAKE="${D}${QMAIL_HOME}/bin/maildirmake"
[[ -e /usr/bin/maildirmake ]] && \
MAILDIRMAKE="/usr/bin/maildirmake"
+ einfo "Setting up default maildirs in the account skeleton"
+ diropts -m 700
+ insinto /etc/skel
+ newins "${GENQMAIL_S}"/control/defaultdelivery .qmail.example
+ "${MAILDIRMAKE}" "${D}"/etc/skel/.maildir
+ keepdir /etc/skel/.maildir/{cur,new,tmp}
+
einfo "Setting up the default aliases"
diropts -o alias -g qmail -m 700
"${MAILDIRMAKE}" "${D}${QMAIL_HOME}"/alias/.maildir
@@ -253,13 +244,7 @@ qmail_maildir_install() {
fi
done
- einfo "Setting up default maildirs in the account skeleton"
- diropts -o root -g "${GROUP_ROOT}" -m 755
- insinto /etc/skel
- insopts -o root -g "${GROUP_ROOT}" -m 644
- newins "${GENQMAIL_S}"/control/defaultdelivery .qmail.sample
- "${MAILDIRMAKE}" "${D}"/etc/skel/.maildir
- keepdir /etc/skel/.maildir/{cur,new,tmp}
+ )
declare -F qmail_maildir_install_hook >/dev/null && \
qmail_maildir_install_hook
@@ -268,7 +253,6 @@ qmail_maildir_install() {
qmail_tcprules_install() {
dodir "${TCPRULES_DIR}"
insinto "${TCPRULES_DIR}"
- insopts -o root -g "${GROUP_ROOT}" -m 0644
doins "${GENQMAIL_S}"/tcprules/Makefile.qmail
doins "${GENQMAIL_S}"/tcprules/tcp.qmail-*
use ssl && use pop3 || rm -f "${D}${TCPRULES_DIR}"/tcp.qmail-pop3sd
@@ -276,8 +260,11 @@ qmail_tcprules_install() {
qmail_supervise_install_one() {
dosupervise ${1}
- diropts -o qmaill -g "${GROUP_ROOT}" -m 755
+ # subshell to not leak the install options
+ (
+ diropts -o qmaill -g root
keepdir /var/log/qmail/${1}
+ )
}
qmail_supervise_install() {
@@ -301,7 +288,6 @@ qmail_supervise_install() {
qmail_spp_install() {
einfo "Installing qmail-spp configuration files"
insinto "${QMAIL_HOME}"/control/
- insopts -o root -g "${GROUP_ROOT}" -m 0644
doins "${GENQMAIL_S}"/spp/smtpplugins
einfo "Installing qmail-spp plugins"
@@ -321,17 +307,14 @@ qmail_ssl_install() {
einfo "Installing SSL Certificate creation script"
insinto "${QMAIL_HOME}"/control
- insopts -o root -g "${GROUP_ROOT}" -m 0644
doins "${GENQMAIL_S}"/ssl/servercert.cnf
- insinto "${QMAIL_HOME}"/bin
- insopts -o root -g "${GROUP_ROOT}" -m 0755
- doins "${GENQMAIL_S}"/ssl/mkservercert
+ exeinto "${QMAIL_HOME}"/bin
+ doexe "${GENQMAIL_S}"/ssl/mkservercert
einfo "Installing RSA key generation cronjob"
- insinto /etc/${CRON_FOLDER}
- insopts -o root -g "${GROUP_ROOT}" -m 0755
- doins "${GENQMAIL_S}"/ssl/qmail-genrsacert.sh
+ exeinto /etc/${CRON_FOLDER}
+ doexe "${GENQMAIL_S}"/ssl/qmail-genrsacert.sh
keepdir "${QMAIL_HOME}"/control/tlshosts
@@ -340,7 +323,6 @@ qmail_ssl_install() {
}
qmail_src_install() {
- export GROUP_ROOT="$(id -gn root)"
qmail_base_install
qmail_config_install
qmail_man_install
@@ -385,28 +367,6 @@ qmail_rootmail_fixup() {
chown -R alias:qmail "${ROOT}${QMAIL_HOME}"/alias/.maildir 2>/dev/null
}
-qmail_tcprules_fixup() {
- mkdir -p "${TCPRULES_DIR}"
- local POP_FILES=
- use pop3 && POP_FILES="pop3 pop3.cdb"
- for f in {smtp,qmtp,qmqp}{,.cdb} ${POP_FILES}; do
- old="/etc/tcp.${f}"
- new="${TCPRULES_DIR}/tcp.qmail-${f}"
- fail=0
- if [[ -f "${old}" && ! -f "${new}" ]]; then
- einfo "Moving ${old} to ${new}"
- cp "${old}" "${new}" || fail=1
- else
- fail=1
- fi
- if [[ "${fail}" = 1 && -f "${old}" ]]; then
- eerror "Error moving ${old} to ${new}, be sure to check the"
- eerror "configuration! You may have already moved the files,"
- eerror "in which case you can delete ${old}"
- fi
- done
-}
-
qmail_tcprules_build() {
for f in tcp.qmail-{smtp,qmtp,qmqp,pop3,pop3s}; do
# please note that we don't check if it exists
diff --git a/eclass/tests/qmail.sh b/eclass/tests/qmail.sh
new file mode 100755
index 000000000000..3520ed2a9d5b
--- /dev/null
+++ b/eclass/tests/qmail.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# Copyright 2020-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+source tests-common.sh
+
+inherit qmail
+
+# some numbers are blocked because they are to small even if prime
+test_low_numbers() {
+ tbegin "low numbers"
+
+ for i in $(seq 0 6); do
+ if is_prime ${i}; then
+ return tend 1 "${i} badly accepted"
+ fi
+ done
+
+ tend 0
+}
+
+# test a given number for being prime
+check_prime_number() {
+ # use factor from coreutils to count the factors
+ if [[ $(factor $1 | cut -d: -f2 | wc -w) == 1 ]]; then
+ return $(is_prime $1)
+ else
+ return $(is_prime $1 && false || true)
+ fi
+}
+
+test_primes() {
+ tbegin "factorizations from ${1} to ${2}"
+
+ for i in $(seq ${1:?} ${2:?}); do
+ if ! check_prime_number $i; then
+ tend 1 "${i} returned bad factorization"
+ return 1
+ fi
+ done
+
+ tend 0
+}
+
+test_low_numbers
+test_primes 7 99
+for i in $(seq 100 100 1000); do
+ test_primes $i $((i + 99))
+done
+
+texit