tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Go packages with many dependencies



I want to package influxdb, but it has a lot of Go dependencies.
Packaging them all individually will not be fun, and may end up
clashing with requirements for different versions from other packages.

Building influxdb outside of pkgsrc uses go dep to fetch all of its
dependencies at a particular version, using a "Godeps" file that looks
like this:

  https://github.com/influxdata/influxdb/blob/master/Godeps

I wrote a small bit of infrastructure to go-package.mk that allows you
to specify these dependencies in a package Makefile and will add them
as additional DISTFILES to be built within the package.

  https://gist.github.com/jperkin/e55797d996e07c460e07b8ffc4c71b1a

As the name of the variable implies, this currently only supports
GitHub, as it seems that every package uses it whether it happens to
have an initial "go get" interface via their primary website or not
(e.g. go.uber.org just issues meta tags that redirect to github.com)

The influxdb package itself then has a bunch of these to mimic the
Godeps file:

  GO_GITHUB_DEPS+= collectd/go-collectd=collectd.org:2ce144541b8903101fb8f1483cc0497a68798122
  GO_GITHUB_DEPS+= BurntSushi/toml:a368813c5e648fee92e5f6c30e3944ff9d5e8895
  GO_GITHUB_DEPS+= RoaringBitmap/roaring:d6540aab65a17321470b1661bfc52da1823871e9

If the URL section contains a "=dir" then that's where the source is
relocated to, otherwise src/github.com/...

It's a bit rough and ready, but it works.  Comments welcome as whether
it's good enough as it stands or if we want to improve it to support
other sites, though I'd want to see enough examples where non-github
is used for the additional complexity to be worth it.

FreeBSD has something similar with its "GH_TUPLE" which looks like
this:

  GH_TUPLE+= collectd:go-collectd:e84e8af:go_collectd/src/collectd.org
  GH_TUPLE+= BurntSushi:toml:a368813:toml/src/github.com/BurntSushi/toml
  GH_TUPLE+= RoaringBitmap:roaring:cefad6e:roaring/src/github.com/RoaringBitmap/roaring

Thanks,

-- 
Jonathan Perkin  -  Joyent, Inc.  -  www.joyent.com


Home | Main Index | Thread Index | Old Index