aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--classes/dosocs.bbclass (renamed from classes/spdx-dosocs.bbclass)18
-rw-r--r--classes/lid-scan.bbclass274
-rw-r--r--conf/lid-scan.conf3
-rw-r--r--recipes-devtools/python/python-docopt_0.6.2.bb17
-rw-r--r--recipes-devtools/python/python-dosocs2-native_0.16.1.bb54
-rw-r--r--recipes-devtools/python/python-dosocs2/0001-setup.py-delete-the-depends-install.patch34
-rw-r--r--recipes-devtools/python/python-jinja2_%.bbappend3
-rw-r--r--recipes-devtools/python/python-lid_git.bb25
-rw-r--r--recipes-devtools/python/python-magic_5.22.bb22
-rw-r--r--recipes-devtools/python/python-markupsafe-native_0.23.bb14
-rw-r--r--recipes-devtools/python/python-nltk_3.0.3.bb22
-rw-r--r--recipes-devtools/python/python-psycopg2-native_2.6.1.bb21
-rw-r--r--recipes-devtools/python/python-sphinx-native_1.3.1.bb17
-rw-r--r--recipes-devtools/python/python-sqlalchemy_0.7.9.bbappend3
-rw-r--r--recipes-devtools/python/python-whatthepatch_0.0.5.bb22
-rw-r--r--recipes-devtools/python/python3-dosocs2/0001-Fix-a-error-as-fowllowing.patch27
-rw-r--r--recipes-devtools/python/python3-dosocs2/0001-Fix-a-magic-error-as-following.patch26
-rw-r--r--recipes-devtools/python/python3-dosocs2_git.bb3
-rw-r--r--recipes-devtools/python/python3-lid_git.bb25
-rw-r--r--recipes-devtools/python/python3-magic-5.22/0001-Modified-the-magic.py-for-dosocs2-to-fix-the-error-a.patch504
-rw-r--r--recipes-devtools/python/python3-magic-5.25/0001-Modified-the-magic.py-for-dosocs2-to-fix-the-error-a.patch (renamed from recipes-devtools/python/python-magic-5.22/0001-Modified-the-magic.py-for-dosocs2-to-fix-the-error-a.patch)0
-rw-r--r--recipes-devtools/python/python3-magic_5.25.bb (renamed from recipes-devtools/python/python3-magic_5.22.bb)9
-rw-r--r--recipes-devtools/python/python3-nltk_3.0.3.bb22
-rw-r--r--recipes-devtools/python/python3-six_1.10.0.bb13
-rw-r--r--recipes-devtools/python/python3-whatthepatch_git.bb22
-rw-r--r--recipes-extended/glib-2.0/glib-2.0_%.bbappend1
-rw-r--r--recipes-extended/perl/perl_5.24.1.bbappend2
28 files changed, 481 insertions, 724 deletions
diff --git a/README.md b/README.md
index 70e1545..618c6f4 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ SPDX scanner(DoSOCSv2) support
in some recipes which you want.
```
- inherit spdx-dosocs
+ inherit dosocs
```
- Redefine SPDX_DEPLOY_DIR in conf/local.conf:
diff --git a/classes/spdx-dosocs.bbclass b/classes/dosocs.bbclass
index 900b663..2774ca0 100644
--- a/classes/spdx-dosocs.bbclass
+++ b/classes/dosocs.bbclass
@@ -29,10 +29,9 @@ export STAGING_LIBDIR
# autoconf macros will use their internal default preference otherwise
export PYTHON
-#do_spdx[depends] += "python3-dosocs2-init-native:do_dosocs2_init"
+do_spdx[depends] += "python3-dosocs2-init-native:do_dosocs2_init"
do_spdx[depends] += "python3-dosocs2-native:do_populate_sysroot"
-SPDXOUTPUTDIR = "${WORKDIR}/spdx_output_dir"
SPDXSSTATEDIR = "${WORKDIR}/spdx_sstate_dir"
# If ${S} isn't actually the top-level source directory, set SPDX_S to point at
@@ -75,7 +74,8 @@ python do_spdx () {
info['package_summary'] = (d.getVar('SUMMARY', True) or "")
info['package_summary'] = info['package_summary'].replace("\n","")
info['package_summary'] = info['package_summary'].replace("'"," ")
- info['package_contains'] = (d.getVar('CONTAINED_BY', True) or "")
+ info['package_contains'] = (d.getVar('CONTAINED', True) or "")
+ info['package_static_link'] = (d.getVar('STATIC_LINK', True) or "")
spdx_sstate_dir = (d.getVar('SPDXSSTATEDIR', True) or "")
manifest_dir = (d.getVar('SPDX_DEPLOY_DIR', True) or "")
@@ -139,7 +139,6 @@ python do_get_spdx_s() {
d.setVar('RECIPE_SYSROOT', d.getVar('RECIPE_SYSROOT'))
d.setVar('RECIPE_SYSROOT_NATIVE', d.getVar('RECIPE_SYSROOT_NATIVE'))
- ar_outdir = d.getVar('SPDX_TEMP_DIR')
bb.note('Archiving the configured source...')
pn = d.getVar('PN')
# "gcc-source-${PV}" recipes don't have "do_configure"
@@ -150,10 +149,10 @@ python do_get_spdx_s() {
# Change the WORKDIR to make do_configure run in another dir.
d.setVar('WORKDIR', d.getVar('SPDX_TEMP_DIR'))
- if bb.data.inherits_class('kernel-yocto', d):
- bb.build.exec_func('do_kernel_configme', d)
- if bb.data.inherits_class('cmake', d):
- bb.build.exec_func('do_generate_toolchain_file', d)
+ #if bb.data.inherits_class('kernel-yocto', d):
+ # bb.build.exec_func('do_kernel_configme', d)
+ #if bb.data.inherits_class('cmake', d):
+ # bb.build.exec_func('do_generate_toolchain_file', d)
bb.build.exec_func('do_unpack', d)
}
@@ -243,8 +242,9 @@ def write_cached_spdx( info,sstatefile, ver_code ):
sed_cmd = sed_replace(sed_cmd,"PackageDescription: ",
"<text>" + info['pn'] + " version " + info['pv'] + "</text>")
for contain in info['package_contains'].split( ):
- bb.note("lmh test contain = %s" % contain)
sed_cmd = sed_insert(sed_cmd,"PackageComment:"," \\n\\n## Relationships\\nRelationship: " + info['pn'] + " CONTAINS " + contain)
+ for static_link in info['package_static_link'].split( ):
+ sed_cmd = sed_insert(sed_cmd,"PackageComment:"," \\n\\n## Relationships\\nRelationship: " + info['pn'] + " STATIC_LINK " + static_link)
sed_cmd = sed_cmd + sstatefile
subprocess.call("%s" % sed_cmd, shell=True)
diff --git a/classes/lid-scan.bbclass b/classes/lid-scan.bbclass
new file mode 100644
index 0000000..ada4df0
--- /dev/null
+++ b/classes/lid-scan.bbclass
@@ -0,0 +1,274 @@
+# This class integrates real-time license scanning, generation of SPDX standard
+# output and verifiying license info during the building process.
+# It is a combination of efforts from the OE-Core, SPDX and DoSOCSv2 projects.
+#
+# For more information on DoSOCSv2:
+# https://github.com/DoSOCSv2
+#
+# For more information on SPDX:
+# http://www.spdx.org
+#
+# Note:
+# 1) Make sure DoSOCSv2 has beed installed in your host
+# 2) By default,spdx files will be output to the path which is defined as[SPDX_DEPLOY_DIR]
+# in ./meta/conf/spdx-dosocs.conf.
+
+PYTHON_INHERIT = "${@bb.utils.contains('PN', '-native', '', 'python3-dir', d)}"
+PYTHON_INHERIT .= "${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3native', '', d)}"
+
+inherit ${PYTHON_INHERIT} python3-dir
+
+PYTHON = "${@bb.utils.contains('PN', '-native', '${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}', '', d)}"
+EXTRANATIVEPATH += "${PYTHON_PN}-native"
+
+# python-config and other scripts are using distutils modules
+# which we patch to access these variables
+export STAGING_INCDIR
+export STAGING_LIBDIR
+
+# autoconf macros will use their internal default preference otherwise
+export PYTHON
+
+#do_spdx[depends] += "python3-dosocs2-init-native:do_dosocs2_init"
+do_lid_scan[depends] += "python-lid-native:do_populate_sysroot"
+
+LIDOUTPUTDIR = "${WORKDIR}/lid_output_dir"
+LIDSSTATEDIR = "${WORKDIR}/lid_sstate_dir"
+
+# If ${S} isn't actually the top-level source directory, set SPDX_S to point at
+# the real top-level directory.
+
+LID_S ?= "${S}"
+
+python do_lid_scan () {
+ import os, sys
+ import json
+
+ pn = d.getVar("PN")
+ depends = d.getVar("DEPENDS")
+ ## gcc is too big to get spdx file.
+ if 'gcc' in d.getVar('PN', True):
+ return None
+ info = {}
+ info['workdir'] = (d.getVar('WORKDIR', True) or "")
+ info['pn'] = (d.getVar( 'PN', True ) or "")
+ info['pv'] = (d.getVar( 'PV', True ) or "")
+ info['package_download_location'] = (d.getVar( 'SRC_URI', True ) or "")
+ if info['package_download_location'] != "":
+ info['package_download_location'] = info['package_download_location'].split()[0]
+ info['spdx_version'] = (d.getVar('SPDX_VERSION', True) or '')
+ info['data_license'] = (d.getVar('DATA_LICENSE', True) or '')
+ info['creator'] = {}
+ info['creator']['Tool'] = (d.getVar('CREATOR_TOOL', True) or '')
+ info['license_list_version'] = (d.getVar('LICENSELISTVERSION', True) or '')
+ info['package_homepage'] = (d.getVar('HOMEPAGE', True) or "")
+ info['package_summary'] = (d.getVar('SUMMARY', True) or "")
+ info['package_summary'] = info['package_summary'].replace("\n","")
+ info['package_summary'] = info['package_summary'].replace("'"," ")
+ info['package_contains'] = (d.getVar('CONTAINED', True) or "")
+
+ lid_sstate_dir = (d.getVar('LIDSSTATEDIR', True) or "")
+ manifest_dir = (d.getVar('LID_DEPLOY_DIR', True) or "")
+ info['outfile'] = os.path.join(manifest_dir, info['pn'] + "-" + info['pv'] + ".smpkg" )
+ sstatefile = os.path.join(lid_sstate_dir,
+ info['pn'] + "-" + info['pv'] + ".smpkg" )
+
+ ## something needs to be rerun
+ if not os.path.exists( lid_sstate_dir ):
+ bb.utils.mkdirhier( lid_sstate_dir )
+
+ #d.setVar('WORKDIR', d.getVar('LIDOUTPUTDIR', True))
+ info['sourcedir'] = (d.getVar('LID_S', True) or "")
+ cur_ver_code = get_ver_code( info['sourcedir'] ).split()[0]
+ cache_cur = False
+
+ def get_lid_s() :
+ import shutil
+
+ # Forcibly expand the sysroot paths as we're about to change WORKDIR
+ d.setVar('RECIPE_SYSROOT', d.getVar('RECIPE_SYSROOT'))
+ d.setVar('RECIPE_SYSROOT_NATIVE', d.getVar('RECIPE_SYSROOT_NATIVE'))
+
+ ar_outdir = d.getVar('LIDOUTPUTDIR')
+ bb.note('Archiving the configured source...')
+
+ # task, so we need to run "do_preconfigure" instead
+ if pn.startswith("gcc-source-"):
+ d.setVar('WORKDIR', d.getVar('ARCHIVER_WORKDIR'))
+ bb.build.exec_func('do_preconfigure', d)
+
+ # Change the WORKDIR to make do_configure run in another dir.
+ if bb.data.inherits_class('kernel-yocto', d):
+ bb.build.exec_func('do_kernel_configme', d)
+ if bb.data.inherits_class('cmake', d):
+ bb.build.exec_func('do_generate_toolchain_file', d)
+ bb.build.exec_func('do_unpack', d)
+
+ #get source-code for scan
+ get_lid_s()
+
+ if os.path.exists( sstatefile ):
+ ## cache for this package exists. read it in
+ cached_lid = get_cached_lid( sstatefile )
+ if cached_lid:
+ cached_lid = cached_lid.split()[0]
+ if (cached_lid == cur_ver_code):
+ bb.warn(info['pn'] + "'s ver code same as cache's. do nothing")
+ cache_cur = True
+ create_manifest(info,sstatefile)
+ if not cache_cur:
+ git_path = "%s/.git" % info['sourcedir']
+ if os.path.exists(git_path):
+ remove_dir_tree(git_path)
+
+ ## Get lid scan result file
+ #bb.warn(' run_dosocs2 ...... ')
+ invoke_lid(info['sourcedir'],sstatefile)
+ if get_cached_lid( sstatefile ) != None:
+ write_cached_lid( info,sstatefile,cur_ver_code )
+ ## CREATE MANIFEST(write to outfile )
+ create_manifest(info,sstatefile)
+ else:
+ bb.warn('Can\'t get the lid result file ' + info['pn'] + '. Please check your lid.')
+ d.setVar('WORKDIR', info['workdir'])
+}
+
+python () {
+ pn = d.getVar("PN")
+ depends = d.getVar("DEPENDS")
+
+ if pn.find("-native") == -1:
+ depends = "%s python-lid-native" % depends
+ d.setVar("DEPENDS", depends)
+ bb.build.addtask('do_lid_scan','do_package', 'do_patch', d)
+}
+
+def invoke_lid( OSS_src_dir, lid_result):
+ import subprocess
+ import string
+ import json
+ import codecs
+
+ path = os.getenv('PATH')
+ lid_cmd = bb.utils.which(os.getenv('PATH'), "license-identifier")
+ lid_scan_cmd = lid_cmd + " -I " + OSS_src_dir
+ print(lid_scan_cmd)
+ try:
+ lid_output = subprocess.check_output(lid_scan_cmd,
+ stderr=subprocess.STDOUT,
+ shell=True)
+ except subprocess.CalledProcessError as e:
+ bb.fatal("Could not invoke lid Command "
+ "'%s' returned %d:\n%s" % (lid_scan_cmd, e.returncode, e.output))
+ lid_output = lid_output.decode('utf-8')
+
+ f = codecs.open(lid_result,'w','utf-8')
+ f.write(lid_output)
+
+def create_manifest(info,sstatefile):
+ import shutil
+ shutil.copyfile(sstatefile,info['outfile'])
+
+def get_cached_lid( sstatefile ):
+ import subprocess
+
+ if not os.path.exists( sstatefile ):
+ return None
+
+ try:
+ output = subprocess.check_output(['grep', "PackageVerificationCode", sstatefile])
+ except subprocess.CalledProcessError as e:
+ #bb.error("Index creation command '%s' failed with return code %d:\n%s" % (e.cmd, e.returncode, e.output))
+ return None
+ cached_lid_info=output.decode('utf-8').split(': ')
+ return cached_lid_info[1]
+
+## Add necessary information into spdx file
+def write_cached_lid( info,sstatefile, ver_code ):
+ import subprocess
+
+ def sed_replace(dest_sed_cmd,key_word,replace_info):
+ dest_sed_cmd = dest_sed_cmd + "-e 's#^" + key_word + ".*#" + \
+ key_word + replace_info + "#' "
+ return dest_sed_cmd
+
+ def sed_insert(dest_sed_cmd,key_word,new_line):
+ dest_sed_cmd = dest_sed_cmd + "-e '/^" + key_word \
+ + r"/a\\" + new_line + "' "
+ return dest_sed_cmd
+
+ ## Document level information
+ sed_cmd = r"sed -i -e 's#\r$##g' "
+ spdx_DocumentComment = "<text>SPDX for " + info['pn'] + " version " \
+ + info['pv'] + "</text>"
+ insrt_line = "DocumentComment" + spdx_DocumentComment + " \n"
+ insrt_line += "CreatorComment: " + " \n"
+ insrt_line += "LicenseListVersion: " + info['license_list_version'] + " \n"
+ insrt_line += "PackageName: " + info['pn'] + " \n"
+ insrt_line += "PackageDownloadLocation: " + info['package_download_location'] + " \n"
+ insrt_line += "PackageHomePage: " + info['package_homepage'] + " \n"
+ insrt_line += "PackageSummary: " + "<text>" + info['package_summary'] + "</text>" + " \n"
+ insrt_line += "PackageVerificationCode: " + ver_code + " \n"
+ insrt_line += "PackageDescription: " + "<text>" + info['pn'] + " version " + info['pv'] + "</text>" + " \n"
+
+ sed_cmd += "-e '1i" + insrt_line + "'"
+ bb.note("lmh test sed cmd = %s " % sed_cmd)
+
+ sed_cmd = sed_cmd + sstatefile
+ bb.note("lmh test1 sed cmd = %s " % sed_cmd)
+ subprocess.call("%s" % sed_cmd, shell=True)
+
+def remove_dir_tree( dir_name ):
+ import shutil
+ try:
+ shutil.rmtree( dir_name )
+ except:
+ pass
+
+def remove_file( file_name ):
+ try:
+ os.remove( file_name )
+ except OSError as e:
+ pass
+
+def list_files( dir ):
+ for root, subFolders, files in os.walk( dir ):
+ for f in files:
+ rel_root = os.path.relpath( root, dir )
+ yield rel_root, f
+ return
+
+def hash_file( file_name ):
+ """
+ Return the hex string representation of the SHA1 checksum of the filename
+ """
+ try:
+ import hashlib
+ except ImportError:
+ return None
+
+ sha1 = hashlib.sha1()
+ with open( file_name, "rb" ) as f:
+ for line in f:
+ sha1.update(line)
+ return sha1.hexdigest()
+
+def hash_string( data ):
+ import hashlib
+ sha1 = hashlib.sha1()
+ sha1.update( data.encode('utf-8') )
+ return sha1.hexdigest()
+
+def get_ver_code( dirname ):
+ chksums = []
+ for f_dir, f in list_files( dirname ):
+ try:
+ stats = os.stat(os.path.join(dirname,f_dir,f))
+ except OSError as e:
+ bb.warn( "Stat failed" + str(e) + "\n")
+ continue
+ chksums.append(hash_file(os.path.join(dirname,f_dir,f)))
+ ver_code_string = ''.join( chksums ).lower()
+ ver_code = hash_string( ver_code_string )
+ return ver_code
+
diff --git a/conf/lid-scan.conf b/conf/lid-scan.conf
new file mode 100644
index 0000000..1426380
--- /dev/null
+++ b/conf/lid-scan.conf
@@ -0,0 +1,3 @@
+LID_TEMP_DIR ?= "${WORKDIR}/spdx_temp"
+LID_DEPLOY_DIR ?= "/home/yocto/lid_scans"
+
diff --git a/recipes-devtools/python/python-docopt_0.6.2.bb b/recipes-devtools/python/python-docopt_0.6.2.bb
deleted file mode 100644
index 7115d0e..0000000
--- a/recipes-devtools/python/python-docopt_0.6.2.bb
+++ /dev/null
@@ -1,17 +0,0 @@
-DESCRIPTION = "Pythonic command line arguments parser, that will make you smile http://docopt.org"
-HOMEPAGE = "http://docopt.org"
-SECTION = "devel/python"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://LICENSE-MIT;md5=09b77fb74986791a3d4a0e746a37d88f"
-
-SRC_NAME = "docopt"
-SRC_URI = "https://github.com/docopt/docopt/archive/${PV}.tar.gz;downloadfilename=${SRC_NAME}-${PV}.tar.gz"
-
-S = "${WORKDIR}/${SRC_NAME}-${PV}/"
-
-SRC_URI[md5sum] = "a6c44155426fd0f7def8b2551d02fef6"
-SRC_URI[sha256sum] = "2113eed1e7fbbcd43fb7ee6a977fb02d0b482753586c9dc1a8e3b7d541426e99"
-
-inherit setuptools python-dir
-
-BBCLASSEXTEND = "native"
diff --git a/recipes-devtools/python/python-dosocs2-native_0.16.1.bb b/recipes-devtools/python/python-dosocs2-native_0.16.1.bb
deleted file mode 100644
index f5c128b..0000000
--- a/recipes-devtools/python/python-dosocs2-native_0.16.1.bb
+++ /dev/null
@@ -1,54 +0,0 @@
-DESCRIPTION = "SPDX 2.0 document creation and storage"
-HOMEPAGE = "https://github.com/DoSOCSv2/DoSOCSv2"
-SECTION = "devel/python"
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263"
-
-DEPENDS += "python-docopt-native"
-DEPENDS += "python-native"
-
-SRC_URI = "https://github.com/DoSOCSv2/DoSOCSv2/archive/v0.16.1.tar.gz \
- file://0001-setup.py-delete-the-depends-install.patch \
- "
-
-SRC_URI[md5sum] = "ecb3f47eb9f7cdd01f520e7843ef09b1"
-SRC_URI[sha256sum] = "868e4c1658bd54546f6f65be9770a80ac98793da3dcb71120a52237b07a1a656"
-
-S = "${WORKDIR}/DoSOCSv2-${PV}/"
-
-inherit distutils native
-
-addtask do_dosocs2_init after do_populate_sysroot
-
-DEPENDS += "python-jinja2-native \
- python-native \
- python-psycopg2-native \
- python-docopt-native \
- python-sqlalchemy-native \
- file-native \
- fossology-nomos-native \
- python-markupsafe-native \
- python-magic-native "
-
-do_install_append() {
- sed -i "s|scanner_nomos_path = /usr/local/|scanner_nomos_path = ${STAGING_DIR_NATIVE}/usr/|g" ${D}${PYTHON_SITEPACKAGES_DIR}/dosocs2-0.16.1-py2.7.egg/dosocs2/configtools.py
-}
-python do_dosocs2_init() {
-
- import os
- import subprocess
- import bb
- import oe.utils
- import string
-
- dosocs2_init_cmd = "dosocs2 dbinit --no-confirm"
- bb.note(dosocs2_init_cmd)
- try:
- complementary_pkgs = subprocess.check_output(dosocs2_init_cmd,
- stderr=subprocess.STDOUT,
- shell=True)
- return
- except subprocess.CalledProcessError as e:
- bb.fatal("Could not invoke dosocs2 dbinit Command "
- "'%s' returned %d:\n%s" % (dosocs2_init_cmd, e.returncode, e.output))
-}
diff --git a/recipes-devtools/python/python-dosocs2/0001-setup.py-delete-the-depends-install.patch b/recipes-devtools/python/python-dosocs2/0001-setup.py-delete-the-depends-install.patch
deleted file mode 100644
index 41f6bb2..0000000
--- a/recipes-devtools/python/python-dosocs2/0001-setup.py-delete-the-depends-install.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From d282ba074625922d12615af676ac1f0e922db88f Mon Sep 17 00:00:00 2001
-From: Lei Maohui <leimaohui@cn.fujitsu.com>
-Date: Wed, 15 Feb 2017 23:23:53 +0900
-Subject: [PATCH] setup.py: delete the depends install
-
-Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com>
----
- setup.py | 7 -------
- 1 file changed, 7 deletions(-)
-
-diff --git a/setup.py b/setup.py
-index 527b161..b35863f 100644
---- a/setup.py
-+++ b/setup.py
-@@ -3,16 +3,9 @@ from setuptools import setup
- _dosocs2_version = '0.16.1'
-
- install_requires=[
-- 'jinja2',
-- 'python-magic',
-- 'docopt',
-- 'SQLAlchemy',
-- 'psycopg2'
- ]
-
- tests_require=[
-- 'pytest',
-- 'mock'
- ]
-
- setup(
---
-1.8.4.2
-
diff --git a/recipes-devtools/python/python-jinja2_%.bbappend b/recipes-devtools/python/python-jinja2_%.bbappend
deleted file mode 100644
index 8fd4f24..0000000
--- a/recipes-devtools/python/python-jinja2_%.bbappend
+++ /dev/null
@@ -1,3 +0,0 @@
-BBCLASSEXTEND = "native"
-
-RDEPENDS_${PN} = "python-sphinx python-markupsafe"
diff --git a/recipes-devtools/python/python-lid_git.bb b/recipes-devtools/python/python-lid_git.bb
new file mode 100644
index 0000000..1897f46
--- /dev/null
+++ b/recipes-devtools/python/python-lid_git.bb
@@ -0,0 +1,25 @@
+DESCRIPTION = "Identify OS licenses and OS license text in source code."
+HOMEPAGE = "https://source.codeaurora.org/external/qostg/lid/"
+SECTION = "devel/python"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3dd6f349067c9c1c473ae3f54efeb2e0"
+
+SRC_URI = "git://source.codeaurora.org/external/qostg/lid;protocol=https \
+ "
+
+S = "${WORKDIR}/git"
+
+SRCREV = "d4ec360b51f34e8e73dcad7b0539fc0029eb7a20"
+BRANCH = "master"
+PV = "1"
+
+inherit distutils pythonnative setuptools python-dir
+
+DEPENDS += "python-pyyaml-native \
+ python-future-native \
+ python-nltk-native \
+ python-six-native \
+ python-chardet \
+ "
+
+BBCLASSEXTEND = "native"
diff --git a/recipes-devtools/python/python-magic_5.22.bb b/recipes-devtools/python/python-magic_5.22.bb
deleted file mode 100644
index 57591a6..0000000
--- a/recipes-devtools/python/python-magic_5.22.bb
+++ /dev/null
@@ -1,22 +0,0 @@
-SUMMARY = "File classification tool: python-magic"
-DESCRIPTION = "File attempts to classify files depending \
-on their contents and prints a description if a match is found."
-HOMEPAGE = "http://www.darwinsys.com/file/"
-SECTION = "console/utils"
-
-# two clause BSD
-LICENSE = "BSD"
-LIC_FILES_CHKSUM = "file://setup.py;md5=1cf0577ca152455b257b815fcc8517de"
-
-SRC_URI = "ftp://ftp.astron.com/pub/file/file-${PV}.tar.gz \
- file://0001-Modified-the-magic.py-for-dosocs2-to-fix-the-error-a.patch \
- "
-
-SRC_URI[md5sum] = "8fb13e5259fe447e02c4a37bc7225add"
-SRC_URI[sha256sum] = "c4e3a8e44cb888c5e4b476e738503e37fb9de3b25a38c143e214bfc12109fc0b"
-
-S="${WORKDIR}/file-${PV}/python"
-
-inherit setuptools python-dir
-
-BBCLASSEXTEND = "native"
diff --git a/recipes-devtools/python/python-markupsafe-native_0.23.bb b/recipes-devtools/python/python-markupsafe-native_0.23.bb
deleted file mode 100644
index 18860e9..0000000
--- a/recipes-devtools/python/python-markupsafe-native_0.23.bb
+++ /dev/null
@@ -1,14 +0,0 @@
-DESCRIPTION = "Implements a XML/HTML/XHTML Markup safe string for Python"
-HOMEPAGE = "http://github.com/mitsuhiko/markupsafe"
-LICENSE = "BSD-3-Clause"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=c6d1adcf45d69359f256c1cea3254127"
-
-PR = "r0"
-
-SRC_URI[md5sum] = "f5ab3deee4c37cd6a922fb81e730da6e"
-SRC_URI[sha256sum] = "a4ec1aff59b95a14b45eb2e23761a0179e98319da5a7eb76b56ea8cdc7b871c3"
-
-PYPI_PACKAGE = "MarkupSafe"
-inherit pypi setuptools native
-
-DEPENDS_${PN} += "${PYTHON_PN}-native"
diff --git a/recipes-devtools/python/python-nltk_3.0.3.bb b/recipes-devtools/python/python-nltk_3.0.3.bb
new file mode 100644
index 0000000..0c9e5d2
--- /dev/null
+++ b/recipes-devtools/python/python-nltk_3.0.3.bb
@@ -0,0 +1,22 @@
+SUMMARY = "Natural Language Toolkit"
+DESCRIPTION = "NLTK is a leading platform for building Python programs \
+to work with human language data."
+HOMEPAGE = "http://www.nltk.org/"
+SECTION = "libs"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=dda944de6d6a9ad8f6bb436dffdade1b"
+
+SRC_URI = "https://pypi.python.org/packages/source/n/nltk/nltk-${PV}.tar.gz \
+ "
+
+SRC_URI[md5sum] = "7bda53f59051337554d243bef904a5e9"
+SRC_URI[sha256sum] = "28d6175984445b9cdcc719f36701f034320edbecb78b69a37d1edc876843ea93"
+
+inherit distutils pythonnative setuptools python-dir
+
+S="${WORKDIR}/nltk-3.0.3"
+
+BBCLASSEXTEND = "native"
+
+
diff --git a/recipes-devtools/python/python-psycopg2-native_2.6.1.bb b/recipes-devtools/python/python-psycopg2-native_2.6.1.bb
deleted file mode 100644
index 6f52621..0000000
--- a/recipes-devtools/python/python-psycopg2-native_2.6.1.bb
+++ /dev/null
@@ -1,21 +0,0 @@
-DESCRIPTION = "Python-PostgreSQL Database Adapter"
-HOMEPAGE = "http://initd.org/psycopg/"
-SECTION = "devel/python"
-LICENSE = "GPLv3+"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=2c9872d13fa571e7ba6de95055da1fe2"
-
-PR = "r0"
-SRCNAME = "psycopg2"
-
-inherit native
-
-SRC_URI = "https://pypi.python.org/packages/source/p/${SRCNAME}/${SRCNAME}-${PV}.tar.gz \
- "
-
-SRC_URI[md5sum] = "842b44f8c95517ed5b792081a2370da1"
-SRC_URI[sha256sum] = "6acf9abbbe757ef75dc2ecd9d91ba749547941abaffbe69ff2086a9e37d4904c"
-
-S = "${WORKDIR}/${SRCNAME}-${PV}"
-
-inherit distutils
-
diff --git a/recipes-devtools/python/python-sphinx-native_1.3.1.bb b/recipes-devtools/python/python-sphinx-native_1.3.1.bb
deleted file mode 100644
index 113764b..0000000
--- a/recipes-devtools/python/python-sphinx-native_1.3.1.bb
+++ /dev/null
@@ -1,17 +0,0 @@
-DESCRIPTION = "Python documentation generator"
-HOMEPAGE = "http://sphinx-doc.org/"
-SECTION = "devel/python"
-LICENSE = "BSD"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=6dd095eaa1e7a662b279daf80ecad7e6"
-
-PR = "r0"
-SRCNAME = "Sphinx"
-
-SRC_URI = "http://pypi.python.org/packages/source/S/${SRCNAME}/${SRCNAME}-${PV}.tar.gz"
-
-SRC_URI[md5sum] = "8786a194acf9673464c5455b11fd4332"
-SRC_URI[sha256sum] = "1a6e5130c2b42d2de301693c299f78cc4bd3501e78b610c08e45efc70e2b5114"
-
-S = "${WORKDIR}/${SRCNAME}-${PV}"
-
-inherit setuptools native
diff --git a/recipes-devtools/python/python-sqlalchemy_0.7.9.bbappend b/recipes-devtools/python/python-sqlalchemy_0.7.9.bbappend
deleted file mode 100644
index 1142af5..0000000
--- a/recipes-devtools/python/python-sqlalchemy_0.7.9.bbappend
+++ /dev/null
@@ -1,3 +0,0 @@
-BBCLASSEXTEND = "native"
-
-RDEPENDS_${PN}_remove = "python-numbers"
diff --git a/recipes-devtools/python/python-whatthepatch_0.0.5.bb b/recipes-devtools/python/python-whatthepatch_0.0.5.bb
new file mode 100644
index 0000000..b9ba7c6
--- /dev/null
+++ b/recipes-devtools/python/python-whatthepatch_0.0.5.bb
@@ -0,0 +1,22 @@
+SUMMARY = "A patch parsing library"
+DESCRIPTION = "What The Patch!? is a library for parsing patch files. \
+Its only purpose is to read a patch file and get it into some usable form by other programs."
+HOMEPAGE = "https://pypi.python.org/pypi/whatthepatch"
+SECTION = "libs"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://setup.py;md5=a6377e466f612f442bbc6bb2e91eee5d"
+
+SRC_URI = "https://pypi.python.org/packages/64/1e/7a63cba8a0d70245b9ab1c03694dabe36476fa65ee546e6dff6c8660434c/whatthepatch-0.0.5.tar.gz \
+ "
+
+SRC_URI[md5sum] = "80d7c24de99ca9501f07b42e88d6f7c1"
+SRC_URI[sha256sum] = "494a2ec6c05b80f9ed1bd773f5ac9411298e1af6f0385f179840b5d60d001aa6"
+
+S="${WORKDIR}/whatthepatch-0.0.5"
+PYTHON_INHERIT = "${@bb.utils.contains('PACKAGECONFIG', 'python2', 'pythonnative', '', d)}"
+PYTHON_INHERIT = "${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3native', '', d)}"
+
+inherit distutils ${PYTHON_INHERIT} setuptools python-dir
+
+BBCLASSEXTEND = "native"
diff --git a/recipes-devtools/python/python3-dosocs2/0001-Fix-a-error-as-fowllowing.patch b/recipes-devtools/python/python3-dosocs2/0001-Fix-a-error-as-fowllowing.patch
new file mode 100644
index 0000000..870201d
--- /dev/null
+++ b/recipes-devtools/python/python3-dosocs2/0001-Fix-a-error-as-fowllowing.patch
@@ -0,0 +1,27 @@
+From 957574355fe80e0dfb86d7318cdd105e472294a4 Mon Sep 17 00:00:00 2001
+From: Lei Maohui <leimaohui@cn.fujitsu.com>
+Date: Sun, 12 Nov 2017 00:37:10 +0900
+Subject: [PATCH] Fix a error as fowllowing:
+
+" TypeError: cannot use a string pattern on a bytes-like object"
+
+Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com>
+---
+ dosocs2/scanners/nomos.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/dosocs2/scanners/nomos.py b/dosocs2/scanners/nomos.py
+index e4f2901..ebdde74 100644
+--- a/dosocs2/scanners/nomos.py
++++ b/dosocs2/scanners/nomos.py
+@@ -34,6 +34,7 @@ class Nomos(scannerbase.FileLicenseScanner):
+ return ''
+
+ def _get_licenses(self, file, nomos_output):
++ nomos_output = nomos_output.decode('utf-8')
+ parsed_output = [
+ Nomos.Evidence(*item)
+ for item in re.findall(self.search_pattern, nomos_output)
+--
+2.7.4
+
diff --git a/recipes-devtools/python/python3-dosocs2/0001-Fix-a-magic-error-as-following.patch b/recipes-devtools/python/python3-dosocs2/0001-Fix-a-magic-error-as-following.patch
new file mode 100644
index 0000000..4b1e397
--- /dev/null
+++ b/recipes-devtools/python/python3-dosocs2/0001-Fix-a-magic-error-as-following.patch
@@ -0,0 +1,26 @@
+From c4ae0f2eb4a2a03329089419fe6f1b0cd05548f9 Mon Sep 17 00:00:00 2001
+From: Lei Maohui <leimaohui@cn.fujitsu.com>
+Date: Mon, 13 Nov 2017 15:43:51 +0900
+Subject: [PATCH] Fix a magic error as following:
+
+could not find any valid magic files!
+---
+ dosocs2/util.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/dosocs2/util.py b/dosocs2/util.py
+index aba864c..200688e 100644
+--- a/dosocs2/util.py
++++ b/dosocs2/util.py
+@@ -30,7 +30,7 @@ import uuid
+ import zipfile
+
+ import magic
+-
++magic = magic.Magic(magic_file="path_to_magic_file")
+
+ def bool_from_str(s):
+ if s.lower() == 'true':
+--
+2.7.4
+
diff --git a/recipes-devtools/python/python3-dosocs2_git.bb b/recipes-devtools/python/python3-dosocs2_git.bb
index de76a66..75d4395 100644
--- a/recipes-devtools/python/python3-dosocs2_git.bb
+++ b/recipes-devtools/python/python3-dosocs2_git.bb
@@ -7,6 +7,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263"
SRC_URI = "git://github.com/DoSOCSv2/DoSOCSv2.git;branch=dev \
file://0001-setup-py-delete-the-depends-install.patch \
file://0001-Fix-bugs-because-python-from-2.x-to-3.x.patch \
+ file://0001-Fix-a-error-as-fowllowing.patch \
+ file://0001-Fix-a-magic-error-as-following.patch \
"
S = "${WORKDIR}/git"
@@ -28,6 +30,7 @@ DEPENDS += "python3-jinja2-native \
do_install_append() {
sed -i "s|scanner_nomos_path = /usr/local/|scanner_nomos_path = ${STAGING_DIR_NATIVE}/usr/|g" ${D}${PYTHON_SITEPACKAGES_DIR}/dosocs2/configtools.py
+ sed -i "s,path_to_magic_file,${STAGING_DATADIR_NATIVE}/misc/magic," ${D}${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/dosocs2/util.py
}
BBCLASSEXTEND = "native"
diff --git a/recipes-devtools/python/python3-lid_git.bb b/recipes-devtools/python/python3-lid_git.bb
new file mode 100644
index 0000000..c93e86d
--- /dev/null
+++ b/recipes-devtools/python/python3-lid_git.bb
@@ -0,0 +1,25 @@
+DESCRIPTION = "Identify OS licenses and OS license text in source code."
+HOMEPAGE = "https://source.codeaurora.org/external/qostg/lid/"
+SECTION = "devel/python"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3dd6f349067c9c1c473ae3f54efeb2e0"
+
+SRC_URI = "git://source.codeaurora.org/external/qostg/lid;protocol=https \
+ "
+
+S = "${WORKDIR}/git"
+
+SRCREV = "d4ec360b51f34e8e73dcad7b0539fc0029eb7a20"
+BRANCH = "master"
+PV = "0.16.1"
+
+inherit distutils pythonnative setuptools python-dir
+
+DEPENDS += "python-pyyaml-native \
+ python-future-native \
+ python-nltk-native \
+ python-six-native \
+ python-chardet-native \
+ "
+
+BBCLASSEXTEND = "native"
diff --git a/recipes-devtools/python/python3-magic-5.22/0001-Modified-the-magic.py-for-dosocs2-to-fix-the-error-a.patch b/recipes-devtools/python/python3-magic-5.22/0001-Modified-the-magic.py-for-dosocs2-to-fix-the-error-a.patch
deleted file mode 100644
index 1383df4..0000000
--- a/recipes-devtools/python/python3-magic-5.22/0001-Modified-the-magic.py-for-dosocs2-to-fix-the-error-a.patch
+++ /dev/null
@@ -1,504 +0,0 @@
-From ef5ad90f3aba98ae3e222f6b076377701997585b Mon Sep 17 00:00:00 2001
-From: Zheng Ruoqin <zhengrq.fnst@cn.fujitsu.com>
-Date: Fri, 5 May 2017 02:23:24 +0900
-Subject: [PATCH] Modified the magic.py for dosocs2 to fix the error as
- fowllowing.
-
-AttributeError: 'module' object has no attribute 'from_file'
-
-Signed-off-by: Zheng Ruoqin <zhengrq.fnst@cn.fujitsu.com>
----
- magic.py | 462 ++++++++++++++++++++++++++++++++------------------------
- 1 file changed, 262 insertions(+), 200 deletions(-)
-
-diff --git a/magic.py b/magic.py
-index a17e8da..c6142a7 100644
---- a/magic.py
-+++ b/magic.py
-@@ -1,221 +1,283 @@
--#!/usr/bin/env python
--'''
--Python bindings for libmagic
--'''
-+"""
-+magic is a wrapper around the libmagic file identification library.
-
--import ctypes
-+See README for more information.
-
--from ctypes import *
--from ctypes.util import find_library
-+Usage:
-
-+>>> import magic
-+>>> magic.from_file("testdata/test.pdf")
-+'PDF document, version 1.2'
-+>>> magic.from_file("testdata/test.pdf", mime=True)
-+'application/pdf'
-+>>> magic.from_buffer(open("testdata/test.pdf").read(1024))
-+'PDF document, version 1.2'
-+>>>
-
--def _init():
-- """
-- Loads the shared library through ctypes and returns a library
-- L{ctypes.CDLL} instance
-- """
-- return ctypes.cdll.LoadLibrary(find_library('magic'))
--
--_libraries = {}
--_libraries['magic'] = _init()
--
--# Flag constants for open and setflags
--MAGIC_NONE = NONE = 0
--MAGIC_DEBUG = DEBUG = 1
--MAGIC_SYMLINK = SYMLINK = 2
--MAGIC_COMPRESS = COMPRESS = 4
--MAGIC_DEVICES = DEVICES = 8
--MAGIC_MIME_TYPE = MIME_TYPE = 16
--MAGIC_CONTINUE = CONTINUE = 32
--MAGIC_CHECK = CHECK = 64
--MAGIC_PRESERVE_ATIME = PRESERVE_ATIME = 128
--MAGIC_RAW = RAW = 256
--MAGIC_ERROR = ERROR = 512
--MAGIC_MIME_ENCODING = MIME_ENCODING = 1024
--MAGIC_MIME = MIME = 1040
--MAGIC_APPLE = APPLE = 2048
--
--MAGIC_NO_CHECK_COMPRESS = NO_CHECK_COMPRESS = 4096
--MAGIC_NO_CHECK_TAR = NO_CHECK_TAR = 8192
--MAGIC_NO_CHECK_SOFT = NO_CHECK_SOFT = 16384
--MAGIC_NO_CHECK_APPTYPE = NO_CHECK_APPTYPE = 32768
--MAGIC_NO_CHECK_ELF = NO_CHECK_ELF = 65536
--MAGIC_NO_CHECK_TEXT = NO_CHECK_TEXT = 131072
--MAGIC_NO_CHECK_CDF = NO_CHECK_CDF = 262144
--MAGIC_NO_CHECK_TOKENS = NO_CHECK_TOKENS = 1048576
--MAGIC_NO_CHECK_ENCODING = NO_CHECK_ENCODING = 2097152
--
--MAGIC_NO_CHECK_BUILTIN = NO_CHECK_BUILTIN = 4173824
--
--
--class magic_set(Structure):
-- pass
--magic_set._fields_ = []
--magic_t = POINTER(magic_set)
--
--_open = _libraries['magic'].magic_open
--_open.restype = magic_t
--_open.argtypes = [c_int]
--
--_close = _libraries['magic'].magic_close
--_close.restype = None
--_close.argtypes = [magic_t]
--
--_file = _libraries['magic'].magic_file
--_file.restype = c_char_p
--_file.argtypes = [magic_t, c_char_p]
--
--_descriptor = _libraries['magic'].magic_descriptor
--_descriptor.restype = c_char_p
--_descriptor.argtypes = [magic_t, c_int]
--
--_buffer = _libraries['magic'].magic_buffer
--_buffer.restype = c_char_p
--_buffer.argtypes = [magic_t, c_void_p, c_size_t]
--
--_error = _libraries['magic'].magic_error
--_error.restype = c_char_p
--_error.argtypes = [magic_t]
--
--_setflags = _libraries['magic'].magic_setflags
--_setflags.restype = c_int
--_setflags.argtypes = [magic_t, c_int]
--
--_load = _libraries['magic'].magic_load
--_load.restype = c_int
--_load.argtypes = [magic_t, c_char_p]
--
--_compile = _libraries['magic'].magic_compile
--_compile.restype = c_int
--_compile.argtypes = [magic_t, c_char_p]
--
--_check = _libraries['magic'].magic_check
--_check.restype = c_int
--_check.argtypes = [magic_t, c_char_p]
--
--_list = _libraries['magic'].magic_list
--_list.restype = c_int
--_list.argtypes = [magic_t, c_char_p]
--
--_errno = _libraries['magic'].magic_errno
--_errno.restype = c_int
--_errno.argtypes = [magic_t]
--
--
--class Magic(object):
-- def __init__(self, ms):
-- self._magic_t = ms
--
-- def close(self):
-- """
-- Closes the magic database and deallocates any resources used.
-- """
-- _close(self._magic_t)
-
-- def file(self, filename):
-- """
-- Returns a textual description of the contents of the argument passed
-- as a filename or None if an error occurred and the MAGIC_ERROR flag
-- is set. A call to errno() will return the numeric error code.
-- """
-- try: # attempt python3 approach first
-- if isinstance(filename, bytes):
-- bi = filename
-- else:
-- bi = bytes(filename, 'utf-8')
-- return str(_file(self._magic_t, bi), 'utf-8')
-- except:
-- return _file(self._magic_t, filename.encode('utf-8'))
--
-- def descriptor(self, fd):
-- """
-- Like the file method, but the argument is a file descriptor.
-- """
-- return _descriptor(self._magic_t, fd)
-+"""
-
-- def buffer(self, buf):
-- """
-- Returns a textual description of the contents of the argument passed
-- as a buffer or None if an error occurred and the MAGIC_ERROR flag
-- is set. A call to errno() will return the numeric error code.
-- """
-- try: # attempt python3 approach first
-- return str(_buffer(self._magic_t, buf, len(buf)), 'utf-8')
-- except:
-- return _buffer(self._magic_t, buf, len(buf))
-+import sys
-+import glob
-+import os.path
-+import ctypes
-+import ctypes.util
-+import threading
-
-- def error(self):
-- """
-- Returns a textual explanation of the last error or None
-- if there was no error.
-- """
-- try: # attempt python3 approach first
-- return str(_error(self._magic_t), 'utf-8')
-- except:
-- return _error(self._magic_t)
-+from ctypes import c_char_p, c_int, c_size_t, c_void_p
-
-- def setflags(self, flags):
-- """
-- Set flags on the magic object which determine how magic checking
-- behaves; a bitwise OR of the flags described in libmagic(3), but
-- without the MAGIC_ prefix.
-
-- Returns -1 on systems that don't support utime(2) or utimes(2)
-- when PRESERVE_ATIME is set.
-- """
-- return _setflags(self._magic_t, flags)
-+class MagicException(Exception):
-+ def __init__(self, message):
-+ super(MagicException, self).__init__(message)
-+ self.message = message
-
-- def load(self, filename=None):
-- """
-- Must be called to load entries in the colon separated list of database
-- files passed as argument or the default database file if no argument
-- before any magic queries can be performed.
-
-- Returns 0 on success and -1 on failure.
-- """
-- return _load(self._magic_t, filename)
-+class Magic:
-+ """
-+ Magic is a wrapper around the libmagic C library.
-
-- def compile(self, dbs):
-- """
-- Compile entries in the colon separated list of database files
-- passed as argument or the default database file if no argument.
-- Returns 0 on success and -1 on failure.
-- The compiled files created are named from the basename(1) of each file
-- argument with ".mgc" appended to it.
-- """
-- return _compile(self._magic_t, dbs)
-+ """
-
-- def check(self, dbs):
-- """
-- Check the validity of entries in the colon separated list of
-- database files passed as argument or the default database file
-- if no argument.
-- Returns 0 on success and -1 on failure.
-+ def __init__(self, mime=False, magic_file=None, mime_encoding=False,
-+ keep_going=False, uncompress=False):
- """
-- return _check(self._magic_t, dbs)
-+ Create a new libmagic wrapper.
-
-- def list(self, dbs):
-+ mime - if True, mimetypes are returned instead of textual descriptions
-+ mime_encoding - if True, codec is returned
-+ magic_file - use a mime database other than the system default
-+ keep_going - don't stop at the first match, keep going
-+ uncompress - Try to look inside compressed files.
- """
-- Check the validity of entries in the colon separated list of
-- database files passed as argument or the default database file
-- if no argument.
-- Returns 0 on success and -1 on failure.
-- """
-- return _list(self._magic_t, dbs)
--
-- def errno(self):
-+ self.flags = MAGIC_NONE
-+ if mime:
-+ self.flags |= MAGIC_MIME
-+ elif mime_encoding:
-+ self.flags |= MAGIC_MIME_ENCODING
-+ if keep_going:
-+ self.flags |= MAGIC_CONTINUE
-+
-+ if uncompress:
-+ self.flags |= MAGIC_COMPRESS
-+
-+ self.cookie = magic_open(self.flags)
-+ self.lock = threading.Lock()
-+
-+ magic_load(self.cookie, magic_file)
-+
-+ def from_buffer(self, buf):
- """
-- Returns a numeric error code. If return value is 0, an internal
-- magic error occurred. If return value is non-zero, the value is
-- an OS error code. Use the errno module or os.strerror() can be used
-- to provide detailed error information.
-+ Identify the contents of `buf`
- """
-- return _errno(self._magic_t)
--
-+ with self.lock:
-+ try:
-+ return magic_buffer(self.cookie, buf)
-+ except MagicException as e:
-+ return self._handle509Bug(e)
-+
-+ def from_file(self, filename):
-+ # raise FileNotFoundException or IOError if the file does not exist
-+ with open(filename):
-+ pass
-+ with self.lock:
-+ try:
-+ return magic_file(self.cookie, filename)
-+ except MagicException as e:
-+ return self._handle509Bug(e)
-+
-+ def _handle509Bug(self, e):
-+ # libmagic 5.09 has a bug where it might fail to identify the
-+ # mimetype of a file and returns null from magic_file (and
-+ # likely _buffer), but also does not return an error message.
-+ if e.message is None and (self.flags & MAGIC_MIME):
-+ return "application/octet-stream"
-+
-+ def __del__(self):
-+ # no _thread_check here because there can be no other
-+ # references to this object at this point.
-+
-+ # during shutdown magic_close may have been cleared already so
-+ # make sure it exists before using it.
-+
-+ # the self.cookie check should be unnecessary and was an
-+ # incorrect fix for a threading problem, however I'm leaving
-+ # it in because it's harmless and I'm slightly afraid to
-+ # remove it.
-+ if self.cookie and magic_close:
-+ magic_close(self.cookie)
-+ self.cookie = None
-+
-+_instances = {}
-+
-+def _get_magic_type(mime):
-+ i = _instances.get(mime)
-+ if i is None:
-+ i = _instances[mime] = Magic(mime=mime)
-+ return i
-+
-+def from_file(filename, mime=False):
-+ """"
-+ Accepts a filename and returns the detected filetype. Return
-+ value is the mimetype if mime=True, otherwise a human readable
-+ name.
-+
-+ >>> magic.from_file("testdata/test.pdf", mime=True)
-+ 'application/pdf'
-+ """
-+ m = _get_magic_type(mime)
-+ return m.from_file(filename)
-
--def open(flags):
-+def from_buffer(buffer, mime=False):
- """
-- Returns a magic object on success and None on failure.
-- Flags argument as for setflags.
-+ Accepts a binary string and returns the detected filetype. Return
-+ value is the mimetype if mime=True, otherwise a human readable
-+ name.
-+
-+ >>> magic.from_buffer(open("testdata/test.pdf").read(1024))
-+ 'PDF document, version 1.2'
- """
-- return Magic(_open(flags))
-+ m = _get_magic_type(mime)
-+ return m.from_buffer(buffer)
-+
-+
-+
-+
-+libmagic = None
-+# Let's try to find magic or magic1
-+dll = ctypes.util.find_library('magic') or ctypes.util.find_library('magic1') or ctypes.util.find_library('cygmagic-1')
-+
-+# This is necessary because find_library returns None if it doesn't find the library
-+if dll:
-+ libmagic = ctypes.CDLL(dll)
-+
-+if not libmagic or not libmagic._name:
-+ windows_dlls = ['magic1.dll','cygmagic-1.dll']
-+ platform_to_lib = {'darwin': ['/opt/local/lib/libmagic.dylib',
-+ '/usr/local/lib/libmagic.dylib'] +
-+ # Assumes there will only be one version installed
-+ glob.glob('/usr/local/Cellar/libmagic/*/lib/libmagic.dylib'),
-+ 'win32': windows_dlls,
-+ 'cygwin': windows_dlls }
-+ for dll in platform_to_lib.get(sys.platform, []):
-+ try:
-+ libmagic = ctypes.CDLL(dll)
-+ break
-+ except OSError:
-+ pass
-+
-+if not libmagic or not libmagic._name:
-+ # It is better to raise an ImportError since we are importing magic module
-+ raise ImportError('failed to find libmagic. Check your installation')
-+
-+magic_t = ctypes.c_void_p
-+
-+def errorcheck_null(result, func, args):
-+ if result is None:
-+ err = magic_error(args[0])
-+ raise MagicException(err)
-+ else:
-+ return result
-+
-+def errorcheck_negative_one(result, func, args):
-+ if result is -1:
-+ err = magic_error(args[0])
-+ raise MagicException(err)
-+ else:
-+ return result
-+
-+
-+def coerce_filename(filename):
-+ if filename is None:
-+ return None
-+
-+ # ctypes will implicitly convert unicode strings to bytes with
-+ # .encode('ascii'). If you use the filesystem encoding
-+ # then you'll get inconsistent behavior (crashes) depending on the user's
-+ # LANG environment variable
-+ is_unicode = (sys.version_info[0] <= 2 and
-+ isinstance(filename, unicode)) or \
-+ (sys.version_info[0] >= 3 and
-+ isinstance(filename, str))
-+ if is_unicode:
-+ return filename.encode('utf-8')
-+ else:
-+ return filename
-+
-+magic_open = libmagic.magic_open
-+magic_open.restype = magic_t
-+magic_open.argtypes = [c_int]
-+
-+magic_close = libmagic.magic_close
-+magic_close.restype = None
-+magic_close.argtypes = [magic_t]
-+
-+magic_error = libmagic.magic_error
-+magic_error.restype = c_char_p
-+magic_error.argtypes = [magic_t]
-+
-+magic_errno = libmagic.magic_errno
-+magic_errno.restype = c_int
-+magic_errno.argtypes = [magic_t]
-+
-+_magic_file = libmagic.magic_file
-+_magic_file.restype = c_char_p
-+_magic_file.argtypes = [magic_t, c_char_p]
-+_magic_file.errcheck = errorcheck_null
-+
-+def magic_file(cookie, filename):
-+ return _magic_file(cookie, coerce_filename(filename))
-+
-+_magic_buffer = libmagic.magic_buffer
-+_magic_buffer.restype = c_char_p
-+_magic_buffer.argtypes = [magic_t, c_void_p, c_size_t]
-+_magic_buffer.errcheck = errorcheck_null
-+
-+def magic_buffer(cookie, buf):
-+ return _magic_buffer(cookie, buf, len(buf))
-+
-+
-+_magic_load = libmagic.magic_load
-+_magic_load.restype = c_int
-+_magic_load.argtypes = [magic_t, c_char_p]
-+_magic_load.errcheck = errorcheck_negative_one
-+
-+def magic_load(cookie, filename):
-+ return _magic_load(cookie, coerce_filename(filename))
-+
-+magic_setflags = libmagic.magic_setflags
-+magic_setflags.restype = c_int
-+magic_setflags.argtypes = [magic_t, c_int]
-+
-+magic_check = libmagic.magic_check
-+magic_check.restype = c_int
-+magic_check.argtypes = [magic_t, c_char_p]
-+
-+magic_compile = libmagic.magic_compile
-+magic_compile.restype = c_int
-+magic_compile.argtypes = [magic_t, c_char_p]
-+
-+
-+
-+MAGIC_NONE = 0x000000 # No flags
-+MAGIC_DEBUG = 0x000001 # Turn on debugging
-+MAGIC_SYMLINK = 0x000002 # Follow symlinks
-+MAGIC_COMPRESS = 0x000004 # Check inside compressed files
-+MAGIC_DEVICES = 0x000008 # Look at the contents of devices
-+MAGIC_MIME = 0x000010 # Return a mime string
-+MAGIC_MIME_ENCODING = 0x000400 # Return the MIME encoding
-+MAGIC_CONTINUE = 0x000020 # Return all matches
-+MAGIC_CHECK = 0x000040 # Print warnings to stderr
-+MAGIC_PRESERVE_ATIME = 0x000080 # Restore access time on exit
-+MAGIC_RAW = 0x000100 # Don't translate unprintable chars
-+MAGIC_ERROR = 0x000200 # Handle ENOENT etc as real errors
-+
-+MAGIC_NO_CHECK_COMPRESS = 0x001000 # Don't check for compressed files
-+MAGIC_NO_CHECK_TAR = 0x002000 # Don't check for tar files
-+MAGIC_NO_CHECK_SOFT = 0x004000 # Don't check magic entries
-+MAGIC_NO_CHECK_APPTYPE = 0x008000 # Don't check application type
-+MAGIC_NO_CHECK_ELF = 0x010000 # Don't check for elf details
-+MAGIC_NO_CHECK_ASCII = 0x020000 # Don't check for ascii files
-+MAGIC_NO_CHECK_TROFF = 0x040000 # Don't check ascii/troff
-+MAGIC_NO_CHECK_FORTRAN = 0x080000 # Don't check ascii/fortran
-+MAGIC_NO_CHECK_TOKENS = 0x100000 # Don't check ascii/tokens
---
-1.8.4.2
-
diff --git a/recipes-devtools/python/python-magic-5.22/0001-Modified-the-magic.py-for-dosocs2-to-fix-the-error-a.patch b/recipes-devtools/python/python3-magic-5.25/0001-Modified-the-magic.py-for-dosocs2-to-fix-the-error-a.patch
index 1383df4..1383df4 100644
--- a/recipes-devtools/python/python-magic-5.22/0001-Modified-the-magic.py-for-dosocs2-to-fix-the-error-a.patch
+++ b/recipes-devtools/python/python3-magic-5.25/0001-Modified-the-magic.py-for-dosocs2-to-fix-the-error-a.patch
diff --git a/recipes-devtools/python/python3-magic_5.22.bb b/recipes-devtools/python/python3-magic_5.25.bb
index 7db444f..edc815c 100644
--- a/recipes-devtools/python/python3-magic_5.22.bb
+++ b/recipes-devtools/python/python3-magic_5.25.bb
@@ -12,11 +12,16 @@ SRC_URI = "ftp://ftp.astron.com/pub/file/file-${PV}.tar.gz \
file://0001-Modified-the-magic.py-for-dosocs2-to-fix-the-error-a.patch \
"
-SRC_URI[md5sum] = "8fb13e5259fe447e02c4a37bc7225add"
-SRC_URI[sha256sum] = "c4e3a8e44cb888c5e4b476e738503e37fb9de3b25a38c143e214bfc12109fc0b"
+SRC_URI[md5sum] = "e6a972d4e10d9e76407a432f4a63cd4c"
+SRC_URI[sha256sum] = "3735381563f69fb4239470b8c51b876a80425348b8285a7cded8b61d6b890eca"
S="${WORKDIR}/file-${PV}/python"
inherit setuptools3 python3-dir
BBCLASSEXTEND = "native"
+
+do_install_append(){
+ install -d ${D}${datadir}/misc/
+ install -m 644 ${WORKDIR}/file-${PV}/magic/Magdir/magic ${D}${datadir}/misc/magic
+}
diff --git a/recipes-devtools/python/python3-nltk_3.0.3.bb b/recipes-devtools/python/python3-nltk_3.0.3.bb
new file mode 100644
index 0000000..0c9e5d2
--- /dev/null
+++ b/recipes-devtools/python/python3-nltk_3.0.3.bb
@@ -0,0 +1,22 @@
+SUMMARY = "Natural Language Toolkit"
+DESCRIPTION = "NLTK is a leading platform for building Python programs \
+to work with human language data."
+HOMEPAGE = "http://www.nltk.org/"
+SECTION = "libs"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=dda944de6d6a9ad8f6bb436dffdade1b"
+
+SRC_URI = "https://pypi.python.org/packages/source/n/nltk/nltk-${PV}.tar.gz \
+ "
+
+SRC_URI[md5sum] = "7bda53f59051337554d243bef904a5e9"
+SRC_URI[sha256sum] = "28d6175984445b9cdcc719f36701f034320edbecb78b69a37d1edc876843ea93"
+
+inherit distutils pythonnative setuptools python-dir
+
+S="${WORKDIR}/nltk-3.0.3"
+
+BBCLASSEXTEND = "native"
+
+
diff --git a/recipes-devtools/python/python3-six_1.10.0.bb b/recipes-devtools/python/python3-six_1.10.0.bb
new file mode 100644
index 0000000..5fd2918
--- /dev/null
+++ b/recipes-devtools/python/python3-six_1.10.0.bb
@@ -0,0 +1,13 @@
+SUMMARY = "python3 compatibility library"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=6f00d4a50713fa859858dd9abaa35b21"
+
+SRC_URI[md5sum] = "34eed507548117b2ab523ab14b2f8b55"
+SRC_URI[sha256sum] = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a"
+
+RDEPENDS_${PN} += "${PYTHON_PN}-io"
+
+inherit pypi setuptools3 distutils3 python3native python3-dir
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/recipes-devtools/python/python3-whatthepatch_git.bb b/recipes-devtools/python/python3-whatthepatch_git.bb
deleted file mode 100644
index 9e8fb6a..0000000
--- a/recipes-devtools/python/python3-whatthepatch_git.bb
+++ /dev/null
@@ -1,22 +0,0 @@
-DESCRIPTION = "is a library for parsing patch files.Its only purpose is to \
-read a patch file and get it into some usable form by other programs."
-HOMEPAGE = "https://github.com/cscorley/whatthepatch"
-SECTION = "devel/python"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263"
-
-SRCREV = "39c8edd34ef30d409d367ffc548d0f0fc5545a18"
-BRANCH = "master"
-PV = "0.0.5"
-
-SRC_URI = "git://github.com/cscorley/whatthepatch.git;protocol=https;branch=${BRANCH} \
- "
-S = "${WORKDIR}/git"
-
-PYTHON_INHERIT = "${@bb.utils.contains('PACKAGECONFIG', 'python2', 'pythonnative', '', d)}"
-PYTHON_INHERIT = "${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3native', '', d)}"
-
-inherit distutils3 ${PYTHON_INHERIT} setuptools3 python3-dir
-
-BBCLASSEXTEND = "native"
-
diff --git a/recipes-extended/glib-2.0/glib-2.0_%.bbappend b/recipes-extended/glib-2.0/glib-2.0_%.bbappend
new file mode 100644
index 0000000..fdc1027
--- /dev/null
+++ b/recipes-extended/glib-2.0/glib-2.0_%.bbappend
@@ -0,0 +1 @@
+STATIC_LINK = "${@bb.utils.contains('PACKAGECONFIG', 'system-pcre', 'system-pcre', '', d)}"
diff --git a/recipes-extended/perl/perl_5.24.1.bbappend b/recipes-extended/perl/perl_5.24.1.bbappend
index 6e9fd30..0042c86 100644
--- a/recipes-extended/perl/perl_5.24.1.bbappend
+++ b/recipes-extended/perl/perl_5.24.1.bbappend
@@ -1 +1 @@
-CONTAINED_BY=" File-Path-2.12 "
+CONTAINED=" File-Path-2.12 "