Merge pull request #2250 from flatcar/chewi/no-eapi6

Bump remaining EAPI 6 ebuilds to 8 and drop obsolete eclasses
This commit is contained in:
James Le Cuirot 2024-08-23 14:29:14 +01:00 committed by GitHub
commit b76bceef89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
43 changed files with 108 additions and 2817 deletions

View File

@ -378,10 +378,8 @@ eclass/eapi8-dosym.eclass
eclass/edo.eclass eclass/edo.eclass
eclass/edos2unix.eclass eclass/edos2unix.eclass
eclass/elisp-common.eclass eclass/elisp-common.eclass
eclass/epatch.eclass
eclass/eqawarn.eclass eclass/eqawarn.eclass
eclass/estack.eclass eclass/estack.eclass
eclass/eutils.eclass
eclass/fcaps.eclass eclass/fcaps.eclass
eclass/flag-o-matic.eclass eclass/flag-o-matic.eclass
eclass/git-r3.eclass eclass/git-r3.eclass
@ -405,7 +403,6 @@ eclass/linux-mod.eclass
eclass/llvm-r1.eclass eclass/llvm-r1.eclass
eclass/llvm-utils.eclass eclass/llvm-utils.eclass
eclass/llvm.eclass eclass/llvm.eclass
eclass/ltprune.eclass
eclass/lua-single.eclass eclass/lua-single.eclass
eclass/lua-utils.eclass eclass/lua-utils.eclass
eclass/mercurial.eclass eclass/mercurial.eclass

View File

