eclass/subversion: Sync with gentoo

It's from gentoo commit e287fa31d05df719242ccdc9a4efe3a73adf22cb.
This commit is contained in:
Krzesimir Nowak 2022-03-09 18:03:15 +01:00
parent 810eb3ef34
commit e7ecc8d32f

View File

@ -1,4 +1,4 @@
# Copyright 1999-2017 Gentoo Foundation
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: subversion.eclass
@ -6,37 +6,32 @@
# Akinori Hattori <hattya@gentoo.org>
# @AUTHOR:
# Original Author: Akinori Hattori <hattya@gentoo.org>
# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6
# @BLURB: The subversion eclass is written to fetch software sources from subversion repositories
# @SUPPORTED_EAPIS: 6 7 8
# @BLURB: Fetch software sources from subversion repositories
# @DESCRIPTION:
# The subversion eclass provides functions to fetch, patch and bootstrap
# software sources from subversion repositories.
inherit eutils
# The subversion eclass provides functions to fetch software sources
# from subversion repositories.
ESVN="${ECLASS}"
case "${EAPI:-0}" in
0|1)
EXPORT_FUNCTIONS src_unpack pkg_preinst
DEPEND="dev-vcs/subversion"
;;
2|3|4|5)
EXPORT_FUNCTIONS src_unpack src_prepare pkg_preinst
DEPEND="|| ( dev-vcs/subversion[http] dev-vcs/subversion[webdav-neon] dev-vcs/subversion[webdav-serf] )"
;;
6)
EXPORT_FUNCTIONS src_unpack pkg_preinst
DEPEND="|| ( dev-vcs/subversion[http] dev-vcs/subversion[webdav-neon] dev-vcs/subversion[webdav-serf] )"
;;
*)
die "EAPI ${EAPI} is not supported in subversion.eclass"
;;
case ${EAPI} in
6|7|8) inherit estack ;;
*) die "${ESVN}: EAPI ${EAPI:-0} is not supported" ;;
esac
DEPEND+=" net-misc/rsync"
PROPERTIES+=" live"
DEPEND="
dev-vcs/subversion[http(+)]
net-misc/rsync"
case ${EAPI} in
6) ;;
*) BDEPEND="${DEPEND}"; DEPEND="" ;;
esac
# @ECLASS-VARIABLE: ESVN_STORE_DIR
# @USER_VARIABLE
# @DESCRIPTION:
# subversion sources store directory. Users may override this in /etc/portage/make.conf
[[ -z ${ESVN_STORE_DIR} ]] && ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/svn-src"
@ -66,7 +61,7 @@ ESVN_OPTIONS="${ESVN_OPTIONS:-}"
# @DESCRIPTION:
# repository uri
#
# e.g. http://foo/trunk, svn://bar/trunk, svn://bar/branch/foo@1234
# e.g. http://example.org/trunk, svn://example.org/branch/foo@1234
#
# supported URI schemes:
# http://
@ -121,24 +116,6 @@ ESVN_PASSWORD="${ESVN_PASSWORD:-}"
# default: ${PN/-svn}.
ESVN_PROJECT="${ESVN_PROJECT:-${PN/-svn}}"
# @ECLASS-VARIABLE: ESVN_BOOTSTRAP
# @DESCRIPTION:
# Bootstrap script or command like autogen.sh or etc..
# Removed in EAPI 6 and later.
ESVN_BOOTSTRAP="${ESVN_BOOTSTRAP:-}"
# @ECLASS-VARIABLE: ESVN_PATCHES
# @DESCRIPTION:
# subversion eclass can apply patches in subversion_bootstrap().
# you can use regexp in this variable like *.diff or *.patch or etc.
# NOTE: patches will be applied before ESVN_BOOTSTRAP is processed.
#
# Patches are searched both in ${PWD} and ${FILESDIR}, if not found in either
# location, the installation dies.
#
# Removed in EAPI 6 and later, use PATCHES instead.
ESVN_PATCHES="${ESVN_PATCHES:-}"
# @ECLASS-VARIABLE: ESVN_RESTRICT
# @DESCRIPTION:
# this should be a space delimited list of subversion eclass features to
@ -148,6 +125,8 @@ ESVN_PATCHES="${ESVN_PATCHES:-}"
ESVN_RESTRICT="${ESVN_RESTRICT:-}"
# @ECLASS-VARIABLE: ESVN_OFFLINE
# @USER_VARIABLE
# @DEFAULT_UNSET
# @DESCRIPTION:
# Set this variable to a non-empty value to disable the automatic updating of
# an svn source tree. This is intended to be set outside the subversion source
@ -155,6 +134,7 @@ ESVN_RESTRICT="${ESVN_RESTRICT:-}"
ESVN_OFFLINE="${ESVN_OFFLINE:-${EVCS_OFFLINE}}"
# @ECLASS-VARIABLE: ESVN_UMASK
# @USER_VARIABLE
# @DESCRIPTION:
# Set this variable to a custom umask. This is intended to be set by users.
# By setting this to something like 002, it can make life easier for people
@ -165,6 +145,7 @@ ESVN_OFFLINE="${ESVN_OFFLINE:-${EVCS_OFFLINE}}"
ESVN_UMASK="${ESVN_UMASK:-${EVCS_UMASK}}"
# @ECLASS-VARIABLE: ESVN_UP_FREQ
# @USER_VARIABLE
# @DESCRIPTION:
# Set the minimum number of hours between svn up'ing in any given svn module. This is particularly
# useful for split KDE ebuilds where we want to ensure that all submodules are compiled for the same
@ -172,6 +153,7 @@ ESVN_UMASK="${ESVN_UMASK:-${EVCS_UMASK}}"
ESVN_UP_FREQ="${ESVN_UP_FREQ:=}"
# @ECLASS-VARIABLE: ESCM_LOGDIR
# @USER_VARIABLE
# @DESCRIPTION:
# User configuration variable. If set to a path such as e.g. /var/log/scm any
# package inheriting from subversion.eclass will record svn revision to
@ -362,50 +344,6 @@ subversion_fetch() {
echo
}
# @FUNCTION: subversion_bootstrap
# @DESCRIPTION:
# Apply patches in ${ESVN_PATCHES} and run ${ESVN_BOOTSTRAP} if specified.
# Removed in EAPI 6 and later.
subversion_bootstrap() {
[[ ${EAPI} == [012345] ]] || die "${FUNCNAME} is removed from subversion.eclass in EAPI 6 and later"
if has "export" ${ESVN_RESTRICT}; then
return
fi
cd "${S}"
if [[ -n ${ESVN_PATCHES} ]]; then
local patch fpatch
einfo "apply patches -->"
for patch in ${ESVN_PATCHES}; do
if [[ -f ${patch} ]]; then
epatch "${patch}"
else
for fpatch in ${FILESDIR}/${patch}; do
if [[ -f ${fpatch} ]]; then
epatch "${fpatch}"
else
die "${ESVN}: ${patch} not found"
fi
done
fi
done
echo
fi
if [[ -n ${ESVN_BOOTSTRAP} ]]; then
einfo "begin bootstrap -->"
if [[ -f ${ESVN_BOOTSTRAP} && -x ${ESVN_BOOTSTRAP} ]]; then
einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}"
eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP."
else
einfo " bootstrap with command: ${ESVN_BOOTSTRAP}"
eval "${ESVN_BOOTSTRAP}" || die "${ESVN}: can't eval ESVN_BOOTSTRAP."
fi
fi
}
# @FUNCTION: subversion_wc_info
# @USAGE: [repo_uri]
# @RETURN: ESVN_WC_URL, ESVN_WC_ROOT, ESVN_WC_UUID, ESVN_WC_REVISION and ESVN_WC_PATH
@ -434,21 +372,9 @@ subversion_wc_info() {
# @FUNCTION: subversion_src_unpack
# @DESCRIPTION:
# Default src_unpack. Fetch and, in older EAPIs, bootstrap.
# Default src_unpack. Fetch.
subversion_src_unpack() {
subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch."
if has "${EAPI:-0}" 0 1; then
subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap."
fi
}
# @FUNCTION: subversion_src_prepare
# @DESCRIPTION:
# Default src_prepare. Bootstrap.
# Removed in EAPI 6 and later.
subversion_src_prepare() {
[[ ${EAPI} == [012345] ]] || die "${FUNCNAME} is removed from subversion.eclass in EAPI 6 and later"
subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap."
}
# @FUNCTION: subversion_pkg_preinst
@ -458,10 +384,9 @@ subversion_src_prepare() {
# want the logs to stick around if packages are uninstalled without messing with
# config protection.
subversion_pkg_preinst() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
local pkgdate=$(date "+%Y%m%d %H:%M:%S")
if [[ -n ${ESCM_LOGDIR} ]]; then
local dir="${EROOT}/${ESCM_LOGDIR}/${CATEGORY}"
local dir="${EROOT%/}${ESCM_LOGDIR}/${CATEGORY}"
if [[ ! -d ${dir} ]]; then
mkdir -p "${dir}" || eerror "Failed to create '${dir}' for logging svn revision"
fi
@ -538,3 +463,5 @@ subversion__get_peg_revision() {
echo "${peg_rev}"
}
EXPORT_FUNCTIONS src_unpack pkg_preinst