View | Details | Raw Unified | Return to bug 230114 | Differences between
and this patch

Collapse All | Expand All

(-)textproc/scancode-toolkit/Makefile (+150 lines)
Line 0 Link Here
1
# $FreeBSD$
2
3
PORTNAME=	scancode-toolkit
4
DISTVERSIONPREFIX=	v
5
DISTVERSION=	2.9.7
6
CATEGORIES=	textproc python
7
8
MAINTAINER=	freebsd_ports@k-worx.org
9
COMMENT=	Scans code for license, copyright, package and documented dependencies
10
11
LICENSE=	APACHE20 CC0-1.0
12
LICENSE_COMB=	multi
13
LICENSE_FILE_APACHE20=	${WRKSRC}/apache-2.0.LICENSE
14
LICENSE_FILE_CC0-1.0=	${WRKSRC}/cc0-1.0.LICENSE
15
16
BUILD_DEPENDS=	${LOCALBASE}/bin/7z:archivers/p7zip \
17
		${LOCALBASE}/bin/file:sysutils/file \
18
		${LOCALBASE}/lib/libarchive.so:archivers/libarchive
19
RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}nltk>=3.2:textproc/py-nltk@${PY_FLAVOR} \
20
		${PYTHON_PKGNAMEPREFIX}url>=0.1.4:www/py-url@${PY_FLAVOR} \
21
		${PYTHON_PKGNAMEPREFIX}fingerprints>=0.5.4:textproc/py-fingerprints@${PY_FLAVOR} \
22
		${PYTHON_PKGNAMEPREFIX}patch>=1.15:devel/py-patch@${PY_FLAVOR} \
23
		${PYTHON_PKGNAMEPREFIX}bz2file>=0.98:archivers/py-bz2file@${PY_FLAVOR} \
24
		${PYTHON_PKGNAMEPREFIX}backports.os=0.1.1:devel/py-backports.os@${PY_FLAVOR} \
25
		${PYTHON_PKGNAMEPREFIX}future>=0.16.0:devel/py-future@${PY_FLAVOR} \
26
		${PYTHON_PKGNAMEPREFIX}text-unidecode>=1.0:converters/py-text-unidecode@${PY_FLAVOR} \
27
		${PYTHON_PKGNAMEPREFIX}bitarray>=0.8.1:devel/py-bitarray@${PY_FLAVOR} \
28
		${PYTHON_PKGNAMEPREFIX}intbitset>=2.3.0:devel/py-intbitset@${PY_FLAVOR} \
29
		${PYTHON_PKGNAMEPREFIX}boolean.py>=3.5:devel/py-boolean.py@${PY_FLAVOR} \
30
		${PYTHON_PKGNAMEPREFIX}license-expression>=0.99:textproc/py-license-expression@${PY_FLAVOR} \
31
		${PYTHON_PKGNAMEPREFIX}pyahocorasick>=1.1:textproc/py-pyahocorasick@${PY_FLAVOR} \
32
		${PYTHON_PKGNAMEPREFIX}yaml>=3.0:devel/py-yaml@${PY_FLAVOR} \
33
		${PYTHON_PKGNAMEPREFIX}lxml>=4.0.0:devel/py-lxml@${PY_FLAVOR} \
34
		${PYTHON_PKGNAMEPREFIX}beautifulsoup>=4.0.0:www/py-beautifulsoup@${PY_FLAVOR} \
35
		${PYTHON_PKGNAMEPREFIX}html5lib>=0:www/py-html5lib@${PY_FLAVOR} \
36
		${PYTHON_PKGNAMEPREFIX}six>=0:devel/py-six@${PY_FLAVOR} \
37
		${PYTHON_PKGNAMEPREFIX}pdfminer.six>=20170720:textproc/py-pdfminer.six@${PY_FLAVOR} \
38
		${PYTHON_PKGNAMEPREFIX}pycryptodome>=3.4:security/py-pycryptodome@${PY_FLAVOR} \
39
		${PYTHON_PKGNAMEPREFIX}binaryornot>=0.4.0:devel/py-binaryornot@${PY_FLAVOR} \
40
		${PYTHON_PKGNAMEPREFIX}chardet>=3.0.0:textproc/py-chardet@${PY_FLAVOR} \
41
		${PYTHON_PKGNAMEPREFIX}pygments>=2.2.0:textproc/py-pygments@${PY_FLAVOR} \
42
		${PYTHON_PKGNAMEPREFIX}pefile>=2018.8.8:devel/py-pefile@${PY_FLAVOR} \
