Gentoo Archives: gentoo-dev

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>, Donnie Berkholz <dberkholz@g.o>, Sergei Trofimovich <slyfox@g.o>
Subject: [gentoo-dev] [PATCH 2/2] Allow user mangle distfiles' "${EGIT_DIR}" after actual git fetch.
Date: Tue, 27 Nov 2012 19:24:39
Message-Id: 1354044140-27037-2-git-send-email-slyfox@gentoo.org
In Reply to: [gentoo-dev] [PATCH 1/2] Set default EGIT_SOURCEDIR to point to standard ${WORKDIR}/${P}. It allows "${S}" overriding in user's code as other eclasses do: by Sergei Trofimovich
1 EGIT_REPO_URI="https://github.com/ghc/ghc.git"
2 requires user to run './sync-all fetch / ./sync-all pull'
3 after actual 'git pull', which fetches 20 more repos for code changes.
4 Upstream does not use submodules.
5
6 The patch injects user's callback right before 'git-2_move_source'.
7 Currently I abuse 'git-2_gc':
8
9 Original ebuild: https://github.com/gentoo-haskell/gentoo-haskell/blob/master/dev-lang/ghc/ghc-9999.ebuild#L180
10
11 Signed-off-by: Sergei Trofimovich <slyfox@g.o>
12 ---
13 git-2.eclass | 24 ++++++++++++++++++++++++
14 1 file changed, 24 insertions(+)
15
16 diff --git a/git-2.eclass b/git-2.eclass
17 index 1a96978..1bacef5 100644
18 --- a/git-2.eclass
19 +++ b/git-2.eclass
20 @@ -569,6 +569,29 @@ git-2_cleanup() {
21 unset EGIT_LOCAL_NONBARE
22 }
23
24 +
25 +# @FUNCTION: git-2_fetch_user
26 +# @DESCRIPTION:
27 +# User-overridable callback allow user to update
28 +# sources in "${EGIT_DIR}" (current location).
29 +# Does nothing by default
30 +git-2_fetch_user() {
31 + :
32 +}
33 +
34 +# @FUNCTION: git-2_post_fetch
35 +# @INTERNAL
36 +# Internal function calling user's callback
37 +# when "${EGIT_DIR}" needs more actions, than
38 +# simple fetch.
39 +git-2_post_fetch() {
40 + debug-print-function ${FUNCNAME} "$@"
41 +
42 + pushd "${EGIT_DIR}" > /dev/null
43 + git-2_fetch_user
44 + popd > /dev/null
45 +}
46 +
47 # @FUNCTION: git-2_src_unpack
48 # @DESCRIPTION:
49 # Default git src_unpack function.
50 @@ -581,6 +604,7 @@ git-2_src_unpack() {
51 git-2_fetch "$@"
52 git-2_gc
53 git-2_submodules
54 + git-2_post_fetch
55 git-2_move_source
56 git-2_branch
57 git-2_bootstrap
58 --
59 1.8.0

Replies