From 026baf3f25aa5a91ffa7bd36e3688a180ddbdc63 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Thu, 2 Nov 2023 17:09:23 +0100 Subject: [PATCH] package/pkg-golang: handle licensing terms for host-only packages The licensing terms are inherited from the target variant to the host variant: when the host _LICENSE is empty, then the value of the target _LICENSE is used. However, for the golang infra, we want to append a little blurb about vendored depndencies. If the package is a host-only, then it would inherit the target _LICENSE, i.e. the variable without the leading HOST_. If that is defined, this is inherited in the generic-package part of the infra, but in the golang infra, we saw an empty variable, and so we would not add the vendoring blurb. We can't move the condition appending that blurb, after we called into the generic-package infra, otherwise in that case, we'd have the opposite issue for packages that are both target and host packages, where the blurb would be duplicated for host packages... Instead, we workaround the issue by duplicating the heuristic to inherit the target value, from the generic- into the golang-package infra. Signed-off-by: Yann E. MORIN Signed-off-by: Arnout Vandecappelle (cherry picked from commit aa87875b9f22f19bd1ee5f9c6d6a3e9eb49ebc2b) Signed-off-by: Peter Korsgaard --- package/pkg-golang.mk | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/package/pkg-golang.mk b/package/pkg-golang.mk index 1fa0b001e0..8e27602d41 100644 --- a/package/pkg-golang.mk +++ b/package/pkg-golang.mk @@ -91,6 +91,15 @@ $(2)_DL_ENV += \ GOPROXY=direct \ $$($(2)_GO_ENV) +# Because we append vendored info, we can't rely on the values being empty +# once we eventually get into the generic-package infra. So, we duplicate +# the heuristics here +ifndef $(2)_LICENSE + ifdef $(3)_LICENSE + $(2)_LICENSE = $$($(3)_LICENSE) + endif +endif + # Due to vendoring, it is pretty likely that not all licenses are # listed in _LICENSE. If the license is unset, it is "unknown" # so adding unknowns to some unknown is still some other unkown,