pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk mk/license.mk: drop the selfmade license guessing c...
details: https://anonhg.NetBSD.org/pkgsrc/rev/c4718b27595b
branches: trunk
changeset: 375701:c4718b27595b
user: rillig <rillig%pkgsrc.org@localhost>
date: Mon Feb 19 12:58:51 2018 +0000
description:
mk/license.mk: drop the selfmade license guessing code in favor of ninka
diffstat:
mk/license.mk | 59 ++++++++++++++---------------------------------------------
1 files changed, 14 insertions(+), 45 deletions(-)
diffs (74 lines):
diff -r 5be4db961bcf -r c4718b27595b mk/license.mk
--- a/mk/license.mk Mon Feb 19 12:58:26 2018 +0000
+++ b/mk/license.mk Mon Feb 19 12:58:51 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: license.mk,v 1.85 2018/02/03 17:38:13 kamil Exp $
+# $NetBSD: license.mk,v 1.86 2018/02/19 12:58:51 rillig Exp $
#
# This file handles everything about the LICENSE variable. It is
# included automatically by bsd.pkg.mk.
@@ -246,51 +246,20 @@
#
# Keywords: license
guess-license: .PHONY
- ${RUN} [ -d ${WRKSRC} ] || ALLOW_VULNERABLE_PACKAGES=yes ${MAKE} makedirs fetch pre-extract do-extract
+ @# Running "make extract" would fetch and build the dependencies
+ ${RUN} [ -d ${WRKSRC} ] \
+ || ALLOW_VULNERABLE_PACKAGES=yes ${MAKE} makedirs fetch pre-extract do-extract
+
${RUN} \
- ${PHASE_MSG} "Guessing package license"; \
\
- if type ninka > /dev/null 2>&1; then \
- (cd ${WRKDIR} && ${FIND} ./* -type f -print \
- | ${XARGS} ninka \
- | ${AWK} -F ';' '{ print $$2 }' \
- | LC_ALL=C ${SORT} | uniq -c | LC_ALL=C ${SORT} -nr \
- | ${AWK} 'BEGIN { printf("%5s %s\n", "Files", "License") } { printf("%5d %s\n", $$1, $$2); }'); \
- exit 0; \
- fi; \
- \
- type wdiff > /dev/null 2>&1 || ${FAIL_MSG} "To guess the license, textproc/wdiff must be installed."; \
- \
- pkgfiles=`find ${WRKSRC} -type f -print | ${EGREP} '/COPYING|/LICEN[CS]E|/COPYRIGHT' | LC_ALL=C ${SORT}`; \
- case $$pkgfiles in *'${.newline}'*) printf "The package has more than one license file:\n\n%s\n" "$$pkgfiles"; exit; esac; \
+ type ninka > /dev/null 2>&1 || ${FAIL_MSG} "To guess the license, wip/ninka must be installed."; \
\
- { \
- bestsize=1000000; \
- bestlicense=; \
- pkglicense="$$pkgfiles"; \
- ${PRINTF} "%8s %s\n" "Wdiff" "License"; \
- for license in ${PKGSRCDIR}/licenses/*; do \
- if [ -f "$$pkglicense" ] && [ -f "$$license" ]; then \
- size=`{ wdiff -3 "$$pkglicense" "$$license" || true; } | wc -c`; \
- if [ "$$size" -lt "$$bestsize" ]; then \
- ${PRINTF} "%8d %s\n" "$$size" "$${license##*/}"; \
- bestsize="$$size"; \
- bestlicense="$$license"; \
- fi \
- fi \
- done; \
+ ${PHASE_MSG} "Guessing licenses for ${PKGNAME}"; \
\
- if [ "$$bestlicense" ]; then \
- echo ""; \
- echo "Line differences in license texts:"; \
- echo ""; \
- diff -wu "$$bestlicense" "$$pkglicense" || true; \
- echo ""; \
- echo "Word differences in license texts:"; \
- echo ""; \
- wdiff -3 "$$bestlicense" "$$pkglicense" || true; \
- else \
- echo "No license file found in ${WRKSRC}:"; \
- ls -l ${WRKSRC}; \
- fi \
- } | $${PAGER:-less}
+ : "Note that ninka can only handle one file at a time; therefore the slow loop below."; \
+ cd ${WRKDIR} \
+ && ${FIND} ./* -type f -print \
+ | while read fname; do ninka "$$fname"; done \
+ | ${AWK} -F ';' '{ print $$2 }' \
+ | LC_ALL=C ${SORT} | uniq -c | LC_ALL=C ${SORT} -nr \
+ | ${AWK} 'BEGIN { printf("%5s %s\n", "Files", "License") } { printf("%5d %s\n", $$1, $$2); }'
Home |
Main Index |
Thread Index |
Old Index