diff options
author | rillig <rillig@pkgsrc.org> | 2018-01-03 00:41:37 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2018-01-03 00:41:37 +0000 |
commit | e6d04d6cda009afc86f1f3193873849ecb7595a3 (patch) | |
tree | e389d353965a11ae802f6034b4235f77919e4c0d /mk | |
parent | 10360988dc026718f4b4fb6f6e50da5497034aea (diff) | |
download | pkgsrc-e6d04d6cda009afc86f1f3193873849ecb7595a3.tar.gz |
Improved guess-license for practical use.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/license.mk | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/mk/license.mk b/mk/license.mk index 0b020d7f4be..2dd4620cb00 100644 --- a/mk/license.mk +++ b/mk/license.mk @@ -1,4 +1,4 @@ -# $NetBSD: license.mk,v 1.81 2018/01/02 22:40:32 rillig Exp $ +# $NetBSD: license.mk,v 1.82 2018/01/03 00:41:37 rillig Exp $ # # This file handles everything about the LICENSE variable. It is # included automatically by bsd.pkg.mk. @@ -242,16 +242,17 @@ PKG_FAIL_REASON+= \ # This is useful for package developers. # # Keywords: license - guess-license: - ${RUN} ${MAKE} extract + ${RUN} [ -d ${WRKSRC} ] || ALLOW_VULNERABLE_PACKAGES=yes ${MAKE} fetch pre-extract do-extract ${RUN} \ + ${PHASE_MSG} "Guessing package license"; \ type wdiff > /dev/null 2>&1 || ${FAIL_MSG} "To guess the license, textproc/wdiff must be installed."; \ \ + { \ printf "%8s %s\n" "Wdiff" "License"; \ bestsize=1000000; \ bestlicense=; \ - for pkglicense in ${WRKSRC}/COPYING ${WRKSRC}/LICENSE; do \ + for pkglicense in ${WRKSRC}/COPYING ${WRKSRC}/LICENSE ${WRKSRC}/COPYRIGHT; do \ for license in ${PKGSRCDIR}/licenses/*; do \ if [ -f "$$pkglicense" ] && [ -f "$$license" ]; then \ size=`{ wdiff -3 "$$pkglicense" "$$license" || true; } | wc -c`; \ @@ -268,19 +269,16 @@ guess-license: done; \ \ if [ "$$bestlicense" ]; then \ - if [ "$$bestsize" -lt 3000 ]; then \ - echo ""; \ - echo "Line differences in license texts:"; \ - echo ""; \ - diff -wu "$$pkglicense" "$$bestlicense" || true; \ - echo ""; \ - echo "Word differences in license texts:"; \ - echo ""; \ - wdiff -3 "$$pkglicense" "$$bestlicense" || true; \ - else \ - echo ""; \ - echo "No similar enough license found."; \ - fi \ + 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}."; \ - fi + echo "No license file found in ${WRKSRC}:"; \ + ls -l ${WRKSRC}; \ + fi \ + } | $${PAGER:-less} |