Saturday, November 30, 2019

Re: packer-vmm - how to retrieve go dependencies?

# $OpenBSD$

COMMENT= packer-builder-openbsd-vmm

GH_ACCOUNT= double-p
GH_PROJECT= packer-builder-openbsd-vmm
GH_COMMIT= 04f261659d2583393835fd904383dde6b134f049
DISTNAME= packer-builder-openbsd-vmm-0.0.20191130

MODGO_GHMOD= hashicorp packer v1.4.0 \
mitchellh go-homedir v1.0.0 \
pkg errors v0.8.1

DISTFILES= packer-builder-openbsd-vmm-{}${GH_COMMIT}.tar.gz

.for _a _p _c in ${MODGO_GHMOD}
DISTFILES+= ${_p}-{${_a}/${_p}/archive/}${_c}.tar.gz:0
.endfor

CATEGORIES= sysutils

# BSD
PERMIT_PACKAGE= Yes

WANTLIB= c pthread

MASTER_SITES0= https://github.com/

MODULES= lang/go
MODGO_TYPE= bin
NO_TEST= Yes

post-extract:
.for _a _p _c in ${MODGO_GHMOD}
mkdir -p ${WRKDIR}/go/src/github.com/${_a}
mv ${WRKDIR}/${_p}-${_c:S/v//} ${WRKDIR}/go/src/github.com/${_a}/${_p}
.endfor

.include <bsd.port.mk>
On 2019/11/30 11:16, Philipp Buehler wrote:
> Hi porters,
>
> it's time to make a port out of my packer-vmm plugin.
> https://github.com/double-p/packer-builder-openbsd-vmm
>
> As this is my first ports try at all, I am missing something blatantly
> obvious.
>
> The Makefile is in 'examples/Makefile.ports' and trying a
> 'make fake' per Porters Guide, this fails like so:
> ===
> ==> Building for packer-builder-openbsd-vmm-0.9.0
> cd /usr/ports/pobj/packer-builder-openbsd-vmm-0.9.0/go/src/github.com/double-p/packer-builder-openbsd-vmm
> && GOMAXPROCS=1
> GOCACHE=/usr/ports/pobj/packer-builder-openbsd-vmm-0.9.0/go-cache
> GOPATH=/usr/ports/pobj/packer-builder-openbsd-vmm-0.9.0/go make
> builder/openbsd-vmm/builder.go:9:2: cannot find package
> "github.com/hashicorp/packer/common" in any of:
> /usr/local/go/src/github.com/hashicorp/packer/common (from $GOROOT)
> /usr/ports/pobj/packer-builder-openbsd-vmm-0.9.0/go/src/github.com/hashicorp/packer/common
> (from $GOPATH)
> ===
> ..and more of the same.
>
> Clearly I need to (let) fetch the required (sub)packages - but how? List all
> subs in go.mod?
> I was looking into several lang/go ports, but cant say I am getting the
> magic sauce :)
>
> TIA,
> --
> pb
>

Here's one way to do it.

No comments:

Post a Comment