*/*: Bump copyright on files touched this year
[gentoo.git] / eclass / subversion.eclass
index c45c725cdb50bb6d6387466d4623743e579b544e..d809a496f526600729d3b437a4ab820bab9967c6 100644 (file)
@@ -1,33 +1,46 @@
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
-# $Id$
 
 # @ECLASS: subversion.eclass
 # @MAINTAINER:
 # Akinori Hattori <hattya@gentoo.org>
 # @AUTHOR:
 # Original Author: Akinori Hattori <hattya@gentoo.org>
-# @BLURB: The subversion eclass is written to fetch software sources from subversion repositories
+# @SUPPORTED_EAPIS: 4 5 6 7
+# @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
-
 ESVN="${ECLASS}"
 
-case "${EAPI:-0}" in
-       0|1)
+case ${EAPI:-0} in
+       4|5)
+               inherit eutils
+               EXPORT_FUNCTIONS src_unpack src_prepare pkg_preinst
+               ;;
+       6|7)
+               inherit estack
                EXPORT_FUNCTIONS src_unpack pkg_preinst
-               DEPEND="dev-vcs/subversion"
                ;;
        *)
-               EXPORT_FUNCTIONS src_unpack src_prepare pkg_preinst
-               DEPEND="|| ( dev-vcs/subversion[http] dev-vcs/subversion[webdav-neon] dev-vcs/subversion[webdav-serf] )"
+               die "${ESVN}: EAPI ${EAPI:-0} is not supported"
                ;;
 esac
 
-DEPEND+=" net-misc/rsync"
+PROPERTIES+=" live"
+
+DEPEND="|| (
+               dev-vcs/subversion[http]
+               dev-vcs/subversion[webdav-neon]
+               dev-vcs/subversion[webdav-serf]
+       )
+       net-misc/rsync"
+
+case ${EAPI} in
+       4|5|6) ;;
+       *) BDEPEND="${DEPEND}"; DEPEND="" ;;
+esac
 
 # @ECLASS-VARIABLE: ESVN_STORE_DIR
 # @DESCRIPTION:
@@ -59,7 +72,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://
@@ -116,7 +129,8 @@ ESVN_PROJECT="${ESVN_PROJECT:-${PN/-svn}}"
 
 # @ECLASS-VARIABLE: ESVN_BOOTSTRAP
 # @DESCRIPTION:
-# bootstrap script or command like autogen.sh or etc..
+# Bootstrap script or command like autogen.sh or etc..
+# Removed in EAPI 6 and later.
 ESVN_BOOTSTRAP="${ESVN_BOOTSTRAP:-}"
 
 # @ECLASS-VARIABLE: ESVN_PATCHES
@@ -127,6 +141,8 @@ ESVN_BOOTSTRAP="${ESVN_BOOTSTRAP:-}"
 #
 # 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
@@ -355,7 +371,10 @@ subversion_fetch() {
 # @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
@@ -421,18 +440,17 @@ 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."
 }
 
@@ -443,10 +461,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