Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GoPackage EasyBlock #2042

Merged
merged 9 commits into from
Apr 27, 2020

Conversation

Darkless012
Copy link
Contributor

No description provided.

@Darkless012
Copy link
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
easybuild/easyblocks/generic/gopackage.py Outdated Show resolved Hide resolved
easybuild/easyblocks/generic/gopackage.py Outdated Show resolved Hide resolved
easybuild/easyblocks/generic/gopackage.py Show resolved Hide resolved
easybuild/easyblocks/generic/gopackage.py Show resolved Hide resolved
easybuild/easyblocks/generic/gopackage.py Outdated Show resolved Hide resolved
easybuild/easyblocks/generic/gopackage.py Outdated Show resolved Hide resolved
easybuild/easyblocks/generic/gopackage.py Outdated Show resolved Hide resolved
easybuild/easyblocks/generic/gopackage.py Outdated Show resolved Hide resolved
easybuild/easyblocks/generic/gopackage.py Outdated Show resolved Hide resolved
# Go Package should produce something into bin directory
custom_paths = {
'files': [],
'dirs': ['bin'],
Copy link
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
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
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
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
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