@ -1,25 +1,19 @@
# Copyright (c) 2016 CoreOS, Inc.. All rights reserved. # Copyright (c) 2016 CoreOS, Inc.. All rights reserved.
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=6 EAPI=8
TMPFILES_OPTIONAL=1
inherit systemd tmpfiles inherit systemd tmpfiles
DESCRIPTION="etcd (System Application Container)" DESCRIPTION="etcd (System Application Container)"
HOMEPAGE="https://github.com/etcd-io/etcd" HOMEPAGE="https://github.com/etcd-io/etcd"
S="${WORKDIR}"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64 arm64" KEYWORDS="amd64 arm64"
LICENSE="Apache-2.0"
IUSE=""
SLOT=0
DEPEND=""
RDEPEND=">=app-admin/sdnotify-proxy-0.1.0" RDEPEND=">=app-admin/sdnotify-proxy-0.1.0"
S=${WORKDIR}
src_install() { src_install() {
local tag="v${PV}" local tag="v${PV}"
if [[ "${ARCH}" != "amd64" ]]; then if [[ "${ARCH}" != "amd64" ]]; then
@ -30,7 +24,7 @@ src_install() {
doexe "${FILESDIR}"/etcd-wrapper doexe "${FILESDIR}"/etcd-wrapper
sed "s|@ETCD_IMAGE_TAG@|${tag}|g" \ sed "s|@ETCD_IMAGE_TAG@|${tag}|g" \
"${FILESDIR}"/etcd-member.service > ${T}/etcd-member.service "${FILESDIR}"/etcd-member.service > "${T}"/etcd-member.service
systemd_dounit ${T}/etcd-member.service systemd_dounit "${T}"/etcd-member.service
dotmpfiles "${FILESDIR}"/etcd-wrapper.conf dotmpfiles "${FILESDIR}"/etcd-wrapper.conf
} }

View File

@ -1,4 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata> <pkgmetadata>
<upstream>
<remote-id type="github">etcd-io/etcd</remote-id>
</upstream>
</pkgmetadata> </pkgmetadata>

View File

@ -1,27 +1,21 @@
# Copyright (c) 2014 CoreOS, Inc.. All rights reserved. # Copyright (c) 2014 CoreOS, Inc.. All rights reserved.
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=6 EAPI=8
inherit systemd inherit systemd
DESCRIPTION="flannel (System Application Container)" DESCRIPTION="flannel (System Application Container)"
HOMEPAGE="https://github.com/coreos/flannel" HOMEPAGE="https://github.com/flannel-io/flannel"
S="${WORKDIR}"
KEYWORDS="amd64 arm64"
SRC_URI=""
LICENSE="Apache-2.0" LICENSE="Apache-2.0"
SLOT="0" SLOT="0"
IUSE="" KEYWORDS="amd64 arm64"
RDEPEND=" RDEPEND="
!app-admin/flannel
>=app-admin/sdnotify-proxy-0.1.0 >=app-admin/sdnotify-proxy-0.1.0
" "
S="$WORKDIR"
src_install() { src_install() {
local tag="v${PV}" local tag="v${PV}"
if [[ "${ARCH}" != "amd64" ]]; then if [[ "${ARCH}" != "amd64" ]]; then
@ -32,12 +26,12 @@ src_install() {
doexe "${FILESDIR}"/flannel-wrapper doexe "${FILESDIR}"/flannel-wrapper
sed "s|@FLANNEL_IMAGE_TAG@|${tag}|g" \ sed "s|@FLANNEL_IMAGE_TAG@|${tag}|g" \
"${FILESDIR}"/flanneld.service > ${T}/flanneld.service "${FILESDIR}"/flanneld.service > "${T}"/flanneld.service
systemd_dounit ${T}/flanneld.service systemd_dounit "${T}"/flanneld.service
sed "s|@FLANNEL_IMAGE_TAG@|${tag}|g" \ sed "s|@FLANNEL_IMAGE_TAG@|${tag}|g" \
"${FILESDIR}"/flannel-docker-opts.service > ${T}/flannel-docker-opts.service "${FILESDIR}"/flannel-docker-opts.service > "${T}"/flannel-docker-opts.service
systemd_dounit ${T}/flannel-docker-opts.service systemd_dounit "${T}"/flannel-docker-opts.service
insinto /usr/lib/systemd/network insinto /usr/lib/systemd/network
doins "${FILESDIR}"/50-flannel.network doins "${FILESDIR}"/50-flannel.network

View File

@ -1,4 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata> <pkgmetadata>
<upstream>
<remote-id type="github">flannel-io/flannel</remote-id>
</upstream>
</pkgmetadata> </pkgmetadata>

View File

@ -1 +1 @@
DIST 20190124.tar.gz 126211 BLAKE2B 7608ec8370f9c1aa1da4cf0f0ec20ff86ef07846bdcb6aabac6de441326a78e98b559502b11ee4028065eb8056f9ee6c2f3247e26485e8c9af70892d955236f7 SHA512 8f12c2a361ebd833b0eb3fa6ef26f42a82b4ef6497d8e5231eeaaf5b2e6dd1662ec596e1bbad73e06207ac29e098863311538c360c62efe9fd5cc9b58d1b8ad4 DIST google-compute-engine-20190124.tar.gz 126211 BLAKE2B 7608ec8370f9c1aa1da4cf0f0ec20ff86ef07846bdcb6aabac6de441326a78e98b559502b11ee4028065eb8056f9ee6c2f3247e26485e8c9af70892d955236f7 SHA512 8f12c2a361ebd833b0eb3fa6ef26f42a82b4ef6497d8e5231eeaaf5b2e6dd1662ec596e1bbad73e06207ac29e098863311538c360c62efe9fd5cc9b58d1b8ad4

View File

@ -1,27 +1,26 @@
# Copyright (c) 2016-2018 CoreOS, Inc. All rights reserved. # Copyright (c) 2016-2018 CoreOS, Inc. All rights reserved.
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=6 EAPI=8
inherit eutils PYTHON_COMPAT=( python3_11 )
DISTUTILS_USE_PEP517=setuptools
inherit distutils-r1
DESCRIPTION="Linux Guest Environment for Google Compute Engine" DESCRIPTION="Linux Guest Environment for Google Compute Engine"
HOMEPAGE="https://github.com/GoogleCloudPlatform/compute-image-packages" HOMEPAGE="https://github.com/GoogleCloudPlatform/compute-image-packages"
SRC_URI="https://github.com/GoogleCloudPlatform/compute-image-packages/archive/${PV}.tar.gz" SRC_URI="https://github.com/GoogleCloudPlatform/compute-image-packages/archive/${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/compute-image-packages-${PV}"
LICENSE="MIT" LICENSE="MIT"
SLOT="0" SLOT="0"
KEYWORDS="amd64 x86" KEYWORDS="amd64"
IUSE=""
DEPEND="dev-python/setuptools"
# These dependencies cover all commands called by the scripts. # These dependencies cover all commands called by the scripts.
RDEPEND=" RDEPEND="
app-admin/sudo app-admin/sudo
dev-python/boto dev-python/boto[${PYTHON_USEDEP}]
dev-python/distro dev-python/distro[${PYTHON_USEDEP}]
dev-python/setuptools
sys-apps/ethtool sys-apps/ethtool
sys-apps/coreutils sys-apps/coreutils
sys-apps/gawk sys-apps/gawk
@ -29,13 +28,3 @@ RDEPEND="
sys-apps/iproute2 sys-apps/iproute2
sys-apps/shadow sys-apps/shadow
" "
S="${WORKDIR}/compute-image-packages-${PV}"
src_compile() {
(cd "${S}" && exec python3 setup.py build)
}
src_install() {
(cd "${S}" && exec python3 setup.py install -O1 --skip-build --root "${D}")
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<upstream>
<remote-id type="github">GoogleCloudPlatform/compute-image-packages</remote-id>
</upstream>
</pkgmetadata>

View File

@ -1 +1 @@
DIST eselect-go-0.1.0.tar.gz 104232 SHA256 541de8bc7b77d93f070f907f17760bb30dc3fa8244216d565fcdfb58ab04381b SHA512 b7e9bf07bc7026115d639ed893c54332d63cd2d7a46a6f3b2f8a6748658dfb82f09e875def8bf9abecfb1e39f054ef194b39b0c415ac9ce69ea03332125d4c1f WHIRLPOOL 77996759041eea27f169eadab48f122e55ec11886e851d583ebdd0cf667500d7ca45a62a9edfb99400cc69cbd936887ddface15e7c81d2b301ba111c53123a6a DIST eselect-go-0.1.0.tar.gz 104232 BLAKE2B 770773f990509bdfcdb1c463f01915526358fe28b440be288dad0833a4e8647cf52ba136569b4e7b46c71b80c6ffd43075fd25bfb516ec5790f80067247e08c5 SHA512 b7e9bf07bc7026115d639ed893c54332d63cd2d7a46a6f3b2f8a6748658dfb82f09e875def8bf9abecfb1e39f054ef194b39b0c415ac9ce69ea03332125d4c1f

View File

@ -1,12 +1,11 @@
# Copyright 2016 CoreOS, Inc. # Copyright 2016 CoreOS, Inc.
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI=6 EAPI=8
DESCRIPTION="Eselect module for managing multiple Go versions" DESCRIPTION="Eselect module for managing multiple Go versions"
HOMEPAGE="https://github.com/coreos/eselect-go" HOMEPAGE="https://github.com/coreos/eselect-go"
SRC_URI="${HOMEPAGE}/releases/download/v${PV}/${P}.tar.gz" SRC_URI="https://github.com/coreos/eselect-go/releases/download/v${PV}/${P}.tar.gz"
# Note for future releases: the tarball was generated via `make dist` and # Note for future releases: the tarball was generated via `make dist` and
# uploaded to GitHub so there is no need for initializing autotools here. # uploaded to GitHub so there is no need for initializing autotools here.
@ -14,6 +13,7 @@ LICENSE="GPL-2"
SLOT="0" SLOT="0"
KEYWORDS="amd64 arm64" KEYWORDS="amd64 arm64"
IUSE="test" IUSE="test"
RESTRICT="!test? ( test )"
DEPEND="test? ( dev-libs/glib )" DEPEND="test? ( dev-libs/glib )"
RDEPEND="app-admin/eselect RDEPEND="app-admin/eselect

View File

@ -6,4 +6,7 @@
packages or architectures that cannot upgrade to the same Go version packages or architectures that cannot upgrade to the same Go version
all at the same time. Gentoo doesn't support this use case. all at the same time. Gentoo doesn't support this use case.
</longdescription> </longdescription>
<upstream>
<remote-id type="github">coreos/eselect-go</remote-id>
</upstream>
</pkgmetadata> </pkgmetadata>

View File

@ -1,57 +0,0 @@
# Copyright (c) 2021 Kinvolk GmbH
# Distributed under the terms of the Apache License 2.0
# This package is heavily based on the files distributed in
# https://github.com/awslabs/amazon-eks-ami, the files have been adapted to fit
# Flatcar Container Linux instead of Amazon Linux.
EAPI=6
inherit eutils
DESCRIPTION="Configuration for EKS worker nodes"
HOMEPAGE=""
SRC_URI=""
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64 arm64"
IUSE=""
# no source directory
S="${WORKDIR}"
src_prepare() {
# The bootstrap.sh file has been downloaded from:
# https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/files/bootstrap.sh
# We keep our patches separate to facilitate sychronizing changes
cp "${FILESDIR}/bootstrap.sh" "${WORKDIR}/"
eapply -p1 "${FILESDIR}/bootstrap.patch"
eapply_user
}
src_install() {
insinto /usr/share/amazon/eks
doins "${WORKDIR}/bootstrap.sh"
# These files are based on the ones found on the amazon-eks-ami repository,
# but adapted to fit Flatcar needs. Since they are a lot simpler, we don't
# use the patching technique, but rather just edit them as needed.
doins "${FILESDIR}/kubelet-kubeconfig"
doins "${FILESDIR}/kubelet.service"
# These files are taken verbatim from the amazon-eks-ami repository:
# https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/files/kubelet-config.json
# https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/files/docker-daemon.json
# https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/files/eni-max-pods.txt
doins "${FILESDIR}/kubelet-config.json"
doins "${FILESDIR}/docker-daemon.json"
doins "${FILESDIR}/eni-max-pods.txt"
# This downloading script has been created specially for Flatcar. It gets
# the current EKS Cluster Kubernetes version and downloads all the
# necessary files to run the kubelet on the node.
doins "${FILESDIR}/download-kubelet.sh"
chmod +x "${D}/usr/share/amazon/eks/bootstrap.sh" "${D}/usr/share/amazon/eks/download-kubelet.sh"
}

View File

@ -0,0 +1,50 @@
# Copyright (c) 2021 Kinvolk GmbH
# Distributed under the terms of the Apache License 2.0
# This package is heavily based on the files distributed in
# https://github.com/awslabs/amazon-eks-ami, the files have been adapted to fit
# Flatcar Container Linux instead of Amazon Linux.
EAPI=8
DESCRIPTION="Configuration for EKS worker nodes"
HOMEPAGE="https://www.flatcar.org"
S="${WORKDIR}"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64 arm64"
src_prepare() {
# The bootstrap.sh file has been downloaded from:
# https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/files/bootstrap.sh
# We keep our patches separate to facilitate sychronizing changes
cp "${FILESDIR}/bootstrap.sh" "${WORKDIR}/"
eapply "${FILESDIR}/bootstrap.patch"
default
}
src_install() {
exeinto /usr/share/amazon/eks
insinto /usr/share/amazon/eks
doexe "${WORKDIR}/bootstrap.sh"
# These files are based on the ones found on the amazon-eks-ami repository,
# but adapted to fit Flatcar needs. Since they are a lot simpler, we don't
# use the patching technique, but rather just edit them as needed.
doins "${FILESDIR}/kubelet-kubeconfig"
doins "${FILESDIR}/kubelet.service"
# These files are taken verbatim from the amazon-eks-ami repository:
# https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/files/kubelet-config.json
# https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/files/docker-daemon.json
# https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/files/eni-max-pods.txt
doins "${FILESDIR}/kubelet-config.json"
doins "${FILESDIR}/docker-daemon.json"
doins "${FILESDIR}/eni-max-pods.txt"
# This downloading script has been created specially for Flatcar. It gets
# the current EKS Cluster Kubernetes version and downloads all the
# necessary files to run the kubelet on the node.
doexe "${FILESDIR}/download-kubelet.sh"
}

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata> <pkgmetadata>
<longdescription lang="en"> <upstream>
</longdescription> <remote-id type="github">flatcar/baselayout</remote-id>
</upstream>
</pkgmetadata> </pkgmetadata>

View File

@ -1,17 +1,14 @@
# Copyright 1999-2014 Gentoo Foundation # Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=6 EAPI=8
DESCRIPTION="Compatibility ebuild stub for CoreOS" DESCRIPTION="Compatibility ebuild stub for Flatcar"
HOMEPAGE="https://github.com/coreos/baselayout" HOMEPAGE="https://github.com/flatcar/baselayout"
SRC_URI=""
LICENSE="metapackage" LICENSE="metapackage"
SLOT="0" SLOT="0"
KEYWORDS="amd64 arm arm64 x86" KEYWORDS="amd64 arm arm64 x86"
IUSE=""
RDEPEND=">=sys-apps/baselayout-3.6 RDEPEND=">=sys-apps/baselayout-3.6
>=sys-libs/pam-1.4" >=sys-libs/pam-1.4"
DEPEND=""

View File

@ -1,14 +1,15 @@
# Copyright 1999-2018 Gentoo Foundation # Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=6 EAPI=8
inherit eutils toolchain-funcs inherit toolchain-funcs
DESCRIPTION="SYSLINUX, PXELINUX, ISOLINUX, EXTLINUX and MEMDISK bootloaders" DESCRIPTION="SYSLINUX, PXELINUX, ISOLINUX, EXTLINUX and MEMDISK bootloaders"
HOMEPAGE="https://syslinux.zytor.com/" HOMEPAGE="https://syslinux.zytor.com/"
SRC_URI_DIR="${PV:0:1}.xx" SRC_URI_DIR="${PV:0:1}.xx"
SRC_URI="https://www.kernel.org/pub/linux/utils/boot/syslinux/${SRC_URI_DIR}/${P/_/-}.tar.xz" SRC_URI="https://www.kernel.org/pub/linux/utils/boot/syslinux/${SRC_URI_DIR}/${P/_/-}.tar.xz"
S=${WORKDIR}/${P/_/-}
LICENSE="GPL-2" LICENSE="GPL-2"
SLOT="0" SLOT="0"
@ -26,8 +27,6 @@ DEPEND="${RDEPEND}
dev-lang/nasm dev-lang/nasm
virtual/os-headers" virtual/os-headers"
S=${WORKDIR}/${P/_/-}
# This ebuild is a departure from the old way of rebuilding everything in syslinux # This ebuild is a departure from the old way of rebuilding everything in syslinux
# This departure is necessary since hpa doesn't support the rebuilding of anything other # This departure is necessary since hpa doesn't support the rebuilding of anything other
# than the installers. # than the installers.
@ -38,7 +37,7 @@ src_unpack() {
unpack ${A} unpack ${A}
cd "${S}" cd "${S}"
# Fix building on hardened # Fix building on hardened
epatch "${FILESDIR}"/${PN}-4.05-nopie.patch eapply "${FILESDIR}"/${PN}-4.05-nopie.patch
rm -f gethostip #bug 137081 rm -f gethostip #bug 137081
@ -77,10 +76,10 @@ src_unpack() {
} }
src_compile() { src_compile() {
emake CC="$(tc-getCC)" installer || die emake CC="$(tc-getCC)" installer
} }
src_install() { src_install() {
emake INSTALLSUBDIRS=utils INSTALLROOT="${D}" MANDIR=/usr/share/man install || die emake INSTALLSUBDIRS=utils INSTALLROOT="${ED}" MANDIR='$(DATADIR)/man' install
dodoc README NEWS doc/*.txt || die dodoc README NEWS doc/*.txt
} }

View File

@ -1,380 +0,0 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: epatch.eclass
# @MAINTAINER:
# base-system@gentoo.org
# @SUPPORTED_EAPIS: 6
# @BLURB: easy patch application functions
# @DEPRECATED: eapply from EAPI 7
# @DESCRIPTION:
# An eclass providing epatch and epatch_user functions to easily apply
# patches to ebuilds. Mostly superseded by eapply* in EAPI 6.
if [[ -z ${_EPATCH_ECLASS} ]]; then
case ${EAPI} in
6) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
inherit estack
# @VARIABLE: EPATCH_SOURCE
# @DESCRIPTION:
# Default directory to search for patches.
EPATCH_SOURCE="${WORKDIR}/patch"
# @VARIABLE: EPATCH_SUFFIX
# @DESCRIPTION:
# Default extension for patches (do not prefix the period yourself).
EPATCH_SUFFIX="patch.bz2"
# @VARIABLE: EPATCH_OPTS
# @DESCRIPTION:
# Options to pass to patch. Meant for ebuild/package-specific tweaking
# such as forcing the patch level (-p#) or fuzz (-F#) factor. Note that
# for single patch tweaking, you can also pass flags directly to epatch.
EPATCH_OPTS=""
# @VARIABLE: EPATCH_COMMON_OPTS
# @DESCRIPTION:
# Common options to pass to `patch`. You probably should never need to
# change these. If you do, please discuss it with base-system first to
# be sure.
# @CODE
# -g0 - keep RCS, ClearCase, Perforce and SCCS happy #24571
# --no-backup-if-mismatch - do not leave .orig files behind
# -E - automatically remove empty files
# @CODE
EPATCH_COMMON_OPTS="-g0 -E --no-backup-if-mismatch"
# @VARIABLE: EPATCH_EXCLUDE
# @DESCRIPTION:
# List of patches not to apply. Note this is only file names,
# and not the full path. Globs accepted.
EPATCH_EXCLUDE=""
# @VARIABLE: EPATCH_MULTI_MSG
# @DESCRIPTION:
# Change the printed message for multiple patches.
EPATCH_MULTI_MSG="Applying various patches (bugfixes/updates) ..."
# @VARIABLE: EPATCH_FORCE
# @DESCRIPTION:
# Only require patches to match EPATCH_SUFFIX rather than the extended
# arch naming style.
EPATCH_FORCE="no"
# @VARIABLE: EPATCH_USER_EXCLUDE
# @DEFAULT_UNSET
# @DESCRIPTION:
# List of patches not to apply. Note this is only file names,
# and not the full path. Globs accepted.
# @FUNCTION: epatch
# @USAGE: [options] [patches] [dirs of patches]
# @DESCRIPTION:
# epatch is designed to greatly simplify the application of patches. It can
# process patch files directly, or directories of patches. The patches may be
# compressed (bzip/gzip/etc...) or plain text. You generally need not specify
# the -p option as epatch will automatically attempt -p0 to -p4 until things
# apply successfully.
#
# If you do not specify any patches/dirs, then epatch will default to the
# directory specified by EPATCH_SOURCE.
#
# Any options specified that start with a dash will be passed down to patch
# for this specific invocation. As soon as an arg w/out a dash is found, then
# arg processing stops.
#
# When processing directories, epatch will apply all patches that match:
# @CODE
# if ${EPATCH_FORCE} != "yes"
# ??_${ARCH}_foo.${EPATCH_SUFFIX}
# else
# *.${EPATCH_SUFFIX}
# @CODE
# The leading ?? are typically numbers used to force consistent patch ordering.
# The arch field is used to apply patches only for the host architecture with
# the special value of "all" means apply for everyone. Note that using values
# other than "all" is highly discouraged -- you should apply patches all the
# time and let architecture details be detected at configure/compile time.
#
# If EPATCH_SUFFIX is empty, then no period before it is implied when searching
# for patches to apply.
#
# Refer to the other EPATCH_xxx variables for more customization of behavior.
epatch() {
_epatch_draw_line() {
# create a line of same length as input string
[[ -z $1 ]] && set "$(printf "%65s" '')"
echo "${1//?/=}"
}
unset P4CONFIG P4PORT P4USER # keep perforce at bay #56402
# First process options. We localize the EPATCH_OPTS setting
# from above so that we can pass it on in the loop below with
# any additional values the user has specified.
local EPATCH_OPTS=( ${EPATCH_OPTS[*]} )
while [[ $# -gt 0 ]] ; do
case $1 in
-*) EPATCH_OPTS+=( "$1" ) ;;
*) break ;;
esac
shift
done
# Let the rest of the code process one user arg at a time --
# each arg may expand into multiple patches, and each arg may
# need to start off with the default global EPATCH_xxx values
if [[ $# -gt 1 ]] ; then
local m
for m in "$@" ; do
epatch "${m}"
done
return 0
fi
local SINGLE_PATCH="no"
# no args means process ${EPATCH_SOURCE}
[[ $# -eq 0 ]] && set -- "${EPATCH_SOURCE}"
if [[ -f $1 ]] ; then
SINGLE_PATCH="yes"
set -- "$1"
# Use the suffix from the single patch (localize it); the code
# below will find the suffix for us
local EPATCH_SUFFIX=$1
elif [[ -d $1 ]] ; then
# We have to force sorting to C so that the wildcard expansion is consistent #471666.
evar_push_set LC_COLLATE C
# Some people like to make dirs of patches w/out suffixes (vim).
set -- "$1"/*${EPATCH_SUFFIX:+."${EPATCH_SUFFIX}"}
evar_pop
elif [[ -f ${EPATCH_SOURCE}/$1 ]] ; then
# Re-use EPATCH_SOURCE as a search dir
epatch "${EPATCH_SOURCE}/$1"
return $?
else
# sanity check ... if it isn't a dir or file, wtf man ?
[[ $# -ne 0 ]] && EPATCH_SOURCE=$1
echo
eerror "Cannot find \$EPATCH_SOURCE! Value for \$EPATCH_SOURCE is:"
eerror
eerror " ${EPATCH_SOURCE}"
eerror " ( ${EPATCH_SOURCE##*/} )"
echo
die "Cannot find \$EPATCH_SOURCE!"
fi
# Now that we know we're actually going to apply something, merge
# all of the patch options back in to a single variable for below.
EPATCH_OPTS="${EPATCH_COMMON_OPTS} ${EPATCH_OPTS[*]}"
local PIPE_CMD
case ${EPATCH_SUFFIX##*\.} in
xz) PIPE_CMD="xz -dc" ;;
lzma) PIPE_CMD="lzma -dc" ;;
bz2) PIPE_CMD="bzip2 -dc" ;;
gz|Z|z) PIPE_CMD="gzip -dc" ;;
ZIP|zip) PIPE_CMD="unzip -p" ;;
*) ;;
esac
[[ ${SINGLE_PATCH} == "no" ]] && einfo "${EPATCH_MULTI_MSG}"
local x
for x in "$@" ; do
# If the patch dir given contains subdirs, or our EPATCH_SUFFIX
# didn't match anything, ignore continue on
[[ ! -f ${x} ]] && continue
local patchname=${x##*/}
# Apply single patches, or forced sets of patches, or
# patches with ARCH dependent names.
# ???_arch_foo.patch
# Else, skip this input altogether
local a=${patchname#*_} # strip the ???_
a=${a%%_*} # strip the _foo.patch
if ! [[ ${SINGLE_PATCH} == "yes" || \
${EPATCH_FORCE} == "yes" || \
${a} == all || \
${a} == ${ARCH} ]]
then
continue
fi
# Let people filter things dynamically
if [[ -n ${EPATCH_EXCLUDE}${EPATCH_USER_EXCLUDE} ]] ; then
# let people use globs in the exclude
eshopts_push -o noglob
local ex
for ex in ${EPATCH_EXCLUDE} ; do
if [[ ${patchname} == ${ex} ]] ; then
einfo " Skipping ${patchname} due to EPATCH_EXCLUDE ..."
eshopts_pop
continue 2
fi
done
for ex in ${EPATCH_USER_EXCLUDE} ; do
if [[ ${patchname} == ${ex} ]] ; then
einfo " Skipping ${patchname} due to EPATCH_USER_EXCLUDE ..."
eshopts_pop
continue 2
fi
done
eshopts_pop
fi
if [[ ${SINGLE_PATCH} == "yes" ]] ; then
ebegin "Applying ${patchname}"
else
ebegin " ${patchname}"
fi
# Handle aliased patch command #404447 #461568
local patch="patch"
eval $(alias patch 2>/dev/null | sed 's:^alias ::')
# most of the time, there will only be one run per unique name,
# but if there are more, make sure we get unique log filenames
local STDERR_TARGET="${T}/${patchname}.out"
if [[ -e ${STDERR_TARGET} ]] ; then
STDERR_TARGET="${T}/${patchname}-$$.out"
fi
printf "***** %s *****\nPWD: %s\nPATCH TOOL: %s -> %s\nVERSION INFO:\n%s\n\n" \
"${patchname}" \
"${PWD}" \
"${patch}" \
"$(type -P "${patch}")" \
"$(${patch} --version)" \
> "${STDERR_TARGET}"
# Decompress the patch if need be
local count=0
local PATCH_TARGET
if [[ -n ${PIPE_CMD} ]] ; then
PATCH_TARGET="${T}/$$.patch"
echo "PIPE_COMMAND: ${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> "${STDERR_TARGET}"
if ! (${PIPE_CMD} "${x}" > "${PATCH_TARGET}") >> "${STDERR_TARGET}" 2>&1 ; then
echo
eerror "Could not extract patch!"
#die "Could not extract patch!"
count=5
break
fi
else
PATCH_TARGET=${x}
fi
# Check for absolute paths in patches. If sandbox is disabled,
# people could (accidentally) patch files in the root filesystem.
# Or trigger other unpleasantries #237667. So disallow -p0 on
# such patches.
local abs_paths=$(grep -E -n '^[-+]{3} /' "${PATCH_TARGET}" | awk '$2 != "/dev/null" { print }')
if [[ -n ${abs_paths} ]] ; then
count=1
printf "NOTE: skipping -p0 due to absolute paths in patch:\n%s\n" "${abs_paths}" >> "${STDERR_TARGET}"
fi
# Similar reason, but with relative paths.
local rel_paths=$(grep -E -n '^[-+]{3} [^ ]*[.][.]/' "${PATCH_TARGET}")
if [[ -n ${rel_paths} ]] ; then
echo
eerror "Rejected Patch: ${patchname}!"
eerror " ( ${PATCH_TARGET} )"
eerror
eerror "Your patch uses relative paths '../':"
eerror "${rel_paths}"
echo
die "you need to fix the relative paths in patch"
fi
# Dynamically detect the correct -p# ... i'm lazy, so shoot me :/
local patch_cmd
while [[ ${count} -lt 5 ]] ; do
patch_cmd="${patch} -p${count} ${EPATCH_OPTS}"
# Generate some useful debug info ...
(
_epatch_draw_line "***** ${patchname} *****"
echo
echo "PATCH COMMAND: ${patch_cmd} --dry-run -f < '${PATCH_TARGET}'"
echo
_epatch_draw_line "***** ${patchname} *****"
${patch_cmd} --dry-run -f < "${PATCH_TARGET}" 2>&1
ret=$?
echo
echo "patch program exited with status ${ret}"
exit ${ret}
) >> "${STDERR_TARGET}"
if [ $? -eq 0 ] ; then
(
_epatch_draw_line "***** ${patchname} *****"
echo
echo "ACTUALLY APPLYING ${patchname} ..."
echo "PATCH COMMAND: ${patch_cmd} < '${PATCH_TARGET}'"
echo
_epatch_draw_line "***** ${patchname} *****"
${patch_cmd} < "${PATCH_TARGET}" 2>&1
ret=$?
echo
echo "patch program exited with status ${ret}"
exit ${ret}
) >> "${STDERR_TARGET}"
if [ $? -ne 0 ] ; then
echo
eerror "A dry-run of patch command succeeded, but actually"
eerror "applying the patch failed!"
#die "Real world sux compared to the dreamworld!"
count=5
fi
break
fi
: $(( count++ ))
done
(( EPATCH_N_APPLIED_PATCHES++ ))
# if we had to decompress the patch, delete the temp one
if [[ -n ${PIPE_CMD} ]] ; then
rm -f "${PATCH_TARGET}"
fi
if [[ ${count} -ge 5 ]] ; then
echo
eerror "Failed patch: ${patchname}!"
eerror " ( ${PATCH_TARGET} )"
eerror
eerror "Include in your bug report the contents of:"
eerror
eerror " ${STDERR_TARGET}"
echo
die "Failed patch: ${patchname}!"
fi
# if everything worked, delete the full debug patch log
rm -f "${STDERR_TARGET}"
# then log away the exact stuff for people to review later
cat <<-EOF >> "${T}/epatch.log"
PATCH: ${x}
CMD: ${patch_cmd}
PWD: ${PWD}
EOF
eend 0
done
[[ ${SINGLE_PATCH} == "no" ]] && einfo "Done with patching"
: # everything worked
}
_EPATCH_ECLASS=1
fi #_EPATCH_ECLASS

View File

@ -1,21 +0,0 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: eutils.eclass
# @MAINTAINER:
# base-system@gentoo.org
# @SUPPORTED_EAPIS: 6
# @BLURB: many extra (but common) functions that are used in ebuilds
# @DEPRECATED: native package manager functions, more specific eclasses
# @DEAD
if [[ -z ${_EUTILS_ECLASS} ]]; then
_EUTILS_ECLASS=1
# implicitly inherited (now split) eclasses
case ${EAPI} in
6) inherit desktop edos2unix epatch eqawarn estack ltprune multilib \
preserve-libs strip-linguas toolchain-funcs vcs-clean wrapper ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
fi