43
		${PYTHON_PKGNAMEPREFIX}pymaven-patch>=0.2.4:devel/py-pymaven-patch@${PY_FLAVOR} \
44
		${PYTHON_PKGNAMEPREFIX}requests>=2.7.0:www/py-requests@${PY_FLAVOR} \
45
		${PYTHON_PKGNAMEPREFIX}packageurl-python>=0.5.0:textproc/py-packageurl-python@${PY_FLAVOR} \
46
		${PYTHON_PKGNAMEPREFIX}xmltodict>=0.11.0:devel/py-xmltodict@${PY_FLAVOR} \
47
		${PYTHON_PKGNAMEPREFIX}click>=6.0.0:devel/py-click@${PY_FLAVOR} \
48
		${PYTHON_PKGNAMEPREFIX}colorama>=0.3.9:devel/py-colorama@${PY_FLAVOR} \
49
		${PYTHON_PKGNAMEPREFIX}pluggy>=0.4.0:devel/py-pluggy@${PY_FLAVOR} \
50
		${PYTHON_PKGNAMEPREFIX}attrs>=17.4:devel/py-attrs@${PY_FLAVOR} \
51
		${PYTHON_PKGNAMEPREFIX}typing>=3.6:devel/py-typing@${PY_FLAVOR} \
52
		${PYTHON_PKGNAMEPREFIX}Jinja2>=2.7.0:devel/py-Jinja2@${PY_FLAVOR} \
53
		${PYTHON_PKGNAMEPREFIX}MarkupSafe>=0.23:textproc/py-MarkupSafe@${PY_FLAVOR} \
54
		${PYTHON_PKGNAMEPREFIX}simplejson>=0:devel/py-simplejson@${PY_FLAVOR} \
55
		${PYTHON_PKGNAMEPREFIX}spdx-tools>=0.5.4:misc/py-spdx-tools@${PY_FLAVOR} \
56
		${PYTHON_PKGNAMEPREFIX}unicodecsv>=0:devel/py-unicodecsv@${PY_FLAVOR} \
57
		${PYTHON_PKGNAMEPREFIX}yg.lockfile>=2.0.1:devel/py-yg.lockfile@${PY_FLAVOR} \
58
		${PYTHON_PKGNAMEPREFIX}zclockfile>=1.0.0:devel/py-zclockfile@${PY_FLAVOR} \
59
		${PYTHON_PKGNAMEPREFIX}contextlib2>=0:devel/py-contextlib2@${PY_FLAVOR} \
60
		${PYTHON_PKGNAMEPREFIX}pytz>=0:devel/py-pytz@${PY_FLAVOR} \
61
		${PYTHON_PKGNAMEPREFIX}tempora>=0:devel/py-tempora@${PY_FLAVOR} \
62
		${PYTHON_PKGNAMEPREFIX}jaraco.timing>=0:devel/py-jaraco.timing@${PY_FLAVOR} \
63
		${PY_IPADDRESS} \
64
		${LOCALBASE}/bin/7z:archivers/p7zip \
65
		${LOCALBASE}/bin/file:sysutils/file \
66
		${LOCALBASE}/lib/libarchive.so:archivers/libarchive
67
68
USES=		python:2.7
69
USE_PYTHON=	distutils autoplist noflavors
70
USE_GITHUB=	yes
71
GH_ACCOUNT=	nexB
72
73
NO_ARCH=	yes
74
75
# The upstream package comes with several Python packages of libmagic, p7zip
76
# and zlib that include precompiled binaries for different architectures:
77
#
78
# - plugins/extractcode-7z-ARCH
79
#   	bin/
80
# - plugins/extractcode-libarchive-ARCH
81
#   	lib/
82
# - plugins/typecode-libmagic-ARCH
83
#   	/data
84
#   	/lib
85
#
86
# We use as ARCH the "manylinux_1_x86_64" architecture to get the directory
87
# structure. The binary files will be overwritten in the post-install target
88
# when the relative symlinks are created.
89
BOGUSLNKS=	${LOCALBASE}/bin/7z \
90
		${LOCALBASE}/libexec/p7zip/7z.so \
91
		${LOCALBASE}/lib/libarchive.so \
92
		${LOCALBASE}/lib/libmagic.so \
93
	       	${LOCALBASE}/share/file/magic.mgc
