Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH git-r3 09/10] Add EGIT_MIN_CLONE_TYPE to support ebuilds requiring greater clone type.
Date: Wed, 26 Feb 2014 12:05:10
Message-Id: 1393415954-19313-9-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCHES git-r3] Clean up and different clone type support by "Michał Górny"
1 Use-cases include Google Code (that doesn't support shallow clones) and
2 random build systems that play with history and 'git describe'.
3
4 However, please use this sparingly. When the build can't go on without
5 non-shallow clone, sure. But if it only results in non-pretty versions,
6 I think users choosing EGIT_CLONE_TYPE=shallow explicitly are ready to
7 deal with the fallout.
8 ---
9 eclass/git-r3.eclass | 31 +++++++++++++++++++++++++++++++
10 1 file changed, 31 insertions(+)
11
12 diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass
13 index 08b8ebb..33e66a6 100644
14 --- a/eclass/git-r3.eclass
15 +++ b/eclass/git-r3.eclass
16 @@ -58,6 +58,19 @@ fi
17 # embedded systems with limited disk space.
18 : ${EGIT_CLONE_TYPE:=single}
19
20 +# @ECLASS-VARIABLE: EGIT_MIN_CLONE_TYPE
21 +# @DESCRIPTION:
22 +# 'Minimum' clone type supported by the ebuild. Takes same values
23 +# as EGIT_CLONE_TYPE. When user sets a type that's 'lower' (that is,
24 +# later on the list) than EGIT_MIN_CLONE_TYPE, the eclass uses
25 +# EGIT_MIN_CLONE_TYPE instead.
26 +#
27 +# A common case is to use 'single' whenever the build system requires
28 +# access to full branch history or the remote (Google Code) does not
29 +# support shallow clones. Please use sparingly, and to fix fatal errors
30 +# rather than 'non-pretty versions'.
31 +: ${EGIT_MIN_CLONE_TYPE:=shallow}
32 +
33 # @ECLASS-VARIABLE: EGIT3_STORE_DIR
34 # @DESCRIPTION:
35 # Storage directory for git sources.
36 @@ -140,6 +153,24 @@ _git-r3_env_setup() {
37 *)
38 die "Invalid EGIT_CLONE_TYPE=${EGIT_CLONE_TYPE}"
39 esac
40 + case "${EGIT_MIN_CLONE_TYPE}" in
41 + shallow)
42 + ;;
43 + single)
44 + if [[ ${EGIT_CLONE_TYPE} == shallow ]]; then
45 + ewarn "git-r3: ebuild needs to be cloned in 'single' mode, adjusting"
46 + EGIT_CLONE_TYPE=single
47 + fi
48 + ;;
49 + mirror)
50 + if [[ ${EGIT_CLONE_TYPE} != mirror ]]; then
51 + ewarn "git-r3: ebuild needs to be cloned in 'mirror' mode, adjusting"
52 + EGIT_CLONE_TYPE=mirror
53 + fi
54 + ;;
55 + *)
56 + die "Invalid EGIT_MIN_CLONE_TYPE=${EGIT_MIN_CLONE_TYPE}"
57 + esac
58
59 local esc_pn livevar
60 esc_pn=${PN//[-+]/_}
61 --
62 1.8.3.2

Replies