View File

@ -1,177 +0,0 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @DEAD
# @ECLASS: ltprune.eclass
# @MAINTAINER:
# Michał Górny <mgorny@gentoo.org>
# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6
# @BLURB: Smart .la file pruning
# @DEPRECATED: none
# @DESCRIPTION:
# A function to locate and remove unnecessary .la files.
#
# Discouraged. Whenever possible, please use much simpler:
# @CODE
# find "${ED}" -type f -name '*.la' -delete || die
# @CODE
if [[ -z ${_LTPRUNE_ECLASS} ]]; then
case ${EAPI:-0} in
0|1|2|3|4|5|6)
;;
*)
die "${ECLASS}: banned in EAPI=${EAPI}; use 'find' instead";;
esac
inherit toolchain-funcs
# @FUNCTION: prune_libtool_files
# @USAGE: [--all|--modules]
# @DESCRIPTION:
# Locate unnecessary libtool files (.la) and libtool static archives
# (.a) and remove them from installation image.
#
# By default, .la files are removed whenever the static linkage can
# either be performed using pkg-config or doesn't introduce additional
# flags.
#
# If '--modules' argument is passed, .la files for modules (plugins) are
# removed as well. This is usually useful when the package installs
# plugins and the plugin loader does not use .la files.
#
# If '--all' argument is passed, all .la files are removed without
# performing any heuristic on them. You shouldn't ever use that,
# and instead report a bug in the algorithm instead.
#
# The .a files are only removed whenever corresponding .la files state
# that they should not be linked to, i.e. whenever these files
# correspond to plugins.
#
# Note: if your package installs both static libraries and .pc files
# which use variable substitution for -l flags, you need to add
# pkg-config to your DEPEND.
prune_libtool_files() {
debug-print-function ${FUNCNAME} "$@"
local removing_all removing_modules opt
for opt; do
case "${opt}" in
--all)
removing_all=1
removing_modules=1
;;
--modules)
removing_modules=1
;;
*)
die "Invalid argument to ${FUNCNAME}(): ${opt}"
esac
done
local f
local queue=()
while IFS= read -r -d '' f; do # for all .la files
local archivefile=${f/%.la/.a}
# The following check is done by libtool itself.
# It helps us avoid removing random files which match '*.la',
# see bug #468380.
if ! sed -n -e '/^# Generated by .*libtool/q0;4q1' "${f}"; then
continue
fi
[[ ${f} != ${archivefile} ]] || die 'regex sanity check failed'
local reason= pkgconfig_scanned=
local snotlink=$(sed -n -e 's:^shouldnotlink=::p' "${f}")
if [[ ${snotlink} == yes ]]; then
# Remove static libs we're not supposed to link against.
if [[ -f ${archivefile} ]]; then
einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)"
queue+=( "${archivefile}" )
fi
# The .la file may be used by a module loader, so avoid removing it
# unless explicitly requested.
if [[ ${removing_modules} ]]; then
reason='module'
fi
else
# Remove .la files when:
# - user explicitly wants us to remove all .la files,
# - respective static archive doesn't exist,
# - they are covered by a .pc file already,
# - they don't provide any new information (no libs & no flags).
if [[ ${removing_all} ]]; then
reason='requested'
elif [[ ! -f ${archivefile} ]]; then
reason='no static archive'
elif [[ ! $(sed -nre \
"s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" \
"${f}") ]]; then
reason='no libs & flags'
else
if [[ ! ${pkgconfig_scanned} ]]; then
# Create a list of all .pc-covered libs.
local pc_libs=()
if [[ ! ${removing_all} ]]; then
local pc
local tf=${T}/prune-lt-files.pc
local pkgconf=$(tc-getPKG_CONFIG)
while IFS= read -r -d '' pc; do # for all .pc files
local arg libs
# Use pkg-config if available (and works),
# fallback to sed.
if ${pkgconf} --exists "${pc}" &>/dev/null; then
sed -e '/^Requires:/d' "${pc}" > "${tf}"
libs=$(${pkgconf} --libs "${tf}")
else
libs=$(sed -ne 's/^Libs://p' "${pc}")
fi
for arg in ${libs}; do
if [[ ${arg} == -l* ]]; then
if [[ ${arg} == '*$*' ]]; then
eerror "${FUNCNAME}: variable substitution likely failed in ${pc}"
eerror "(arg: ${arg})"
eerror "Most likely, you need to add virtual/pkgconfig to DEPEND."
die "${FUNCNAME}: unsubstituted variable found in .pc"
fi
pc_libs+=( lib${arg#-l}.la )
fi
done
done < <(find "${D}" -type f -name '*.pc' -print0)
rm -f "${tf}"
fi
pkgconfig_scanned=1
fi # pkgconfig_scanned
has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc'
fi # removal due to .pc
fi # shouldnotlink==no
if [[ ${reason} ]]; then
einfo "Removing unnecessary ${f#${D%/}} (${reason})"
queue+=( "${f}" )
fi
done < <(find "${D}" -xtype f -name '*.la' -print0)
if [[ ${queue[@]} ]]; then
rm -f "${queue[@]}"
fi
}
_LTPRUNE_ECLASS=1
fi #_LTPRUNE_ECLASS

View File

@ -1,31 +0,0 @@
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
inherit autotools
test-it() {
tbegin "eaclocal_amflags $1: $2"
printf "ACLOCAL_AMFLAGS = %b\n" "$2" > Makefile.am
local flags=$(eaclocal_amflags) exp=${3:-$2}
[[ "${flags}" == "${exp}" ]]
if ! tend $? ; then
printf '### INPUT:\n%s\n' "$2"
printf '### FILE:\n%s\n' "$(<Makefile.am)"
printf '### EXPECTED:\n%s\n' "${exp}"
printf '### ACTUAL:\n%s\n' "${flags}"
fi
rm Makefile.am
}
test-it simple "-Im4"
test-it simple "-I m4 -I lakdjfladsfj /////"
test-it shell-exec '`echo hi`' "hi"
test-it shell-exec '`echo {0..3}`' "0 1 2 3"
test-it multiline '-I oneline \\\n\t-I twoline' "-I oneline -I twoline"
texit

View File

@ -1,32 +0,0 @@
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
PYTHON_COMPAT=( python2_7 )
source tests-common.sh
test-phase_name_free() {
local ph=${1}
if declare -f "${ph}"; then
die "${ph} function declared while name reserved for phase!"
fi
if declare -f "${ph}_all"; then
die "${ph}_all function declared while name reserved for phase!"
fi
}
inherit distutils-r1
tbegin "sane function names"
test-phase_name_free python_prepare
test-phase_name_free python_configure
test-phase_name_free python_compile
test-phase_name_free python_test
test-phase_name_free python_install
tend ${failed}
texit

View File

@ -1,177 +0,0 @@
#!/bin/bash
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
source tests-common.sh
inherit eapi7-ver
teq() {
local expected=${1}; shift
tbegin "${*} -> ${expected}"
local got=$("${@}")
[[ ${got} == ${expected} ]]
tend ${?} "returned: ${got}"
}
teqr() {
local expected=$1; shift
tbegin "$* -> ${expected}"
"$@"
local ret=$?
[[ ${ret} -eq ${expected} ]]
tend $? "returned: ${ret}"
}
txf() {
tbegin "XFAIL: ${*}"
local got=$("${@}" 2>&1)
[[ ${got} == die:* ]]
tend ${?} "function did not die"
}
teq 1 ver_cut 1 1.2.3
teq 1 ver_cut 1-1 1.2.3
teq 1.2 ver_cut 1-2 1.2.3
teq 2.3 ver_cut 2- 1.2.3
teq 1.2.3 ver_cut 1- 1.2.3
teq 3b ver_cut 3-4 1.2.3b_alpha4
teq alpha ver_cut 5 1.2.3b_alpha4
teq 1.2 ver_cut 1-2 .1.2.3
teq .1.2 ver_cut 0-2 .1.2.3
teq 2.3 ver_cut 2-3 1.2.3.
teq 2.3. ver_cut 2- 1.2.3.
teq 2.3. ver_cut 2-4 1.2.3.
teq 1-2.3 ver_rs 1 - 1.2.3
teq 1.2-3 ver_rs 2 - 1.2.3
teq 1-2-3.4 ver_rs 1-2 - 1.2.3.4
teq 1.2-3-4 ver_rs 2- - 1.2.3.4
teq 1.2.3 ver_rs 2 . 1.2-3
teq 1.2.3.a ver_rs 3 . 1.2.3a
teq 1.2-alpha-4 ver_rs 2-3 - 1.2_alpha4
teq 1.23-b_alpha4 ver_rs 3 - 2 "" 1.2.3b_alpha4
teq a1b_2-c-3-d4e5 ver_rs 3-5 _ 4-6 - a1b2c3d4e5
teq .1-2.3 ver_rs 1 - .1.2.3
teq -1.2.3 ver_rs 0 - .1.2.3
# truncating range
teq 1.2 ver_cut 0-2 1.2.3
teq 2.3 ver_cut 2-5 1.2.3
teq "" ver_cut 4 1.2.3
teq "" ver_cut 0 1.2.3
teq "" ver_cut 4- 1.2.3
teq 1.2.3 ver_rs 0 - 1.2.3
teq 1.2.3 ver_rs 3 . 1.2.3
teq 1.2.3 ver_rs 3- . 1.2.3
teq 1.2.3 ver_rs 3-5 . 1.2.3
txf ver_cut foo 1.2.3
txf ver_rs -3 _ a1b2c3d4e5
txf ver_rs 5-3 _ a1b2c3d4e5
# Tests from Portage's test_vercmp.py
teqr 0 ver_test 6.0 -gt 5.0
teqr 0 ver_test 5.0 -gt 5
teqr 0 ver_test 1.0-r1 -gt 1.0-r0
teqr 0 ver_test 999999999999999999 -gt 999999999999999998 # 18 digits
teqr 0 ver_test 1.0.0 -gt 1.0
teqr 0 ver_test 1.0.0 -gt 1.0b
teqr 0 ver_test 1b -gt 1
teqr 0 ver_test 1b_p1 -gt 1_p1
teqr 0 ver_test 1.1b -gt 1.1
teqr 0 ver_test 12.2.5 -gt 12.2b
teqr 0 ver_test 4.0 -lt 5.0
teqr 0 ver_test 5 -lt 5.0
teqr 0 ver_test 1.0_pre2 -lt 1.0_p2
teqr 0 ver_test 1.0_alpha2 -lt 1.0_p2
teqr 0 ver_test 1.0_alpha1 -lt 1.0_beta1
teqr 0 ver_test 1.0_beta3 -lt 1.0_rc3
teqr 0 ver_test 1.001000000000000001 -lt 1.001000000000000002
teqr 0 ver_test 1.00100000000 -lt 1.001000000000000001
teqr 0 ver_test 999999999999999998 -lt 999999999999999999
teqr 0 ver_test 1.01 -lt 1.1
teqr 0 ver_test 1.0-r0 -lt 1.0-r1
teqr 0 ver_test 1.0 -lt 1.0-r1
teqr 0 ver_test 1.0 -lt 1.0.0
teqr 0 ver_test 1.0b -lt 1.0.0
teqr 0 ver_test 1_p1 -lt 1b_p1
teqr 0 ver_test 1 -lt 1b
teqr 0 ver_test 1.1 -lt 1.1b
teqr 0 ver_test 12.2b -lt 12.2.5
teqr 0 ver_test 4.0 -eq 4.0
teqr 0 ver_test 1.0 -eq 1.0
teqr 0 ver_test 1.0-r0 -eq 1.0
teqr 0 ver_test 1.0 -eq 1.0-r0
teqr 0 ver_test 1.0-r0 -eq 1.0-r0
teqr 0 ver_test 1.0-r1 -eq 1.0-r1
teqr 1 ver_test 1 -eq 2
teqr 1 ver_test 1.0_alpha -eq 1.0_pre
teqr 1 ver_test 1.0_beta -eq 1.0_alpha
teqr 1 ver_test 1 -eq 0.0
teqr 1 ver_test 1.0-r0 -eq 1.0-r1
teqr 1 ver_test 1.0-r1 -eq 1.0-r0
teqr 1 ver_test 1.0 -eq 1.0-r1
teqr 1 ver_test 1.0-r1 -eq 1.0
teqr 1 ver_test 1.0 -eq 1.0.0
teqr 1 ver_test 1_p1 -eq 1b_p1
teqr 1 ver_test 1b -eq 1
teqr 1 ver_test 1.1b -eq 1.1
teqr 1 ver_test 12.2b -eq 12.2
# A subset of tests from Paludis
teqr 0 ver_test 1.0_alpha -gt 1_alpha
teqr 0 ver_test 1.0_alpha -gt 1
teqr 0 ver_test 1.0_alpha -lt 1.0
teqr 0 ver_test 1.2.0.0_alpha7-r4 -gt 1.2_alpha7-r4
teqr 0 ver_test 0001 -eq 1
teqr 0 ver_test 01 -eq 001
teqr 0 ver_test 0001.1 -eq 1.1
teqr 0 ver_test 01.01 -eq 1.01
teqr 0 ver_test 1.010 -eq 1.01
teqr 0 ver_test 1.00 -eq 1.0
teqr 0 ver_test 1.0100 -eq 1.010
teqr 0 ver_test 1-r00 -eq 1-r0
# Additional tests
teqr 0 ver_test 0_rc99 -lt 0
teqr 0 ver_test 011 -eq 11
teqr 0 ver_test 019 -eq 19
teqr 0 ver_test 1.2 -eq 001.2
teqr 0 ver_test 1.2 -gt 1.02
teqr 0 ver_test 1.2a -lt 1.2b
teqr 0 ver_test 1.2_pre1 -gt 1.2_pre1_beta2
teqr 0 ver_test 1.2_pre1 -lt 1.2_pre1_p2
teqr 0 ver_test 1.00 -lt 1.0.0
teqr 0 ver_test 1.010 -eq 1.01
teqr 0 ver_test 1.01 -lt 1.1
teqr 0 ver_test 1.2_pre08-r09 -eq 1.2_pre8-r9
teqr 0 ver_test 0 -lt 576460752303423488 # 2**59
teqr 0 ver_test 0 -lt 9223372036854775808 # 2**63
# Bad number or ordering of arguments
txf ver_test 1
txf ver_test 1 -lt 2 3
txf ver_test -lt 1 2
# Bad operators
txf ver_test 1 "<" 2
txf ver_test 1 lt 2
txf ver_test 1 -foo 2
# Malformed versions
txf ver_test "" -ne 1
txf ver_test 1. -ne 1
txf ver_test 1ab -ne 1
txf ver_test b -ne 1
txf ver_test 1-r1_pre -ne 1
txf ver_test 1-pre1 -ne 1
txf ver_test 1_foo -ne 1
txf ver_test 1_pre1.1 -ne 1
txf ver_test 1-r1.0 -ne 1
txf ver_test cvs.9999 -ne 9999
texit

View File

@ -1,147 +0,0 @@
#!/bin/bash
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
source tests-common.sh
inherit eapi7-ver versionator
cutting() {
local x
for x in {1..1000}; do
ver_cut 1 1.2.3
ver_cut 1-2 1.2.3
ver_cut 2- 1.2.3
ver_cut 1- 1.2.3
ver_cut 3-4 1.2.3b_alpha4
ver_cut 5 1.2.3b_alpha4
ver_cut 1-2 .1.2.3
ver_cut 0-2 .1.2.3
ver_cut 2-3 1.2.3.
ver_cut 2- 1.2.3.
ver_cut 2-4 1.2.3.
done >/dev/null
}
cutting_versionator() {
local x
for x in {1..100}; do
get_version_component_range 1 1.2.3
get_version_component_range 1-2 1.2.3
get_version_component_range 2- 1.2.3
get_version_component_range 1- 1.2.3
get_version_component_range 3-4 1.2.3b_alpha4
get_version_component_range 5 1.2.3b_alpha4
get_version_component_range 1-2 .1.2.3
get_version_component_range 0-2 .1.2.3
get_version_component_range 2-3 1.2.3.
get_version_component_range 2- 1.2.3.
get_version_component_range 2-4 1.2.3.
done >/dev/null
}
replacing() {
local x
for x in {1..1000}; do
ver_rs 1 - 1.2.3
ver_rs 2 - 1.2.3
ver_rs 1-2 - 1.2.3.4
ver_rs 2- - 1.2.3.4
ver_rs 2 . 1.2-3
ver_rs 3 . 1.2.3a
ver_rs 2-3 - 1.2_alpha4
#ver_rs 3 - 2 "" 1.2.3b_alpha4
#ver_rs 3-5 _ 4-6 - a1b2c3d4e5
ver_rs 1 - .1.2.3
ver_rs 0 - .1.2.3
done >/dev/null
}
replacing_versionator() {
local x
for x in {1..100}; do
replace_version_separator 1 - 1.2.3
replace_version_separator 2 - 1.2.3
replace_version_separator 1-2 - 1.2.3.4
replace_version_separator 2- - 1.2.3.4
replace_version_separator 2 . 1.2-3
replace_version_separator 3 . 1.2.3a
replace_version_separator 2-3 - 1.2_alpha4
#replace_version_separator 3 - 2 "" 1.2.3b_alpha4
#replace_version_separator 3-5 _ 4-6 - a1b2c3d4e5
replace_version_separator 1 - .1.2.3
replace_version_separator 0 - .1.2.3
done >/dev/null
}
comparing() {
local x
for x in {1..1000}; do
ver_test 1b_p1 -le 1_p1
ver_test 1.1b -le 1.1
ver_test 12.2.5 -le 12.2b
ver_test 4.0 -le 5.0
ver_test 5 -le 5.0
ver_test 1.0_pre2 -le 1.0_p2
ver_test 1.0_alpha2 -le 1.0_p2
ver_test 1.0_alpha1 -le 1.0_beta1
ver_test 1.0_beta3 -le 1.0_rc3
ver_test 1.001000000000000001 -le 1.001000000000000002
done
}
comparing_versionator() {
local x
for x in {1..100}; do
version_is_at_least 1b_p1 1_p1
version_is_at_least 1.1b 1.1
version_is_at_least 12.2.5 12.2b
version_is_at_least 4.0 5.0
version_is_at_least 5 5.0
version_is_at_least 1.0_pre2 1.0_p2
version_is_at_least 1.0_alpha2 1.0_p2
version_is_at_least 1.0_alpha1 1.0_beta1
version_is_at_least 1.0_beta3 1.0_rc3
version_is_at_least 1.001000000000000001 1.001000000000000002
done
}
get_times() {
local factor=${1}; shift
echo "${*}"
local real=()
local user=()
for x in {1..5}; do
while read tt tv; do
case ${tt} in
real) real+=( $(dc -e "${tv} ${factor} * p") );;
user) user+=( $(dc -e "${tv} ${factor} * p") );;
esac
done < <( ( time -p "${@}" ) 2>&1 )
done
[[ ${#real[@]} == 5 ]] || die "Did not get 5 real times"
[[ ${#user[@]} == 5 ]] || die "Did not get 5 user times"
local sum
for v in real user; do
vr="${v}[*]"
sum=$(dc -e "${!vr} + + + + 3 k 5 / p")
vr="${v}[@]"
printf '%s %4.2f %4.2f %4.2f %4.2f %4.2f => %4.2f avg\n' \
"${v}" "${!vr}" "${sum}"
done
}
export LC_ALL=C
get_times 1 cutting
get_times 10 cutting_versionator
get_times 1 replacing
get_times 10 replacing_versionator
get_times 1 comparing
get_times 10 comparing_versionator

View File

@ -1,69 +0,0 @@
#!/bin/bash
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
inherit estack
test-it() {
local s0 s1 s2
tbegin "push/pop '$*'"
s0=$(shopt -p)
t eshopts_push $*
s1=$(shopt -p)
t eshopts_pop
s2=$(shopt -p)
[[ ${s0} == "${s2}" ]] && \
[[ ${s1} == *"shopt $*"* ]]
tend $?
}
# should handle bug #395025
for arg in nullglob dotglob extglob ; do
for flag in s u ; do
test-it -${flag} ${arg}
done
done
# test 'set' options
set -f
tbegin "set +f"
s0=$-
t eshopts_push +f
s1=$-
t eshopts_pop
s2=$-
[[ ${s0} == "${s2}" ]] &&
[[ ${s1} != *f* ]]
tend $?
set +f
tbegin "set -f"
s0=$-
t eshopts_push -f
s1=$-
t eshopts_pop
s2=$-
[[ ${s0} == "${s2}" ]] &&
[[ ${s1} == *f* ]]
tend $?
tbegin "multi push/pop"
s0=$(shopt -p)
t eshopts_push -s dotglob
t eshopts_push -u dotglob
t eshopts_push -s extglob
t eshopts_push -u dotglob
t eshopts_push -s dotglob
t eshopts_pop
t eshopts_pop
t eshopts_pop
t eshopts_pop
t eshopts_pop
s1=$(shopt -p)
[[ ${s0} == "${s1}" ]]
tend $?
texit

View File

@ -1,52 +0,0 @@
#!/bin/bash
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
inherit estack
tbegin "initial stack state"
estack_pop teststack
# Should be empty and thus return 1
[[ $? -eq 1 ]]
tend $?
tbegin "simple push/pop"
estack_push ttt 1
pu=$?
estack_pop ttt
po=$?
[[ ${pu}${po} == "00" ]]
tend $?
tbegin "simple push/pop var"
estack_push xxx "boo ga boo"
pu=$?
estack_pop xxx i
po=$?
[[ ${pu}${po} == "00" ]] && [[ ${i} == "boo ga boo" ]]
tend $?
tbegin "multi push/pop"
estack_push yyy {1..10}
pu=$?
i=0
while estack_pop yyy ; do
: $(( i++ ))
done
[[ ${pu} -eq 0 && ${i} -eq 10 ]]
tend $?
tbegin "umask push/pop"
u0=$(umask)
eumask_push 0000
pu=$?
u1=$(umask)
eumask_pop
po=$?
u2=$(umask)
[[ ${pu}${po}:${u0}:${u1}:${u2} == "00:${u0}:0000:${u0}" ]]
tend $?
texit

View File

@ -1,99 +0,0 @@
#!/bin/bash
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
inherit estack
tbegin "simple push/pop"
VAR=1
evar_push VAR
pu=$?
VAR=2
evar_pop
po=$?
[[ ${pu}${po}${VAR} == "001" ]]
tend $?
tbegin "unset push/pop"
unset VAR
evar_push VAR
pu=$?
VAR=2
evar_pop
po=$?
[[ ${pu}${po}${VAR+set} == "00" ]]
tend $?
tbegin "empty push/pop"
VAR=
evar_push VAR
pu=$?
VAR=2
evar_pop
po=$?
[[ ${pu}${po}${VAR+set}${VAR} == "00set" ]]
tend $?
tbegin "export push/pop"
export VAR=exported
evar_push VAR
pu=$?
VAR=2
evar_pop
po=$?
var=$(bash -c 'echo ${VAR}')
[[ ${pu}${po}${var} == "00exported" ]]
tend $?
tbegin "unexport push/pop"
unset VAR
VAR=not-exported
evar_push VAR
pu=$?
VAR=2
evar_pop
po=$?
var=$(bash -c 'echo ${VAR+set}')
[[ ${pu}${po}${VAR}${var} == "00not-exported" ]]
tend $?
tbegin "multi push/pop"
A=a B=b C=c
evar_push A B C
pu=$?
A=A B=B C=C
evar_pop 1
po1=$?
[[ ${A}${B}${C} == "ABc" ]]
po2=$?
evar_pop 2
po3=$?
var=$(bash -c 'echo ${VAR+set}')
[[ ${pu}${po1}${po2}${po3}${A}${B}${C} == "0000abc" ]]
tend $?
tbegin "simple push_set/pop"
VAR=1
evar_push_set VAR 2
pu=$?
[[ ${VAR} == "2" ]]
po1=$?
evar_pop
po2=$?
[[ ${pu}${po1}${po2}${VAR} == "0001" ]]
tend $?
tbegin "unset push_set/pop"
VAR=1
evar_push_set VAR
pu=$?
[[ ${VAR+set} != "set" ]]
po1=$?
evar_pop
po2=$?
[[ ${pu}${po1}${po2}${VAR} == "0001" ]]
tend $?
texit

View File

@ -1,153 +0,0 @@
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
inherit flag-o-matic
CFLAGS="-a -b -c=1 --param l1-cache-size=32"
CXXFLAGS="-x -y -z=2"
LDFLAGS="-l -m -n=3"
ftend() {
local ret=$?
local msg="Failed; flags are:"
local flag
for flag in $(all-flag-vars) ; do
msg+=$'\n\t'"${flag}=${!flag}"
done
tend ${ret} "${msg}"
}
tbegin "is-flag"
! (is-flag 1 2 3) 2>/dev/null
ftend
tbegin "is-ldflag"
! (is-ldflag 1 2 3) 2>/dev/null
ftend
while read exp flag ; do
[[ -z ${exp}${flag} ]] && continue
tbegin "is-flagq ${flag}"
is-flagq ${flag}
[[ ${exp} -eq $? ]]
ftend
done <<<"
1 -L
0 -a
0 -x
"
while read exp flag ; do
[[ -z ${exp}${flag} ]] && continue
tbegin "is-ldflagq ${flag}"
is-ldflagq "${flag}"
[[ ${exp} -eq $? ]]
ftend
done <<<"
1 -a
0 -n=*
1 -n
"
tbegin "strip-unsupported-flags"
strip-unsupported-flags
[[ ${CFLAGS} == "--param l1-cache-size=32" ]] && [[ ${CXXFLAGS} == "-z=2" ]] && [[ ${LDFLAGS} == "" ]]
ftend
for var in $(all-flag-vars) ; do
eval ${var}=\"-filter -filter-glob -foo-${var%FLAGS}\"
done
tbegin "filter-flags basic"
filter-flags -filter
(
for var in $(all-flag-vars) ; do
val=${!var}
[[ ${val} == "-filter-glob -foo-${var%FLAGS}" ]] || exit 1
done
)
ftend
tbegin "filter-flags glob"
filter-flags '-filter-*'
(
for var in $(all-flag-vars) ; do
val=${!var}
[[ ${val} == "-foo-${var%FLAGS}" ]] || exit 1
done
)
ftend
tbegin "strip-flags basic"
CXXFLAGS+=" -O999 "
strip-flags
[[ -z ${CFLAGS}${LDFLAGS}${CPPFLAGS} && ${CXXFLAGS} == "-O2" ]]
ftend
tbegin "replace-flags basic"
CFLAGS="-O0 -foo"
replace-flags -O0 -O1
[[ ${CFLAGS} == "-O1 -foo" ]]
ftend
tbegin "replace-flags glob"
CXXFLAGS="-O0 -mcpu=bad -cow"
replace-flags '-mcpu=*' -mcpu=good
[[ ${CXXFLAGS} == "-O0 -mcpu=good -cow" ]]
ftend
tbegin "append-cflags basic"
CFLAGS=
append-cflags -O0
[[ ${CFLAGS} == " -O0" ]]
ftend
tbegin "append-cflags -DFOO='a b c'"
CFLAGS=
append-cflags '-DFOO="a b c"'
[[ ${CFLAGS} == ' -DFOO="a b c"' ]]
ftend
tbegin "raw-ldflags"
LDFLAGS='-Wl,-O1 -Wl,--as-needed -Wl,-z,now -flto'
LDFLAGS=$(raw-ldflags)
[[ ${LDFLAGS} == '-O1 --as-needed -z now' ]]
ftend
tbegin "test-flags-CC (valid flags)"
out=$(test-flags-CC -O3)
[[ $? -eq 0 && ${out} == "-O3" ]]
ftend
tbegin "test-flags-CC (invalid flags)"
out=$(test-flags-CC -finvalid-flag)
[[ $? -ne 0 && -z ${out} ]]
ftend
if type -P clang >/dev/null ; then
tbegin "test-flags-CC (valid flags w/clang)"
out=$(CC=clang test-flags-CC -O3)
[[ $? -eq 0 && ${out} == "-O3" ]]
ftend
tbegin "test-flags-CC (invalid flags w/clang)"
out=$(CC=clang test-flags-CC -finvalid-flag)
[[ $? -ne 0 && -z ${out} ]]
ftend
tbegin "test-flags-CC (gcc-valid but clang-invalid flags)"
out=$(CC=clang test-flags-CC -finline-limit=1200)
[[ $? -ne 0 && -z ${out} ]]
ftend
tbegin "test-flags-CC (unused flags w/clang)"
out=$(CC=clang test-flags-CC -Wl,-O1)
[[ $? -eq 0 && ${out} == "-Wl,-O1" ]]
ftend
fi
texit

View File

@ -1,203 +0,0 @@
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
inherit git-r3
testdir=${pkg_root}/git
mkdir "${testdir}" || die "unable to mkdir testdir"
cd "${testdir}" || die "unable to cd to testdir"
EGIT3_STORE_DIR=store
mkdir "${EGIT3_STORE_DIR}" || die "unable to mkdir store"
test_file() {
local fn=${1}
local expect=${2}
if [[ ! -f ${fn} ]]; then
eerror "${fn} does not exist (not checked out?)"
else
local got=$(<"${fn}")
if [[ ${got} != ${expect} ]]; then
eerror "${fn}, expected: ${expect}, got: ${got}"
else
return 0
fi
fi
return 1
}
test_no_file() {
local fn=${1}
if [[ -f ${fn} ]]; then
eerror "${fn} exists (wtf?!)"
else
return 0
fi
return 1
}
test_repo_clean() {
local P=${P}_${FUNCNAME#test_}
(
mkdir repo
cd repo
git init -q
echo test > file
git add file
git commit -m 1 -q
echo other-text > file2
git add file2
git commit -m 2 -q
) || die "unable to prepare repo"
# we need to use an array to preserve whitespace
local EGIT_REPO_URI=(
"ext::git daemon --export-all --base-path=. --inetd %G/repo"
)
tbegin "fetching from a simple repo"
(
git-r3_src_unpack
test_file "${WORKDIR}/${P}/file" test && \
test_file "${WORKDIR}/${P}/file2" other-text
) &>fetch.log
eend ${?} || cat fetch.log
}
test_repo_revert() {
local P=${P}_${FUNCNAME#test_}
(
cd repo
git revert -n HEAD^
git commit -m r1 -q
) || die "unable to prepare repo"
# we need to use an array to preserve whitespace
local EGIT_REPO_URI=(
"ext::git daemon --export-all --base-path=. --inetd %G/repo"
)
tbegin "fetching revert"
(
git-r3_src_unpack
test_no_file "${WORKDIR}/${P}/file" && \
test_file "${WORKDIR}/${P}/file2" other-text
) &>fetch.log
eend ${?} || cat fetch.log
}
test_repo_branch() {
local P=${P}_${FUNCNAME#test_}
(
cd repo
git branch -q other-branch HEAD^
git checkout -q other-branch
echo one-more > file3
git add file3
git commit -m 3 -q
git checkout -q master
) || die "unable to prepare repo"
# we need to use an array to preserve whitespace
local EGIT_REPO_URI=(
"ext::git daemon --export-all --base-path=. --inetd %G/repo"
)
local EGIT_BRANCH=other-branch
tbegin "switching branches"
(
git-r3_src_unpack
test_file "${WORKDIR}/${P}/file" test && \
test_file "${WORKDIR}/${P}/file2" other-text && \
test_file "${WORKDIR}/${P}/file3" one-more
) &>fetch.log
eend ${?} || cat fetch.log
}
test_repo_merge() {
local P=${P}_${FUNCNAME#test_}
(
cd repo
git branch -q one-more-branch HEAD^
git checkout -q one-more-branch
echo foobarbaz > file3
git add file3
git commit -m 3b -q
git checkout -q master
git merge -m 4 -q one-more-branch
) || die "unable to prepare repo"
# we need to use an array to preserve whitespace
local EGIT_REPO_URI=(
"ext::git daemon --export-all --base-path=. --inetd %G/repo"
)
tbegin "fetching a merge commit"
(
git-r3_src_unpack
test_no_file "${WORKDIR}/${P}/file" && \
test_file "${WORKDIR}/${P}/file2" other-text && \
test_file "${WORKDIR}/${P}/file3" foobarbaz
) &>fetch.log
eend ${?} || cat fetch.log
}
test_repo_revert_merge() {
local P=${P}_${FUNCNAME#test_}
(
cd repo
git branch -q to-be-reverted
git checkout -q to-be-reverted
echo trrm > file3
git add file3
git commit -m 5b -q
git checkout -q master
echo trrm > file2
git add file2
git commit -m 5 -q
git merge -m 6 -q to-be-reverted
echo trrm > file
git add file
git commit -m 7 -q
git revert -m 1 -n HEAD^
git commit -m 7r -q
) || die "unable to prepare repo"
# we need to use an array to preserve whitespace
local EGIT_REPO_URI=(
"ext::git daemon --export-all --base-path=. --inetd %G/repo"
)
tbegin "fetching a revert of a merge commit"
(
git-r3_src_unpack
test_file "${WORKDIR}/${P}/file" trrm && \
test_file "${WORKDIR}/${P}/file2" trrm && \
test_file "${WORKDIR}/${P}/file3" foobarbaz
) &>fetch.log
eend ${?} || cat fetch.log
}
test_repo_clean
test_repo_revert
test_repo_branch
test_repo_merge
test_repo_revert_merge
texit

View File

@ -1,60 +0,0 @@
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
inherit git-r3
testdir=${pkg_root}/git
mkdir "${testdir}" || die "unable to mkdir testdir"
cd "${testdir}" || die "unable to cd to testdir"
EGIT3_STORE_DIR=store
mkdir "${EGIT3_STORE_DIR}" || die "unable to mkdir store"
# Test cleaning up canonical repo URI
test_repouri() {
local uri=${1}
local expect=${2}
local -x GIT_DIR
tbegin "GIT_DIR for ${uri}"
_git-r3_set_gitdir "${uri}" &>/dev/null
local got=${GIT_DIR#${EGIT3_STORE_DIR}/}
[[ ${expect} == ${got} ]]
tend ${?} || eerror "Expected: ${expect}, got: ${got}"
}
test_repouri git://git.overlays.gentoo.org/proj/portage.git proj_portage.git
test_repouri https://git.overlays.gentoo.org/gitroot/proj/portage.git proj_portage.git
test_repouri git+ssh://git@git.overlays.gentoo.org/proj/portage.git proj_portage.git
test_repouri git://anongit.freedesktop.org/mesa/mesa mesa_mesa.git
test_repouri ssh://git.freedesktop.org/git/mesa/mesa mesa_mesa.git
test_repouri http://anongit.freedesktop.org/git/mesa/mesa.git mesa_mesa.git
test_repouri http://cgit.freedesktop.org/mesa/mesa/ mesa_mesa.git
test_repouri https://code.google.com/p/snakeoil/ snakeoil.git
test_repouri git://git.code.sf.net/p/xournal/code xournal_code.git
test_repouri http://git.code.sf.net/p/xournal/code xournal_code.git
test_repouri git://git.gnome.org/glibmm glibmm.git
test_repouri https://git.gnome.org/browse/glibmm glibmm.git
test_repouri ssh://USERNAME@git.gnome.org/git/glibmm glibmm.git
test_repouri git://git.kernel.org/pub/scm/git/git.git git_git.git
test_repouri http://git.kernel.org/pub/scm/git/git.git git_git.git
test_repouri https://git.kernel.org/pub/scm/git/git.git git_git.git
test_repouri https://git.kernel.org/cgit/git/git.git/ git_git.git
#test_repouri git@github.com:gentoo/identity.gentoo.org.git gentoo_identity.gentoo.org.git
test_repouri https://github.com/gentoo/identity.gentoo.org.git gentoo_identity.gentoo.org.git
#test_repouri git@bitbucket.org:mgorny/python-exec.git mgorny_python-exec.git
test_repouri https://mgorny@bitbucket.org/mgorny/python-exec.git mgorny_python-exec.git
texit

View File

@ -1,37 +0,0 @@
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
inherit git-r3
# Test getting submodule URIs
test_subrepos() {
local suburi=${1}
local expect=( "${@:2}" )
tbegin "subrepos for ${suburi} -> ${expect[0]}${expect[1]+...}"
local subrepos
_git-r3_set_subrepos "${suburi}" "${repos[@]}"
[[ ${expect[@]} == ${subrepos[@]} ]]
tend ${?} || eerror "Expected: ${expect[@]}, got: ${subrepos[@]}"
}
# parent repos
repos=( http://foohub/fooman/foo.git git://foohub/fooman/foo.git )
# absolute URI
test_subrepos http://foo/bar http://foo/bar
test_subrepos /foo/bar /foo/bar
# plain relative URI
test_subrepos ./baz http://foohub/fooman/foo.git/baz git://foohub/fooman/foo.git/baz
# backward relative URIs
test_subrepos ../baz.git http://foohub/fooman/baz.git git://foohub/fooman/baz.git
test_subrepos ../../bazman/baz.git http://foohub/bazman/baz.git git://foohub/bazman/baz.git
texit

View File

@ -1,38 +0,0 @@
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
inherit linux-info
test_get_running_version() {
local test_kv=$1 major=$2 minor=$3 patch=$4 extra=$5
tbegin "get_running_version ${test_kv}"
uname() { echo "${test_kv}" ; }
ROOT=/:/:/:/: get_running_version
local r=$?
[[ ${r} -eq 0 &&
${major} == "${KV_MAJOR}" &&
${minor} == "${KV_MINOR}" &&
${patch} == "${KV_PATCH}" &&
${extra} == "${KV_EXTRA}" ]]
tend $? "FAIL: {ret: ${r}==0} {major: ${major}==${KV_MAJOR}} {minor: ${minor}==${KV_MINOR}} {patch: ${patch}==${KV_PATCH}} {extra: ${extra}==${KV_EXTRA}}"
}
tests=(
# KV_FULL MAJOR MINOR PATCH EXTRA
1.2.3 1 2 3 ''
1.2.3.4 1 2 3 .4
1.2.3-ver+1.4 1 2 3 -ver+1.4
1.2-kern.3 1 2 0 -kern.3
1.2+kern.5 1 2 0 +kern.5
1.2.3_blah 1 2 3 _blah
3.2.1-zen-vs2.3.2.5+ 3 2 1 -zen-vs2.3.2.5+
)
for (( i = 0; i < ${#tests[@]}; i += 5 )) ; do
test_get_running_version "${tests[@]:i:5}"
done
texit

View File

@ -1,50 +0,0 @@
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
inherit multiprocessing
test-makeopts_jobs() {
local exp=$1; shift
tbegin "makeopts_jobs($1${2+; inf=${2}}) == ${exp}"
local indirect=$(MAKEOPTS="$*" makeopts_jobs)
local direct=$(makeopts_jobs "$@")
if [[ "${direct}" != "${indirect}" ]] ; then
tend 1 "Mismatch between MAKEOPTS/cli: '${indirect}' != '${direct}'"
else
[[ ${direct} == "${exp}" ]]
tend $? "Got back: ${act}"
fi
}
tests=(
999 "-j"
999 "--jobs"
999 "-j -l9"
1 ""
1 "-l9 -w"
1 "-l9 -w-j4"
1 "-l9--jobs=3"
1 "-l9--jobs=8"
2 "-j2"
3 "-j 3"
4 "-l3 -j 4 -w"
5 "--jobs=5"
6 "--jobs 6"
7 "-l3 --jobs 7 -w"
4 "-j1 -j 2 --jobs 3 --jobs=4"
8 " -j 8 "
999 "-kj"
4 "-kj4"
5 "-kj 5"
)
for (( i = 0; i < ${#tests[@]}; i += 2 )) ; do
test-makeopts_jobs "${tests[i]}" "${tests[i+1]}"
done
# test custom inf value
test-makeopts_jobs 645 "-j" 645
texit

View File

@ -1,48 +0,0 @@
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
inherit multiprocessing
test-makeopts_loadavg() {
local exp=$1; shift
tbegin "makeopts_loadavg($1${2+; inf=${2}}) == ${exp}"
local indirect=$(MAKEOPTS="$*" makeopts_loadavg)
local direct=$(makeopts_loadavg "$@")
if [[ "${direct}" != "${indirect}" ]] ; then
tend 1 "Mismatch between MAKEOPTS/cli: '${indirect}' != '${direct}'"
else
[[ ${direct} == "${exp}" ]]
tend $? "Got back: ${direct}"
fi
}
tests=(
999 "-j"
999 "-l"
999 ""
9 "-l9 -w"
9 "-l 9 -w-j4"
3 "-l3 -j 4 -w"
5 "--load-average=5"
6 "--load-average 6"
7 "-l3 --load-average 7 -w"
4 "-j1 -j 2 --load-average 3 --load-average=4"
3 " --max-load=3 -x"
8 " -l 8 "
999 "-kl"
4 "-kl4"
5 "-kl 5"
2.3 "-l 2.3"
999 "-l 2.3.4"
)
for (( i = 0; i < ${#tests[@]}; i += 2 )) ; do
test-makeopts_loadavg "${tests[i]}" "${tests[i+1]}"
done
# test custom inf value
test-makeopts_loadavg 645 "-l" 645
texit

View File

@ -1,183 +0,0 @@
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
source tests-common.sh
test_var() {
local var=${1}
local impl=${2}
local expect=${3}
tbegin "${var} for ${impl}"
local ${var}
python_export ${impl} PYTHON ${var}
[[ ${!var} == ${expect} ]] || eerror "(${impl}: ${var}: ${!var} != ${expect}"
tend ${?}
}
test_is() {
local func=${1}
local expect=${2}
tbegin "${func} (expecting: ${expect})"
${func}
[[ ${?} == ${expect} ]]
tend ${?}
}
test_fix_shebang() {
local from=${1}
local to=${2}
local expect=${3}
local args=( "${@:4}" )
tbegin "python_fix_shebang${args[@]+ ${args[*]}} from ${from} to ${to} (exp: ${expect})"
echo "${from}" > "${tmpfile}"
output=$( EPYTHON=${to} python_fix_shebang "${args[@]}" -q "${tmpfile}" 2>&1 )
if [[ ${?} != 0 ]]; then
if [[ ${expect} != FAIL ]]; then
echo "${output}"
tend 1
else
tend 0
fi
else
[[ $(<"${tmpfile}") == ${expect} ]] \
|| eerror "${from} -> ${to}: $(<"${tmpfile}") != ${expect}"
tend ${?}
fi
}
tmpfile=$(mktemp)
inherit python-utils-r1
test_var EPYTHON python2_7 python2.7
test_var PYTHON python2_7 /usr/bin/python2.7
if [[ -x /usr/bin/python2.7 ]]; then
test_var PYTHON_SITEDIR python2_7 "/usr/lib*/python2.7/site-packages"
test_var PYTHON_INCLUDEDIR python2_7 /usr/include/python2.7
test_var PYTHON_LIBPATH python2_7 "/usr/lib*/libpython2.7$(get_libname)"
test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config
fi
test_var PYTHON_PKG_DEP python2_7 '*dev-lang/python*:2.7'
test_var PYTHON_SCRIPTDIR python2_7 /usr/lib/python-exec/python2.7
test_var EPYTHON python3_4 python3.4
test_var PYTHON python3_4 /usr/bin/python3.4
if [[ -x /usr/bin/python3.4 ]]; then
abiflags=$(/usr/bin/python3.4 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
test_var PYTHON_SITEDIR python3_4 "/usr/lib*/python3.4/site-packages"
test_var PYTHON_INCLUDEDIR python3_4 "/usr/include/python3.4${abiflags}"
test_var PYTHON_LIBPATH python3_4 "/usr/lib*/libpython3.4${abiflags}$(get_libname)"
test_var PYTHON_CONFIG python3_4 "/usr/bin/python3.4${abiflags}-config"
fi
test_var PYTHON_PKG_DEP python3_4 '*dev-lang/python*:3.4'
test_var PYTHON_SCRIPTDIR python3_4 /usr/lib/python-exec/python3.4
test_var EPYTHON jython2_7 jython2.7
test_var PYTHON jython2_7 /usr/bin/jython2.7
if [[ -x /usr/bin/jython2.7 ]]; then
test_var PYTHON_SITEDIR jython2_7 /usr/share/jython-2.7/Lib/site-packages
fi
test_var PYTHON_PKG_DEP jython2_7 '*dev-java/jython*:2.7'
test_var PYTHON_SCRIPTDIR jython2_7 /usr/lib/python-exec/jython2.7
test_var EPYTHON pypy pypy
test_var PYTHON pypy /usr/bin/pypy
if [[ -x /usr/bin/pypy ]]; then
test_var PYTHON_SITEDIR pypy "/usr/lib*/pypy/site-packages"
test_var PYTHON_INCLUDEDIR pypy "/usr/lib*/pypy/include"
fi
test_var PYTHON_PKG_DEP pypy '*virtual/pypy*:0='
test_var PYTHON_SCRIPTDIR pypy /usr/lib/python-exec/pypy
test_var EPYTHON pypy3 pypy3
test_var PYTHON pypy3 /usr/bin/pypy3
if [[ -x /usr/bin/pypy3 ]]; then
test_var PYTHON_SITEDIR pypy3 "/usr/lib*/pypy3/site-packages"
test_var PYTHON_INCLUDEDIR pypy3 "/usr/lib*/pypy3/include"
fi
test_var PYTHON_PKG_DEP pypy3 '*virtual/pypy3*:0='
test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3
test_is "python_is_python3 python2.7" 1
test_is "python_is_python3 python3.2" 0
test_is "python_is_python3 jython2.7" 1
test_is "python_is_python3 pypy" 1
test_is "python_is_python3 pypy3" 0
# generic shebangs
test_fix_shebang '#!/usr/bin/python' python2.7 '#!/usr/bin/python2.7'
test_fix_shebang '#!/usr/bin/python' python3.4 '#!/usr/bin/python3.4'
test_fix_shebang '#!/usr/bin/python' pypy '#!/usr/bin/pypy'
test_fix_shebang '#!/usr/bin/python' pypy3 '#!/usr/bin/pypy3'
test_fix_shebang '#!/usr/bin/python' jython2.7 '#!/usr/bin/jython2.7'
# python2/python3 matching
test_fix_shebang '#!/usr/bin/python2' python2.7 '#!/usr/bin/python2.7'
test_fix_shebang '#!/usr/bin/python3' python2.7 FAIL
test_fix_shebang '#!/usr/bin/python3' python2.7 '#!/usr/bin/python2.7' --force
test_fix_shebang '#!/usr/bin/python3' python3.4 '#!/usr/bin/python3.4'
test_fix_shebang '#!/usr/bin/python2' python3.4 FAIL
test_fix_shebang '#!/usr/bin/python2' python3.4 '#!/usr/bin/python3.4' --force
# pythonX.Y matching (those mostly test the patterns)
test_fix_shebang '#!/usr/bin/python2.7' python2.7 '#!/usr/bin/python2.7'
test_fix_shebang '#!/usr/bin/python2.7' python3.2 FAIL
test_fix_shebang '#!/usr/bin/python2.7' python3.2 '#!/usr/bin/python3.2' --force
test_fix_shebang '#!/usr/bin/python3.2' python3.2 '#!/usr/bin/python3.2'
test_fix_shebang '#!/usr/bin/python3.2' python2.7 FAIL
test_fix_shebang '#!/usr/bin/python3.2' python2.7 '#!/usr/bin/python2.7' --force
test_fix_shebang '#!/usr/bin/pypy' pypy '#!/usr/bin/pypy'
test_fix_shebang '#!/usr/bin/pypy' python2.7 FAIL
test_fix_shebang '#!/usr/bin/pypy' python2.7 '#!/usr/bin/python2.7' --force
test_fix_shebang '#!/usr/bin/jython2.7' jython2.7 '#!/usr/bin/jython2.7'
test_fix_shebang '#!/usr/bin/jython2.7' jython3.2 FAIL
test_fix_shebang '#!/usr/bin/jython2.7' jython3.2 '#!/usr/bin/jython3.2' --force
# fancy path handling
test_fix_shebang '#!/mnt/python2/usr/bin/python' python3.4 \
'#!/mnt/python2/usr/bin/python3.4'
test_fix_shebang '#!/mnt/python2/usr/bin/python2' python2.7 \
'#!/mnt/python2/usr/bin/python2.7'
test_fix_shebang '#!/mnt/python2/usr/bin/env python' python2.7 \
'#!/mnt/python2/usr/bin/env python2.7'
test_fix_shebang '#!/mnt/python2/usr/bin/python2 python2' python2.7 \
'#!/mnt/python2/usr/bin/python2.7 python2'
test_fix_shebang '#!/mnt/python2/usr/bin/python3 python2' python2.7 FAIL
test_fix_shebang '#!/mnt/python2/usr/bin/python3 python2' python2.7 \
'#!/mnt/python2/usr/bin/python2.7 python2' --force
test_fix_shebang '#!/usr/bin/foo' python2.7 FAIL
# regression test for bug #522080
test_fix_shebang '#!/usr/bin/python ' python2.7 '#!/usr/bin/python2.7 '
# make sure we don't break pattern matching
test_is "_python_impl_supported python2_5" 1
test_is "_python_impl_supported python2_6" 1
test_is "_python_impl_supported python2_7" 0
test_is "_python_impl_supported python3_1" 1
test_is "_python_impl_supported python3_2" 1
test_is "_python_impl_supported python3_3" 1
test_is "_python_impl_supported python3_4" 0
test_is "_python_impl_supported python3_5" 0
test_is "_python_impl_supported python3_6" 0
test_is "_python_impl_supported pypy1_8" 1
test_is "_python_impl_supported pypy1_9" 1
test_is "_python_impl_supported pypy2_0" 1
test_is "_python_impl_supported pypy" 0
test_is "_python_impl_supported pypy3" 0
test_is "_python_impl_supported jython2_7" 0
rm "${tmpfile}"
texit

View File

@ -1,78 +0,0 @@
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
inherit savedconfig
quiet() {
local out ret
out=$("$@" 2>&1)
ret=$?
[[ ${ret} -eq 0 ]] || echo "${out}"
return ${ret}
}
sc() { EBUILD_PHASE=install quiet save_config "$@" ; }
rc() { EBUILD_PHASE=prepare quiet restore_config "$@" ; }
cleanup() { rm -rf "${ED}"/* "${T}"/* "${WORKDIR}"/* ; }
test-it() {
local ret=0
tbegin "$@"
mkdir -p "${ED}"/etc/portage/savedconfig
: $(( ret |= $? ))
pushd "${WORKDIR}" >/dev/null
: $(( ret |= $? ))
test
: $(( ret |= $? ))
popd >/dev/null
: $(( ret |= $? ))
tend ${ret}
cleanup
}
test() {
touch f || return 1
sc f || return 1
[[ -f ${ED}/etc/portage/savedconfig/${CATEGORY}/${PF} ]]
}
test-it "simple save_config"
test() {
touch a b c || return 1
sc a b c || return 1
[[ -d ${ED}/etc/portage/savedconfig/${CATEGORY}/${PF} ]]
}
test-it "multi save_config"
test() {
mkdir dir || return 1
touch dir/{a,b,c} || return 1
sc dir || return 1
[[ -d ${ED}/etc/portage/savedconfig/${CATEGORY}/${PF} ]]
}
test-it "dir save_config"
PORTAGE_CONFIGROOT=${D}
test() {
echo "ggg" > f || return 1
rc f || return 1
[[ $(<f) == "ggg" ]]
}
test-it "simple restore_config"
test() {
echo "ggg" > f || return 1
rc f || return 1
[[ $(<f) == "ggg" ]] || return 1
sc f || return 1
echo "hhh" > f || return 1
rc f || return 1
[[ $(<f) == "ggg" ]]
}
test-it "simple restore+save config"
texit

View File

@ -1,105 +0,0 @@
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
if ! source /lib/gentoo/functions.sh ; then
echo "Missing functions.sh. Please install sys-apps/gentoo-functions!" 1>&2
exit 1
fi
# Let overlays override this so they can add their own testsuites.
TESTS_ECLASS_SEARCH_PATHS=( .. )
inherit() {
local e path
for e in "$@" ; do
for path in "${TESTS_ECLASS_SEARCH_PATHS[@]}" ; do
local eclass=${path}/${e}.eclass
if [[ -e "${eclass}" ]] ; then
source "${eclass}"
continue 2
fi
done
die "could not find ${e}.eclass"
done
}
EXPORT_FUNCTIONS() { :; }
debug-print() {
[[ ${#} -eq 0 ]] && return
if [[ ${ECLASS_DEBUG_OUTPUT} == on ]]; then
printf 'debug: %s\n' "${@}" >&2
elif [[ -n ${ECLASS_DEBUG_OUTPUT} ]]; then
printf 'debug: %s\n' "${@}" >> "${ECLASS_DEBUG_OUTPUT}"
fi
}
debug-print-function() {
debug-print "${1}, parameters: ${*:2}"
}
debug-print-section() {
debug-print "now in section ${*}"
}
has() {
local needle=$1
shift
local x
for x in "$@"; do
[ "${x}" = "${needle}" ] && return 0
done
return 1
}
use() { has "$1" ${IUSE} ; }
die() {
echo "die: $*" 1>&2
exit 1
}
has_version() {
portageq has_version / "$@"
}
tret=0
tbegin() {
ebegin "Testing $*"
}
texit() {
rm -rf "${tmpdir}"
exit ${tret}
}
tend() {
t eend "$@"
}
t() {
"$@"
local ret=$?
: $(( tret |= ${ret} ))
return ${ret}
}
tmpdir="${PWD}/tmp"
pkg_root="${tmpdir}/$0/${RANDOM}"
T="${pkg_root}/temp"
D="${pkg_root}/image"
WORKDIR="${pkg_root}/work"
ED=${D}
mkdir -p "${D}" "${T}" "${WORKDIR}"
dodir() {
mkdir -p "${@/#/${ED}/}"
}
elog() { einfo "$@" ; }
IUSE=""
CATEGORY="dev-eclass"
PN="tests"
PV="0"
P="${PN}-${PV}"
PF=${P}
SLOT=0

View File

@ -1,175 +0,0 @@
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
inherit toolchain-funcs
#
# TEST: tc-arch-kernel
#
test-tc-arch-kernel() {
local ret=0
KV=$1 ; shift
for CHOST in "$@" ; do
exp=${CHOST##*:}
CHOST=${CHOST%%:*}
actual=$(tc-arch-kernel)
if [[ ${actual} != ${exp:-${CHOST}} ]] ; then
eerror "Failure for CHOST: ${CHOST} Expected: ${exp} != Actual: ${actual}"
((++ret))
fi
done
return ${ret}
}
tbegin "tc-arch-kernel() (KV=2.6.30)"
test-tc-arch-kernel 2.6.30 \
i{3..6}86:x86 x86_64:x86 \
powerpc{,64}:powerpc i{3..6}86-gentoo-freebsd:i386
tend $?
#
# TEST: tc-arch
#
tbegin "tc-arch"
ret=0
for CHOST in \
alpha arm{,eb}:arm avr32:avr bfin cris hppa i{3..6}86:x86 ia64 m68k \
mips{,eb}:mips nios2 powerpc:ppc powerpc64:ppc64 s390{,x}:s390 \
sh{1..4}{,eb}:sh sparc{,64}:sparc vax x86_64:amd64
do
exp=${CHOST##*:}
CHOST=${CHOST%%:*}
actual=$(tc-arch)
if [[ ${actual} != ${exp:-${CHOST}} ]] ; then
eerror "Failure for CHOST: ${CHOST} Expected: ${exp} != Actual: ${actual}"
: $((++ret))
fi
done
tend ${ret}
#
# TEST: tc-ld-is-gold
#
tbegin "tc-ld-is-gold (bfd selected)"
LD=ld.bfd tc-ld-is-gold && ret=1 || ret=0
tend ${ret}
tbegin "tc-ld-is-gold (gold selected)"
LD=ld.gold tc-ld-is-gold
ret=$?
tend ${ret}
tbegin "tc-ld-is-gold (bfd selected via flags)"
LD=ld.gold LDFLAGS=-fuse-ld=bfd tc-ld-is-gold
ret=$?
tend ${ret}
tbegin "tc-ld-is-gold (gold selected via flags)"
LD=ld.bfd LDFLAGS=-fuse-ld=gold tc-ld-is-gold
ret=$?
tend ${ret}
#
# TEST: tc-ld-disable-gold
#
tbegin "tc-ld-disable-gold (bfd selected)"
(
export LD=ld.bfd LDFLAGS=
ewarn() { :; }
tc-ld-disable-gold
[[ ${LD} == "ld.bfd" && -z ${LDFLAGS} ]]
)
tend $?
tbegin "tc-ld-disable-gold (gold selected)"
(
export LD=ld.gold LDFLAGS=
ewarn() { :; }
tc-ld-disable-gold
[[ ${LD} == "ld.bfd" || ${LDFLAGS} == *"-fuse-ld=bfd"* ]]
)
tend $?
tbegin "tc-ld-disable-gold (gold selected via flags)"
(
export LD= LDFLAGS="-fuse-ld=gold"
ewarn() { :; }
tc-ld-disable-gold
[[ ${LD} == *"/ld.bfd" || ${LDFLAGS} == "-fuse-ld=gold -fuse-ld=bfd" ]]
)
tend $?
unset CPP
tbegin "tc-get-compiler-type (gcc)"
(
export CC=gcc
[[ $(tc-get-compiler-type) == gcc ]]
)
tend $?
tbegin "tc-is-gcc (gcc)"
(
export CC=gcc
tc-is-gcc
)
tend $?
tbegin "! tc-is-clang (gcc)"
(
export CC=gcc
! tc-is-clang
)
tend $?
if type -P clang &>/dev/null; then
tbegin "tc-get-compiler-type (clang)"
(
export CC=clang
[[ $(tc-get-compiler-type) == clang ]]
)
tend $?
tbegin "! tc-is-gcc (clang)"
(
export CC=clang
! tc-is-gcc
)
tend $?
tbegin "tc-is-clang (clang)"
(
export CC=clang
tc-is-clang
)
tend $?
fi
if type -P pathcc &>/dev/null; then
tbegin "tc-get-compiler-type (pathcc)"
(
export CC=pathcc
[[ $(tc-get-compiler-type) == pathcc ]]
)
tend $?
tbegin "! tc-is-gcc (pathcc)"
(
export CC=pathcc
! tc-is-gcc
)
tend $?
tbegin "! tc-is-clang (pathcc)"
(
export CC=pathcc
! tc-is-clang
)
tend $?
fi
texit

View File

@ -1,175 +0,0 @@
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
# apply exlass globals to test version parsing
TOOLCHAIN_GCC_PV=7.3.0
PR=r0
source tests-common.sh
inherit toolchain
test_downgrade_arch_flags() {
local exp msg ret=0 ver
ver=${1}
exp=${2}
shift 2
CFLAGS=${@}
tbegin "downgrade_arch_flags: ${ver} ${CFLAGS} => ${exp}"
CHOST=x86_64 # needed for tc-arch
downgrade_arch_flags ${ver}
if [[ ${CFLAGS} != ${exp} ]]; then
msg="Failure - Expected: \"${exp}\" Got: \"${CFLAGS}\""
ret=1
fi
tend ${ret} ${msg}
}
# ver expected given
test_downgrade_arch_flags 4.9 "-march=haswell" "-march=haswell"
test_downgrade_arch_flags 4.8 "-march=core-avx2" "-march=haswell"
test_downgrade_arch_flags 4.7 "-march=core-avx2" "-march=haswell"
test_downgrade_arch_flags 4.6 "-march=core-avx-i" "-march=haswell"
test_downgrade_arch_flags 4.5 "-march=core2" "-march=haswell"
test_downgrade_arch_flags 4.4 "-march=core2" "-march=haswell"
test_downgrade_arch_flags 4.3 "-march=core2" "-march=haswell"
test_downgrade_arch_flags 4.2 "-march=nocona" "-march=haswell"
test_downgrade_arch_flags 4.1 "-march=nocona" "-march=haswell"
test_downgrade_arch_flags 4.0 "-march=nocona" "-march=haswell"
test_downgrade_arch_flags 3.4 "-march=nocona" "-march=haswell"
test_downgrade_arch_flags 3.3 "-march=nocona" "-march=haswell"
test_downgrade_arch_flags 4.9 "-march=bdver4" "-march=bdver4"
test_downgrade_arch_flags 4.8 "-march=bdver3" "-march=bdver4"
test_downgrade_arch_flags 4.7 "-march=bdver2" "-march=bdver4"
test_downgrade_arch_flags 4.6 "-march=bdver1" "-march=bdver4"
test_downgrade_arch_flags 4.5 "-march=amdfam10" "-march=bdver4"
test_downgrade_arch_flags 4.4 "-march=amdfam10" "-march=bdver4"
test_downgrade_arch_flags 4.3 "-march=amdfam10" "-march=bdver4"
test_downgrade_arch_flags 4.2 "-march=k8" "-march=bdver4"
test_downgrade_arch_flags 4.1 "-march=k8" "-march=bdver4"
test_downgrade_arch_flags 4.0 "-march=k8" "-march=bdver4"
test_downgrade_arch_flags 3.4 "-march=k8" "-march=bdver4"
test_downgrade_arch_flags 3.3 "-march=x86-64" "-march=bdver4"
test_downgrade_arch_flags 3.4 "-march=c3-2" "-march=c3-2"
test_downgrade_arch_flags 3.3 "-march=c3" "-march=c3-2"
test_downgrade_arch_flags 4.5 "-march=garbage" "-march=garbage"
test_downgrade_arch_flags 4.9 "-mtune=intel" "-mtune=intel"
test_downgrade_arch_flags 4.8 "-mtune=generic" "-mtune=intel"
test_downgrade_arch_flags 3.4 "" "-mtune=generic"
test_downgrade_arch_flags 3.4 "" "-mtune=x86-64"
test_downgrade_arch_flags 3.3 "" "-mtune=anything"
test_downgrade_arch_flags 4.5 "-march=amdfam10 -mtune=generic" "-march=btver2 -mtune=generic"
test_downgrade_arch_flags 3.3 "-march=k6-2" "-march=geode -mtune=barcelona"
test_downgrade_arch_flags 3.4 "-march=k8" "-march=btver2 -mtune=generic"
test_downgrade_arch_flags 4.2 "-march=native" "-march=native"
test_downgrade_arch_flags 4.1 "-march=nocona" "-march=native"
test_downgrade_arch_flags 4.9 "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1"
test_downgrade_arch_flags 4.8 "-march=foo -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1"
test_downgrade_arch_flags 4.7 "-march=foo -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1"
test_downgrade_arch_flags 4.6 "-march=foo -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1"
test_downgrade_arch_flags 4.3 "-march=foo -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1"
test_downgrade_arch_flags 4.2 "-march=foo" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1"
test_downgrade_arch_flags 4.4 "-O2 -march=core2 -ffoo -fblah" "-O2 -march=atom -mno-sha -ffoo -mno-rtm -fblah"
# basic version parsing tests in preparation to eapi7-ver switch
test_tc_version_is_at_least() {
local exp msg ret=0 want mine res
want=${1}
mine=${2}
exp=${3}
tbegin "tc_version_is_at_least: ${want} ${mine} => ${exp}"
tc_version_is_at_least ${want} ${mine}
res=$?
if [[ ${res} -ne ${exp} ]]; then
msg="Failure - Expected: \"${exp}\" Got: \"${res}\""
ret=1
fi
tend ${ret} ${msg}
}
# want mine expect
test_tc_version_is_at_least 8 '' 1
test_tc_version_is_at_least 8.0 '' 1
test_tc_version_is_at_least 7 '' 0
test_tc_version_is_at_least 7.0 '' 0
test_tc_version_is_at_least ${TOOLCHAIN_GCC_PV} '' 0
test_tc_version_is_at_least 5.0 6.0 0
test_tc_version_is_between() {
local exp msg ret=0 lo hi res
lo=${1}
hi=${2}
exp=${3}
tbegin "tc_version_is_between: ${lo} ${hi} => ${exp}"
tc_version_is_between ${lo} ${hi}
res=$?
if [[ ${res} -ne ${exp} ]]; then
msg="Failure - Expected: \"${exp}\" Got: \"${res}\""
ret=1
fi
tend ${ret} ${msg}
}
# lo hi expect
test_tc_version_is_between 1 0 1
test_tc_version_is_between 1 2 1
test_tc_version_is_between 7 8 0
test_tc_version_is_between ${TOOLCHAIN_GCC_PV} 8 0
test_tc_version_is_between ${TOOLCHAIN_GCC_PV} ${TOOLCHAIN_GCC_PV} 1
test_tc_version_is_between 7 ${TOOLCHAIN_GCC_PV} 1
test_tc_version_is_between 8 9 1
# eclass has a few critical global variables worth not breaking
test_var_assert() {
local var_name exp
var_name=${1}
exp=${2}
tbegin "asserv variable value: ${var_name} => ${exp}"
if [[ ${!var_name} != ${exp} ]]; then
msg="Failure - Expected: \"${exp}\" Got: \"${!var_name}\""
ret=1
fi
tend ${ret} ${msg}
}
# TODO: convert these globals to helpers to ease testing against multiple
# ${TOOLCHAIN_GCC_PV} vaues.
test_var_assert GCC_PV 7.3.0
test_var_assert GCC_PVR 7.3.0
test_var_assert GCC_RELEASE_VER 7.3.0
test_var_assert GCC_BRANCH_VER 7.3
test_var_assert GCCMAJOR 7
test_var_assert GCCMINOR 3
test_var_assert GCCMICRO 0
test_var_assert BRANCH_UPDATE ''
test_var_assert GCC_CONFIG_VER 7.3.0
test_var_assert PREFIX /usr
texit

View File

@ -1,199 +0,0 @@
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
inherit versionator
eshopts_push -s extglob
ver=( "" "lt" "eq" "gt" )
lt=1 eq=2 gt=3
test_version_compare() {
tbegin "version_compare ${1} -${ver[${2}]} ${3}"
version_compare "${1}" "${3}"
local r=$?
[[ ${r} -eq ${2} ]]
tend $? "FAIL: ${@} (got ${r} exp ${2})"
}
echo "
0 $lt 1
1 $lt 2
2 $gt 1
2 $eq 2
0 $eq 0
10 $lt 20
68 $eq 068
068 $gt 67
068 $lt 69
1.0 $lt 2.0
2.0 $eq 2.0
2.0 $gt 1.0
1.0 $gt 0.0
0.0 $eq 0.0
0.0 $lt 1.0
0.1 $lt 0.2
0.2 $eq 0.2
0.3 $gt 0.2
1.2 $lt 2.1
2.1 $gt 1.2
1.2.3 $lt 1.2.4
1.2.4 $gt 1.2.3
1.2.0 $gt 1.2
1.2.1 $gt 1.2
1.2 $lt 1.2.1
1.2b $eq 1.2b
1.2b $lt 1.2c
1.2b $gt 1.2a
1.2b $gt 1.2
1.2 $lt 1.2a
1.3 $gt 1.2a
1.3 $lt 1.3a
1.0_alpha7 $lt 1.0_beta7
1.0_beta $lt 1.0_pre
1.0_pre5 $lt 1.0_rc2
1.0_rc2 $lt 1.0
1.0_p1 $gt 1.0
1.0_p1-r1 $gt 1.0_p1
1.0_alpha6-r1 $gt 1.0_alpha6
1.0_beta6-r1 $gt 1.0_alpha6-r2
1.0_pre1 $lt 1.0_p1
1.0p $gt 1.0_p1
1.0r $gt 1.0-r1
1.6.15 $gt 1.6.10-r2
1.6.10-r2 $lt 1.6.15
" | while read a b c ; do
[[ -z "${a}${b}${c}" ]] && continue
test_version_compare "${a}" "${b}" "${c}"
done
for q in "alpha beta pre rc=${lt};${gt}" "p=${gt};${lt}" ; do
for p in ${q%%=*} ; do
c=${q##*=}
alt=${c%%;*} agt=${c##*;}
test_version_compare "1.0" $agt "1.0_${p}"
test_version_compare "1.0" $agt "1.0_${p}1"
test_version_compare "1.0" $agt "1.0_${p}068"
test_version_compare "2.0_${p}" $alt "2.0"
test_version_compare "2.0_${p}1" $alt "2.0"
test_version_compare "2.0_${p}068" $alt "2.0"
test_version_compare "1.0_${p}" $eq "1.0_${p}"
test_version_compare "0.0_${p}" $lt "0.0_${p}1"
test_version_compare "666_${p}3" $gt "666_${p}"
test_version_compare "1_${p}7" $lt "1_${p}8"
test_version_compare "1_${p}7" $eq "1_${p}7"
test_version_compare "1_${p}7" $gt "1_${p}6"
test_version_compare "1_${p}09" $eq "1_${p}9"
test_version_compare "1_${p}7-r0" $eq "1_${p}7"
test_version_compare "1_${p}7-r0" $lt "1_${p}7-r1"
test_version_compare "1_${p}7-r0" $lt "1_${p}7-r01"
test_version_compare "1_${p}7-r01" $eq "1_${p}7-r1"
test_version_compare "1_${p}8-r1" $gt "1_${p}7-r100"
test_version_compare "1_${p}_alpha" $lt "1_${p}_beta"
done
done
for p in "-r" "_p" ; do
test_version_compare "7.2${p}1" $lt "7.2${p}2"
test_version_compare "7.2${p}2" $gt "7.2${p}1"
test_version_compare "7.2${p}3" $gt "7.2${p}2"
test_version_compare "7.2${p}2" $lt "7.2${p}3"
done
# The following tests all come from portage's test cases:
test_version_compare "6.0" $gt "5.0"
test_version_compare "5.0" $gt "5"
test_version_compare "1.0-r1" $gt "1.0-r0"
test_version_compare "1.0-r1" $gt "1.0"
test_version_compare "999999999999999999999999999999" $gt "999999999999999999999999999998"
test_version_compare "1.0.0" $gt "1.0"
test_version_compare "1.0.0" $gt "1.0b"
test_version_compare "1b" $gt "1"
test_version_compare "1b_p1" $gt "1_p1"
test_version_compare "1.1b" $gt "1.1"
test_version_compare "12.2.5" $gt "12.2b"
test_version_compare "4.0" $lt "5.0"
test_version_compare "5" $lt "5.0"
test_version_compare "1.0_pre2" $lt "1.0_p2"
test_version_compare "1.0_alpha2" $lt "1.0_p2"
test_version_compare "1.0_alpha1" $lt "1.0_beta1"
test_version_compare "1.0_beta3" $lt "1.0_rc3"
test_version_compare "1.001000000000000000001" $lt "1.001000000000000000002"
test_version_compare "1.00100000000" $lt "1.0010000000000000001"
test_version_compare "999999999999999999999999999998" $lt "999999999999999999999999999999"
test_version_compare "1.01" $lt "1.1"
test_version_compare "1.0-r0" $lt "1.0-r1"
test_version_compare "1.0" $lt "1.0-r1"
test_version_compare "1.0" $lt "1.0.0"
test_version_compare "1.0b" $lt "1.0.0"
test_version_compare "1_p1" $lt "1b_p1"
test_version_compare "1" $lt "1b"
test_version_compare "1.1" $lt "1.1b"
test_version_compare "12.2b" $lt "12.2.5"
test_version_compare "4.0" $eq "4.0"
test_version_compare "1.0" $eq "1.0"
test_version_compare "1.0-r0" $eq "1.0"
test_version_compare "1.0" $eq "1.0-r0"
test_version_compare "1.0-r0" $eq "1.0-r0"
test_version_compare "1.0-r1" $eq "1.0-r1"
# The following were just tests for != in portage, we need something a bit
# more precise
test_version_compare "1" $lt "2"
test_version_compare "1.0_alpha" $lt "1.0_pre"
test_version_compare "1.0_beta" $gt "1.0_alpha"
test_version_compare "0" $lt "0.0"
test_version_compare "1.0-r0" $lt "1.0-r1"
test_version_compare "1.0-r1" $gt "1.0-r0"
test_version_compare "1.0" $lt "1.0-r1"
test_version_compare "1.0-r1" $gt "1.0"
test_version_compare "1_p1" $lt "1b_p1"
test_version_compare "1b" $gt "1"
test_version_compare "1.1b" $gt "1.1"
test_version_compare "12.2b" $gt "12.2"
# The following tests all come from paludis's test cases:
test_version_compare "1.0" $gt "1"
test_version_compare "1" $lt "1.0"
test_version_compare "1.0_alpha" $gt "1_alpha"
test_version_compare "1.0_alpha" $gt "1"
test_version_compare "1.0_alpha" $lt "1.0"
test_version_compare "1.2.0.0_alpha7-r4" $gt "1.2_alpha7-r4"
test_version_compare "0001" $eq "1"
test_version_compare "01" $eq "001"
test_version_compare "0001.1" $eq "1.1"
test_version_compare "01.01" $eq "1.01"
test_version_compare "1.010" $eq "1.01"
test_version_compare "1.00" $eq "1.0"
test_version_compare "1.0100" $eq "1.010"
test_version_compare "1" $eq "1-r0"
test_version_compare "1-r00" $eq "1-r0"
eshopts_pop
texit