94
95
.for _b in ${BOGUSLNKS}
96
BOGUSDIR_${_b}=	`${DIRNAME} ${_b}`
97
.endfor
98
99
post-patch:
100
	@${FIND} ${WRKSRC} -name "*.orig" -or -name "*.bak" -delete
101
102
do-build:
103
	# Build the port and the plugin packages
104
	@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS})
105
	@(cd ${BUILD_WRKSRC}/plugins/extractcode-7z-manylinux1_x86_64; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS})
106
	@(cd ${BUILD_WRKSRC}/plugins/extractcode-libarchive-manylinux1_i686; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS})
107
	@(cd ${BUILD_WRKSRC}/plugins/typecode-libmagic-manylinux1_x86_64; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS})
108
109
do-install:
110
	# Install scancode and the plugin packages. After each installation run
111
	# the newly created ${_PYTHONPKGLIST} is renamed for later processing.
112
	(cd ${INSTALL_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_INSTALL_TARGET} ${PYDISTUTILS_INSTALLARGS})
113
	@${MV} ${_PYTHONPKGLIST} ${_PYTHONPKGLIST}.scancode
114
	(cd ${INSTALL_WRKSRC}/plugins/extractcode-7z-manylinux1_x86_64; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_INSTALL_TARGET} ${PYDISTUTILS_INSTALLARGS})
115
	@${MV} ${_PYTHONPKGLIST} ${_PYTHONPKGLIST}.extractcode-7z
116
	(cd ${INSTALL_WRKSRC}/plugins/extractcode-libarchive-manylinux1_i686; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_INSTALL_TARGET} ${PYDISTUTILS_INSTALLARGS})
117
	@${MV} ${_PYTHONPKGLIST} ${_PYTHONPKGLIST}.extractcode-libarchive
118
	(cd ${INSTALL_WRKSRC}/plugins/typecode-libmagic-manylinux1_x86_64; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_INSTALL_TARGET} ${PYDISTUTILS_INSTALLARGS})
119
	@${MV} ${_PYTHONPKGLIST} ${_PYTHONPKGLIST}.typecode-libmagic
120
	# Merge the package lists from the previous install steps into one
121
	# ${_PYTHONPKGLIST}
122
	@${CAT} ${_PYTHONPKGLIST}.scancode ${_PYTHONPKGLIST}.extractcode-7z ${_PYTHONPKGLIST}.extractcode-libarchive ${_PYTHONPKGLIST}.typecode-libmagic > ${_PYTHONPKGLIST}
123
124
post-install:
125
	# Create bogus directories and files that will be used as sources for
126
	# the relative symlinks in the stagedir. Also keep track of the
127
	# files/directory that need to be created for later removal.
128
.for _f in ${BOGUSLNKS}
129
	@if ! ${TEST} -d ${STAGEDIR}${BOGUSDIR_${_f}}; then \
130
		${MKDIR} ${STAGEDIR}${BOGUSDIR_${_f}} && \
131
	       	${ECHO} ${STAGEDIR}${BOGUSDIR_${_f}} >> ${WRKDIR}/.bogusdirs ; \
132
	fi
133
134
	@${ECHO} DUMMY > ${STAGEDIR}${_f}
135
	@${ECHO} ${STAGEDIR}${_f} >> ${WRKDIR}/.bogusdirs
136
.endfor
137
138
	# Create the relative symlinks using the bogus libmagic, p7zip and zlib
139
	# as sources to overwrite the placeholder that were created with the
140
	# post-extract target.
141
	@${RLN} ${STAGEDIR}${LOCALBASE}/bin/7z ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/extractcode_7z/bin/
142
	@${RLN} ${STAGEDIR}${LOCALBASE}/libexec/p7zip/7z.so ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/extractcode_7z/bin/
143
	@${RLN} ${STAGEDIR}${LOCALBASE}/lib/libarchive.so ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/extractcode_libarchive/lib/
144
	@${RLN} ${STAGEDIR}${LOCALBASE}/share/file/magic.mgc ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/typecode_libmagic/data/
145
	@${RLN} ${STAGEDIR}${LOCALBASE}/lib/libmagic.so ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/typecode_libmagic/lib/
146
147
	# Remove all bogus source files/directories to pass stage qa
148
	@${RM} -r `${CAT} ${WRKDIR}/.bogusdirs`
149
150
.include <bsd.port.mk>
(-)textproc/scancode-toolkit/distinfo (+3 lines)
Line 0 Link Here
1
TIMESTAMP = 1540635003
2
SHA256 (nexB-scancode-toolkit-v2.9.7_GH0.tar.gz) = 717249edb32ffc65668f21c9b7630932e7d5fad713954c53892afaa8bc1e935d
3
SIZE (nexB-scancode-toolkit-v2.9.7_GH0.tar.gz) = 173522172
(-)textproc/scancode-toolkit/files/patch-setup.py (+38 lines)
Line 0 Link Here
1
--- setup.py.orig	2018-10-19 14:31:36 UTC
2
+++ setup.py
3
@@ -125,9 +125,7 @@ setup(
4
         # cluecode
5
         # Some nltk version ranges are buggy
6
         'nltk >= 3.2, < 4.0',
7
-        'publicsuffix2',
8
-        'py2-ipaddress >= 2.0, <3.5',
9
-        'url >= 0.1.4, < 0.1.6',
10
+        'url >= 0.1.4',
11
         'fingerprints == 0.5.4',
12
 
13
         # extractcode
14
@@ -135,8 +133,6 @@ setup(
15
         # to work around bug http://bugs.python.org/issue19839
16
         # on multistream bzip2 files: this can removed in Python 3.
17
         'bz2file >= 0.98',
18
-        'extractcode-libarchive',
19
-        'extractcode-7z',
20
 
21
         # commoncode
22
         'backports.os == 0.1.1',
23
@@ -166,7 +162,6 @@ setup(
24
         'chardet >= 3.0.0, <4.0.0',
25
         # note that we use a short version range because we use a simpler lexer list
26
         'pygments >= 2.2.0, <2.3',
27
-        'typecode-libmagic',
28
 
29
         # packagedcode
30
         'pefile >= 2018.8.8',
31
@@ -180,7 +175,6 @@ setup(
32
         'colorama >= 0.3.9',
33
         'pluggy >= 0.4.0, < 1.0',
34
         'attrs >=17.4, < 19.0',
35
-        'cattrs',
36
         'typing >=3.6, < 3.7',
37
 
38
         # scancode outputs
(-)textproc/scancode-toolkit/files/patch-src_commoncode_system.py (+30 lines)
Line 0 Link Here
1
--- src/commoncode/system.py.orig	2018-05-08 13:54:52 UTC
2
+++ src/commoncode/system.py
3
@@ -46,6 +46,8 @@ def os_arch():
4
         os = 'win'
5
     elif 'darwin' in sys_platform:
6
         os = 'mac'
7
+    elif 'freebsd' in sys_platform:
8
+        os = 'freebsd'
9
     else:
10
         raise Exception('Unsupported OS/platform %r' % sys_platform)
11
     return os, arch
12
@@ -84,7 +86,8 @@ current_os, current_arch = os_arch()
13
 on_windows = current_os == 'win'
14
 on_mac = current_os == 'mac'
15
 on_linux = current_os == 'linux'
16
-on_posix = not on_windows and (on_mac or on_linux)
17
+on_freebsd = current_os == 'freebsd'
18
+on_posix = not on_windows and (on_mac or on_linux or on_freebsd)
19
 
20
 current_os_arch = '%(current_os)s-%(current_arch)s' % locals()
21
 noarch = 'noarch'
22
@@ -97,7 +100,7 @@ if on_windows:
23
     lib_ext = '.dll'
24
 if on_mac:
25
     lib_ext = '.dylib'
26
-if on_linux:
27
+if on_linux or on_freebsd:
28
     lib_ext = '.so'
29
 
30
 #
(-)textproc/scancode-toolkit/files/patch-src_extractcode_libarchive2.py (+10 lines)
Line 0 Link Here
1
--- src/extractcode/libarchive2.py.orig	2018-10-15 13:51:18 UTC
2
+++ src/extractcode/libarchive2.py
3
@@ -101,6 +101,7 @@ def load_lib():
4
     # get paths from plugins
5
     dll = get_location(EXTRACTCODE_LIBARCHIVE_DLL)
6
     libdir = get_location(EXTRACTCODE_LIBARCHIVE_LIBDIR)
7
+    dll = libdir
8
     return command.load_shared_library(dll, libdir)
9
 
10
 
(-)textproc/scancode-toolkit/pkg-descr (+5 lines)
Line 0 Link Here
1
ScanCode scans code and detects licenses, copyrights, package manifests,
2
dependencies and more. It can be also used to discover and inventory open source
3
and third-party packages used in your code. 
4
5
WWW: https://github.com/nexB/scancode-toolkit

Return to bug 230114