eclass/subversion: Sync with Gentoo

It's from Gentoo commit 8683826779ccf122d079e74c83a6601240f82235.
This commit is contained in:
Krzesimir Nowak 2024-08-02 16:04:41 +02:00
parent d93bc0f4a3
commit 89247b2a2f

View File

@ -1,4 +1,4 @@
# Copyright 1999-2022 Gentoo Authors # Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# @ECLASS: subversion.eclass # @ECLASS: subversion.eclass
@ -6,58 +6,54 @@
# Akinori Hattori <hattya@gentoo.org> # Akinori Hattori <hattya@gentoo.org>
# @AUTHOR: # @AUTHOR:
# Original Author: Akinori Hattori <hattya@gentoo.org> # Original Author: Akinori Hattori <hattya@gentoo.org>
# @SUPPORTED_EAPIS: 6 7 8 # @SUPPORTED_EAPIS: 7 8
# @BLURB: Fetch software sources from subversion repositories # @BLURB: Fetch software sources from subversion repositories
# @DESCRIPTION: # @DESCRIPTION:
# The subversion eclass provides functions to fetch software sources # The subversion eclass provides functions to fetch software sources
# from subversion repositories. # from subversion repositories.
ESVN="${ECLASS}"
case ${EAPI} in case ${EAPI} in
6|7|8) inherit estack ;; 7|8) inherit estack ;;
*) die "${ESVN}: EAPI ${EAPI:-0} is not supported" ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac esac
if [[ -z ${_SUBVERSION_ECLASS} ]]; then
_SUBVERSION_ECLASS=1
PROPERTIES+=" live" PROPERTIES+=" live"
DEPEND=" BDEPEND="
dev-vcs/subversion[http(+)] dev-vcs/subversion[http(+)]
net-misc/rsync" net-misc/rsync"
case ${EAPI} in # @ECLASS_VARIABLE: ESVN_STORE_DIR
6) ;;
*) BDEPEND="${DEPEND}"; DEPEND="" ;;
esac
# @ECLASS-VARIABLE: ESVN_STORE_DIR
# @USER_VARIABLE # @USER_VARIABLE
# @DESCRIPTION: # @DESCRIPTION:
# subversion sources store directory. Users may override this in /etc/portage/make.conf # 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" [[ -z ${ESVN_STORE_DIR} ]] && ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/svn-src"
# @ECLASS-VARIABLE: ESVN_FETCH_CMD # @ECLASS_VARIABLE: ESVN_FETCH_CMD
# @DESCRIPTION: # @DESCRIPTION:
# subversion checkout command # subversion checkout command
ESVN_FETCH_CMD="svn checkout" ESVN_FETCH_CMD="svn checkout"
# @ECLASS-VARIABLE: ESVN_UPDATE_CMD # @ECLASS_VARIABLE: ESVN_UPDATE_CMD
# @DESCRIPTION: # @DESCRIPTION:
# subversion update command # subversion update command
ESVN_UPDATE_CMD="svn update" ESVN_UPDATE_CMD="svn update"
# @ECLASS-VARIABLE: ESVN_SWITCH_CMD # @ECLASS_VARIABLE: ESVN_SWITCH_CMD
# @DESCRIPTION: # @DESCRIPTION:
# subversion switch command # subversion switch command
ESVN_SWITCH_CMD="svn switch" ESVN_SWITCH_CMD="svn switch"
# @ECLASS-VARIABLE: ESVN_OPTIONS # @ECLASS_VARIABLE: ESVN_OPTIONS
# @DESCRIPTION: # @DESCRIPTION:
# the options passed to checkout or update. If you want a specific revision see # the options passed to checkout or update. If you want a specific revision see
# ESVN_REPO_URI instead of using -rREV. # ESVN_REPO_URI instead of using -rREV.
ESVN_OPTIONS="${ESVN_OPTIONS:-}" ESVN_OPTIONS="${ESVN_OPTIONS:-}"
# @ECLASS-VARIABLE: ESVN_REPO_URI # @ECLASS_VARIABLE: ESVN_REPO_URI
# @DESCRIPTION: # @DESCRIPTION:
# repository uri # repository uri
# #
@ -73,7 +69,7 @@ ESVN_OPTIONS="${ESVN_OPTIONS:-}"
# to peg to a specific revision, append @REV to the repo's uri # to peg to a specific revision, append @REV to the repo's uri
ESVN_REPO_URI="${ESVN_REPO_URI:-}" ESVN_REPO_URI="${ESVN_REPO_URI:-}"
# @ECLASS-VARIABLE: ESVN_REVISION # @ECLASS_VARIABLE: ESVN_REVISION
# @DESCRIPTION: # @DESCRIPTION:
# User configurable revision checkout or update to from the repository # User configurable revision checkout or update to from the repository
# #
@ -83,17 +79,17 @@ ESVN_REPO_URI="${ESVN_REPO_URI:-}"
# Note: This should never be set in an ebuild! # Note: This should never be set in an ebuild!
ESVN_REVISION="${ESVN_REVISION:-}" ESVN_REVISION="${ESVN_REVISION:-}"
# @ECLASS-VARIABLE: ESVN_USER # @ECLASS_VARIABLE: ESVN_USER
# @DESCRIPTION: # @DESCRIPTION:
# User name # User name
ESVN_USER="${ESVN_USER:-}" ESVN_USER="${ESVN_USER:-}"
# @ECLASS-VARIABLE: ESVN_PASSWORD # @ECLASS_VARIABLE: ESVN_PASSWORD
# @DESCRIPTION: # @DESCRIPTION:
# Password # Password
ESVN_PASSWORD="${ESVN_PASSWORD:-}" ESVN_PASSWORD="${ESVN_PASSWORD:-}"
# @ECLASS-VARIABLE: ESVN_PROJECT # @ECLASS_VARIABLE: ESVN_PROJECT
# @DESCRIPTION: # @DESCRIPTION:
# project name of your ebuild (= name space) # project name of your ebuild (= name space)
# #
@ -116,7 +112,7 @@ ESVN_PASSWORD="${ESVN_PASSWORD:-}"
# default: ${PN/-svn}. # default: ${PN/-svn}.
ESVN_PROJECT="${ESVN_PROJECT:-${PN/-svn}}" ESVN_PROJECT="${ESVN_PROJECT:-${PN/-svn}}"
# @ECLASS-VARIABLE: ESVN_RESTRICT # @ECLASS_VARIABLE: ESVN_RESTRICT
# @DESCRIPTION: # @DESCRIPTION:
# this should be a space delimited list of subversion eclass features to # this should be a space delimited list of subversion eclass features to
# restrict. # restrict.
@ -124,7 +120,7 @@ ESVN_PROJECT="${ESVN_PROJECT:-${PN/-svn}}"
# don't export the working copy to S. # don't export the working copy to S.
ESVN_RESTRICT="${ESVN_RESTRICT:-}" ESVN_RESTRICT="${ESVN_RESTRICT:-}"
# @ECLASS-VARIABLE: ESVN_OFFLINE # @ECLASS_VARIABLE: ESVN_OFFLINE
# @USER_VARIABLE # @USER_VARIABLE
# @DEFAULT_UNSET # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
@ -133,7 +129,7 @@ ESVN_RESTRICT="${ESVN_RESTRICT:-}"
# tree by users. # tree by users.
ESVN_OFFLINE="${ESVN_OFFLINE:-${EVCS_OFFLINE}}" ESVN_OFFLINE="${ESVN_OFFLINE:-${EVCS_OFFLINE}}"
# @ECLASS-VARIABLE: ESVN_UMASK # @ECLASS_VARIABLE: ESVN_UMASK
# @USER_VARIABLE # @USER_VARIABLE
# @DESCRIPTION: # @DESCRIPTION:
# Set this variable to a custom umask. This is intended to be set by users. # Set this variable to a custom umask. This is intended to be set by users.
@ -144,15 +140,15 @@ ESVN_OFFLINE="${ESVN_OFFLINE:-${EVCS_OFFLINE}}"
# already can screw the system over in more creative ways. # already can screw the system over in more creative ways.
ESVN_UMASK="${ESVN_UMASK:-${EVCS_UMASK}}" ESVN_UMASK="${ESVN_UMASK:-${EVCS_UMASK}}"
# @ECLASS-VARIABLE: ESVN_UP_FREQ # @ECLASS_VARIABLE: ESVN_UP_FREQ
# @USER_VARIABLE # @USER_VARIABLE
# @DESCRIPTION: # @DESCRIPTION:
# Set the minimum number of hours between svn up'ing in any given svn module. This is particularly # 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 # useful for split KDE ebuilds where we want to ensure that all submodules are compiled for the same
# revision. It should also be kept user overrideable. # revision. It should also be kept user overridable.
ESVN_UP_FREQ="${ESVN_UP_FREQ:=}" ESVN_UP_FREQ="${ESVN_UP_FREQ:=}"
# @ECLASS-VARIABLE: ESCM_LOGDIR # @ECLASS_VARIABLE: ESCM_LOGDIR
# @USER_VARIABLE # @USER_VARIABLE
# @DESCRIPTION: # @DESCRIPTION:
# User configuration variable. If set to a path such as e.g. /var/log/scm any # User configuration variable. If set to a path such as e.g. /var/log/scm any
@ -176,10 +172,10 @@ subversion_fetch() {
local S_dest="${2}" local S_dest="${2}"
if [[ -z ${repo_uri} ]]; then if [[ -z ${repo_uri} ]]; then
die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty." die "${ECLASS}: ESVN_REPO_URI (or specified URI) is empty."
fi fi
[[ -n "${ESVN_REVISION}" ]] && revision="${ESVN_REVISION}" [[ -n ${ESVN_REVISION} ]] && revision="${ESVN_REVISION}"
# check for the scheme # check for the scheme
local scheme="${repo_uri%%:*}" local scheme="${repo_uri%%:*}"
@ -191,30 +187,30 @@ subversion_fetch() {
file) file)
;; ;;
*) *)
die "${ESVN}: fetch from '${scheme}' is not yet implemented." die "${ECLASS}: fetch from '${scheme}' is not yet implemented."
;; ;;
esac esac
addread "/etc/subversion" addread "/etc/subversion"
addwrite "${ESVN_STORE_DIR}" addwrite "${ESVN_STORE_DIR}"
if [[ -n "${ESVN_UMASK}" ]]; then if [[ -n ${ESVN_UMASK} ]]; then
eumask_push "${ESVN_UMASK}" eumask_push "${ESVN_UMASK}"
fi fi
if [[ ! -d ${ESVN_STORE_DIR} ]]; then if [[ ! -d ${ESVN_STORE_DIR} ]]; then
debug-print "${FUNCNAME}: initial checkout. creating subversion directory" debug-print "${FUNCNAME}: initial checkout. creating subversion directory"
mkdir -m 775 -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}." mkdir -m 775 -p "${ESVN_STORE_DIR}" || die "${ECLASS}: can't mkdir ${ESVN_STORE_DIR}."
fi fi
pushd "${ESVN_STORE_DIR}" >/dev/null || die "${ESVN}: can't chdir to ${ESVN_STORE_DIR}" pushd "${ESVN_STORE_DIR}" >/dev/null || die "${ECLASS}: can't chdir to ${ESVN_STORE_DIR}"
local wc_path="$(subversion__get_wc_path "${repo_uri}")" local wc_path="$(subversion__get_wc_path "${repo_uri}")"
local options="${ESVN_OPTIONS} --config-dir ${ESVN_STORE_DIR}/.subversion" local options="${ESVN_OPTIONS} --config-dir ${ESVN_STORE_DIR}/.subversion"
[[ -n "${revision}" ]] && options="${options} -r ${revision}" [[ -n ${revision} ]] && options="${options} -r ${revision}"
if [[ "${ESVN_OPTIONS}" = *-r* ]]; then if [[ ${ESVN_OPTIONS} == *-r* ]]; then
ewarn "\${ESVN_OPTIONS} contains -r, this usage is unsupported. Please" ewarn "\${ESVN_OPTIONS} contains -r, this usage is unsupported. Please"
ewarn "see \${ESVN_REPO_URI}" ewarn "see \${ESVN_REPO_URI}"
fi fi
@ -237,32 +233,32 @@ subversion_fetch() {
debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}" debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}"
mkdir -m 775 -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." mkdir -m 775 -p "${ESVN_PROJECT}" || die "${ECLASS}: can't mkdir ${ESVN_PROJECT}."
cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}" cd "${ESVN_PROJECT}" || die "${ECLASS}: can't chdir to ${ESVN_PROJECT}"
if [[ -n "${ESVN_USER}" ]]; then if [[ -n ${ESVN_USER} ]]; then
${ESVN_FETCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." ${ESVN_FETCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" "${repo_uri}" || die "${ECLASS}: can't fetch to ${wc_path} from ${repo_uri}."
else else
${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ECLASS}: can't fetch to ${wc_path} from ${repo_uri}."
fi fi
elif [[ -n ${ESVN_OFFLINE} ]]; then elif [[ -n ${ESVN_OFFLINE} ]]; then
svn upgrade "${wc_path}" &>/dev/null svn upgrade "${wc_path}" &>/dev/null
svn cleanup "${wc_path}" &>/dev/null svn cleanup "${wc_path}" &>/dev/null
subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." subversion_wc_info "${repo_uri}" || die "${ECLASS}: unknown problem occurred while accessing working copy."
if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then
die "${ESVN}: You requested off-line updating and revision ${ESVN_REVISION} but only revision ${ESVN_WC_REVISION} is available locally." die "${ECLASS}: You requested off-line updating and revision ${ESVN_REVISION} but only revision ${ESVN_WC_REVISION} is available locally."
fi fi
einfo "Fetching disabled: Using existing repository copy at revision ${ESVN_WC_REVISION}." einfo "Fetching disabled: Using existing repository copy at revision ${ESVN_WC_REVISION}."
else else
svn upgrade "${wc_path}" &>/dev/null svn upgrade "${wc_path}" &>/dev/null
svn cleanup "${wc_path}" &>/dev/null svn cleanup "${wc_path}" &>/dev/null
subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." subversion_wc_info "${repo_uri}" || die "${ECLASS}: unknown problem occurred while accessing working copy."
local esvn_up_freq= local esvn_up_freq=
if [[ -n ${ESVN_UP_FREQ} ]]; then if [[ -n ${ESVN_UP_FREQ} ]]; then
if [[ -n ${ESVN_UP_FREQ//[[:digit:]]} ]]; then if [[ -n ${ESVN_UP_FREQ//[[:digit:]]} ]]; then
die "${ESVN}: ESVN_UP_FREQ must be an integer value corresponding to the minimum number of hours between svn up." die "${ECLASS}: ESVN_UP_FREQ must be an integer value corresponding to the minimum number of hours between svn up."
elif [[ -z $(find "${wc_path}/.svn/entries" -mmin "+$((ESVN_UP_FREQ*60))") ]]; then elif [[ -z $(find "${wc_path}/.svn/entries" -mmin "+$((ESVN_UP_FREQ*60))") ]]; then
einfo "Fetching disabled since ${ESVN_UP_FREQ} hours has not passed since last update." einfo "Fetching disabled since ${ESVN_UP_FREQ} hours has not passed since last update."
einfo "Using existing repository copy at revision ${ESVN_WC_REVISION}." einfo "Using existing repository copy at revision ${ESVN_WC_REVISION}."
@ -278,16 +274,16 @@ subversion_fetch() {
einfo " new UUID: $(subversion__svn_info "${repo_uri}" "Repository UUID")" einfo " new UUID: $(subversion__svn_info "${repo_uri}" "Repository UUID")"
einfo " repository: ${repo_uri}${revision:+@}${revision}" einfo " repository: ${repo_uri}${revision:+@}${revision}"
rm -fr "${ESVN_PROJECT}" || die rm -rf "${ESVN_PROJECT}" || die
debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}" debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}"
mkdir -m 775 -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." mkdir -m 775 -p "${ESVN_PROJECT}" || die "${ECLASS}: can't mkdir ${ESVN_PROJECT}."
cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}" cd "${ESVN_PROJECT}" || die "${ECLASS}: can't chdir to ${ESVN_PROJECT}"
if [[ -n "${ESVN_USER}" ]]; then if [[ -n ${ESVN_USER} ]]; then
${ESVN_FETCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." ${ESVN_FETCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" "${repo_uri}" || die "${ECLASS}: can't fetch to ${wc_path} from ${repo_uri}."
else else
${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ECLASS}: can't fetch to ${wc_path} from ${repo_uri}."
fi fi
elif [[ ${ESVN_WC_URL} != $(subversion__get_repository_uri "${repo_uri}") ]]; then elif [[ ${ESVN_WC_URL} != $(subversion__get_repository_uri "${repo_uri}") ]]; then
einfo "subversion switch start -->" einfo "subversion switch start -->"
@ -296,11 +292,11 @@ subversion_fetch() {
debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}" debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}"
cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" cd "${wc_path}" || die "${ECLASS}: can't chdir to ${wc_path}"
if [[ -n "${ESVN_USER}" ]]; then if [[ -n ${ESVN_USER} ]]; then
${ESVN_SWITCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." ${ESVN_SWITCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" ${repo_uri} || die "${ECLASS}: can't update ${wc_path} from ${repo_uri}."
else else
${ESVN_SWITCH_CMD} ${options} ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." ${ESVN_SWITCH_CMD} ${options} ${repo_uri} || die "${ECLASS}: can't update ${wc_path} from ${repo_uri}."
fi fi
else else
# update working copy # update working copy
@ -309,35 +305,35 @@ subversion_fetch() {
debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}" debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}"
cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" cd "${wc_path}" || die "${ECLASS}: can't chdir to ${wc_path}"
if [[ -n "${ESVN_USER}" ]]; then if [[ -n ${ESVN_USER} ]]; then
${ESVN_UPDATE_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." ${ESVN_UPDATE_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" || die "${ECLASS}: can't update ${wc_path} from ${repo_uri}."
else else
${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." ${ESVN_UPDATE_CMD} ${options} || die "${ECLASS}: can't update ${wc_path} from ${repo_uri}."
fi fi
fi fi
# export updated information for the working copy # export updated information for the working copy
subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." subversion_wc_info "${repo_uri}" || die "${ECLASS}: unknown problem occurred while accessing working copy."
fi fi
fi fi
if [[ -n "${ESVN_UMASK}" ]]; then if [[ -n ${ESVN_UMASK} ]]; then
eumask_pop eumask_pop
fi fi
einfo " working copy: ${wc_path}" einfo " working copy: ${wc_path}"
if ! has "export" ${ESVN_RESTRICT}; then if ! has "export" ${ESVN_RESTRICT}; then
cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" cd "${wc_path}" || die "${ECLASS}: can't chdir to ${wc_path}"
local S="${S}/${S_dest}" local S="${S}/${S_dest}"
mkdir -p "${S}" mkdir -p "${S}"
# export to the ${WORKDIR} # export to the ${WORKDIR}
#* "svn export" has a bug. see https://bugs.gentoo.org/119236 #* "svn export" has a bug. see https://bugs.gentoo.org/119236
#* svn export . "${S}" || die "${ESVN}: can't export to ${S}." #* svn export . "${S}" || die "${ECLASS}: can't export to ${S}."
rsync -rlpgo --exclude=".svn/" . "${S}" || die "${ESVN}: can't export to ${S}." rsync -rlpgo --exclude=".svn/" . "${S}" || die "${ECLASS}: can't export to ${S}."
fi fi
popd >/dev/null popd >/dev/null
@ -374,7 +370,7 @@ subversion_wc_info() {
# @DESCRIPTION: # @DESCRIPTION:
# Default src_unpack. Fetch. # Default src_unpack. Fetch.
subversion_src_unpack() { subversion_src_unpack() {
subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch." subversion_fetch || die "${ECLASS}: unknown problem occurred in subversion_fetch."
} }
# @FUNCTION: subversion_pkg_preinst # @FUNCTION: subversion_pkg_preinst
@ -386,7 +382,7 @@ subversion_src_unpack() {
subversion_pkg_preinst() { subversion_pkg_preinst() {
local pkgdate=$(date "+%Y%m%d %H:%M:%S") local pkgdate=$(date "+%Y%m%d %H:%M:%S")
if [[ -n ${ESCM_LOGDIR} ]]; then if [[ -n ${ESCM_LOGDIR} ]]; then
local dir="${EROOT%/}${ESCM_LOGDIR}/${CATEGORY}" local dir="${EROOT}${ESCM_LOGDIR}/${CATEGORY}"
if [[ ! -d ${dir} ]]; then if [[ ! -d ${dir} ]]; then
mkdir -p "${dir}" || eerror "Failed to create '${dir}' for logging svn revision" mkdir -p "${dir}" || eerror "Failed to create '${dir}' for logging svn revision"
fi fi
@ -401,11 +397,9 @@ subversion_pkg_preinst() {
## -- Private Functions ## -- Private Functions
## -- subversion__svn_info() ------------------------------------------------- # # @FUNCTION: subversion__svn_info
# # @USAGE: <target> <key name>
# param $1 - a target. # @INTERNAL
# param $2 - a key name.
#
subversion__svn_info() { subversion__svn_info() {
local target="${1}" local target="${1}"
local key="${2}" local key="${2}"
@ -415,15 +409,15 @@ subversion__svn_info() {
| cut -d" " -f2- | cut -d" " -f2-
} }
## -- subversion__get_repository_uri() --------------------------------------- # # @FUNCTION: subversion__get_repository_uri
# # @USAGE: <repository URI>
# param $1 - a repository URI. # @INTERNAL
subversion__get_repository_uri() { subversion__get_repository_uri() {
local repo_uri="${1}" local repo_uri="${1}"
debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
if [[ -z ${repo_uri} ]]; then if [[ -z ${repo_uri} ]]; then
die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty." die "${ECLASS}: ESVN_REPO_URI (or specified URI) is empty."
fi fi
# delete trailing slash # delete trailing slash
if [[ -z ${repo_uri##*/} ]]; then if [[ -z ${repo_uri##*/} ]]; then
@ -434,9 +428,9 @@ subversion__get_repository_uri() {
echo "${repo_uri}" echo "${repo_uri}"
} }
## -- subversion__get_wc_path() ---------------------------------------------- # # @FUNCTION: subversion__get_wc_path
# # @USAGE: <repository URI>
# param $1 - a repository URI. # @INTERNAL
subversion__get_wc_path() { subversion__get_wc_path() {
local repo_uri="$(subversion__get_repository_uri "${1}")" local repo_uri="$(subversion__get_repository_uri "${1}")"
@ -445,16 +439,16 @@ subversion__get_wc_path() {
echo "${ESVN_STORE_DIR}/${ESVN_PROJECT}/${repo_uri##*/}" echo "${ESVN_STORE_DIR}/${ESVN_PROJECT}/${repo_uri##*/}"
} }
## -- subversion__get_peg_revision() ----------------------------------------- # # @FUNCTION: subversion__get_peg_revision
# # @USAGE: <repository URI>
# param $1 - a repository URI. # @INTERNAL
subversion__get_peg_revision() { subversion__get_peg_revision() {
local repo_uri="${1}" local repo_uri="${1}"
local peg_rev= local peg_rev=
debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
# repo_uri has peg revision? # repo_uri has peg revision?
if [[ ${repo_uri} = *@* ]]; then if [[ ${repo_uri} == *@* ]]; then
peg_rev="${repo_uri##*@}" peg_rev="${repo_uri##*@}"
debug-print "${FUNCNAME}: peg_rev = ${peg_rev}" debug-print "${FUNCNAME}: peg_rev = ${peg_rev}"
else else
@ -464,4 +458,6 @@ subversion__get_peg_revision() {
echo "${peg_rev}" echo "${peg_rev}"
} }
fi
EXPORT_FUNCTIONS src_unpack pkg_preinst EXPORT_FUNCTIONS src_unpack pkg_preinst