summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2016-06-05 18:12:54 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2016-06-05 18:12:54 +0300
commitaeb412883b87ff87c3e3dfeacc0d692ff7dae304 (patch)
treedd92698e3513ef08b0e2bdc9daefeabcba688c2b /eclass
parent2864b61cae3037c7026a2015b1d80d61dccdd458 (diff)
a bit aditred paludis ebuild added
Diffstat (limited to 'eclass')
-rw-r--r--eclass/bash-completion-r1.eclass136
-rw-r--r--eclass/scm-git.eclass186
-rw-r--r--eclass/scm.eclass374
3 files changed, 696 insertions, 0 deletions
diff --git a/eclass/bash-completion-r1.eclass b/eclass/bash-completion-r1.eclass
new file mode 100644
index 0000000..4afeb86
--- /dev/null
+++ b/eclass/bash-completion-r1.eclass
@@ -0,0 +1,136 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: bash-completion-r1.eclass
+# @MAINTAINER:
+# mgorny@gentoo.org
+# @BLURB: A few quick functions to install bash-completion files
+# @EXAMPLE:
+#
+# @CODE
+# EAPI=5
+#
+# src_configure() {
+# econf \
+# --with-bash-completion-dir="$(get_bashcompdir)"
+# }
+#
+# src_install() {
+# default
+#
+# newbashcomp contrib/${PN}.bash-completion ${PN}
+# }
+# @CODE
+
+inherit toolchain-funcs
+
+case ${EAPI:-0} in
+ 0|1|2|3|4|5|6|paludis-1) ;;
+ *) die "EAPI ${EAPI} unsupported (yet)."
+esac
+
+# @FUNCTION: _bash-completion-r1_get_bashdir
+# @INTERNAL
+# @DESCRIPTION:
+# First argument is name of the string in bash-completion.pc
+# Second argument is the fallback directory if the string is not found
+# @EXAMPLE:
+# _bash-completion-r1_get_bashdir completionsdir /usr/share/bash-completion
+_bash-completion-r1_get_bashdir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ if $(tc-getPKG_CONFIG) --exists bash-completion &>/dev/null; then
+ local path
+ path=$($(tc-getPKG_CONFIG) --variable="${1}" bash-completion) || die
+ # we need to return unprefixed, so strip from what pkg-config returns
+ # to us, bug #477692
+ echo "${path#${EPREFIX}}"
+ else
+ echo "${2}"
+ fi
+}
+
+# @FUNCTION: _bash-completion-r1_get_bashcompdir
+# @INTERNAL
+# @DESCRIPTION:
+# Get unprefixed bash-completion completions directory.
+_bash-completion-r1_get_bashcompdir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ _bash-completion-r1_get_bashdir completionsdir /usr/share/bash-completion/completions
+}
+
+# @FUNCTION: _bash-completion-r1_get_helpersdir
+# @INTERNAL
+# @DESCRIPTION:
+# Get unprefixed bash-completion helpers directory.
+_bash-completion-r1_get_bashhelpersdir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ _bash-completion-r1_get_bashdir helpersdir /usr/share/bash-completion/helpers
+}
+
+# @FUNCTION: get_bashcompdir
+# @DESCRIPTION:
+# Get the bash-completion completions directory.
+get_bashcompdir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ echo "${EPREFIX}$(_bash-completion-r1_get_bashcompdir)"
+}
+
+# @FUNCTION: get_bashhelpersdir
+# @INTERNAL
+# @DESCRIPTION:
+# Get the bash-completion helpers directory.
+get_bashhelpersdir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ echo "${EPREFIX}$(_bash-completion-r1_get_bashhelpersdir)"
+}
+
+# @FUNCTION: dobashcomp
+# @USAGE: file [...]
+# @DESCRIPTION:
+# Install bash-completion files passed as args. Has EAPI-dependant failure
+# behavior (like doins).
+dobashcomp() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ (
+ insinto "$(_bash-completion-r1_get_bashcompdir)"
+ doins "${@}"
+ )
+}
+
+# @FUNCTION: newbashcomp
+# @USAGE: file newname
+# @DESCRIPTION:
+# Install bash-completion file under a new name. Has EAPI-dependant failure
+# behavior (like newins).
+newbashcomp() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ (
+ insinto "$(_bash-completion-r1_get_bashcompdir)"
+ newins "${@}"
+ )
+}
+
+# @FUNCTION: bashcomp_alias
+# @USAGE: <basename> <alias>...
+# @DESCRIPTION:
+# Alias <basename> completion to one or more commands (<alias>es).
+bashcomp_alias() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ ${#} -lt 2 ]] && die "Usage: ${FUNCNAME} <basename> <alias>..."
+ local base=${1} f
+ shift
+
+ for f; do
+ dosym "${base}" "$(_bash-completion-r1_get_bashcompdir)/${f}" \
+ || return
+ done
+}
diff --git a/eclass/scm-git.eclass b/eclass/scm-git.eclass
new file mode 100644
index 0000000..c027085
--- /dev/null
+++ b/eclass/scm-git.eclass
@@ -0,0 +1,186 @@
+# Copyright 2008 David Leverton <dleverton@exherbo.org>
+# Distributed under the terms of the GNU General Public License v2
+# Based in part upon git.exlib, which is:
+# Copyright 2008 Fernando J. Pereda
+# Based upon 'git.eclass' which is:
+# Copyright 1999-2007 Gentoo Foundation
+
+if [[ -z ${SCM_TYPE} ]]; then
+ SCM_TYPE=git
+ inherit scm
+fi
+
+scm-git_do_dependencies() {
+ local git='>=dev-vcs/git-1.6.0'
+ if [[ $(scm_get_var REPOSITORY) == https://* ]]; then
+ echo "${git}$(scm_usedeps curl) net-misc/curl$(scm_usedeps ssl)"
+ elif [[ $(scm_get_var REPOSITORY) == http://* || $(scm_get_var REPOSITORY) == ftp://* ]]; then
+ echo "${git}$(scm_usedeps curl)"
+ elif [[ $(scm_get_var REPOSITORY) == rsync://* ]]; then
+ echo "${git} net-misc/rsync"
+ elif [[ $(scm_get_var REPOSITORY) == ssh://* ]] ||
+ [[ $(scm_get_var REPOSITORY) != *://* && $(scm_get_var REPOSITORY) == *:* ]]; then
+ echo "${git} net-misc/openssh"
+ else
+ echo "${git}"
+ fi
+
+ if [[ -n $(scm_get_var TAG) ]]; then
+ local keys
+ scm_get_array GIT_TAG_SIGNING_KEYS keys
+ [[ ${#keys[@]} -gt 0 ]] && echo app-crypt/gnupg
+ fi
+}
+
+scm-git_do_check_vars() {
+ [[ -n $(scm_get_var TAG) && -n $(scm_get_var REVISION) ]] \
+ && die "for git, $(scm_var_name TAG) must not be set at the same time as $(scm_var_name REVISION)"
+ [[ -z $(scm_get_var BRANCH) && -z $(scm_get_var REVISION) &&
+ -z $(scm_get_var TAG) ]] && scm_set_var BRANCH master
+ local rev=$(scm_get_var REVISION)
+ [[ -n ${rev} ]] && [[ ${rev} == *[^0123456789abcdef]* || ${#rev} -ne 40 ]] \
+ && die "for git, $(scm_var_name REVISION) must be a 40-character lowercase hexadecimal SHA-1 sum"
+ [[ -n $(scm_get_var SUBPATH) ]] && die "for git, $(scm_var_name SUBPATH) must not be set"
+
+ scm_modify_var REPOSITORY scm_trim_slashes -scheme -trailing
+}
+
+scm-git_git() {
+ local echo=echo
+ if [[ ${1} == -q ]]; then
+ shift
+ echo=:
+ fi
+
+ local need_git_dir=yes global=( )
+ while [[ ${#} -gt 0 && ${1} == -* ]]; do
+ global+=( "${1}" )
+ [[ ${1} == --git-dir=* ]] && need_git_dir=
+ shift
+ done
+ [[ ${1} != clone && -n ${need_git_dir} ]] && global+=( --git-dir="$(scm_get_var CHECKOUT_TO)" )
+
+ ${echo} git "${global[@]}" "${@}"
+ GIT_PAGER=cat git "${global[@]}" "${@}" || scm_die_unless_nonfatal "git ${1} failed"
+}
+
+scm-git_do_appraise() {
+ local dir=$(scm_get_var CHECKOUT_TO)
+
+ if ! scm_nonfatal scm-git_git -q rev-parse 2>/dev/null; then
+ echo "${dir} is not a git checkout"
+ return 3
+ fi
+
+ if [[ -n $(scm_get_var REVISION) ]]; then
+ if [[ -z $(scm_nonfatal scm-git_git -q cat-file -t $(scm_get_var REVISION) 2>/dev/null) ]]; then
+ echo "$(scm_get_var REVISION) is not present in ${dir}"
+ return 1
+ elif [[ $(scm-git_git -q cat-file -t $(scm_get_var REVISION)) == commit ]]; then
+ if [[ -n $(scm_get_var BRANCH) ]] && ! scm-git_git -q rev-list "refs/heads/$(scm_get_var BRANCH)" \
+ | grep -Fx $(scm_get_var REVISION) >/dev/null; then
+ echo "revision $(scm_get_var REVISION) is not part of branch $(scm_get_var BRANCH) of ${dir}"
+ return 1
+ fi
+ return 2
+ else
+ die "$(scm_get_var REVISION) is not a commit in ${dir}"
+ fi
+ fi
+
+ local origin=$(scm-git_git -q config remote.origin.url)
+ [[ -n ${origin} ]] || die "could not determine origin URL for ${dir}"
+ if [[ ${origin} != $(scm_get_var REPOSITORY) ]]; then
+ echo "${dir} is a clone of ${origin}, but wanted $(scm_get_var REPOSITORY)"
+ return 1
+ fi
+
+ if [[ -n $(scm_get_var TAG) ]]; then
+ if [[ -n $(scm-git_git -q for-each-ref "refs/tags/$(scm_get_var TAG)") ]]; then
+ if [[ -n $(scm_get_var BRANCH) ]] && ! scm-git_git -q rev-list "refs/heads/$(scm_get_var BRANCH)" \
+ | grep -Fx $(scm-git_git -q rev-parse "refs/tags/$(scm_get_var TAG)") >/dev/null; then
+ echo "tag $(scm_get_var TAG) is not part of branch $(scm_get_var BRANCH) of ${dir}"
+ return 1
+ fi
+
+ local keys
+ scm_get_array GIT_TAG_SIGNING_KEYS keys
+ if [[ ${#keys[@]} -gt 0 ]]; then
+ local gpghome=$(mktemp -d -p "${T}" gpg-XXXXXX)
+ [[ -n ${gpghome} ]] || die "mktemp failed"
+
+ cat >"${gpghome}/gpg" <<-EOF
+ #! /usr/bin/env bash
+ $(HOME=${gpghome} declare -p HOME)
+ $(gpg=$(type -P gpg); declare -p gpg)
+ errors=\$("\${gpg}" --keyserver-options no-auto-key-retrieve "\${@}" 2>&1 >/dev/null) && exit
+ status=\${?}
+ echo "\${errors}" >&2
+ exit \${status}
+ EOF
+ [[ ${?} -eq 0 ]] || die "create gpg wrapper failed"
+ chmod +x "${gpghome}/gpg" || die "chmod +x gpg wrapper failed"
+
+ PATH=${gpghome}:${PATH} gpg --import "${keys[@]}" || die "gpg --import ${keys[*]} failed"
+ PATH=${gpghome}:${PATH} scm-git_git -q verify-tag "$(scm_get_var TAG)" >/dev/null
+ fi
+
+ return 2
+ else
+ echo "${dir} does not contain the tag $(scm_get_var TAG)"
+ return 1
+ fi
+ fi
+
+ if [[ -n $(scm_get_var BRANCH) && -z $(scm-git_git -q for-each-ref "refs/heads/$(scm_get_var BRANCH)") ]]; then
+ echo "${dir} does not contain the branch $(scm_get_var BRANCH)"
+ return 1
+ fi
+
+ return 0
+}
+
+scm-git_do_checkout() {
+ scm-git_git clone --bare "$(scm_get_var REPOSITORY)" "$(scm_get_var CHECKOUT_TO)"
+ scm-git_git config remote.origin.url "$(scm_get_var REPOSITORY)"
+ scm-git_git gc --auto
+}
+
+scm-git_do_update() {
+ local old_origin=$(scm-git_git -q config remote.origin.url)
+ [[ -n ${old_origin} ]] || die "could not determine origin URL for $(scm_get_var CHECKOUT_TO)"
+ if [[ ${old_origin} != $(scm_get_var REPOSITORY) ]]; then
+ scm-git_git config remote.origin.url "$(scm_get_var REPOSITORY)"
+ eval "$(scm-git_git -q for-each-ref --shell --format "scm-git_git update-ref -d %(refname)" refs/{heads,tags}/\*)"
+ fi
+
+ local branch=$(scm_get_var BRANCH)
+ scm-git_git fetch -f -u origin "refs/heads/${branch:-*}:refs/heads/${branch:-*}"
+ scm-git_git gc --auto
+ [[ -n ${branch} ]] && scm_set_array FETCHED_BRANCHES "${branch}"
+}
+
+scm-git_do_revision() {
+ scm-git_git -q rev-parse $(
+ if [[ -n $(scm_get_var TAG) ]]; then
+ echo refs/tags/$(scm_get_var TAG)
+ elif [[ -n $(scm_get_var REVISION) ]]; then
+ scm_get_var REVISION
+ else
+ echo refs/heads/$(scm_get_var BRANCH)
+ fi)
+}
+
+scm-git_do_unpack() {
+ scm-git_git clone -s -n "$(scm_get_var CHECKOUT_TO)" "$(scm_get_var UNPACK_TO)"
+ scm-git_git --git-dir="$(scm_get_var UNPACK_TO)"/.git --work-tree="$(scm_get_var UNPACK_TO)" checkout -f $(
+ if [[ -n $(scm_get_var TAG) ]]; then
+ echo refs/tags/$(scm_get_var TAG)
+ elif [[ -n $(scm_get_var REVISION) ]]; then
+ scm_get_var REVISION
+ else
+ [[ -n $(scm-git_git -q --git-dir="$(scm_get_var UNPACK_TO)"/.git for-each-ref "refs/heads/$(scm_get_var BRANCH)") ]] \
+ || echo -b $(scm_get_var BRANCH) refs/remotes/origin/$(scm_get_var BRANCH)
+ fi) --
+}
+
diff --git a/eclass/scm.eclass b/eclass/scm.eclass
new file mode 100644
index 0000000..a509d40
--- /dev/null
+++ b/eclass/scm.eclass
@@ -0,0 +1,374 @@
+# Copyright 2008 David Leverton <dleverton@exherbo.org>
+# Distributed under the terms of the GNU General Public License v2
+# Based in part upon subversion.eclass, which is:
+# Copyright 1999-2008 Gentoo Foundation
+
+scm_need_extglob() {
+ [[ ${#} -eq 1 ]] || die "scm_need_extglob needs exactly one argument"
+ [[ -n $(declare -F ${1}) ]] || die "${1} is not a function"
+ eval "_scm_need_extglob_$(declare -f ${1})"
+ eval "${1}() {
+ local oldextglob=\$(shopt -p extglob)
+ shopt -s extglob
+ _scm_need_extglob_${1} \"\${@}\"
+ local status=\${?}
+ \${oldextglob}
+ return \${status}
+ }"
+}
+
+scm_usedeps() {
+ [[ ${#} -ge 1 ]] || die "scm_usedeps needs at least one argument"
+ local myeapi=$(echo ${EAPI/prefix})
+ has ${myeapi:-0} 0 1 && return
+ local IFS=,
+ local deps="[${*}]"
+ [[ ${myeapi:-0} == kdebuild-* ]] && deps=${deps//,/][}
+ echo "${deps}"
+}
+
+scm_nonfatal() {
+ SCM_NONFATAL=1 "${@}"
+}
+
+scm_die_unless_nonfatal() {
+ [[ -z ${SCM_NONFATAL} ]] && die "${@}"
+}
+
+scm_for_each() {
+ [[ ${#} -ge 1 ]] || die "scm_for_each needs at least one argument"
+
+ [[ -z ${SCM_NO_PRIMARY_REPOSITORY} ]] && SCM_THIS= "${@}"
+
+ local t active=true
+ local -i level=0
+ for t in ${SCM_SECONDARY_REPOSITORIES}; do
+ if [[ ${t} == *\? ]]; then
+ ${active} && ! use ${t%\?} && active=false
+ elif [[ ${t} == \( ]]; then
+ ${active} || (( level++ ))
+ elif [[ ${t} == \) ]]; then
+ if ! ${active}; then
+ (( level-- ))
+ [[ ${level} -eq 0 ]] && active=true
+ fi
+ else
+ ${active} && SCM_THIS=${t} "${@}"
+ fi
+ done
+}
+
+scm_var_name() {
+ [[ ${#} -eq 1 ]] || die "scm_var_name needs exactly one argument"
+ echo SCM${SCM_THIS:+_${SCM_THIS}}_${1}
+}
+
+scm_get_var() {
+ [[ ${#} -eq 1 ]] || die "scm_get_var needs exactly one argument"
+ local var=$(scm_var_name ${1})
+ echo "${!var}"
+}
+
+scm_set_var() {
+ [[ ${#} -eq 2 ]] || die "scm_set_var needs exactly two arguments"
+ printf -v $(scm_var_name ${1}) %s "${2}"
+}
+
+scm_modify_var() {
+ [[ ${#} -ge 2 ]] || die "scm_modify_var needs at least two arguments"
+ local var=${1}
+ shift
+ scm_set_var ${var} "$("${@}" "$(scm_get_var ${var})")"
+}
+
+scm_get_array() {
+ [[ ${#} -eq 2 ]] || die "scm_get_array needs exactly two arguments"
+ eval "${2}=( \"\${$(scm_var_name ${1})[@]}\" )"
+}
+
+scm_set_array() {
+ [[ ${#} -ge 1 ]] || die "scm_set_array needs at least one argument"
+ local name=${1}
+ shift
+ eval "$(scm_var_name ${name})=( \"\${@}\" )"
+}
+
+scm_call() {
+ [[ ${#} -ge 1 ]] || die "scm_call needs at least one argument"
+ local func=${1} type=$(scm_get_var TYPE)
+ shift
+ if [[ -n $(declare -F scm-${type}_do_${func}) ]]; then
+ scm-${type}_do_${func} "${@}"
+ elif [[ -n $(declare -F scm_do_${func}) ]]; then
+ scm_do_${func} "${@}"
+ else
+ die "bug in scm-${type}.eclass: scm-${type}_do_${func} not defined"
+ fi
+}
+
+scm_access_checkout() {
+ [[ ${#} -ge 1 ]] || die "scm_access_checkout needs at least one argument"
+ local dir=$(scm_get_var CHECKOUT_TO)
+ local lock=${dir%/*}/.lock-${dir##*/}
+
+ local dir_base=${dir%/*}
+ if [[ ! -d ${dir_base} ]]; then
+ local dir_addwrite=${dir_base}
+ local dir_search=${dir_addwrite%/*}
+ while [[ ! -d ${dir_search} ]]; do
+ dir_addwrite=${dir_search}
+ dir_search=${dir_search%/*}
+ done
+ (
+ addwrite "${dir_addwrite}"
+ mkdir -p "${dir_base}"
+ ) || die "mkdir failed"
+ fi
+
+ local SANDBOX_WRITE=${SANDBOX_WRITE}
+ addwrite "${dir}"
+ addwrite "${lock}"
+
+ local fd
+ for fd in {3..9}; do
+ [[ -e /dev/fd/${fd} ]] || break
+ done
+ [[ -e /dev/fd/${fd} ]] && die "can't find free file descriptor"
+
+ eval "
+ {
+ flock -x \${fd} || die \"flock failed\"
+ \"\${@}\"
+ local status=\${?}
+ :
+ } ${fd}>\"\${lock}\" || die \"opening lock file failed\"
+ "
+
+ return ${status}
+}
+
+scm_do_resolve_externals() {
+ :
+}
+
+scm_check_timestamp() {
+ [[ -e ${1}/${2} && -n $(find "${1}" -maxdepth 1 -name "${2}" \
+ -mmin -$((${SCM_MIN_UPDATE_DELAY} * 60)) -print) ]]
+}
+
+scm_perform_fetch() {
+ local dir=$(scm_get_var CHECKOUT_TO)
+
+ local whynot status
+ if [[ -d ${dir} ]]; then
+ whynot=$(scm_call appraise)
+ status=${?}
+ if [[ ${status} -eq 2 ]]; then
+ einfo "Not fetching ${SCM_THIS:-primary repository} because the existing checkout is perfect"
+ return
+ fi
+ else
+ whynot="${dir} does not exist"
+ status=1
+ fi
+
+ if [[ -n ${SCM_OFFLINE} ]]; then
+ [[ ${status} -ne 0 ]] && die "can't use SCM_OFFLINE for ${SCM_THIS:-primary repository} because ${whynot}"
+ einfo "Not fetching ${SCM_THIS:-primary repository} because SCM_OFFLINE is set"
+ return
+ fi
+
+ if [[ -n ${SCM_MIN_UPDATE_DELAY} ]]; then
+ [[ ${SCM_MIN_UPDATE_DELAY} == *[^0123456789]* || ${SCM_MIN_UPDATE_DELAY} -eq 0 ]] \
+ && die "SCM_MIN_UPDATE_DELAY must be a positive integer"
+ local branch=$(scm_get_var BRANCH)
+ if scm_check_timestamp "${dir}" .scm.eclass.timestamp ||
+ { [[ -n ${branch} ]] && scm_check_timestamp "${dir}" .scm.eclass.timestamp."${branch//\//--}"; }; then
+ if [[ ${status} -eq 0 ]]; then
+ einfo "Not fetching ${SCM_THIS:-primary repository} because SCM_MIN_UPDATE_DELAY (${SCM_MIN_UPDATE_DELAY}) hours have not passed"
+ return
+ else
+ einfo "Ignoring SCM_MIN_UPDATE_DELAY for ${SCM_THIS:-primary repository} because ${whynot}"
+ fi
+ fi
+ fi
+
+ if [[ ${status} -eq 3 ]]; then
+ echo rm -rf "${dir}"
+ rm -rf "${dir}"
+ [[ -d ${dir} ]] && die "rm failed"
+ fi
+
+ if [[ -d ${dir} ]]; then
+ scm_call update
+ else
+ scm_call checkout
+ fi
+
+ if [[ -d ${dir} ]]; then
+ whynot=$(scm_call appraise)
+ [[ ${?} -eq 1 || ${?} -eq 3 ]] && die "${whynot}"
+ else
+ die "${dir} does not exist"
+ fi
+
+ local fetched
+ scm_get_array FETCHED_BRANCHES fetched
+ if [[ ${#fetched[@]} -gt 0 ]]; then
+ fetched=( "${fetched[@]//\//--}" )
+ touch "${fetched[@]/#/${dir}/.scm.eclass.timestamp.}" || die "touch failed"
+ else
+ touch "${dir}/.scm.eclass.timestamp" || die "touch failed"
+ fi
+}
+
+scm_fetch_one() {
+ scm_perform_fetch
+ scm_call resolve_externals
+}
+
+scm_src_fetch_extra() {
+ scm_{for_each,access_checkout,fetch_one}
+}
+
+scm_scmrevision_one() {
+ local rev=$(scm_call revision)
+ [[ -n ${rev} ]] || die "could not determine revision for ${SCM_THIS:-primary repository}"
+ SCM_PKG_SCM_REVISION_RESULT+=,${SCM_THIS}=${rev}
+}
+
+scm_pkg_scm_revision() {
+ local SCM_PKG_SCM_REVISION_RESULT=
+ scm_{for_each,access_checkout,scmrevision_one}
+ echo ${SCM_PKG_SCM_REVISION_RESULT#,=}
+}
+
+scm_do_unpack() {
+ echo cp -pPR "$(scm_get_var CHECKOUT_TO)" "$(scm_get_var UNPACK_TO)"
+ cp -pPR "$(scm_get_var CHECKOUT_TO)" "$(scm_get_var UNPACK_TO)" || die "cp failed"
+}
+
+scm_do_set_actual_vars() {
+ local rev=$(scm_call revision)
+ [[ -n ${rev} ]] || die "could not determine revision for ${SCM_THIS:-primary repository}"
+ scm_set_var ACTUAL_REVISION "${rev}"
+}
+
+scm_unpack_one() {
+ scm_call resolve_externals
+
+ local whynot
+ if [[ -d $(scm_get_var CHECKOUT_TO) ]]; then
+ whynot=$(scm_call appraise)
+ [[ ${?} -eq 1 || ${?} -eq 3 ]] && die "${whynot}"
+ else
+ die "$(scm_get_var CHECKOUT_TO) does not exist"
+ fi
+
+ local dir=$(scm_get_var UNPACK_TO)
+ if [[ -d ${dir} ]]; then
+ rmdir "${dir}" || die "rmdir failed"
+ else
+ mkdir -p "${dir%/*}" || die mkdir "failed"
+ fi
+
+ scm_call unpack
+ rm -f "${dir}/.scm.eclass.timestamp"{,.*}
+ scm_call set_actual_vars
+}
+
+scm_src_unpack() {
+ scm_src_fetch_extra
+
+ scm_{for_each,access_checkout,unpack_one}
+ SCM_IS_BUILT=1
+}
+
+scm_do_info() {
+ :
+}
+
+scm_pkg_info() {
+ [[ -n ${SCM_IS_BUILT} ]] && scm_{for_each,call} info
+}
+
+scm_trim_slashes() {
+ local scheme= leading= trailing=
+ while [[ ${#} -gt 0 && ${1} == -* ]]; do
+ case ${1} in
+ -scheme) scheme=1 ;;
+ -leading) leading=1 ;;
+ -trailing) trailing=1 ;;
+ *) die "scm_trim_slashes: unrecognised switch ${1}"
+ esac
+ shift
+ done
+
+ [[ ${#} -eq 1 ]] || die "scm_trim_slashes needs exactly one argument besides switches"
+ local value=${1}
+
+ local myscheme=
+ if [[ -n ${scheme} && ${value} == *://* ]]; then
+ myscheme=${value%%://*}://
+ value=${value#*://}
+ fi
+
+ value=${value//+(\/)/\/}
+ [[ -n ${leading} ]] && value=${value#/}
+ [[ -n ${trailing} ]] && value=${value%/}
+
+ echo "${myscheme}${value}"
+}
+scm_need_extglob scm_trim_slashes
+
+scm_do_check_vars() {
+ :
+}
+
+scm_global_stuff() {
+ if [[ -z $(scm_get_var TYPE) ]]; then
+ if [[ -n ${SCM_THIS} ]]; then
+ scm_set_var TYPE ${SCM_TYPE}
+ else
+ die "$(scm_var_name TYPE) must be set"
+ fi
+ fi
+ inherit scm-$(scm_get_var TYPE)
+
+ [[ -z $(scm_get_var REPOSITORY) ]] \
+ && die "$(scm_var_name REPOSITORY) must be set"
+
+ local checkout_to=$(scm_get_var CHECKOUT_TO)
+ [[ -z ${checkout_to} ]] && checkout_to=${SCM_THIS:-${PN}}
+ [[ ${checkout_to} == /* ]] || checkout_to=${SCM_HOME}/${checkout_to}
+ scm_set_var CHECKOUT_TO "$(scm_trim_slashes -trailing "${checkout_to}")"
+
+ local unpack_to=$(scm_get_var UNPACK_TO)
+ [[ -z ${unpack_to} ]] && unpack_to=${WORKDIR}/${SCM_THIS:-${P}}
+ scm_set_var UNPACK_TO "$(scm_trim_slashes -trailing "${unpack_to}")"
+
+ scm_call check_vars
+
+ DEPEND+=" $(scm_call dependencies)"
+}
+
+SCM_HOME=${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/scm
+scm_finalise() {
+ DEPEND+=" >=sys-apps/util-linux-2.13_pre2"
+
+ [[ -z ${SCM_NO_PRIMARY_REPOSITORY} ]] && SCM_THIS= scm_global_stuff
+
+ local t
+ for t in ${SCM_SECONDARY_REPOSITORIES}; do
+ if [[ ${t} == *\? || ${t} == \( || ${t} == \) ]]; then
+ DEPEND+=" ${t}"
+ else
+ SCM_THIS=${t} scm_global_stuff
+ fi
+ done
+}
+[[ -z ${SCM_NO_AUTOMATIC_FINALISE} ]] && scm_finalise
+
+#EXPORT_FUNCTIONS src_fetch_extra pkg_scm_revision src_unpack pkg_info
+EXPORT_FUNCTIONS src_unpack pkg_info
+