summaryrefslogtreecommitdiffstats
path: root/eclass/g-sorcery.eclass
blob: 338dc83f675f307be0060219ed930ad71ccb8c95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
# automatically generated by g-sorcery
# please do not edit this file
#
# Original Author: Jauhien Piatlicki <piatlicki@gmail.com>
# Purpose: base routines for g-sorcery backends' eclasses
#
# Bugs to piatlicki@gmail.com
#
# @ECLASS: g-sorcery.eclass
#
# @ECLASS-VARIABLE: REPO_URI
# @DESCRIPTION: address of a repository with sources
#
# @ECLASS-VARIABLE: DIGEST_SOURCES
# @DESCRIPTION: whether manifest for sources exists
#
# @ECLASS-VARIABLE: SOURCEFILE
# @DESCRIPTION: source file name
#
# @ECLASS-VARIABLE: GSORCERY_STORE_DIR
# @DESCRIPTION: store location for downloaded sources
GSORCERY_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}"
#
# @ECLASS-VARIABLE: GSORCERY_FETCH_CMD
# @DESCRIPTION: fetch command
GSORCERY_FETCH_CMD="wget"

EXPORT_FUNCTIONS src_unpack

g-sorcery_fetch() {
	addwrite "${GSORCERY_STORE_DIR}"
	pushd "${GSORCERY_STORE_DIR}" >/dev/null || die "can't chdir to ${GSORCERY_STORE_DIR}"
	if [[ ! -f "${SOURCEFILE}" ]]; then
		$GSORCERY_FETCH_CMD ${REPO_URI}${SOURCEFILE} || die
	fi
	popd >/dev/null || die
}

g-sorcery_src_unpack() {
	if [[ x${DIGEST_SOURCES} = x ]]; then
		g-sorcery_fetch
	fi

	cp ${GSORCERY_STORE_DIR}/${SOURCEFILE} . || die
	unpack ./${SOURCEFILE}
}