make varlink optional for podman

some platforms and operating systems do not have varlink.  in those cases,
we need to be able to turn off enablement of varlink in podman. this can now
be done with BUILDTAGS passed to the build though perhaps in the future
will be better.

the default is to build with varlink

Signed-off-by: baude <bbaude@redhat.com>

squash! make varlink optional for podman

The API.md and cmd/podman/varlink/ioprojectatomicpodman.go targets
will continue to work regardless of the presence (or not) of 'varlink'
is in BUILDTAGS.  However, cmd/podman/varlink/ioprojectatomicpodman.go
is now only required by the podman target when BUILDTAGS contains
'varlink'.

API.md had also been an podman dependency since 5b2627dd (Makefile:
Drop find-godeps.sh for podman target, 2018-05-15, #776) when I
expanded varlink_api_generate.  It had been an indirect podman
dependency (via varlink_api_generate) since 25263558 (Generate varlink
API documentation automatically, 2018-05-07, #734).  But the podman
executable obviously doesn't depend on the Markdown file, so I'm
removing that dependency here.

Signed-off-by: baude <bbaude@redhat.com>

squash! make varlink optional for podman

The command-pointer approach will scale well if/when we add additional
optional commands behind their own build tags, because those tags
won't all be competing for the same getOptionalCommands namespace.

Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #987
Approved by: rhatdan
This commit is contained in:
baude 2018-06-22 08:56:08 -05:00 committed by Atomic Bot
parent 7182339d1a
commit e89bbd6068
4 changed files with 24 additions and 4 deletions

View file

@ -17,7 +17,12 @@ ETCDIR ?= ${DESTDIR}/etc
ETCDIR_LIBPOD ?= ${ETCDIR}/crio
TMPFILESDIR ?= ${PREFIX}/lib/tmpfiles.d
SYSTEMDDIR ?= ${PREFIX}/lib/systemd/system
BUILDTAGS ?= seccomp $(shell hack/btrfs_tag.sh) $(shell hack/libdm_tag.sh) $(shell hack/btrfs_installed_tag.sh) $(shell hack/ostree_tag.sh) $(shell hack/selinux_tag.sh)
BUILDTAGS ?= seccomp $(shell hack/btrfs_tag.sh) $(shell hack/libdm_tag.sh) $(shell hack/btrfs_installed_tag.sh) $(shell hack/ostree_tag.sh) $(shell hack/selinux_tag.sh) varlink
ifneq (,$(findstring varlink,$(BUILDTAGS)))
PODMAN_VARLINK_DEPENDENCIES = cmd/podman/varlink/ioprojectatomicpodman.go
endif
PYTHON ?= /usr/bin/python3
HAS_PYTHON3 := $(shell command -v python3 2>/dev/null)
@ -92,7 +97,7 @@ test/copyimg/copyimg: .gopathok $(wildcard test/copyimg/*.go)
test/checkseccomp/checkseccomp: .gopathok $(wildcard test/checkseccomp/*.go)
$(GO) build -ldflags '$(LDFLAGS)' -tags "$(BUILDTAGS) containers_image_ostree_stub" -o $@ $(PROJECT)/test/checkseccomp
podman: .gopathok API.md cmd/podman/varlink/ioprojectatomicpodman.go
podman: .gopathok $(PODMAN_VARLINK_DEPENDENCIES)
$(GO) build -i -ldflags '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS)" -o bin/$@ $(PROJECT)/cmd/podman
python-podman:

View file

@ -75,10 +75,14 @@ func main() {
topCommand,
umountCommand,
unpauseCommand,
varlinkCommand,
versionCommand,
waitCommand,
}
if varlinkCommand != nil {
app.Commands = append(app.Commands, *varlinkCommand)
}
app.Before = func(c *cli.Context) error {
logLevel := c.GlobalString("log-level")
if logLevel != "" {

View file

@ -1,3 +1,5 @@
// +build varlink
package main
import (
@ -25,7 +27,7 @@ var (
Value: 1000,
},
}
varlinkCommand = cli.Command{
varlinkCommand = &cli.Command{
Name: "varlink",
Usage: "Run varlink interface",
Description: varlinkDescription,

View file

@ -0,0 +1,9 @@
// +build !varlink
package main
import (
"github.com/urfave/cli"
)
var varlinkCommand *cli.Command