[Slackbuilds-users] RFC for building a golang with modules program (restic)
erich.public at protonmail.com
Wed Jan 13 00:02:15 UTC 2021
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, January 12, 2021 3:14 PM, 414N <414N at slacky.it> wrote:
> I could not find info about this topic, so I decided to ask directly.
> I'm working on a restic SlackBuild script that builds it from source.
> Given that:
> 1. the program is written in golang;
> 2. it uses the new-ish module system for itself and its dependencies,
> which also simplifies the build procedure (no need to "emulate" the
> previously expected $GOPATH/src/package_name directory structure);
> 3. the dependencies get automatically downloaded during build in
> what I devised when building it is the following:
> 4. override GOPATH, GOCACHE and GOENV to a path under $TMP to avoid
> polluting /root/go with build artifacts/caches;
> 5. packaged all the dependencies downloaded during "go get" under
> $GOPATH/pkg/mod in a ~100MB tarball, that gets unpacked before building
> if found -- this should enable totally offline and reproducible builds,
> while also speeding up the build process.
> I'd like to inquire if these measures are acceptable for a SBo
> submission and, in case, where should the "dependencies cache" be put
> (SBo SF.net repo?).
> Given that currently there are no SlackBuild templates for golang
> programs, I can also contribute one based on what I've done with restic.
> : https://restic.net/
> : https://sourceforge.net/projects/slackbuildsdirectlinks/
Can you treat it similarly to how some of the Rust builds do it? For example:
directly downloads all the dependencies and builds everything at once. This works because direct downloads can be obtained for each and every dependency.
When updating the program, every dependency is not necessarily updated. If you use sbopkg, then the old (still valid) dependencies will still exist in /var/cache/sbopkg/, which avoids having to re-download them.
Don't credit this methodology to me - I just copied my SlackBuild from an already-existing SlackBuild (don't remember which).
> Kindest regards
> Alan Alberghini
More information about the SlackBuilds-users