From e89bbd60687cd3ecf361e2d286791ece2f3b5d66 Mon Sep 17 00:00:00 2001 From: baude Date: Fri, 22 Jun 2018 08:56:08 -0500 Subject: 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 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 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 Closes: #987 Approved by: rhatdan --- cmd/podman/main.go | 6 +++++- cmd/podman/varlink.go | 4 +++- cmd/podman/varlink_dummy.go | 9 +++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 cmd/podman/varlink_dummy.go (limited to 'cmd/podman') diff --git a/cmd/podman/main.go b/cmd/podman/main.go index 8ee86dd92..f936a332f 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -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 != "" { diff --git a/cmd/podman/varlink.go b/cmd/podman/varlink.go index ca3159460..f1bf2db6b 100644 --- a/cmd/podman/varlink.go +++ b/cmd/podman/varlink.go @@ -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, diff --git a/cmd/podman/varlink_dummy.go b/cmd/podman/varlink_dummy.go new file mode 100644 index 000000000..ec4bbb208 --- /dev/null +++ b/cmd/podman/varlink_dummy.go @@ -0,0 +1,9 @@ +// +build !varlink + +package main + +import ( + "github.com/urfave/cli" +) + +var varlinkCommand *cli.Command -- cgit v1.2.3-54-g00ecf