Porting of Smallstep CA

Adam Weinberger adamw at adamw.org
Wed Apr 8 01:34:24 UTC 2020


On Tue, Apr 7, 2020 at 2:08 PM Markus Wipp <mw at wipp.bayern> wrote:
>
> Hi all,
>
> I would like to create a port of the CA tool (basically two ports: cli and certificates) found on
> https://github.com/smallstep
> https://smallstep.com/
>
> What I tried so far was:
> 1) make it on my machine without the ports infrastructure. This basically works fine and without any errors and modifications needed ( I just do a gmake bootstrap and then a gmake build )
> 2) tried to create a port using the guide at https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/quick-porting.html
> 3) tried Slow porting, but I think I’m not really understanding how and where to begin
>
> The main issue is, that I don’t really know what I have to do here, to achieve what’s required to correctly build the port.
> It is the very first time I’m trying to create a port.

Hi Markus,

You're on the right track here. The next step is that none of the
stuff where go fetches a remote module can happen. All packages on the
cluster (and the vast majority of end-user-built sets) are built using
poudriere (ports-mgmt/poudriere), which shuts down all external
traffic during builds.

The port needs to specify all dependent modules. Take a look at
another go port, like www/gohugo for an idea of how this works.
net/geoipupdate is similar to what you're doing, where it needs go
modules, but is built with gmake.

You're misusing a couple constructs, but if you copy the framework in
geoipupdate and gohugo you'll resolve most of them (also, define
NO_WRKSUBDIR instead of setting WRKSRC=WRKDIR).

I'm not sure where golint is entering in, but it needs to not be
there. Linting is for upstream developers, and has no purpose for
end-user builds.

Does that help to get you started?

# Adam


