- rem: upstream is gone
[booboo.git] / eclass / fossil.eclass
blob6f820a770f9b4cda46086d00bfa58443b428e145
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
6 # Original Author: l29ah
7 # Purpose: fuck you
10 inherit eutils
12 EFOSSIL="$ECLASS"
14 case "${EAPI:-0}" in
15 0|1|2|3|4) die "this eclass doesn't support older EAPIs" ;;
16 esac
18 EXPORT_FUNCTIONS src_unpack
20 PROPERTIES+=" live"
22 [[ -z ${EFOSSIL_STORE_DIR} ]] && EFOSSIL_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/fossil-src"
25 EFOSSIL_PROJECT="${EFOSSIL_PROJECT:-${PN/-fossil}}"
27 fossil_fetch() {
28 local repo_uri="${1:-${EFOSSIL_REPO_URI}}"
29 local S_dest="${2}"
31 addwrite "${EFOSSIL_STORE_DIR}"
32 if [[ ! -d ${EFOSSIL_STORE_DIR} ]]; then
33 debug-print "${FUNCNAME}: initial checkout. creating fossil directory"
34 mkdir -m 775 -p "${EFOSSIL_STORE_DIR}" || die "${EFOSSIL}: can't mkdir ${EFOSSIL_STORE_DIR}."
36 pushd "${EFOSSIL_STORE_DIR}" >/dev/null || die "${EFOSSIL}: can't chdir to ${EFOSSIL_STORE_DIR}"
37 mkdir -m 775 -p "${EFOSSIL_PROJECT}" || die "${EFOSSIL}: can't mkdir ${EFOSSIL_PROJECT}."
38 cloned_repo="${EFOSSIL_STORE_DIR}/${EFOSSIL_PROJECT}/${repo_uri##*/}"
39 if [[ -e "$cloned_repo" ]]; then
40 fossil --user portage pull -R "$cloned_repo" "$repo_uri" || die "${EFOSSIL}: can't pull ${repo_uri}."
41 else
42 fossil --user portage clone "$repo_uri" "$cloned_repo" || die "${EFOSSIL}: can't clone ${repo_uri}."
45 if ! has "export" ${EFOSSIL_RESTRICT}; then
46 local S="${S}/${S_dest}"
47 mkdir -p "${S}"
48 cd "$S"
49 fossil open --nested "$cloned_repo"
52 popd >/dev/null
55 fossil_src_unpack() {
56 fossil_fetch
59 DEPEND+=" dev-vcs/fossil"