Add %cargo_license and %cargo_license_summary macros
This commit is contained in:
parent
23523b5fdc
commit
69b5574ce0
1 changed files with 38 additions and 0 deletions
|
@ -109,6 +109,44 @@ if %__cargo_is_bin; then \
|
|||
fi \
|
||||
)
|
||||
|
||||
# This macro prints license information for all crates in the dependency tree
|
||||
# that are neither build-dependencies, dev-dependencies nor proc-macro
|
||||
# dependencies.
|
||||
# Additionally, deprecated SPDX syntax is normalized before sorting the
|
||||
# results to ensure consistent order.
|
||||
%cargo_license(naf:)\
|
||||
%{shrink:\
|
||||
%{__cargo} tree \
|
||||
--workspace \
|
||||
--offline \
|
||||
--edges no-build,no-dev,no-proc-macro \
|
||||
--no-dedupe \
|
||||
--target all \
|
||||
%{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
|
||||
--prefix none \
|
||||
--format "{l}: {p}" \
|
||||
| sed -e "s: ($(pwd)[^)]*)::g" -e "s: / :/:g" -e "s:/: OR :g" \
|
||||
| sort -u
|
||||
}
|
||||
|
||||
# This macro prints license summary for all crates in the dependency tree that
|
||||
# are neither dev-dependencies nor proc-macros. Additionally, deprecated SPDX
|
||||
# syntax is normalized before sorting the results to ensure consistent order.
|
||||
%cargo_license_summary(naf:)\
|
||||
%{shrink:\
|
||||
%{__cargo} tree \
|
||||
--workspace \
|
||||
--offline \
|
||||
--edges no-build,no-dev,no-proc-macro \
|
||||
--no-dedupe \
|
||||
--target all \
|
||||
%{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
|
||||
--prefix none \
|
||||
--format "# {l}" \
|
||||
| sed -e "s: / :/:g" -e "s:/: OR :g" \
|
||||
| sort -u \
|
||||
}
|
||||
|
||||
%__cargo_feature_from_name(n:) %{lua:
|
||||
local name = rpm.expand("%{-n*}")
|
||||
local feature = string.match(name, "^[^+]+%+(.+)-devel$")
|
||||
|
|
Loading…
Reference in a new issue