>
> My Makefile looks like this:
>
> # $FreeBSD $
>
> PORTNAME=                       step-cli
> DISTVERSIONPREFIX=      v
> DISTVERSION=            0.14.0-rc.4
> CATEGORIES=                     security
> MASTER_SITES=           https://github.com/smallstep/cli/releases/download/v${DISTVERSION}/
> #PKGNAMESUFFIX=         0.14.0-rc.4
> DISTNAME=                       ${PORTNAME}_${DISTVERSION}
> MAINTAINER=                     mw at wipp.bayern
> COMMENT=                        Smallstep step-ca command line client
> LICENSE=                        APACHE20
>
> #WRKSRC=                        ${WRKDIR}/step-cli
> WRKSRC=                         ${WRKDIR}/
> NO_WRKSUBDIR=           yes
>
> BUILD_DEPENDS=          go>1:lang/go \
>                                         bash>5:shells/bash \
>                                         curl>7:ftp/curl \
>                                         golint:devel/golint
>
> USES=                           gmake
> MAKE_ARGS=                      build
>
>
> .include <bsd.port.mk>
>
>
> When I try to run make stage on this I get:
> root at pkgbuild:/usr/ports/security/step-cli # make stage
> ===>  Building for step-cli-0.14.0.r.4
> gmake[1]: Entering directory '/usr/ports/security/step-cli/work'
> /bin/sh: golangci-lint: not found
> gmake[1]: *** [make/common.mk:101: lint] Error 127
> gmake[1]: *** Waiting for unfinished jobs....
> go: finding module for package github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/go
> go: finding module for package github.com/shurcooL/github_flavored_markdown
> go: finding module for package github.com/samuel/go-zookeeper/zk
> go: finding module for package github.com/mozilla/scribe
> go: finding module for package golang.org/x/mobile/event/lifecycle
> go: finding module for package github.com/lyft/protoc-gen-star
> go: finding module for package github.com/ethereum/go-ethereum/ethclient
> go: finding module for package github.com/BurntSushi/xgb
> go: finding module for package github.com/ethereum/go-ethereum/rlp
> go: finding module for package github.com/oklog/oklog/pkg/group
> go: finding module for package github.com/influxdata/influxdb1-client/v2
> go: finding module for package gopkg.in/yaml.v1
> go: finding module for package github.com/hashicorp/consul/api
> go: finding module for package github.com/openzipkin/zipkin-go
> go: finding module for package github.com/iancoleman/strcase
> go: finding module for package github.com/BurntSushi/xgb/shm
> go: finding module for package golang.org/x/mobile/event/key
> go: finding module for package golang.org/x/image/math/fixed
> go: finding module for package github.com/gorilla/mux
> go: finding module for package github.com/ianlancetaylor/demangle
> go: finding module for package github.com/openzipkin-contrib/zipkin-go-opentracing
> go: finding module for package go.mozilla.org/mozlog
> go: finding module for package github.com/nats-io/nats.go
> go: finding module for package github.com/envoyproxy/protoc-gen-validate/tests/harness/go
> go: finding module for package github.com/Sirupsen/logrus
> go: finding module for package bitbucket.org/creachadair/shell
> go: finding module for package github.com/envoyproxy/protoc-gen-validate/tests/harness/gogo
> go: finding module for package sourcegraph.com/sourcegraph/appdash/opentracing
> go: finding module for package github.com/remyoudompheng/go-misc/zipfs
> go: finding module for package github.com/benlaurie/gds-registers/register
> go: finding module for package github.com/BurntSushi/xgb/render
> go: finding module for package github.com/shurcooL/gopherjslib
> go: finding module for package github.com/openzipkin/zipkin-go/reporter/http
> go: finding module for package golang.org/x/mobile/event/paint
> go: finding module for package sourcegraph.com/sourcegraph/appdash
> go: finding module for package github.com/VividCortex/gohistogram
> go: finding module for package github.com/shurcooL/httpfs/vfsutil
> go: finding module for package github.com/remyoudompheng/go-misc/weechat
> go: finding module for package github.com/miekg/dns
> go: finding module for package golang.org/x/mobile/event/mouse
> go: finding module for package github.com/lyft/protoc-gen-star/lang/go
> go: finding module for package gopkg.in/gcfg.v1
> go: finding module for package github.com/jgautheron/goconst
> go: finding module for package github.com/otiai10/copy
> go: finding module for package github.com/gorhill/cronexpr
> go: finding module for package gopkg.in/src-d/go-git.v4
> go: finding module for package github.com/godbus/dbus
> go: finding module for package github.com/lightstep/lightstep-tracer-go
> go: finding module for package golang.org/x/image/font/inconsolata
> go: finding module for package github.com/yudai/gojsondiff
> go: finding module for package github.com/openzipkin/zipkin-go/propagation/b3
> go: finding module for package github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/other_package/go
> go: finding module for package golang.org/x/mobile/geom
> go: finding module for package github.com/shurcooL/github_flavored_markdown/gfmstyle
> go: finding module for package github.com/BurntSushi/xgb/xproto
> go: finding module for package github.com/casbin/casbin/persist/file-adapter
> go: finding module for package github.com/remyoudompheng/go-misc/webclock
> go: finding module for package github.com/pact-foundation/pact-go/dsl
> go: finding module for package github.com/mgutz/ansi
> go: finding module for package github.com/casbin/casbin
> go: finding module for package github.com/google/licenseclassifier
> go: finding module for package github.com/streadway/handy/breaker
> go: finding module for package github.com/remyoudompheng/go-dbus
> go: finding module for package github.com/remyoudompheng/go-liblzma
> go: finding module for package github.com/aws/aws-sdk-go-v2/service/cloudwatch
> go: finding module for package github.com/remyoudompheng/go-misc/webtoys/irc
> go: finding module for package github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/other_package/gogo
> go: finding module for package github.com/aws/aws-sdk-go-v2/service/cloudwatch/cloudwatchiface
> go: finding module for package gopkg.in/urfave/cli.v1
> go: finding module for package golang.org/x/image/math/f64
> go: finding module for package golang.org/x/image/font
> go: finding module for package github.com/bradleyfalzon/revgrep
> go: finding module for package github.com/ethereum/go-ethereum/core/types
> go: finding module for package github.com/streadway/amqp
> go: finding module for package github.com/remyoudompheng/go-misc/nokia/mms
> go: finding module for package github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/gogo
> go: finding module for package github.com/google/go-github/github
> go: finding module for package github.com/sony/gobreaker
> go: finding module for package github.com/aws/aws-sdk-go-v2/aws
> go: finding module for package gopkg.in/pipe.v2
> go: finding module for package golang.org/x/mobile/event/size
> go: finding module for package github.com/afex/hystrix-go/hystrix
> go: finding module for package github.com/remyoudompheng/go-misc/webtoys/vdeck
> go: finding module for package golang.org/x/mobile/gl
> go: finding module for package github.com/pborman/getopt/v2
> go: finding module for package github.com/apache/thrift/lib/go/thrift
> go: finding module for package golang.org/x/image/math/f32
> go: finding module for package github.com/remyoudompheng/go-misc/pastehere
> go: finding module for package github.com/aws/aws-lambda-go/events
> go: finding module for package github.com/gregjones/httpcache/diskcache
> go: finding module for package github.com/remyoudompheng/go-misc/weblibs
> go: finding module for package github.com/remyoudompheng/go-misc/nokia/nbu
> go: finding module for package github.com/mattn/go-shellwords
> go: finding module for package github.com/gregjones/httpcache
> go: finding module for package github.com/performancecopilot/speed
> go: finding module for package github.com/hudl/fargo
> go: finding module for package honnef.co/go/js/dom
> go: finding module for package github.com/neelance/astrewrite
> go: finding module for package github.com/yudai/gojsondiff/formatter
> go: finding module for package golang.org/x/image/vector
> go: finding module for package github.com/viki-org/dnscache
> go: finding module for package github.com/aryann/difflib
> go: finding module for package github.com/openzipkin/zipkin-go/model
> go: finding module for package github.com/remyoudompheng/go-misc/nokia/nbf
> go: finding module for package github.com/openzipkin/zipkin-go/reporter/recorder
> go: finding module for package github.com/neelance/sourcemap
> go: finding module for package github.com/nats-io/nats-server/server
> go: found gopkg.in/urfave/cli.v1 in gopkg.in/urfave/cli.v1 v1.20.0
> go: found github.com/godbus/dbus in github.com/godbus/dbus v4.1.0+incompatible
> go: found gopkg.in/yaml.v1 in gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0
> go: found github.com/lyft/protoc-gen-star in github.com/lyft/protoc-gen-star v0.4.14
> go: found github.com/iancoleman/strcase in github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334
> go: found github.com/casbin/casbin in github.com/casbin/casbin v1.9.1
> go: found github.com/afex/hystrix-go/hystrix in github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5
> go: found github.com/sony/gobreaker in github.com/sony/gobreaker v0.4.1
> go: found github.com/streadway/handy/breaker in github.com/streadway/handy v0.0.0-20200128134331-0f66f006fb2e
> go: found github.com/apache/thrift/lib/go/thrift in github.com/apache/thrift v0.13.0
> go: found github.com/lightstep/lightstep-tracer-go in github.com/lightstep/lightstep-tracer-go v0.20.0
> go: found github.com/openzipkin-contrib/zipkin-go-opentracing in github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5
> go: found github.com/openzipkin/zipkin-go in github.com/openzipkin/zipkin-go v0.2.2
> go: found sourcegraph.com/sourcegraph/appdash in sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0
> go: found github.com/oklog/oklog/pkg/group in github.com/oklog/oklog v0.3.2
> go: found github.com/gorilla/mux in github.com/gorilla/mux v1.7.4
> go: found github.com/hashicorp/consul/api in github.com/hashicorp/consul/api v1.4.0
> go: found github.com/nats-io/nats.go in github.com/nats-io/nats.go v1.9.2
> go: found github.com/aws/aws-sdk-go-v2/aws in github.com/aws/aws-sdk-go-v2 v0.20.0
> go: found github.com/VividCortex/gohistogram in github.com/VividCortex/gohistogram v1.0.0
> go: found github.com/influxdata/influxdb1-client/v2 in github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d
> go: found github.com/performancecopilot/speed in github.com/performancecopilot/speed v3.0.0+incompatible
> go: found github.com/hudl/fargo in github.com/hudl/fargo v1.3.0
> go: found github.com/samuel/go-zookeeper/zk in github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da
> go: found github.com/streadway/amqp in github.com/streadway/amqp v0.0.0-20200108173154-1c71cc93ed71
> go: found github.com/remyoudompheng/go-misc/nokia/nbf in github.com/remyoudompheng/go-misc v0.0.0-20190427085024-2d6ac652a50e
> go: found github.com/remyoudompheng/go-liblzma in github.com/remyoudompheng/go-liblzma v0.0.0-20190506200333-81bf2d431b96
> go: found github.com/remyoudompheng/go-dbus in github.com/remyoudompheng/go-dbus v0.0.0-20121104212943-b7232d34b1d5
> go: found github.com/jgautheron/goconst in github.com/jgautheron/goconst v0.0.0-20200227150835-cda7ea3bf591
> go: found github.com/bradleyfalzon/revgrep in github.com/bradleyfalzon/revgrep v0.0.0-20170920092642-c04006dc3307
> go: found github.com/ianlancetaylor/demangle in github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6
> go: found github.com/ethereum/go-ethereum/ethclient in github.com/ethereum/go-ethereum v1.9.12
> go: found github.com/benlaurie/gds-registers/register in github.com/benlaurie/gds-registers v0.0.0-20180214133647-6355673a9585
> go: found bitbucket.org/creachadair/shell in bitbucket.org/creachadair/shell v0.0.6
> go: found github.com/otiai10/copy in github.com/otiai10/copy v1.1.1
> go: found github.com/google/licenseclassifier in github.com/google/licenseclassifier v0.0.0-20200402202327-879cb1424de0
> go: found gopkg.in/src-d/go-git.v4 in gopkg.in/src-d/go-git.v4 v4.13.1
> go: found github.com/neelance/sourcemap in github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c
> go: found github.com/shurcooL/httpfs/vfsutil in github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749
> go: found github.com/neelance/astrewrite in github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86
> go: found gopkg.in/gcfg.v1 in gopkg.in/gcfg.v1 v1.2.3
> go: found go.mozilla.org/mozlog in go.mozilla.org/mozlog v0.0.0-20170222151521-4bb13139d403
> go: found github.com/gorhill/cronexpr in github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75
> go: found github.com/viki-org/dnscache in github.com/viki-org/dnscache v0.0.0-20130720023526-c70c1f23c5d8
> go: found github.com/yudai/gojsondiff in github.com/yudai/gojsondiff v1.0.0
> go: found github.com/miekg/dns in github.com/miekg/dns v1.1.29
> go: found github.com/gregjones/httpcache in github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79
> go: found github.com/mozilla/scribe in github.com/mozilla/scribe v0.0.0-20180711195314-fb71baf557c1
> go: found github.com/pborman/getopt/v2 in github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3
> go: found github.com/mgutz/ansi in github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
> go: found github.com/shurcooL/github_flavored_markdown in github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470
> go: found github.com/shurcooL/gopherjslib in github.com/shurcooL/gopherjslib v0.0.0-20200209150458-30f639db26d4
> go: found honnef.co/go/js/dom in honnef.co/go/js/dom v0.0.0-20190526011328-ebc4cf92d81f
> go: found gopkg.in/pipe.v2 in gopkg.in/pipe.v2 v2.0.0-20140414041502-3c2ca4d52544
> go: found github.com/Sirupsen/logrus in github.com/Sirupsen/logrus v1.5.0
> go: found github.com/google/go-github/github in github.com/google/go-github v17.0.0+incompatible
> go: found github.com/mattn/go-shellwords in github.com/mattn/go-shellwords v1.0.10
> go: found golang.org/x/image/math/f64 in golang.org/x/image v0.0.0-20200119044424-58c23975cae1
> go: found golang.org/x/mobile/event/lifecycle in golang.org/x/mobile v0.0.0-20200329125638-4c31acba0007
> go: found github.com/BurntSushi/xgb in github.com/BurntSushi/xgb v0.0.0-20200324125942-20f126ea2843
> go: found github.com/aryann/difflib in github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a
> go: found github.com/pact-foundation/pact-go/dsl in github.com/pact-foundation/pact-go v1.2.0
> go: found github.com/aws/aws-lambda-go/events in github.com/aws/aws-lambda-go v1.16.0
> go: found github.com/nats-io/nats-server/server in github.com/nats-io/nats-server v1.4.1
> go: github.com/smallstep/zlint/cmd/zlint imports
>         github.com/Sirupsen/logrus: github.com/Sirupsen/logrus at v1.5.0: parsing go.mod:
>         module declares its path as: github.com/sirupsen/logrus
>                 but was required as: github.com/Sirupsen/logrus
> gmake[1]: *** [make/common.mk:82: test] Error 1
> gmake[1]: Leaving directory '/usr/ports/security/step-cli/work'
> ===> Compilation failed unexpectedly.
> Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
> the maintainer.
> *** Error code 1
>
> I’m not getting any errors , when building manually.
>
> Thanks for any help
> Markus
>
> _______________________________________________
> freebsd-ports at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-ports
> To unsubscribe, send any mail to "freebsd-ports-unsubscribe at freebsd.org"



-- 
Adam Weinberger
adamw at adamw.org
https://www.adamw.org


More information about the freebsd-ports mailing list