From 049ea7b389e1f4657aa7683b6a6241e021817b76 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Thu, 2 Nov 2023 17:09:21 +0100 Subject: [PATCH] package/pkg-cargo: 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 cargo 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 cargo 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 cargo-package infra. Signed-off-by: Yann E. MORIN Signed-off-by: Arnout Vandecappelle --- package/pkg-cargo.mk | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/package/pkg-cargo.mk b/package/pkg-cargo.mk index 7802c3a883..2c277f7079 100644 --- a/package/pkg-cargo.mk +++ b/package/pkg-cargo.mk @@ -95,6 +95,15 @@ ifneq ($$($(2)_SUBDIR),) $(2)_DL_ENV += BR_CARGO_MANIFEST_PATH=$$($(2)_SUBDIR)/Cargo.toml endif +# 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,