diff mbox series

[2/8] package/pkg-cargo: handle licensing terms for host-only packages

Message ID dd69769d22bceb5d8538495e395f1a7aed4fb4e4.1698941362.git.yann.morin@orange.com
State Accepted
Headers show
Series [1/8] package/pkg-cargo: don't expand license info when empty | expand

Commit Message

Yann E. MORIN Nov. 2, 2023, 4:09 p.m. UTC
From: "Yann E. MORIN" <yann.morin@orange.com>

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 <yann.morin@orange.com>
---
 package/pkg-cargo.mk | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

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 <pkg>_LICENSE. If the license is unset, it is "unknown"
 # so adding unknowns to some unknown is still some other unkown,