Commit e11efc27 authored by Kirill Smelkov's avatar Kirill Smelkov

golang: Break future gowork ⇄ go-git-package cycle

Consider a Go package that is defined via go-git-package, for example

    [helloweb]
    <= go-git-package
    go.importpath = lab.nexedi.com/nexedi/helloweb
    repository    = https://lab.nexedi.com/nexedi/helloweb.git

Currently, since go-git-package references ${gowork:src}, it creates
helloweb -> gowork dependency. gowork, in turn, depends on
gowork.goinstall, which gets list of things to install from ${gowork:install}.

Currently we put only plain strings into ${gowork.install}, e.g.

    [gowork]
    install =
       lab.nexedi.com/nexedi/helloweb/go/...

but for Go modules support and for properly expressing what depends on what,
we'll want in the next patch to be able to specify something like

    [gowork]
    install =
       ${helloweb:location}/go:./...

which will create helloweb ⇄ gowork cycle.

Unfortunately buildout does not detect nor report an error for such cycles, and
simply processes parts in an order, which leads to situation where e.g.
helloweb was not yet cloned, but gowork.goinstall tries to `go install` it and
complains "no such helloweb directory".

-> Fix it by leaving gowork to use by component/golang/ users, and putting
settings about where gowork directories is into underlying gowork.dir section.
parent db640aa7
......@@ -116,9 +116,9 @@ template= inline:
exec go "$@"
[gowork]
directory = ${buildout:directory}/go.work
src = ${:directory}/src
bin = ${:directory}/bin
directory = ${gowork.dir:directory}
src = ${gowork.dir:src}
bin = ${gowork.dir:bin}
depends = ${gowork.goinstall:recipe}
# go version used for the workspace (possible to override in applications)
......@@ -140,16 +140,19 @@ env.sh = ${gowork-env.sh:output}
[gowork-env.sh]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/goenv.sh.in
output = ${gowork:directory}/env.sh
depends = ${gowork.mkdir:recipe}
output = ${gowork.dir:directory}/env.sh
depends = ${gowork.dir:recipe}
md5sum = 6efdf5d63381c240c7d206d7939a63f7
[gowork.mkdir]
[gowork.dir]
directory = ${buildout:directory}/go.work
src = ${:directory}/src
bin = ${:directory}/bin
# NOTE do not use slapos.cookbook:mkdirectory here - if anything in software (not instance)
# uses slapos.cookbook:* in recipe - slapos.cookbook will get compiled against system
# libxml/libxslt or fail to bootstrap at all if those are not present.
recipe = plone.recipe.command
command = mkdir -p ${gowork:directory}
command = mkdir -p ${:directory}
update-command = ${:command}
stop-on-error = true
......@@ -175,4 +178,4 @@ git-executable = ${git:location}/bin/git
# generated with the help of gowork-snapshot tool.
[go-git-package]
<= git-repository
location = ${gowork:src}/${:go.importpath}
location = ${gowork.dir:src}/${:go.importpath}
......@@ -44,7 +44,7 @@ input = inline:
[helloweb-egg]
recipe = zc.recipe.egg:develop
egg = helloweb
setup = ${gowork:src}/lab.nexedi.com/nexedi/helloweb/python/
setup = ${go_lab.nexedi.com_nexedi_helloweb:location}/python/
[helloweb-python]
recipe = zc.recipe.egg:scripts
......@@ -86,7 +86,7 @@ environment =
[helloweb-ruby-bundle]
recipe = slapos.recipe.cmmi
path = ${gowork:src}/lab.nexedi.com/nexedi/helloweb/ruby/
path = ${go_lab.nexedi.com_nexedi_helloweb:location}/ruby/
configure-command = :
make-binary =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment