sys-kernel/linux-firmware: treeclean
[booboo.git] / eclass / fossil.eclass
blob93c69e9f4368c38e6be504f68904d21e924ed067
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 EFOSSIL="$ECLASS"
12 case "${EAPI:-0}" in
13 0|1|2|3|4) die "this eclass doesn't support older EAPIs" ;;
14 5|6|7) inherit eutils ;;
15 esac
17 EXPORT_FUNCTIONS src_unpack
19 PROPERTIES+=" live"
21 [[ -z ${EFOSSIL_STORE_DIR} ]] && EFOSSIL_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/fossil-src"
24 EFOSSIL_PROJECT="${EFOSSIL_PROJECT:-${PN/-fossil}}"
26 fossil_fetch() {
27 local repo_uri="${1:-${EFOSSIL_REPO_URI}}"
28 local S_dest="${2}"
30 addwrite "${EFOSSIL_STORE_DIR}"
31 if [[ ! -d ${EFOSSIL_STORE_DIR} ]]; then
32 debug-print "${FUNCNAME}: initial checkout. creating fossil directory"
33 mkdir -m 775 -p "${EFOSSIL_STORE_DIR}" || die "${EFOSSIL}: can't mkdir ${EFOSSIL_STORE_DIR}."
35 pushd "${EFOSSIL_STORE_DIR}" >/dev/null || die "${EFOSSIL}: can't chdir to ${EFOSSIL_STORE_DIR}"
36 mkdir -m 775 -p "${EFOSSIL_PROJECT}" || die "${EFOSSIL}: can't mkdir ${EFOSSIL_PROJECT}."
37 cloned_repo="${EFOSSIL_STORE_DIR}/${EFOSSIL_PROJECT}/${repo_uri##*/}"
38 if [[ -e "$cloned_repo" ]]; then
39 fossil pull -R "$cloned_repo" "$repo_uri" || die "${EFOSSIL}: can't pull ${repo_uri}."
40 else
41 fossil clone "$repo_uri" "$cloned_repo" || die "${EFOSSIL}: can't clone ${repo_uri}."
44 if ! has "export" ${EFOSSIL_RESTRICT}; then
45 local S="${S}/${S_dest}"
46 mkdir -p "${S}"
47 cd "$S"
48 fossil open --nested "$cloned_repo"
51 popd >/dev/null
54 fossil_src_unpack() {
55 fossil_fetch
58 DEPEND+=" dev-vcs/fossil"