Help building golang packages

I’m looking to help upgrade the rclone and restic packages in clear, but I’m not able to get them to build using autospec due to failed go dependencies. eg.

[FATAL] Cannot resolve dependency name: go-bazil.org-fuse

For my own learning purposes, and hopefully to help contribute to the project in future, is there something special I need to do to resolve this?

@ahkok or @pmccarty?

Add go-bazil.org-fuse to buildreq_ban file

Currently is a new feature for autospec that is in development.

Whenever a “Cannot resolve dependency name…” error is raised by autospec, it means that a build dependency has been autodetected that does not exist in the Clear Linux OS repo. Sometimes this occurs due to (a) a misdetected dependency, and other times, it is (b) a hint that a package is missing and should be added to the repo before continuing the build.

In this specific situation, scenario (b) applies. The new packages are detected because autospec recently gained more robust dependency detection for Golang packages, and the Clear Linux OS team has not yet added all Golang dependency (or godep) packages to satisfy those requirements.

So, until we actually add all of these packages, we will have to force autospec to build the package. My recommendation is to follow these steps:

  1. Ban unresolvable package names
    Add all the listed package names that autospec cannot resolve to the buildreq_ban file. Easiest is to copy/paste the results/root.log file into buildreq_ban, and filter out all of its content except for the package names in question. Eventually, the team will add these packages, but it will not happen in the near future.
  2. Change build pattern
    Force autospec to use make by running: echo make > build_pattern
  3. Use fallback build step
    Replace the contents of make_args with: || go build -mod vendor
  4. Skip install phase
    Add an install_macro file containing: true
4 Likes

This was exactly the kind of advice I was hoping for. Thanks @pmccarty.

1 Like

I tried to use autospec for some packages that only has make and no make install. And I ended up writing patches for the Makefile, but never realized that I can modify install_macro with true. It would be really helpful if practical examples like this are added to autospec documentation.

Boy do I have a list for this… Yes, we’re well aware of hacks like this, we’re also somewhat ashamed of them too. :slight_smile:

3 Likes