Message ID | 20210401154453.144605-2-aduskett@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | package/mender: make xz optional | expand |
Adam, All, On 2021-04-01 08:44 -0700, Adam Duskett spake thusly: > According to the README.md file, xz is optional. > - Remove the dependency on the xz package. > - If the xz package is not selected, add "nolzma" to MENDER_TAGS > > Signed-off-by: Adam Duskett <aduskett@gmail.com> > --- [--SNIP--] > diff --git a/package/mender/mender.mk b/package/mender/mender.mk > index 794dd4be8c..1ebd5a2e83 100644 > --- a/package/mender/mender.mk > +++ b/package/mender/mender.mk [--SNIP--] > @@ -81,6 +81,12 @@ endef > > MENDER_POST_INSTALL_TARGET_HOOKS += MENDER_INSTALL_CONFIG_FILES > > +ifeq ($(BR2_PACKAGE_XZ),y) > +MENDER_DEPENDENCIES += xz > +else > +MENDER_TAGS += nolzma FOO_TAGS is supposed to be a comma-separated list (but see later): https://golang.org/cmd/go/#hdr-Compile_packages_and_dependencies -tags tag,list a comma-separated list of build tags to consider satisfied during the build. For more information about build tags, see the description of build constraints in the documentation for the go/build package. (Earlier versions of Go used a space-separated list, and that form is deprecated but still recognized.) However, the += assignment operator in Makefile will create a space-separated list. So when we have neither xz nor dbus, we'll get: MENDER_TAGS=nolzma nodbus which is pased -as-is to the go build command: https://git.buildroot.org/buildroot/tree/package/pkg-golang.mk#n45 $(2)_BUILD_OPTS += \ -ldflags "$$($(2)_LDFLAGS)" \ -tags "$$($(2)_TAGS)" \ -trimpath \ -p $(PARALLEL_JOBS) So, even though the space-separated list is still supported, we should switch over to the comma-separated list. Either we require that packages do provide such a comma-seprated list, or we do it in the infra, with something along those lines: diff --git a/package/pkg-golang.mk b/package/pkg-golang.mk index d07242310d..bfa1a9e9ce 100644 --- a/package/pkg-golang.mk +++ b/package/pkg-golang.mk @@ -42,7 +42,7 @@ define inner-golang-package $(2)_BUILD_OPTS += \ -ldflags "$$($(2)_LDFLAGS)" \ - -tags "$$($(2)_TAGS)" \ + -tags "$$(subst $(space),$(comma),$$(strip $$($(2)_TAGS)))" \ -trimpath \ -p $(PARALLEL_JOBS) Note that we still need to quote, in case there is no tag, and we need to strip in case FOO_TAGS contains expansions itself, like FOO_TAGS = $(FOO_TAG_BLARK_MAYBE) $(FOO_TAG_MEH_MOSTLY) Care to look further into that, please? Regards, Yann E. MORIN. > +endif > + > ifeq ($(BR2_PACKAGE_DBUS),y) > define MENDER_INSTALL_DBUS_AUTHENTICATION_MANAGER_CONF > $(INSTALL) -D -m 0755 $(@D)/support/dbus/io.mender.AuthenticationManager.conf \ > -- > 2.30.2 > > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot
diff --git a/package/mender/Config.in b/package/mender/Config.in index accee4676a..5ac8bb1676 100644 --- a/package/mender/Config.in +++ b/package/mender/Config.in @@ -4,7 +4,6 @@ config BR2_PACKAGE_MENDER depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS depends on BR2_TOOLCHAIN_HAS_THREADS select BR2_PACKAGE_OPENSSL - select BR2_PACKAGE_XZ help Mender is an open source over-the-air (OTA) software updater for embedded Linux devices. Mender comprises a client diff --git a/package/mender/mender.mk b/package/mender/mender.mk index 794dd4be8c..1ebd5a2e83 100644 --- a/package/mender/mender.mk +++ b/package/mender/mender.mk @@ -38,7 +38,7 @@ MENDER_LICENSE_FILES = \ vendor/github.com/mattn/go-isatty/LICENSE \ vendor/github.com/bmatsuo/lmdb-go/LICENSE.mdb.md -MENDER_DEPENDENCIES = host-pkgconf openssl xz +MENDER_DEPENDENCIES = host-pkgconf openssl MENDER_LDFLAGS = -X github.com/mendersoftware/mender/conf.Version=$(MENDER_VERSION) @@ -81,6 +81,12 @@ endef MENDER_POST_INSTALL_TARGET_HOOKS += MENDER_INSTALL_CONFIG_FILES +ifeq ($(BR2_PACKAGE_XZ),y) +MENDER_DEPENDENCIES += xz +else +MENDER_TAGS += nolzma +endif + ifeq ($(BR2_PACKAGE_DBUS),y) define MENDER_INSTALL_DBUS_AUTHENTICATION_MANAGER_CONF $(INSTALL) -D -m 0755 $(@D)/support/dbus/io.mender.AuthenticationManager.conf \
According to the README.md file, xz is optional. - Remove the dependency on the xz package. - If the xz package is not selected, add "nolzma" to MENDER_TAGS Signed-off-by: Adam Duskett <aduskett@gmail.com> --- package/mender/Config.in | 1 - package/mender/mender.mk | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-)