Skip to content

Add GoPackage EasyBlock#2042

Merged
boegel merged 9 commits intoeasybuilders:developfrom
Darkless012:add_gopackage_easyblock
Apr 27, 2020
Merged

Add GoPackage EasyBlock#2042
boegel merged 9 commits intoeasybuilders:developfrom
Darkless012:add_gopackage_easyblock

Conversation

@Darkless012
Copy link
Copy Markdown
Contributor

No description provided.

@Darkless012
Copy link
Copy Markdown
Contributor Author

Yet another take on reproducible go package easyblock.
Related: #1629 #1466

This time GoPackage easyblock is using go modules which are currently "the way to go" with managing dependencies in go.

Setting only GOBIN to installdir/bin will ensure the binaries are put into correct place.
Apparently GOPATH is not a thing anymore...

How it works?

Option a) There is go.mod and go.sum in the downloaded package.
go install will download all the dependencies while go.sum ensures that those dependencies are always the same.

Option b) There is no go.mod and go.sum.
Go allows to pretty easy migration to native modules from various old "packaging" tools (https://blog.golang.org/migrating-to-go-modules)
In this case the bundle tries to do exactly that.

However "modulename" is required in this case. So that go knows how to call it.

Sometimes it also fails to pinpoint exact version of dependency, so "force_deps" is used to say go which version of that dependency is used.

Then it does all the magic.
As part of output there is generated go.mod and go.sum files in the log.

Ideally you should make patchfile with those 2 new files, and include that into build. And this should truly ensure reproducibility of the build.

@Darkless012 Darkless012 changed the title initial GoPackage EasyBlock Add GoPackage EasyBlock Apr 24, 2020
@boegel boegel added the new label Apr 24, 2020
@boegel boegel added this to the 4.x milestone Apr 24, 2020
Comment thread easybuild/easyblocks/generic/gopackage.py Outdated
Comment thread easybuild/easyblocks/generic/gopackage.py Outdated
Comment thread easybuild/easyblocks/generic/gopackage.py
Comment thread easybuild/easyblocks/generic/gopackage.py
Comment thread easybuild/easyblocks/generic/gopackage.py Outdated
Comment thread easybuild/easyblocks/generic/gopackage.py Outdated
Comment thread easybuild/easyblocks/generic/gopackage.py Outdated
Comment thread easybuild/easyblocks/generic/gopackage.py Outdated
Comment thread easybuild/easyblocks/generic/gopackage.py Outdated
# Go Package should produce something into bin directory
custom_paths = {
'files': [],
'dirs': ['bin'],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very generic... We can't derive anything from software name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very confident in naming in go. But it should match last part of Go module name, considering that main.go is in root. Otherwise it could be any name from any sub-folder producing binary.

The main reason for this "basic" check was that for example compiling gonum doesn't produce any binary, since it is intended to be used as dependency in go source. So you are able to build and install this package, but no binary will be dropped in bin and nothing you can use on easybuild will be installed.

Should we check the name (namelower)?
Consider this: https://github.com/evolbioinfo/gotree
They have 3 different names in single paragraph:
Gotree in heading
GoTree just below in description
gotree as cli command

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think assuming that there will be a bin/%(namelower)s makes sense, since this is only a default (it's easy to override in the easyconfig file).

This would work for both goalign and gotree.

Maybe also add %(namelower)s --help as default sanity check commands (via custom_commands here)?

Also easy to override in easyconfig file via sanity_check_commands.

@easybuilders easybuilders deleted a comment from boegelbot Apr 25, 2020
@easybuilders easybuilders deleted a comment from boegelbot Apr 25, 2020
@easybuilders easybuilders deleted a comment from boegelbot Apr 25, 2020
# Go Package should produce something into bin directory
custom_paths = {
'files': [],
'dirs': ['bin'],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think assuming that there will be a bin/%(namelower)s makes sense, since this is only a default (it's easy to override in the easyconfig file).

This would work for both goalign and gotree.

Maybe also add %(namelower)s --help as default sanity check commands (via custom_commands here)?

Also easy to override in easyconfig file via sanity_check_commands.

@boegel boegel modified the milestones: 4.x, next release (4.2.1?) Apr 27, 2020
Copy link
Copy Markdown
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@boegel boegel merged commit 566a14f into easybuilders:develop Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants