[oe-commits] [openembedded-core] 54/59: go.bbclass: add do_unpack function to handle common cases
git at git.openembedded.org
git at git.openembedded.org
Mon Sep 11 16:31:45 UTC 2017
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master
in repository openembedded-core.
commit efcf6513b71021ea4bfe6fbaa326e6591dee487d
Author: Matt Madison <matt at madison.systems>
AuthorDate: Fri Sep 8 18:04:41 2017 -0300
go.bbclass: add do_unpack function to handle common cases
Go source trees have a particular structure, with all
sources located under ${GOROOT}/src/<import-path>.
The fetcher step implemented by the 'go get' command
automatically follows this structure, so we need
to do the same here.
Since most Go packages are hosted in git repositories,
this adds a custom do_unpack() function that sets
the destsuffix to match the expected directory structure,
for any git SRC_URIs that haven't had a destsuffix
explicitly set in the recipe.
This simplifies recipe writing for the most common
cases.
Signed-off-by: Matt Madison <matt at madison.systems>
Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/classes/go.bbclass | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index cfe773e..c1ef01f 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -55,6 +55,24 @@ GO_INSTALL ?= "${GO_IMPORT}/..."
B = "${WORKDIR}/build"
+python go_do_unpack() {
+ src_uri = (d.getVar('SRC_URI') or "").split()
+ if len(src_uri) == 0:
+ return
+
+ try:
+ fetcher = bb.fetch2.Fetch(src_uri, d)
+ for url in fetcher.urls:
+ if fetcher.ud[url].type == 'git':
+ if fetcher.ud[url].parm.get('destsuffix') is None:
+ s_dirname = os.path.basename(d.getVar('S'))
+ fetcher.ud[url].parm['destsuffix'] = os.path.join(s_dirname, 'src',
+ d.getVar('GO_IMPORT')) + '/'
+ fetcher.unpack(d.getVar('WORKDIR'))
+ except bb.fetch2.BBFetchException as e:
+ raise bb.build.FuncFailed(e)
+}
+
go_do_configure() {
ln -snf ${S}/src ${B}/
}
@@ -79,4 +97,4 @@ go_do_install() {
fi
}
-EXPORT_FUNCTIONS do_configure do_compile do_install
+EXPORT_FUNCTIONS do_unpack do_configure do_compile do_install
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list