pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk In guess-license, use ninka for determining the lic...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d5dc12f4615b
branches:  trunk
changeset: 373645:d5dc12f4615b
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun Jan 07 19:44:31 2018 +0000

description:
In guess-license, use ninka for determining the licenses.

Ninka can be installed from wip/ninka and analyzes each file individually,
thereby providing a much more detailed analysis than the ad-hoc method that
only looks at some COPYING files.

If Ninka is not installed, the naive fallback continues to be used.

diffstat:

 mk/license.mk |  16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r ce689e5cc23f -r d5dc12f4615b mk/license.mk
--- a/mk/license.mk     Sun Jan 07 19:27:56 2018 +0000
+++ b/mk/license.mk     Sun Jan 07 19:44:31 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: license.mk,v 1.83 2018/01/05 07:54:39 rillig Exp $
+# $NetBSD: license.mk,v 1.84 2018/01/07 19:44:31 rillig Exp $
 #
 # This file handles everything about the LICENSE variable. It is
 # included automatically by bsd.pkg.mk.
@@ -242,10 +242,20 @@
 #      This is useful for package developers.
 #
 # Keywords: license
-guess-license:
-       ${RUN} [ -d ${WRKSRC} ] || ALLOW_VULNERABLE_PACKAGES=yes ${MAKE} fetch pre-extract do-extract
+guess-license: .PHONY
+       ${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}`; \



Home | Main Index | Thread Index | Old Index