summaryrefslogtreecommitdiffstats
path: root/external/meta-spdxscanner
diff options
context:
space:
mode:
authortakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-10-22 14:58:56 +0900
committertakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-10-22 14:58:56 +0900
commit4204309872da5cb401cbb2729d9e2d4869a87f42 (patch)
treec7415e8600205e40ff7e91e8e5f4c411f30329f2 /external/meta-spdxscanner
parent5b80bfd7bffd4c20d80b7c70a7130529e9a755dd (diff)
Diffstat (limited to 'external/meta-spdxscanner')
-rw-r--r--external/meta-spdxscanner/README.md63
-rw-r--r--external/meta-spdxscanner/classes/dosocs-host.bbclass262
-rw-r--r--external/meta-spdxscanner/classes/dosocs.bbclass302
-rw-r--r--external/meta-spdxscanner/classes/fossdriver-host.bbclass241
-rw-r--r--external/meta-spdxscanner/classes/fossology-rest.bbclass499
-rw-r--r--external/meta-spdxscanner/classes/scancode-tk.bbclass139
-rw-r--r--external/meta-spdxscanner/classes/spdx-common.bbclass221
-rw-r--r--external/meta-spdxscanner/conf/include/security_flags.inc1
-rw-r--r--external/meta-spdxscanner/conf/layer.conf2
-rw-r--r--external/meta-spdxscanner/conf/lid-scan.conf3
-rw-r--r--external/meta-spdxscanner/conf/spdx-dosocs.conf5
-rw-r--r--external/meta-spdxscanner/recipes-devtools/file/file/0001-magic.py-modified-for-dosocs2.patch501
-rw-r--r--external/meta-spdxscanner/recipes-devtools/file/file_%.bbappend3
-rw-r--r--external/meta-spdxscanner/recipes-devtools/fossology/fossology-nomos-native_git.bb29
-rw-r--r--external/meta-spdxscanner/recipes-devtools/fossology/fossology-nomos/0001-Add-rpath-to-fix-error-as-following.patch28
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/files/0001-Delete-the-version-limit-for-dosocs2.patch25
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/files/0001-Deleted-version-limit-for-dosocs2.patch25
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/files/0001-setup-py-delete-the-depends-install.patch34
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python-futures/python-futures_%.bbappend1
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python-lid_git.bb25
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python-nltk_3.0.3.bb22
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python-whatthepatch_0.0.5.bb22
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-docopt_0.6.2.bb17
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2-init_git.bb49
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2/0001-Fix-a-error-as-fowllowing.patch27
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2/0001-Fix-a-magic-error-as-following.patch26
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2/0001-Fix-bugs-because-python-from-2.x-to-3.x.patch142
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2_git.bb36
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-jinja2_%.bbappend3
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-lid_git.bb25
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-magic-5.25/0001-Modified-the-magic.py-for-dosocs2-to-fix-the-error-a.patch504
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-magic_5.25.bb27
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-markupsafe_%.bbappend1
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-nltk_3.0.3.bb22
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-psycopg2-native_2.6.1.bb23
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-six_1.10.0.bb13
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-sphinx-native_1.6.6.bb18
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-sqlalchemy_%.bbappend3
-rw-r--r--external/meta-spdxscanner/recipes-devtools/python/python3-whatthepatch_0.0.5.bb22
-rw-r--r--external/meta-spdxscanner/recipes-devtools/scancode-toolkit/scancode-toolkit-native_3.1.1.bb40
-rw-r--r--external/meta-spdxscanner/recipes-extended/glib-2.0/glib-2.0_%.bbappend1
-rw-r--r--external/meta-spdxscanner/recipes-extended/perl/perl_%.bbappend1
-rw-r--r--external/meta-spdxscanner/recipes-support/postgresql/files/0001-Use-pkg-config-for-libxml2-detection.patch43
-rw-r--r--external/meta-spdxscanner/recipes-support/postgresql/postgresql-native_9.4.11.bb91
44 files changed, 974 insertions, 2613 deletions
diff --git a/external/meta-spdxscanner/README.md b/external/meta-spdxscanner/README.md
index 799bba1f..a41f8216 100644
--- a/external/meta-spdxscanner/README.md
+++ b/external/meta-spdxscanner/README.md
@@ -1,52 +1,79 @@
+# This repository has been moved to http://git.yoctoproject.org/cgit/cgit.cgi/meta-spdxscanner/.
+
# meta-spdxscanner
meta-spdxscanner supports the following SPDX create tools.
-1. fossdriver (recommend)
-2. DoSOCSv2 (Not recommended)
+1. fossology REST API (Can work with fossology after 3.5.0)
+2. fossdriver (Can work with fossology)
+3. scancode-toolkit
+4. DoSOCSv2 (Scanner comes from fossology 3.4.0)
+
+# This layer supplys invoking scanners as following:
+
+1. fossology REST API
+- openembedded-core
-# This layer depends on:
+2. fossdriver
+- openembedded-core
+3. scancode-toolkit
+- openembedded-core
+
+4. DoSOCSv2
- openembedded-core
- meta-openembedded/meta-oe
- meta-openembedded/meta-python
# How to use
-1. fossdriver-host.bbclass(recommend)
+1. fossology-rest.bbclass
+- inherit the folowing class in your conf/local.conf for all of recipes or
+ in some recipes which you want.
+
+```
+ INHERIT += "fossology-rest"
+ TOKEN = "eyJ0eXAiO..."
+ FOSSOLOGY_SERVER = "http://xx.xx.xx.xx:8081/repo" //Optional,by default, it is http://127.0.0.1:8081/repo
+ FOLDER_NAME = "xxxx" //Optional,by default, it is the top folder "Software Repository"(folderId=1).
+```
+Note
+- If you want to use fossology-rest.bbclass, you have to make sure that fossology server on your host and make sure it works well.
+ Please reference to https://hub.docker.com/r/fossology/fossology/.
+- TOKEN can be created on fossology server after login by "Admin"->"Users"->"Edit user account"->"Create a new token".
+- If you don't want to create spdx files for *-native, please use meta-spdxscanner/classes/nopackages.bbclass instead of oe-core.
+
+2. fossdriver-host.bbclass
- inherit the folowing class in your conf/local.conf for all of recipes or
in some recipes which you want.
```
INHERIT += "fossdriver-host"
- SPDX_DEPLOY_DIR = "${SPDX_DEST_DIR}"
```
Note
- If you want to use fossdriver-host.bbclass, you have to make sure that fossology server and fossdriver has been installed on your host and make sure it works well.
Please reference to https://hub.docker.com/r/fossology/fossology/ and https://github.com/fossology/fossdriver.
- Please use meta-spdxscanner/classes/nopackages.bbclass instead of oe-core. Because there is no necessary to create spdx files for *-native.
-2. dosocs-host.bbclass (Not recommended)
+3. scancode.bbclass
- inherit the folowing class in your conf/local.conf for all of recipes or
in some recipes which you want.
```
- INHERIT += "dosocs-host"
- SPDX_DEPLOY_DIR = "${SPDX_DEST_DIR}"
+ INHERIT += "scancode-tk"
```
-
Note
- - If you want to use dosocs-host.bbclass, you have to make sure that DoSOCSv2 has been installed on your host and it works wekk.
- Please reference to https://github.com/DoSOCSv2/DoSOCSv2.
- - To make DoSOCSv2 support multi task, Add PostgreSQL configuration for DoSOCSv2.
-
-3. dosocs.bbclass (Not recommended)
+- If you want to use scancode.bbclass, There is no need to install anything on your host.
+- To aviod loop dependence,please use meta-spdxscanner/classes/nopackages.bbclass instead the file comes from oe-core.
+
+
+4. dosocs.bbclass
- inherit the folowing class in your conf/local.conf for all of recipes or
in some recipes which you want.
```
INHERIT += "dosocs"
- SPDX_DEPLOY_DIR = "${SPDX_DEST_DIR}"
```
-
-Note
- - Default, DoSOCSv2 uses SQLite for database, so dosocs.bbclass doesn't support multi tasks of do_spdx.
+Note
+- There is no necessary to install any OSS on host.
+- Please use meta-spdxscanner/classes/nopackages.bbclass instead of oe-core. Because there is no necessary to create spdx files for *-native.
+- Default, DoSOCSv2 uses SQLite for database, so dosocs.bbclass doesn't support multi tasks of do_spdx.
diff --git a/external/meta-spdxscanner/classes/dosocs-host.bbclass b/external/meta-spdxscanner/classes/dosocs-host.bbclass
deleted file mode 100644
index a6ed6917..00000000
--- a/external/meta-spdxscanner/classes/dosocs-host.bbclass
+++ /dev/null
@@ -1,262 +0,0 @@
-# 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.
-
-SPDXSSTATEDIR = "${WORKDIR}/spdx_sstate_dir"
-LICENSELISTVERSION = "2.6"
-CREATOR_TOOL = "meta-spdxscanner"
-# If ${S} isn't actually the top-level source directory, set SPDX_S to point at
-# the real top-level directory.
-
-SPDX_S ?= "${S}"
-
-python do_spdx () {
- import os, sys
- import json
-
- import shutil
-
- pn = d.getVar('PN')
- workdir_tmp = d.getVar('WORKDIR')
-
- ## It's no necessary to get spdx files for *-native
- if pn.find("-native") != -1 or pn.find("binutils-cross") != -1:
- return None
-
- # 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'))
-
- ## gcc and kernel is too big to get spdx file.
- if ('gcc') in d.getVar('PN', True):
- #invoke_dosocs2("/yocto/work002/fnst/leimh/community/gcc-7.3.0/","/yocto/work001/gcc-7.3.spdx",(d.getVar('WORKDIR', True) or ""))
- return None
- if bb.data.inherits_class('kernel', d):
- #invoke_dosocs2("/yocto/work002/fnst/leimh/community/linux-4.14.44","/yocto/work001/linux-4.14.44.spdx",(d.getVar('WORKDIR', True) or ""))
- return None
-
- bb.note('Archiving the configured source...')
- # "gcc-source-${PV}" recipes don't have "do_configure"
- # 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.
- 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)
- bb.build.exec_func('do_unpack', d)
-
- d.setVar('WORKDIR', workdir_tmp)
- 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 "")
- 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 "")
- info['outfile'] = os.path.join(manifest_dir, info['pn'] + "-" + info['pv'] + ".spdx" )
- sstatefile = os.path.join(spdx_sstate_dir,
- info['pn'] + "-" + info['pv'] + ".spdx" )
-
- ## get everything from cache. use it to decide if
- ## something needs to be rerun
- if not os.path.exists( spdx_sstate_dir ):
- bb.utils.mkdirhier( spdx_sstate_dir )
-
- d.setVar('WORKDIR', d.getVar('SPDX_TEMP_DIR', True))
- info['sourcedir'] = (d.getVar('SPDX_S', True) or "")
- cur_ver_code = get_ver_code( info['sourcedir'] ).split()[0]
- cache_cur = False
- if os.path.exists( sstatefile ):
- ## cache for this package exists. read it in
- cached_spdx = get_cached_spdx( sstatefile )
- if cached_spdx:
- cached_spdx = cached_spdx.split()[0]
- if (cached_spdx == 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 spdx file
- #bb.warn(' run_dosocs2 ...... ')
- invoke_dosocs2(info['sourcedir'],sstatefile,info['workdir'])
- if get_cached_spdx( sstatefile ) != None:
- write_cached_spdx( info,sstatefile,cur_ver_code )
- ## CREATE MANIFEST(write to outfile )
- create_manifest(info,sstatefile)
- else:
- bb.warn('Can\'t get the spdx file ' + info['pn'] + '. Please check your dosocs2.')
- d.setVar('WORKDIR', info['workdir'])
-}
-
-addtask spdx after do_patch before do_configure
-
-def invoke_dosocs2( OSS_src_dir, spdx_file, workdir):
- import subprocess
- import string
- import json
- import codecs
-
-
- dosocs2_cmd = "/usr/local/bin/dosocs2"
- dosocs2_oneshot_cmd = dosocs2_cmd + " oneshot " + OSS_src_dir
- print(dosocs2_oneshot_cmd)
- try:
- dosocs2_output = subprocess.check_output(dosocs2_oneshot_cmd,
- stderr=subprocess.STDOUT,
- shell=True)
- except subprocess.CalledProcessError as e:
- bb.warn("Could not invoke dosocs2 oneshot Command "
- "'%s' returned %d:\n%s" % (dosocs2_oneshot_cmd, e.returncode, e.output))
- return None
- dosocs2_output = dosocs2_output.decode('utf-8')
-
- f = codecs.open(spdx_file,'w','utf-8')
- f.write(dosocs2_output)
-
-def create_manifest(info,sstatefile):
- import shutil
- shutil.copyfile(sstatefile,info['outfile'])
-
-def get_cached_spdx( 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_spdx_info=output.decode('utf-8').split(': ')
- return cached_spdx_info[1]
-
-## Add necessary information into spdx file
-def write_cached_spdx( 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>"
- sed_cmd = sed_replace(sed_cmd,"DocumentComment",spdx_DocumentComment)
-
- ## Creator information
- sed_cmd = sed_replace(sed_cmd,"Creator: ",info['creator']['Tool'])
- sed_cmd = sed_replace(sed_cmd,"LicenseListVersion: ",info['license_list_version'])
-
- ## Package level information
- sed_cmd = sed_replace(sed_cmd,"PackageName: ",info['pn'])
- sed_cmd = sed_insert(sed_cmd,"PackageName: ", "PackageVersion: " + info['pv'])
- sed_cmd = sed_replace(sed_cmd,"PackageDownloadLocation: ",info['package_download_location'])
- sed_cmd = sed_replace(sed_cmd,"PackageHomePage: ",info['package_homepage'])
- sed_cmd = sed_replace(sed_cmd,"PackageSummary: ","<text>" + info['package_summary'] + "</text>")
- sed_cmd = sed_insert(sed_cmd,"PackageVerificationCode: ",ver_code)
- sed_cmd = sed_replace(sed_cmd,"PackageDescription: ",
- "<text>" + info['pn'] + " version " + info['pv'] + "</text>")
- for contain in info['package_contains'].split( ):
- 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)
-
-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/external/meta-spdxscanner/classes/dosocs.bbclass b/external/meta-spdxscanner/classes/dosocs.bbclass
deleted file mode 100644
index 755e8260..00000000
--- a/external/meta-spdxscanner/classes/dosocs.bbclass
+++ /dev/null
@@ -1,302 +0,0 @@
-# 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_spdx[depends] += "python3-dosocs2-native:do_populate_sysroot"
-
-SPDXSSTATEDIR = "${WORKDIR}/spdx_sstate_dir"
-
-# If ${S} isn't actually the top-level source directory, set SPDX_S to point at
-# the real top-level directory.
-
-SPDX_S ?= "${S}"
-
-python do_spdx () {
- import os, sys
- import json
-
- pn = d.getVar("PN")
- depends = d.getVar("DEPENDS")
- ## It's no necessary to get spdx files for *-native
- if pn.find("-native") == -1 and pn.find("binutils-cross") == -1:
- PYTHON = "${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}"
- os.environ['PYTHON'] = PYTHON
- depends = "%s python3-dosocs2-init-native" % depends
- d.setVar("DEPENDS", depends)
- else:
- return None
-
- ## gcc and kernel is too big to get spdx file.
- if ('gcc' or 'linux-yocto') 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 "")
- 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 "")
- info['outfile'] = os.path.join(manifest_dir, info['pn'] + "-" + info['pv'] + ".spdx" )
- sstatefile = os.path.join(spdx_sstate_dir,
- info['pn'] + "-" + info['pv'] + ".spdx" )
-
- ## get everything from cache. use it to decide if
- ## something needs to be rerun
- if not os.path.exists( spdx_sstate_dir ):
- bb.utils.mkdirhier( spdx_sstate_dir )
-
- d.setVar('WORKDIR', d.getVar('SPDX_TEMP_DIR', True))
- info['sourcedir'] = (d.getVar('SPDX_S', True) or "")
- cur_ver_code = get_ver_code( info['sourcedir'] ).split()[0]
- cache_cur = False
- if os.path.exists( sstatefile ):
- ## cache for this package exists. read it in
- cached_spdx = get_cached_spdx( sstatefile )
- if cached_spdx:
- cached_spdx = cached_spdx.split()[0]
- if (cached_spdx == 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 spdx file
- #bb.warn(' run_dosocs2 ...... ')
- invoke_dosocs2(info['sourcedir'],sstatefile)
- if get_cached_spdx( sstatefile ) != None:
- write_cached_spdx( info,sstatefile,cur_ver_code )
- ## CREATE MANIFEST(write to outfile )
- create_manifest(info,sstatefile)
- else:
- bb.warn('Can\'t get the spdx file ' + info['pn'] + '. Please check your dosocs2.')
- d.setVar('WORKDIR', info['workdir'])
-}
-#python () {
-# deps = ' python3-dosocs2-native:do_dosocs2_init'
-# d.appendVarFlag('do_spdx', 'depends', deps)
-#}
-
-## Get the src after do_patch.
-python do_get_spdx_s() {
- import shutil
-
- pn = d.getVar('PN')
- ## It's no necessary to get spdx files for *-native
- if d.getVar('PN', True) == d.getVar('BPN', True) + "-native":
- return None
-
- ## gcc and kernel is too big to get spdx file.
- if ('gcc' or 'linux-yocto') in d.getVar('PN', True):
- return None
-
- # 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'))
-
- bb.note('Archiving the configured source...')
- pn = d.getVar('PN')
- # "gcc-source-${PV}" recipes don't have "do_configure"
- # 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.
- 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)
- bb.build.exec_func('do_unpack', d)
-}
-
-python () {
- pn = d.getVar("PN")
- depends = d.getVar("DEPENDS")
-
- if pn.find("-native") == -1 and pn.find("binutils-cross") == -1:
- depends = "%s python3-dosocs2-native" % depends
- d.setVar("DEPENDS", depends)
- bb.build.addtask('do_get_spdx_s','do_configure','do_patch', d)
- bb.build.addtask('do_spdx','do_package', 'do_get_spdx_s', d)
-}
-#addtask get_spdx_s after do_patch before do_configure
-#addtask spdx after do_get_spdx_s before do_package
-
-def invoke_dosocs2( OSS_src_dir, spdx_file):
- import subprocess
- import string
- import json
- import codecs
-
- path = os.getenv('PATH')
- dosocs2_cmd = bb.utils.which(os.getenv('PATH'), "dosocs2")
- dosocs2_oneshot_cmd = dosocs2_cmd + " oneshot " + OSS_src_dir
- print(dosocs2_oneshot_cmd)
- try:
- dosocs2_output = subprocess.check_output(dosocs2_oneshot_cmd,
- stderr=subprocess.STDOUT,
- shell=True)
- except subprocess.CalledProcessError as e:
- bb.fatal("Could not invoke dosocs2 oneshot Command "
- "'%s' returned %d:\n%s" % (dosocs2_oneshot_cmd, e.returncode, e.output))
- dosocs2_output = dosocs2_output.decode('utf-8')
-
- f = codecs.open(spdx_file,'w','utf-8')
- f.write(dosocs2_output)
-
-def create_manifest(info,sstatefile):
- import shutil
- shutil.copyfile(sstatefile,info['outfile'])
-
-def get_cached_spdx( 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_spdx_info=output.decode('utf-8').split(': ')
- return cached_spdx_info[1]
-
-## Add necessary information into spdx file
-def write_cached_spdx( 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>"
- sed_cmd = sed_replace(sed_cmd,"DocumentComment",spdx_DocumentComment)
-
- ## Package level information
- sed_cmd = sed_replace(sed_cmd,"PackageName: ",info['pn'])
- sed_cmd = sed_insert(sed_cmd,"PackageVersion: ",info['pv'])
- sed_cmd = sed_replace(sed_cmd,"PackageDownloadLocation: ",info['package_download_location'])
- sed_cmd = sed_replace(sed_cmd,"PackageChecksum: ","PackageHomePage: " + info['package_homepage'])
- sed_cmd = sed_replace(sed_cmd,"PackageSummary: ","<text>" + info['package_summary'] + "</text>")
- sed_cmd = sed_replace(sed_cmd,"PackageVerificationCode: ",ver_code)
- sed_cmd = sed_replace(sed_cmd,"PackageDescription: ",
- "<text>" + info['pn'] + " version " + info['pv'] + "</text>")
- for contain in info['package_contains'].split( ):
- 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)
-
-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/external/meta-spdxscanner/classes/fossdriver-host.bbclass b/external/meta-spdxscanner/classes/fossdriver-host.bbclass
index a279eab1..0b168a60 100644
--- a/external/meta-spdxscanner/classes/fossdriver-host.bbclass
+++ b/external/meta-spdxscanner/classes/fossdriver-host.bbclass
@@ -1,40 +1,23 @@
# 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.
+# It is a combination of efforts from the OE-Core, SPDX and fossology projects.
#
-# For more information on DoSOCSv2:
-# https://github.com/DoSOCSv2
+# For more information on fossology REST API:
+# https://www.fossology.org/get-started/basic-rest-api-calls/
#
# For more information on SPDX:
# http://www.spdx.org
#
# Note:
-# 1) Make sure fossdriver 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.
-
-
-SPDXEPENDENCY += "${PATCHTOOL}-native:do_populate_sysroot"
-SPDXEPENDENCY += " wget-native:do_populate_sysroot"
-SPDXEPENDENCY += " subversion-native:do_populate_sysroot"
-SPDXEPENDENCY += " git-native:do_populate_sysroot"
-SPDXEPENDENCY += " lz4-native:do_populate_sysroot"
-SPDXEPENDENCY += " lzip-native:do_populate_sysroot"
-SPDXEPENDENCY += " xz-native:do_populate_sysroot"
-SPDXEPENDENCY += " unzip-native:do_populate_sysroot"
-SPDXEPENDENCY += " xz-native:do_populate_sysroot"
-SPDXEPENDENCY += " nodejs-native:do_populate_sysroot"
-SPDXEPENDENCY += " quilt-native:do_populate_sysroot"
-SPDXEPENDENCY += " tar-native:do_populate_sysroot"
-
-SPDX_TOPDIR ?= "${WORKDIR}/spdx_sstate_dir"
-SPDX_OUTDIR = "${SPDX_TOPDIR}/${TARGET_SYS}/${PF}/"
-SPDX_WORKDIR = "${WORKDIR}/spdx_temp/"
+# 1) Make sure fossology (after 3.5.0)(https://hub.docker.com/r/fossology/fossology/) has beed started on your host
+# 2) spdx files will be output to the path which is defined as[SPDX_DEPLOY_DIR].
+# By default, SPDX_DEPLOY_DIR is tmp/deploy/
+# 3) Added TOKEN has been set in conf/local.conf
+#
-do_spdx[dirs] = "${WORKDIR}"
+inherit spdx-common
-LICENSELISTVERSION = "2.6"
-CREATOR_TOOL = "meta-spdxscanner"
+CREATOR_TOOL = "fossdriver-host.bbclass in meta-spdxscanner"
# If ${S} isn't actually the top-level source directory, set SPDX_S to point at
# the real top-level directory.
@@ -55,8 +38,6 @@ python do_spdx () {
# so avoid archiving source here.
if pn.startswith('glibc-locale'):
return
- if (d.getVar('BPN') == "linux-yocto"):
- return
if (d.getVar('PN') == "libtool-cross"):
return
if (d.getVar('PN') == "libgcc-initial"):
@@ -64,6 +45,9 @@ python do_spdx () {
if (d.getVar('PN') == "shadow-sysroot"):
return
+ if d.getVar('BPN') in ['gcc', 'libgcc']:
+ bb.debug(1, 'spdx: There is bug in scan of %s is, do nothing' % pn)
+ return
# We just archive gcc-source for all the gcc related recipes
if d.getVar('BPN') in ['gcc', 'libgcc']:
@@ -103,6 +87,9 @@ python do_spdx () {
info['modified'] = "true"
manifest_dir = (d.getVar('SPDX_DEPLOY_DIR', True) or "")
+ if not os.path.exists( manifest_dir ):
+ bb.utils.mkdirhier( manifest_dir )
+
info['outfile'] = os.path.join(manifest_dir, info['pn'] + "-" + info['pv'] + ".spdx" )
sstatefile = os.path.join(spdx_outdir, info['pn'] + "-" + info['pv'] + ".spdx" )
@@ -122,8 +109,12 @@ python do_spdx () {
for f_dir, f in list_files(spdx_temp_dir):
temp_file = os.path.join(spdx_temp_dir,f_dir,f)
shutil.copy(temp_file, temp_dir)
- shutil.rmtree(spdx_temp_dir)
+
d.setVar('WORKDIR', spdx_workdir)
+ info['sourcedir'] = spdx_workdir
+ git_path = "%s/git/.git" % info['sourcedir']
+ if os.path.exists(git_path):
+ remove_dir_tree(git_path)
tar_name = spdx_create_tarball(d, d.getVar('WORKDIR'), 'patched', spdx_outdir)
## get everything from cache. use it to decide if
## something needs to be rerun
@@ -142,76 +133,21 @@ python do_spdx () {
create_manifest(info,sstatefile)
else:
bb.warn('Can\'t get the spdx file ' + info['pn'] + '. Please check your.')
+ remove_file(tar_name)
}
-addtask do_spdx before do_unpack after do_fetch
-
-def spdx_create_tarball(d, srcdir, suffix, ar_outdir):
- """
- create the tarball from srcdir
- """
- import tarfile, shutil
- # Make sure we are only creating a single tarball for gcc sources
- #if (d.getVar('SRC_URI') == ""):
- # return
-
- # For the kernel archive, srcdir may just be a link to the
- # work-shared location. Use os.path.realpath to make sure
- # that we archive the actual directory and not just the link.
- srcdir = os.path.realpath(srcdir)
-
- bb.utils.mkdirhier(ar_outdir)
- if suffix:
- filename = '%s-%s.tar.gz' % (d.getVar('PF'), suffix)
- else:
- filename = '%s.tar.gz' % d.getVar('PF')
- tarname = os.path.join(ar_outdir, filename)
-
- bb.note('Creating %s' % tarname)
- tar = tarfile.open(tarname, 'w:gz')
- tar.add(srcdir, arcname=os.path.basename(srcdir))
- tar.close()
- shutil.rmtree(srcdir)
- return tarname
-
-# Run do_unpack and do_patch
-def spdx_get_src(d):
- import shutil
- spdx_workdir = d.getVar('SPDX_WORKDIR')
- spdx_sysroot_native = d.getVar('STAGING_DIR_NATIVE')
- pn = d.getVar('PN')
-
- # We just archive gcc-source for all the gcc related recipes
- if d.getVar('BPN') in ['gcc', 'libgcc']:
- bb.debug(1, 'spdx: There is bug in scan of %s is, do nothing' % pn)
- return
-
- # The kernel class functions require it to be on work-shared, so we dont change WORKDIR
- if not is_work_shared(d):
- # Change the WORKDIR to make do_unpack do_patch run in another dir.
- d.setVar('WORKDIR', spdx_workdir)
- # Restore the original path to recipe's native sysroot (it's relative to WORKDIR).
- d.setVar('STAGING_DIR_NATIVE', spdx_sysroot_native)
-
- # The changed 'WORKDIR' also caused 'B' changed, create dir 'B' for the
- # possibly requiring of the following tasks (such as some recipes's
- # do_patch required 'B' existed).
- bb.utils.mkdirhier(d.getVar('B'))
-
- bb.build.exec_func('do_unpack', d)
-
- # Make sure gcc and kernel sources are patched only once
- if not (d.getVar('SRC_URI') == "" or is_work_shared(d)):
- bb.build.exec_func('do_patch', d)
- # Some userland has no source.
- if not os.path.exists( spdx_workdir ):
- bb.utils.mkdirhier(spdx_workdir)
def invoke_fossdriver(tar_file, spdx_file):
import os
import time
delaytime = 20
+ import logging
+
+ logger = logging.getLogger()
+ logger.setLevel(logging.INFO)
+ logging.basicConfig(level=logging.INFO)
+
(work_dir, tar_file) = os.path.split(tar_file)
os.chdir(work_dir)
@@ -238,7 +174,7 @@ def invoke_fossdriver(tar_file, spdx_file):
i = 0
while i < 10:
if (Scanners(server, tar_file, "Software Repository").run() != True):
- bb.warn("%s scanner failed, try again!" % tar_file)
+ bb.warn("%s Scanners failed, try again!" % tar_file)
time.sleep(delaytime)
i+= 1
else:
@@ -270,123 +206,4 @@ def invoke_fossdriver(tar_file, spdx_file):
bb.warn("%s SPDXTV failed, Please check your fossology server." % tar_file)
return False
-def create_manifest(info,sstatefile):
- import shutil
- shutil.copyfile(sstatefile,info['outfile'])
-
-def get_cached_spdx( 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_spdx_info=output.decode('utf-8').split(': ')
- return cached_spdx_info[1]
-
-## Add necessary information into spdx file
-def write_cached_spdx( 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>"
- sed_cmd = sed_replace(sed_cmd,"DocumentComment",spdx_DocumentComment)
-
- ## Creator information
- sed_cmd = sed_replace(sed_cmd,"Creator: ",info['creator']['Tool'])
-
- ## Package level information
- sed_cmd = sed_replace(sed_cmd, "PackageName: ", info['pn'])
- sed_cmd = sed_insert(sed_cmd, "PackageName: ", "PackageVersion: " + info['pv'])
- sed_cmd = sed_replace(sed_cmd, "PackageDownloadLocation: ",info['package_download_location'])
- sed_cmd = sed_insert(sed_cmd, "PackageDownloadLocation: ", "PackageHomePage: " + info['package_homepage'])
- sed_cmd = sed_insert(sed_cmd, "PackageDownloadLocation: ", "PackageSummary: " + "<text>" + info['package_summary'] + "</text>")
- sed_cmd = sed_insert(sed_cmd, "PackageDownloadLocation: ", "modification record : " + info['modified'])
- sed_cmd = sed_replace(sed_cmd, "PackageVerificationCode: ",ver_code)
- sed_cmd = sed_insert(sed_cmd, "PackageVerificationCode: ", "PackageDescription: " +
- "<text>" + info['pn'] + " version " + info['pv'] + "</text>")
- for contain in info['package_contains'].split( ):
- 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)
-
-def is_work_shared(d):
- pn = d.getVar('PN')
- return bb.data.inherits_class('kernel', d) or pn.startswith('gcc-source')
-
-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
-
-do_spdx[depends] = "${SPDXEPENDENCY}"
-
EXPORT_FUNCTIONS do_spdx
diff --git a/external/meta-spdxscanner/classes/fossology-rest.bbclass b/external/meta-spdxscanner/classes/fossology-rest.bbclass
new file mode 100644
index 00000000..d253853d
--- /dev/null
+++ b/external/meta-spdxscanner/classes/fossology-rest.bbclass
@@ -0,0 +1,499 @@
+# 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 fossdriver 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.
+inherit spdx-common
+FOSSOLOGY_SERVER ?= "http://127.0.0.1:8081/repo"
+
+#upload OSS into No.1 folder of fossology
+FOLDER_ID = "1"
+
+HOSTTOOLS_NONFATAL += "curl"
+
+CREATOR_TOOL = "fossology-rest.bbclass in meta-spdxscanner"
+
+# If ${S} isn't actually the top-level source directory, set SPDX_S to point at
+# the real top-level directory.
+SPDX_S ?= "${S}"
+
+python do_spdx () {
+ import os, sys, shutil
+
+ pn = d.getVar('PN')
+ assume_provided = (d.getVar("ASSUME_PROVIDED") or "").split()
+ if pn in assume_provided:
+ for p in d.getVar("PROVIDES").split():
+ if p != pn:
+ pn = p
+ break
+ if d.getVar('BPN') in ['gcc', 'libgcc']:
+ bb.debug(1, 'spdx: There is bug in scan of %s is, do nothing' % pn)
+ return
+ # The following: do_fetch, do_unpack and do_patch tasks have been deleted,
+ # so avoid archiving do_spdx here.
+ if pn.startswith('glibc-locale'):
+ return
+ if (d.getVar('PN') == "libtool-cross"):
+ return
+ if (d.getVar('PN') == "libgcc-initial"):
+ return
+ if (d.getVar('PN') == "shadow-sysroot"):
+ return
+
+ spdx_outdir = d.getVar('SPDX_OUTDIR')
+ spdx_workdir = d.getVar('SPDX_WORKDIR')
+ spdx_temp_dir = os.path.join(spdx_workdir, "temp")
+ temp_dir = os.path.join(d.getVar('WORKDIR'), "temp")
+
+ 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 "")
+ info['package_static_link'] = (d.getVar('STATIC_LINK', True) or "")
+ info['modified'] = "false"
+ info['token'] = (d.getVar('TOKEN', True) or "")
+
+ srcuri = d.getVar("SRC_URI", False).split()
+ length = len("file://")
+ for item in srcuri:
+ if item.startswith("file://"):
+ item = item[length:]
+ if item.endswith(".patch") or item.endswith(".diff"):
+ info['modified'] = "true"
+
+ manifest_dir = (d.getVar('SPDX_DEPLOY_DIR', True) or "")
+ if not os.path.exists( manifest_dir ):
+ bb.utils.mkdirhier( manifest_dir )
+
+ info['outfile'] = os.path.join(manifest_dir, info['pn'] + "-" + info['pv'] + ".spdx" )
+ sstatefile = os.path.join(spdx_outdir, info['pn'] + "-" + info['pv'] + ".spdx" )
+
+ # if spdx has been exist
+ if os.path.exists(info['outfile']):
+ bb.note(info['pn'] + "spdx file has been exist, do nothing")
+ return
+ if os.path.exists( sstatefile ):
+ bb.note(info['pn'] + "spdx file has been exist, do nothing")
+ create_manifest(info,sstatefile)
+ return
+
+ spdx_get_src(d)
+
+ bb.note('SPDX: Archiving the patched source...')
+ if os.path.isdir(spdx_temp_dir):
+ for f_dir, f in list_files(spdx_temp_dir):
+ temp_file = os.path.join(spdx_temp_dir,f_dir,f)
+ shutil.copy(temp_file, temp_dir)
+ # shutil.rmtree(spdx_temp_dir)
+ d.setVar('WORKDIR', spdx_workdir)
+ info['sourcedir'] = spdx_workdir
+ git_path = "%s/git/.git" % info['sourcedir']
+ if os.path.exists(git_path):
+ remove_dir_tree(git_path)
+ tar_name = spdx_create_tarball(d, d.getVar('WORKDIR'), 'patched', spdx_outdir)
+
+ ## get everything from cache. use it to decide if
+ ## something needs to be rerun
+ if not os.path.exists(spdx_outdir):
+ bb.utils.mkdirhier(spdx_outdir)
+ cur_ver_code = get_ver_code(spdx_workdir).split()[0]
+ ## Get spdx file
+ bb.note(' run fossology rest api ...... ')
+ if not os.path.isfile(tar_name):
+ bb.warn(info['pn'] + "has no source, do nothing")
+ return
+ folder_id = get_folder_id(d)
+ if invoke_rest_api(d, tar_name, sstatefile, folder_id) == False:
+ bb.warn(info['pn'] + ": Get spdx file fail, please check fossology server.")
+ remove_file(tar_name)
+ return False
+ if get_cached_spdx(sstatefile) != None:
+ write_cached_spdx( info,sstatefile,cur_ver_code )
+ ## CREATE MANIFEST(write to outfile )
+ create_manifest(info,sstatefile)
+ else:
+ bb.warn(info['pn'] + ': Can\'t get the spdx file ' + '. Please check fossology server.')
+ remove_file(tar_name)
+}
+
+def get_folder_id_by_name(d, folder_name):
+ import os
+ import subprocess
+ import json
+
+ server_url = (d.getVar('FOSSOLOGY_SERVER', True) or "")
+ if server_url == "":
+ bb.note("Please set fossology server URL by setting FOSSOLOGY_SERVER!\n")
+ raise OSError(errno.ENOENT, "No setting of FOSSOLOGY_SERVER")
+
+ token = (d.getVar('TOKEN', True) or "")
+ if token == "":
+ bb.note("Please set token of fossology server by setting TOKEN!\n" + srcPath)
+ raise OSError(errno.ENOENT, "No setting of TOKEN comes from fossology server.")
+
+ rest_api_cmd = "curl -k -s -S -X GET " + server_url + "/api/v1/folders" \
+ + " -H \"Authorization: Bearer " + token + "\"" \
+ + " --noproxy 127.0.0.1"
+ bb.note("Invoke rest_api_cmd = " + rest_api_cmd )
+ try:
+ all_folder = subprocess.check_output(rest_api_cmd, stderr=subprocess.STDOUT, shell=True)
+ except subprocess.CalledProcessError as e:
+ bb.error(d.getVar('PN', True) + ": Get folder list failed: \n%s" % e.output.decode("utf-8"))
+ return False
+ all_folder = str(all_folder, encoding = "utf-8")
+ bb.note("all_folder list= " + all_folder)
+ all_folder = json.loads(all_folder)
+ bb.note("len of all_folder = ")
+ bb.note(str(len(all_folder)))
+ if len(all_folder) == 0:
+ bb.note("Can not get folder list.")
+ return False
+ bb.note("all_folder[0][name] = ")
+ bb.note(all_folder[0]["name"])
+ for i in range(0, len(all_folder)):
+ if all_folder[i]["name"] == folder_name:
+ bb.note("Find " + folder_name + "in fossology server ")
+ return all_folder[i]["id"]
+ return False
+
+def create_folder(d, folder_name):
+ import os
+ import subprocess
+
+ server_url = (d.getVar('FOSSOLOGY_SERVER', True) or "")
+ if server_url == "":
+ bb.note("Please set fossology server URL by setting FOSSOLOGY_SERVER!\n")
+ raise OSError(errno.ENOENT, "No setting of FOSSOLOGY_SERVER")
+
+ token = (d.getVar('TOKEN', True) or "")
+ if token == "":
+ bb.note("Please set token of fossology server by setting TOKEN!\n" + srcPath)
+ raise OSError(errno.ENOENT, "No setting of TOKEN comes from fossology server.")
+
+ rest_api_cmd = "curl -k -s -S -X POST " + server_url + "/api/v1/folders" \
+ + " -H \'parentFolder: 1\'" \
+ + " -H \'folderName: " + folder_name + "\'" \
+ + " -H \"Authorization: Bearer " + token + "\"" \
+ + " --noproxy 127.0.0.1"
+ bb.note("Invoke rest_api_cmd = " + rest_api_cmd)
+ try:
+ add_folder = subprocess.check_output(rest_api_cmd, stderr=subprocess.STDOUT, shell=True)
+ except subprocess.CalledProcessError as e:
+ bb.error(d.getVar('PN', True) + ": Added folder failed: \n%s" % e.output.decode("utf-8"))
+ return False
+
+ add_folder = str(add_folder, encoding = "utf-8")
+ bb.note("add_folder = ")
+ bb.note(add_folder)
+ add_folder = eval(add_folder)
+ if str(add_folder["code"]) == "201":
+ bb.note("add_folder = " + folder_name)
+ return add_folder["message"]
+ elif str(add_folder["code"]) == "200":
+ bb.note("Folder : " + folder_name + "has been created.")
+ return get_folder_id_by_name(d, folder_name)
+ else:
+ bb.error(d.getVar('PN', True) + ": Added folder failed, please check your fossology server.")
+ return False
+
+def get_folder_id(d):
+
+ if d.getVar('FOLDER_NAME', False):
+ folder_name = d.getVar('FOLDER_NAME')
+ folder_id = create_folder(d, folder_name)
+ else:
+ folder_id = (d.getVar('FOLDER_ID', True) or "1")
+
+ bb.note("Folder Id = " + str(folder_id))
+ return str(folder_id)
+
+def has_upload(d, tar_file, folder_id):
+ import os
+ import subprocess
+
+ (work_dir, file_name) = os.path.split(tar_file)
+
+ server_url = (d.getVar('FOSSOLOGY_SERVER', True) or "")
+ if server_url == "":
+ bb.note("Please set fossology server URL by setting FOSSOLOGY_SERVER!\n")
+ raise OSError(errno.ENOENT, "No setting of FOSSOLOGY_SERVER")
+
+ token = (d.getVar('TOKEN', True) or "")
+ if token == "":
+ bb.note("Please set token of fossology server by setting TOKEN!\n" + srcPath)
+ raise OSError(errno.ENOENT, "No setting of TOKEN comes from fossology server.")
+
+ rest_api_cmd = "curl -k -s -S -X GET " + server_url + "/api/v1/uploads" \
+ + " -H \"Authorization: Bearer " + token + "\"" \
+ + " --noproxy 127.0.0.1"
+ bb.note("Invoke rest_api_cmd = " + rest_api_cmd )
+
+ try:
+ upload_output = subprocess.check_output(rest_api_cmd, stderr=subprocess.STDOUT, shell=True)
+ except subprocess.CalledProcessError as e:
+ bb.error("curl failed: \n%s" % e.output.decode("utf-8"))
+ return False
+
+ upload_output = str(upload_output, encoding = "utf-8")
+ upload_output = eval(upload_output)
+ bb.note("upload_output = ")
+ print(upload_output)
+ bb.note("len of upload_output = ")
+ bb.note(str(len(upload_output)))
+ if len(upload_output) == 0:
+ bb.note("The upload of fossology is 0.")
+ return False
+ bb.note("upload_output[0][uploadname] = ")
+ bb.note(upload_output[0]["uploadname"])
+ bb.note("len of upload_output = ")
+ bb.note(str(len(upload_output)))
+ for i in range(0, len(upload_output)):
+ if upload_output[i]["uploadname"] == file_name and str(upload_output[i]["folderid"]) == str(folder_id):
+ bb.warn("Find " + file_name + " in fossology server \"Software Repository\" folder. So, will not upload again.")
+ return upload_output[i]["id"]
+ return False
+
+def upload(d, tar_file, folder):
+ import os
+ import subprocess
+ delaytime = 50
+ i = 0
+
+ server_url = (d.getVar('FOSSOLOGY_SERVER', True) or "")
+ if server_url == "":
+ bb.note("Please set fossology server URL by setting FOSSOLOGY_SERVER!\n")
+ raise OSError(errno.ENOENT, "No setting of FOSSOLOGY_SERVER")
+
+ token = (d.getVar('TOKEN', True) or "")
+ if token == "":
+ bb.note("Please set token of fossology server by setting TOKEN!\n" + srcPath)
+ raise OSError(errno.ENOENT, "No setting of TOKEN comes from fossology server.")
+
+ rest_api_cmd = "curl -k -s -S -X POST " + server_url + "/api/v1/uploads" \
+ + " -H \"folderId: " + folder + "\"" \
+ + " -H \"Authorization: Bearer " + token + "\"" \
+ + " -H \'uploadDescription: created by REST\'" \
+ + " -H \'public: public\'" \
+ + " -H \'Content-Type: multipart/form-data\'" \
+ + " -F \'fileInput=@\"" + tar_file + "\";type=application/octet-stream\'" \
+ + " --noproxy 127.0.0.1"
+ bb.note("Upload : Invoke rest_api_cmd = " + rest_api_cmd )
+ while i < 10:
+ time.sleep(delaytime)
+ try:
+ upload = subprocess.check_output(rest_api_cmd, stderr=subprocess.STDOUT, shell=True)
+ except subprocess.CalledProcessError as e:
+ bb.error(d.getVar('PN', True) + ": Upload failed: \n%s" % e.output.decode("utf-8"))
+ return False
+ upload = str(upload, encoding = "utf-8")
+ bb.note("Upload = ")
+ bb.note(upload)
+ upload = eval(upload)
+ if str(upload["code"]) == "201":
+ return upload["message"]
+ i += 1
+ bb.warn(d.getVar('PN', True) + ": Upload is fail, please check your fossology server.")
+ return False
+
+def analysis(d, folder_id, upload_id):
+ import os
+ import subprocess
+ delaytime = 50
+ i = 0
+
+ server_url = (d.getVar('FOSSOLOGY_SERVER', True) or "")
+ if server_url == "":
+ bb.note("Please set fossology server URL by setting FOSSOLOGY_SERVER!\n")
+ raise OSError(errno.ENOENT, "No setting of FOSSOLOGY_SERVER")
+
+ token = (d.getVar('TOKEN', True) or "")
+ if token == "":
+ bb.note("Please set token of fossology server by setting TOKEN!\n" + srcPath)
+ raise OSError(errno.ENOENT, "No setting of TOKEN comes from fossology server.")
+
+ rest_api_cmd = "curl -k -s -S -X POST " + server_url + "/api/v1/jobs" \
+ + " -H \"folderId: " + str(folder_id) + "\"" \
+ + " -H \"uploadId: " + str(upload_id) + "\"" \
+ + " -H \"Authorization: Bearer " + token + "\"" \
+ + " -H \'Content-Type: application/json\'" \
+ + " --data \'{\"analysis\": {\"bucket\": true,\"copyright_email_author\": true,\"ecc\": true, \"keyword\": true,\"mime\": true,\"monk\": true,\"nomos\": true,\"package\": true},\"decider\": {\"nomos_monk\": true,\"bulk_reused\": true,\"new_scanner\": true}}\'" \
+ + " --noproxy 127.0.0.1"
+ bb.note("Analysis : Invoke rest_api_cmd = " + rest_api_cmd )
+ while i < 10:
+ try:
+ time.sleep(delaytime)
+ analysis = subprocess.check_output(rest_api_cmd, stderr=subprocess.STDOUT, shell=True)
+ except subprocess.CalledProcessError as e:
+ bb.error("Analysis failed: \n%s" % e.output.decode("utf-8"))
+ return False
+ time.sleep(delaytime)
+ analysis = str(analysis, encoding = "utf-8")
+ bb.note("analysis = ")
+ bb.note(analysis)
+ analysis = eval(analysis)
+ if str(analysis["code"]) == "201":
+ return analysis["message"]
+ elif str(analysis["code"]) == "404":
+ bb.warn(d.getVar('PN', True) + ": analysis is still not complete.")
+ time.sleep(delaytime*2)
+ else:
+ return False
+ i += 1
+ bb.warn(d.getVar('PN', True) + ": Analysis is fail, will try again.")
+ bb.warn(d.getVar('PN', True) + ": Analysis is fail, please check your fossology server.")
+ return False
+
+def trigger(d, folder_id, upload_id):
+ import os
+ import subprocess
+ delaytime = 50
+ i = 0
+
+ server_url = (d.getVar('FOSSOLOGY_SERVER', True) or "")
+ if server_url == "":
+ bb.note("Please set fossology server URL by setting FOSSOLOGY_SERVER!\n")
+ raise OSError(errno.ENOENT, "No setting of FOSSOLOGY_SERVER")
+
+ token = (d.getVar('TOKEN', True) or "")
+ if token == "":
+ bb.note("Please set token of fossology server by setting TOKEN!\n" + srcPath)
+ raise OSError(errno.ENOENT, "No setting of TOKEN comes from fossology server.")
+
+ rest_api_cmd = "curl -k -s -S -X GET " + server_url + "/api/v1/report" \
+ + " -H \"Authorization: Bearer " + token + "\"" \
+ + " -H \"uploadId: " + str(upload_id) + "\"" \
+ + " -H \'reportFormat: spdx2tv\'" \
+ + " --noproxy 127.0.0.1"
+ bb.note("trigger : Invoke rest_api_cmd = " + rest_api_cmd )
+ while i < 10:
+ time.sleep(delaytime)
+ try:
+ trigger = subprocess.check_output(rest_api_cmd, stderr=subprocess.STDOUT, shell=True)
+ except subprocess.CalledProcessError as e:
+ bb.error(d.getVar('PN', True) + ": Trigger failed: \n%s" % e.output.decode("utf-8"))
+ return False
+ time.sleep(delaytime)
+ trigger = str(trigger, encoding = "utf-8")
+ trigger = eval(trigger)
+ bb.note("trigger id = ")
+ bb.note(str(trigger["message"]))
+ if str(trigger["code"]) == "201":
+ return trigger["message"].split("/")[-1]
+ i += 1
+ time.sleep(delaytime * 2)
+ bb.warn(d.getVar('PN', True) + ": Trigger is fail, will try again.")
+ bb.warn(d.getVar('PN', True) + ": Trigger is fail, please check your fossology server.")
+ return False
+
+def get_spdx(d, report_id, spdx_file):
+ import os
+ import subprocess
+ import time
+ delaytime = 50
+ complete = False
+ i = 0
+
+ server_url = (d.getVar('FOSSOLOGY_SERVER', True) or "")
+ if server_url == "":
+ bb.note("Please set fossology server URL by setting FOSSOLOGY_SERVER!\n")
+ raise OSError(errno.ENOENT, "No setting of FOSSOLOGY_SERVER")
+
+ token = (d.getVar('TOKEN', True) or "")
+ if token == "":
+ bb.note("Please set token of fossology server by setting TOKEN!\n" + srcPath)
+ raise OSError(errno.ENOENT, "No setting of TOKEN comes from fossology server.")
+ rest_api_cmd = "curl -k -s -S -X GET " + server_url + "/api/v1/report/" + report_id \
+ + " -H \'accept: text/plain\'" \
+ + " -H \"Authorization: Bearer " + token + "\"" \
+ + " --noproxy 127.0.0.1"
+ bb.note("get_spdx : Invoke rest_api_cmd = " + rest_api_cmd )
+ while i < 10:
+ time.sleep(delaytime)
+ file = open(spdx_file,'wt')
+ try:
+ p = subprocess.Popen(rest_api_cmd, shell=True, universal_newlines=True, stdout=file).wait()
+ except subprocess.CalledProcessError as e:
+ bb.error("Get spdx failed: \n%s. Please check fossology server." % e.output.decode("utf-8"))
+ file.close()
+ os.remove(spdx_file)
+ return False
+ file.flush()
+ time.sleep(delaytime)
+ file.close()
+ file = open(spdx_file,'r+')
+ first_line = file.readline()
+ if "SPDXVersion" in first_line:
+ line = file.readline()
+ while line:
+ if "LicenseID:" in line:
+ complete = True
+ break
+ line = file.readline()
+ file.close()
+ if complete == False:
+ bb.warn("license info not complete, try agin.")
+ else:
+ return True
+ else:
+ bb.warn(d.getVar('PN', True) + ": Get the first line is " + first_line + ". Try agin")
+
+ file.close()
+ os.remove(spdx_file)
+ i += 1
+ delaytime = delaytime + 20
+ time.sleep(delaytime)
+
+ file.close()
+ bb.warn(d.getVar('PN', True) + ": Get spdx failed, Please check your fossology server.")
+
+def invoke_rest_api(d, tar_file, spdx_file, folder_id):
+ import os
+ import time
+ i = 0
+
+ bb.note("invoke fossology REST API : tar_file = %s " % tar_file)
+ upload_id = has_upload(d, tar_file, folder_id)
+ if upload_id == False:
+ bb.note("This OSS has not been scanned. So upload it to fossology server.")
+ upload_id = upload(d, tar_file, folder_id)
+ if upload_id == False:
+ return False
+
+ if analysis(d, folder_id, upload_id) == False:
+ return False
+ while i < 10:
+ i += 1
+ report_id = trigger(d, folder_id, upload_id)
+ if report_id == False:
+ return False
+ spdx2tv = get_spdx(d, report_id, spdx_file)
+ if spdx2tv == False:
+ bb.warn(d.getVar('PN', True) + ": get_spdx is unnormal. Will try again!")
+ else:
+ return True
+
+ bb.warn("get_spdx of %s is unnormal. Please confirm!")
+ return False
diff --git a/external/meta-spdxscanner/classes/scancode-tk.bbclass b/external/meta-spdxscanner/classes/scancode-tk.bbclass
new file mode 100644
index 00000000..0dc244f9
--- /dev/null
+++ b/external/meta-spdxscanner/classes/scancode-tk.bbclass
@@ -0,0 +1,139 @@
+# 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 ScanCode projects.
+#
+# For more information on ScanCode:
+# https://github.com/nexB/scancode-toolkit
+#
+# For more information on SPDX:
+# http://www.spdx.org
+#
+# Note:
+# 1) By default,spdx files will be output to the path which is defined as[SPDX_DEPLOY_DIR]
+# 2) By default, SPDX_DEPLOY_DIR is tmp/deploy
+#
+
+inherit spdx-common
+
+SPDXEPENDENCY += "scancode-toolkit-native:do_populate_sysroot"
+
+CREATOR_TOOL = "scancode-tk.bbclass in meta-spdxscanner"
+
+python do_spdx(){
+ import os, sys, json, shutil
+ pn = d.getVar('PN')
+ assume_provided = (d.getVar("ASSUME_PROVIDED") or "").split()
+ if pn in assume_provided:
+ for p in d.getVar("PROVIDES").split():
+ if p != pn:
+ pn = p
+ break
+ if d.getVar('BPN') in ['gcc', 'libgcc']:
+ bb.debug(1, 'spdx: There is bug in scan of %s is, do nothing' % pn)
+ return
+ # glibc-locale: do_fetch, do_unpack and do_patch tasks have been deleted,
+ # so avoid archiving source here.
+ if pn.startswith('glibc-locale'):
+ return
+ if (d.getVar('PN') == "libtool-cross"):
+ return
+ if (d.getVar('PN') == "libgcc-initial"):
+ return
+ if (d.getVar('PN') == "shadow-sysroot"):
+ return
+
+ spdx_outdir = d.getVar('SPDX_OUTDIR')
+ spdx_workdir = d.getVar('SPDX_WORKDIR')
+ spdx_temp_dir = os.path.join(spdx_workdir, "temp")
+ temp_dir = os.path.join(d.getVar('WORKDIR'), "temp")
+
+ 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 "")
+ info['package_static_link'] = (d.getVar('STATIC_LINK', True) or "")
+ info['modified'] = "false"
+ srcuri = d.getVar("SRC_URI", False).split()
+ length = len("file://")
+ for item in srcuri:
+ if item.startswith("file://"):
+ item = item[length:]
+ if item.endswith(".patch") or item.endswith(".diff"):
+ info['modified'] = "true"
+
+ manifest_dir = (d.getVar('SPDX_DEPLOY_DIR', True) or "")
+ if not os.path.exists( manifest_dir ):
+ bb.utils.mkdirhier( manifest_dir )
+ info['outfile'] = os.path.join(manifest_dir, info['pn'] + "-" + info['pv'] + ".spdx" )
+ sstatefile = os.path.join(spdx_outdir, info['pn'] + "-" + info['pv'] + ".spdx" )
+ # if spdx has been exist
+ if os.path.exists(info['outfile']):
+ bb.note(info['pn'] + "spdx file has been exist, do nothing")
+ return
+ if os.path.exists( sstatefile ):
+ bb.note(info['pn'] + "spdx file has been exist, do nothing")
+ create_manifest(info,sstatefile)
+ return
+ spdx_get_src(d)
+
+ bb.note('SPDX: Archiving the patched source...')
+ if os.path.isdir(spdx_temp_dir):
+ for f_dir, f in list_files(spdx_temp_dir):
+ temp_file = os.path.join(spdx_temp_dir,f_dir,f)
+ shutil.copy(temp_file, temp_dir)
+ #shutil.rmtree(spdx_temp_dir)
+ if not os.path.exists(spdx_outdir):
+ bb.utils.mkdirhier(spdx_outdir)
+ cur_ver_code = get_ver_code(spdx_workdir).split()[0]
+ ## Get spdx file
+ bb.note(' run scanCode ...... ')
+ d.setVar('WORKDIR', d.getVar('SPDX_WORKDIR', True))
+ info['sourcedir'] = spdx_workdir
+ git_path = "%s/git/.git" % info['sourcedir']
+ if os.path.exists(git_path):
+ remove_dir_tree(git_path)
+ invoke_scancode(info['sourcedir'],sstatefile)
+ bb.warn("source dir = " + info['sourcedir'])
+ if get_cached_spdx(sstatefile) != None:
+ write_cached_spdx( info,sstatefile,cur_ver_code )
+ ## CREATE MANIFEST(write to outfile )
+ create_manifest(info,sstatefile)
+ else:
+ bb.warn('Can\'t get the spdx file ' + info['pn'] + '. Please check your.')
+}
+
+def invoke_scancode( OSS_src_dir, spdx_file):
+ import subprocess
+ import string
+ import json
+ import codecs
+ import logging
+
+ logger = logging.getLogger()
+ logger.setLevel(logging.INFO)
+ logging.basicConfig(level=logging.INFO)
+
+ path = os.getenv('PATH')
+ scancode_cmd = bb.utils.which(os.getenv('PATH'), "scancode")
+ scancode_cmd = scancode_cmd + " -lpci --spdx-tv " + spdx_file + " " + OSS_src_dir
+ print(scancode_cmd)
+ try:
+ subprocess.check_output(scancode_cmd,
+ stderr=subprocess.STDOUT,
+ shell=True)
+ except subprocess.CalledProcessError as e:
+ bb.fatal("Could not invoke scancode Command "
+ "'%s' returned %d:\n%s" % (scancode_cmd, e.returncode, e.output))
diff --git a/external/meta-spdxscanner/classes/spdx-common.bbclass b/external/meta-spdxscanner/classes/spdx-common.bbclass
new file mode 100644
index 00000000..0dcd7938
--- /dev/null
+++ b/external/meta-spdxscanner/classes/spdx-common.bbclass
@@ -0,0 +1,221 @@
+# This class supplys common functions.
+
+
+SPDXEPENDENCY += "${PATCHTOOL}-native:do_populate_sysroot"
+SPDXEPENDENCY += " wget-native:do_populate_sysroot"
+SPDXEPENDENCY += " subversion-native:do_populate_sysroot"
+SPDXEPENDENCY += " git-native:do_populate_sysroot"
+SPDXEPENDENCY += " lz4-native:do_populate_sysroot"
+SPDXEPENDENCY += " lzip-native:do_populate_sysroot"
+SPDXEPENDENCY += " xz-native:do_populate_sysroot"
+SPDXEPENDENCY += " unzip-native:do_populate_sysroot"
+SPDXEPENDENCY += " xz-native:do_populate_sysroot"
+SPDXEPENDENCY += " quilt-native:do_populate_sysroot"
+SPDXEPENDENCY += " tar-native:do_populate_sysroot"
+
+SPDX_DEPLOY_DIR ??= "${DEPLOY_DIR}/spdx"
+SPDX_TOPDIR ?= "${WORKDIR}/spdx_sstate_dir"
+SPDX_OUTDIR = "${SPDX_TOPDIR}/${TARGET_SYS}/${PF}/"
+SPDX_WORKDIR = "${WORKDIR}/spdx_temp/"
+
+do_spdx[dirs] = "${WORKDIR}"
+
+LICENSELISTVERSION = "2.6"
+
+# If ${S} isn't actually the top-level source directory, set SPDX_S to point at
+# the real top-level directory.
+SPDX_S ?= "${S}"
+
+addtask do_spdx before do_configure after do_patch
+
+def spdx_create_tarball(d, srcdir, suffix, ar_outdir):
+ """
+ create the tarball from srcdir
+ """
+ import tarfile, shutil
+
+ # Make sure we are only creating a single tarball for gcc sources
+ #if (d.getVar('SRC_URI') == ""):
+ # return
+ # For the kernel archive, srcdir may just be a link to the
+ # work-shared location. Use os.path.realpath to make sure
+ # that we archive the actual directory and not just the link.
+ srcdir = os.path.realpath(srcdir)
+
+ bb.utils.mkdirhier(ar_outdir)
+ if suffix:
+ filename = '%s-%s.tar.gz' % (d.getVar('PF'), suffix)
+ else:
+ filename = '%s.tar.gz' % d.getVar('PF')
+ tarname = os.path.join(ar_outdir, filename)
+
+ bb.note('Creating %s' % tarname)
+ tar = tarfile.open(tarname, 'w:gz')
+ tar.add(srcdir, arcname=os.path.basename(srcdir))
+ tar.close()
+ #shutil.rmtree(srcdir)
+ return tarname
+
+# Run do_unpack and do_patch
+def spdx_get_src(d):
+ import shutil
+ spdx_workdir = d.getVar('SPDX_WORKDIR')
+ spdx_sysroot_native = d.getVar('STAGING_DIR_NATIVE')
+ pn = d.getVar('PN')
+
+ # The kernel class functions require it to be on work-shared, so we dont change WORKDIR
+ if not is_work_shared(d):
+ # Change the WORKDIR to make do_unpack do_patch run in another dir.
+ d.setVar('WORKDIR', spdx_workdir)
+ # Restore the original path to recipe's native sysroot (it's relative to WORKDIR).
+ d.setVar('STAGING_DIR_NATIVE', spdx_sysroot_native)
+
+ # The changed 'WORKDIR' also caused 'B' changed, create dir 'B' for the
+ # possibly requiring of the following tasks (such as some recipes's
+ # do_patch required 'B' existed).
+ bb.utils.mkdirhier(d.getVar('B'))
+
+ bb.build.exec_func('do_unpack', d)
+ # Copy source of kernel to spdx_workdir
+ if is_work_shared(d):
+ d.setVar('WORKDIR', spdx_workdir)
+ d.setVar('STAGING_DIR_NATIVE', spdx_sysroot_native)
+ src_dir = spdx_workdir + "/" + d.getVar('PN')+ "-" + d.getVar('PV') + "-" + d.getVar('PR')
+ bb.utils.mkdirhier(src_dir)
+ if bb.data.inherits_class('kernel',d):
+ share_src = d.getVar('STAGING_KERNEL_DIR')
+ cmd_copy_share = "cp -rf " + share_src + "/* " + src_dir + "/"
+ cmd_copy_kernel_result = os.popen(cmd_copy_share).read()
+ bb.note("cmd_copy_kernel_result = " + cmd_copy_kernel_result)
+
+ git_path = src_dir + "/.git"
+ if os.path.exists(git_path):
+ remove_dir_tree(git_path)
+
+ # Make sure gcc and kernel sources are patched only once
+ if not (d.getVar('SRC_URI') == "" or is_work_shared(d)):
+ bb.build.exec_func('do_patch', d)
+
+ # Some userland has no source.
+ if not os.path.exists( spdx_workdir ):
+ bb.utils.mkdirhier(spdx_workdir)
+
+def create_manifest(info,sstatefile):
+ import shutil
+ shutil.copyfile(sstatefile,info['outfile'])
+
+def get_cached_spdx( 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_spdx_info=output.decode('utf-8').split(': ')
+ return cached_spdx_info[1]
+
+## Add necessary information into spdx file
+def write_cached_spdx( 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$##' "
+ spdx_DocumentComment = "<text>SPDX for " + info['pn'] + " version " \
+ + info['pv'] + "</text>"
+ sed_cmd = sed_replace(sed_cmd,"DocumentComment",spdx_DocumentComment)
+
+ ## Creator information
+ sed_cmd = sed_replace(sed_cmd,"Creator: Tool: ",info['creator']['Tool'])
+
+ ## Package level information
+ sed_cmd = sed_replace(sed_cmd, "PackageName: ", info['pn'])
+ sed_cmd = sed_insert(sed_cmd, "PackageName: ", "PackageVersion: " + info['pv'])
+ sed_cmd = sed_replace(sed_cmd, "PackageDownloadLocation: ",info['package_download_location'])
+ sed_cmd = sed_insert(sed_cmd, "PackageDownloadLocation: ", "PackageHomePage: " + info['package_homepage'])
+ sed_cmd = sed_insert(sed_cmd, "PackageDownloadLocation: ", "PackageSummary: " + "<text>" + info['package_summary'] + "</text>")
+ sed_cmd = sed_insert(sed_cmd, "PackageCopyrightText: ", "PackageComment: <text>\\nModificationRecord: " + info['modified'] + "\\n</text>")
+ sed_cmd = sed_replace(sed_cmd, "PackageVerificationCode: ",ver_code)
+ sed_cmd = sed_insert(sed_cmd, "PackageVerificationCode: ", "PackageDescription: " +
+ "<text>" + info['pn'] + " version " + info['pv'] + "</text>")
+ for contain in info['package_contains'].split( ):
+ 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)
+
+def is_work_shared(d):
+ pn = d.getVar('PN')
+ return bb.data.inherits_class('kernel', d) or pn.startswith('gcc-source')
+
+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
+
+do_spdx[depends] = "${SPDXEPENDENCY}"
+
diff --git a/external/meta-spdxscanner/conf/include/security_flags.inc b/external/meta-spdxscanner/conf/include/security_flags.inc
deleted file mode 100644
index 8c5fbea1..00000000
--- a/external/meta-spdxscanner/conf/include/security_flags.inc
+++ /dev/null
@@ -1 +0,0 @@
-SECURITY_CFLAGS_pn-fossology-nomos = "${SECURITY_NO_PIE_CFLAGS}"
diff --git a/external/meta-spdxscanner/conf/layer.conf b/external/meta-spdxscanner/conf/layer.conf
index 120dc274..f1c4329a 100644
--- a/external/meta-spdxscanner/conf/layer.conf
+++ b/external/meta-spdxscanner/conf/layer.conf
@@ -9,4 +9,4 @@ BBFILE_COLLECTIONS += "spdxscanner"
BBFILE_PATTERN_spdxscanner = "^${LAYERDIR}/"
BBFILE_PRIORITY_spdxscanner = "6"
-LAYERSERIES_COMPAT_spdxscanner = "sumo thud warrior master"
+LAYERSERIES_COMPAT_spdxscanner = "sumo thud warrior zeus master"
diff --git a/external/meta-spdxscanner/conf/lid-scan.conf b/external/meta-spdxscanner/conf/lid-scan.conf
deleted file mode 100644
index 14263800..00000000
--- a/external/meta-spdxscanner/conf/lid-scan.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-LID_TEMP_DIR ?= "${WORKDIR}/spdx_temp"
-LID_DEPLOY_DIR ?= "/home/yocto/lid_scans"
-
diff --git a/external/meta-spdxscanner/conf/spdx-dosocs.conf b/external/meta-spdxscanner/conf/spdx-dosocs.conf
deleted file mode 100644
index 55fbd0a5..00000000
--- a/external/meta-spdxscanner/conf/spdx-dosocs.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-SPDX_TEMP_DIR ?= "${WORKDIR}/spdx_temp"
-SPDX_DEPLOY_DIR ?= "/home/yocto/spdx_scans"
-
-ASSUME_PROVIDED_remove = "file-native"
-
diff --git a/external/meta-spdxscanner/recipes-devtools/file/file/0001-magic.py-modified-for-dosocs2.patch b/external/meta-spdxscanner/recipes-devtools/file/file/0001-magic.py-modified-for-dosocs2.patch
deleted file mode 100644
index 0d2bb40c..00000000
--- a/external/meta-spdxscanner/recipes-devtools/file/file/0001-magic.py-modified-for-dosocs2.patch
+++ /dev/null
@@ -1,501 +0,0 @@
-From e983220202c3c7fcc36ba2719ed2cdaa33e3d38c Mon Sep 17 00:00:00 2001
-From: Lei Maohui <leimaohui@cn.fujitsu.com>
-Date: Wed, 15 Feb 2017 11:46:05 +0900
-Subject: [PATCH] magic.py: modified for dosocs2
-
-Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com>
----
- python/magic.py | 462 ++++++++++++++++++++++++++++++++------------------------
- 1 file changed, 262 insertions(+), 200 deletions(-)
-
-diff --git a/python/magic.py b/python/magic.py
-index a17e8da..c6142a7 100644
---- a/python/magic.py
-+++ b/python/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/external/meta-spdxscanner/recipes-devtools/file/file_%.bbappend b/external/meta-spdxscanner/recipes-devtools/file/file_%.bbappend
deleted file mode 100644
index 8bb8199a..00000000
--- a/external/meta-spdxscanner/recipes-devtools/file/file_%.bbappend
+++ /dev/null
@@ -1,3 +0,0 @@
-SRC_URI_native += " 0001-magic.py-modified-for-dosocs2.patch \
- "
-
diff --git a/external/meta-spdxscanner/recipes-devtools/fossology/fossology-nomos-native_git.bb b/external/meta-spdxscanner/recipes-devtools/fossology/fossology-nomos-native_git.bb
deleted file mode 100644
index e034a341..00000000
--- a/external/meta-spdxscanner/recipes-devtools/fossology/fossology-nomos-native_git.bb
+++ /dev/null
@@ -1,29 +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://GenCodeCopyright;md5=7296ec131dbd040718b64fb843d63048"
-DEPENDS = "glib-2.0-native libpcre-native"
-
-SRCREV = "34467fd530b832f08c095936a72c22c40fa13278"
-BRANCH = "release/${PV}/master"
-SRC_URI = "git://github.com/fossology/fossology.git \
- file://0001-Add-rpath-to-fix-error-as-following.patch \
- "
-
-S = "${WORKDIR}/git/src/nomos/agent"
-
-inherit native
-
-do_compile() {
- cp ${S}/Makefile.sa ${S}/Makefile -f
- make
-}
-
-do_install() {
- oe_runmake install \
- DESTDIR="${D}" \
- PREFIX="${prefix}" \
- SBINDIR="${D}${sbindir}"
-}
diff --git a/external/meta-spdxscanner/recipes-devtools/fossology/fossology-nomos/0001-Add-rpath-to-fix-error-as-following.patch b/external/meta-spdxscanner/recipes-devtools/fossology/fossology-nomos/0001-Add-rpath-to-fix-error-as-following.patch
deleted file mode 100644
index 4052b1c8..00000000
--- a/external/meta-spdxscanner/recipes-devtools/fossology/fossology-nomos/0001-Add-rpath-to-fix-error-as-following.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From b81cced8566406c85b38a1c3c71858982a3dd4a5 Mon Sep 17 00:00:00 2001
-From: Lei Maohui <leimaohui@cn.fujitsu.com>
-Date: Wed, 1 Mar 2017 10:23:03 +0900
-Subject: [PATCH] Add rpath to fix error as following:
-
-/usr/bin/ld: warning: libpcre.so.1, needed by tmp/sysroots/x86_64-linux/usr/lib/libglib-2.0.so, not found (try using -rpath or -rpath-link)
-
-Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com>
----
- Makefile.sa | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Makefile.sa b/Makefile.sa
-index 24a16ca..f39bdd6 100644
---- a/Makefile.sa
-+++ b/Makefile.sa
-@@ -26,7 +26,7 @@ all: encode nomos
- debug: nomos-gl
-
- nomos: nomos.o $(OBJS) $(GENOBJS)
-- $(CC) nomos.o $(OBJS) $(GENOBJS) $(CFLAGS_LOCAL) -o $(EXE)
-+ $(CC) nomos.o $(OBJS) $(GENOBJS) $(CFLAGS_LOCAL) -o $(EXE) -Wl,-rpath,${libdir}
-
- nomos.o: nomos.c $(HDRS) $(DB) $(REPO) $(AGENTLIB) $(VARS)
- $(CC) -c $< $(CFLAGS_LOCAL) $(DEFS)
---
-1.8.4.2
-
diff --git a/external/meta-spdxscanner/recipes-devtools/python/files/0001-Delete-the-version-limit-for-dosocs2.patch b/external/meta-spdxscanner/recipes-devtools/python/files/0001-Delete-the-version-limit-for-dosocs2.patch
deleted file mode 100644
index 5773b8b6..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/files/0001-Delete-the-version-limit-for-dosocs2.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 3e3bef6aff2563e4bb206c1169b783a1c61308e5 Mon Sep 17 00:00:00 2001
-From: Lei Maohui <leimaohui@cn.fujitsu.com>
-Date: Fri, 25 Aug 2017 03:03:06 +0900
-Subject: [PATCH] Delete the version limit for dosocs2.
-
-Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com>
----
- setup.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/setup.py b/setup.py
-index b35863f..1bae161 100644
---- a/setup.py
-+++ b/setup.py
-@@ -1,6 +1,6 @@
- from setuptools import setup
-
--_dosocs2_version = '0.16.1'
-+_dosocs2_version = ''
-
- install_requires=[
- ]
---
-2.7.4
-
diff --git a/external/meta-spdxscanner/recipes-devtools/python/files/0001-Deleted-version-limit-for-dosocs2.patch b/external/meta-spdxscanner/recipes-devtools/python/files/0001-Deleted-version-limit-for-dosocs2.patch
deleted file mode 100644
index 4daab5ea..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/files/0001-Deleted-version-limit-for-dosocs2.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From f9b27dee4dc01dafec111957a1ad411f20bcb644 Mon Sep 17 00:00:00 2001
-From: Lei Maohui <leimaohui@cn.fujitsu.com>
-Date: Fri, 25 Aug 2017 03:17:19 +0900
-Subject: [PATCH] Deleted version limit for dosocs2.
-
-Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com>
----
- setup.py | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/setup.py b/setup.py
-index b35863f..9be6cd7 100644
---- a/setup.py
-+++ b/setup.py
-@@ -10,7 +10,6 @@ tests_require=[
-
- setup(
- name='dosocs2',
-- version=_dosocs2_version,
- description='SPDX 2.0 document creation and storage',
- long_description='',
- url='https://github.com/DoSOCSv2/DoSOCSv2',
---
-2.7.4
-
diff --git a/external/meta-spdxscanner/recipes-devtools/python/files/0001-setup-py-delete-the-depends-install.patch b/external/meta-spdxscanner/recipes-devtools/python/files/0001-setup-py-delete-the-depends-install.patch
deleted file mode 100644
index 41f6bb2c..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/files/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/external/meta-spdxscanner/recipes-devtools/python/python-futures/python-futures_%.bbappend b/external/meta-spdxscanner/recipes-devtools/python/python-futures/python-futures_%.bbappend
deleted file mode 100644
index d3267ac4..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python-futures/python-futures_%.bbappend
+++ /dev/null
@@ -1 +0,0 @@
-BBCLASSEXTEND = "native"
diff --git a/external/meta-spdxscanner/recipes-devtools/python/python-lid_git.bb b/external/meta-spdxscanner/recipes-devtools/python/python-lid_git.bb
deleted file mode 100644
index 1897f467..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python-lid_git.bb
+++ /dev/null
@@ -1,25 +0,0 @@
-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/external/meta-spdxscanner/recipes-devtools/python/python-nltk_3.0.3.bb b/external/meta-spdxscanner/recipes-devtools/python/python-nltk_3.0.3.bb
deleted file mode 100644
index 0c9e5d2c..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python-nltk_3.0.3.bb
+++ /dev/null
@@ -1,22 +0,0 @@
-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/external/meta-spdxscanner/recipes-devtools/python/python-whatthepatch_0.0.5.bb b/external/meta-spdxscanner/recipes-devtools/python/python-whatthepatch_0.0.5.bb
deleted file mode 100644
index b9ba7c6a..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python-whatthepatch_0.0.5.bb
+++ /dev/null
@@ -1,22 +0,0 @@
-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/external/meta-spdxscanner/recipes-devtools/python/python3-docopt_0.6.2.bb b/external/meta-spdxscanner/recipes-devtools/python/python3-docopt_0.6.2.bb
deleted file mode 100644
index 2b1dd0a8..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-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 setuptools3 python3-dir
-
-BBCLASSEXTEND = "native"
diff --git a/external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2-init_git.bb b/external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2-init_git.bb
deleted file mode 100644
index 200f5963..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2-init_git.bb
+++ /dev/null
@@ -1,49 +0,0 @@
-DESCRIPTION = "SPDX 2.0 document creation and storage"
-HOMEPAGE = "https://github.com/DoSOCSv2/DoSOCSv2"
-SECTION = "devel/python"
-LICENSE = "GPLv2"
-
-SRCREV = "97140a1fc2905ca646220dace1692e0ede475e3e"
-BRANCH = "master"
-PV = "0.16.1"
-
-addtask do_dosocs2_init before do_populate_sysroot
-
-do_dosocs2_init[depends] += "python3-dosocs2-native:do_populate_sysroot"
-
-DEPENDS = "python3-dosocs2-native"
-
-BBCLASSEXTEND = "native"
-
-inherit distutils3 python3native setuptools3 python3-dir
-
-python do_dosocs2_init() {
-
- import os
- import subprocess
- import bb
- import oe.utils
- import oe.path
- import string
-
- path = os.getenv('PATH')
- dosocs2_cmd = bb.utils.which(os.getenv('PATH'), "dosocs2")
- dosocs2_init_cmd = dosocs2_cmd + " dbinit --no-confirm"
- #dosocs2_init_cmd = dosocs2_cmd + " --help"
- bb.note("lmh test PATH = %s " % path)
- bb.note("lmh test dosocs2_init_cmd = %s " % 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))
-}
-deltask do_fetch
-deltask do_unpack
-deltask do_patch
-deltask do_configure
-deltask do_compile
-deltask do_install
diff --git a/external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2/0001-Fix-a-error-as-fowllowing.patch b/external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2/0001-Fix-a-error-as-fowllowing.patch
deleted file mode 100644
index 870201d4..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2/0001-Fix-a-error-as-fowllowing.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-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/external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2/0001-Fix-a-magic-error-as-following.patch b/external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2/0001-Fix-a-magic-error-as-following.patch
deleted file mode 100644
index 4b1e3977..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2/0001-Fix-a-magic-error-as-following.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-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/external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2/0001-Fix-bugs-because-python-from-2.x-to-3.x.patch b/external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2/0001-Fix-bugs-because-python-from-2.x-to-3.x.patch
deleted file mode 100644
index f648d501..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2/0001-Fix-bugs-because-python-from-2.x-to-3.x.patch
+++ /dev/null
@@ -1,142 +0,0 @@
-From dbea8f1cf03b986ce98d50faa39f8721048b280e Mon Sep 17 00:00:00 2001
-From: Lei Maohui <leimaohui@cn.fujitsu.com>
-Date: Thu, 26 Oct 2017 16:08:39 +0900
-Subject: [PATCH] Fix bugs because python from 2.x to 3.x.
-
-Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com>
----
- dosocs2/render.py | 4 ++--
- dosocs2/scannerbase.py | 6 +++---
- dosocs2/spdxdb.py | 2 +-
- dosocs2/util.py | 30 +++++++++++++++---------------
- 4 files changed, 21 insertions(+), 21 deletions(-)
-
-diff --git a/dosocs2/render.py b/dosocs2/render.py
-index 7118e3d..434bb5b 100644
---- a/dosocs2/render.py
-+++ b/dosocs2/render.py
-@@ -54,7 +54,7 @@ def get_row(conn, query):
-
-
- def get_rows(conn, query):
-- return list(sorted(dict(**row) for row in conn.execute(query)))
-+ return list(dict(**row) for row in conn.execute(query))
-
-
- def render_template(templatefile, context):
-@@ -77,7 +77,7 @@ def render_document(conn, docid, template_file):
- query = queries.relationships(document['document_namespace_id'], package['id_string'])
- package['relationships'] = get_rows(conn, query)
- package['files'] = get_rows(conn, queries.documents_files(docid, package['package_id']))
-- for file in sorted(package['files']):
-+ for file in package['files']:
- file['license_info'] = get_rows(conn, queries.files_licenses(file['file_id']))
- file['contributors'] = get_rows(conn, queries.file_contributors(file['file_id']))
- file['annotations'] = get_rows(conn, queries.annotations(docid, file['id_string']))
-diff --git a/dosocs2/scannerbase.py b/dosocs2/scannerbase.py
-index d7a38b6..a54dce7 100644
---- a/dosocs2/scannerbase.py
-+++ b/dosocs2/scannerbase.py
-@@ -274,8 +274,8 @@ class FileLicenseScanner(Scanner):
-
- Return the new or existing license object in any case.
- '''
-- transtable = string.maketrans('()[]<>', '------')
-- short_name = string.translate(short_name, transtable)
-+ transtable = str.maketrans('()[]<>', '------')
-+ short_name = str.translate(short_name, transtable)
- existing_license = FileLicenseScanner.lookup_license(conn, short_name)
- if existing_license is not None:
- return existing_license
-@@ -311,7 +311,7 @@ class FileLicenseScanner(Scanner):
-
- def store_results(self, processed_files):
- licenses_to_add = []
-- for (file, licenses_extracted) in processed_files.iteritems():
-+ for (file, licenses_extracted) in processed_files.items():
- licenses = []
- for license_name in licenses_extracted:
- license_kwargs = {
-diff --git a/dosocs2/spdxdb.py b/dosocs2/spdxdb.py
-index a8d3fd6..b8aef5f 100644
---- a/dosocs2/spdxdb.py
-+++ b/dosocs2/spdxdb.py
-@@ -135,7 +135,7 @@ def register_package(conn, package_root, name=None, version=None, comment=None,
- package['package_id'] = insert(conn, db.packages, package)
- # Create packages_files rows
- row_params = []
-- for (file_path, file_sha256) in hashes.iteritems():
-+ for (file_path, file_sha256) in hashes.items():
- fileobj = register_file(conn, file_path, known_sha256=file_sha256)
- package_file_params = {
- 'package_id': package['package_id'],
-diff --git a/dosocs2/util.py b/dosocs2/util.py
-index 5670f67..aba864c 100644
---- a/dosocs2/util.py
-+++ b/dosocs2/util.py
-@@ -43,23 +43,23 @@ def bool_from_str(s):
-
- def is_source(magic_string):
- return (
-- ' source' in magic_string and ' text' in magic_string or
-- ' script' in magic_string and ' text' in magic_string or
-- ' program' in magic_string and ' text' in magic_string or
-- ' shell script' in magic_string or
-- ' text executable' in magic_string or
-- 'HTML' in magic_string and 'text' in magic_string or
-- 'XML' in magic_string and 'text' in magic_string
-+ b' source' in magic_string and b' text' in magic_string or
-+ b' script' in magic_string and b' text' in magic_string or
-+ b' program' in magic_string and b' text' in magic_string or
-+ b' shell script' in magic_string or
-+ b' text executable' in magic_string or
-+ b'HTML' in magic_string and b'text' in magic_string or
-+ b'XML' in magic_string and b'text' in magic_string
- )
-
-
- def is_binary(magic_string):
- return (
-- ' executable' in magic_string or
-- ' relocatable' in magic_string or
-- ' shared object' in magic_string or
-- ' dynamically linked' in magic_string or
-- ' ar archive' in magic_string
-+ b' executable' in magic_string or
-+ b' relocatable' in magic_string or
-+ b' shared object' in magic_string or
-+ b' dynamically linked' in magic_string or
-+ b' ar archive' in magic_string
- )
-
-
-@@ -70,7 +70,7 @@ def spdx_filetype(filename):
- return 'SOURCE'
- if is_binary(magic_string):
- return 'BINARY'
-- if 'archive' in magic_string:
-+ if b'archive' in magic_string:
- return 'ARCHIVE'
- return 'OTHER'
-
-@@ -158,7 +158,7 @@ def gen_ver_code(hashes, excluded_hashes=None):
- excluded_hashes = set()
- hashes_less_excluded = (h for h in hashes if h not in excluded_hashes)
- hashblob = ''.join(sorted(hashes_less_excluded))
-- return hashlib.sha256(hashblob).hexdigest()
-+ return hashlib.sha256((hashblob).encode('utf-8')).hexdigest()
-
-
- def get_dir_hashes(path, excluded_hashes=None):
-@@ -184,7 +184,7 @@ def get_dir_hashes(path, excluded_hashes=None):
- and hashes.get(abspath) not in excluded_hashes
- )
- rel_listing_hashes = (
-- hashlib.sha256(relpath).hexdigest()
-+ hashlib.sha256((relpath).encode('utf-8')).hexdigest()
- for relpath in sorted(relative_listing)
- )
- return (gen_ver_code(hashes.values(), excluded_hashes),
---
-2.7.4
-
diff --git a/external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2_git.bb b/external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2_git.bb
deleted file mode 100644
index 75d43955..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-dosocs2_git.bb
+++ /dev/null
@@ -1,36 +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"
-
-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"
-
-SRCREV = "aa84166694913bf1d2cce416f1c2bff120c3ba3b"
-BRANCH = "dev"
-PV = "0.16.1"
-
-inherit distutils3 python3native setuptools3 python3-dir
-
-DEPENDS += "python3-jinja2-native \
- python3-psycopg2-native \
- python3-docopt-native \
- python3-sqlalchemy-native \
- file-native \
- fossology-nomos-native \
- python3-markupsafe-native \
- python3-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/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/external/meta-spdxscanner/recipes-devtools/python/python3-jinja2_%.bbappend b/external/meta-spdxscanner/recipes-devtools/python/python3-jinja2_%.bbappend
deleted file mode 100644
index 3eecfad0..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-jinja2_%.bbappend
+++ /dev/null
@@ -1,3 +0,0 @@
-BBCLASSEXTEND = "native"
-
-RDEPENDS_${PN} = "python3-sphinx python3-markupsafe"
diff --git a/external/meta-spdxscanner/recipes-devtools/python/python3-lid_git.bb b/external/meta-spdxscanner/recipes-devtools/python/python3-lid_git.bb
deleted file mode 100644
index c93e86d8..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-lid_git.bb
+++ /dev/null
@@ -1,25 +0,0 @@
-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/external/meta-spdxscanner/recipes-devtools/python/python3-magic-5.25/0001-Modified-the-magic.py-for-dosocs2-to-fix-the-error-a.patch b/external/meta-spdxscanner/recipes-devtools/python/python3-magic-5.25/0001-Modified-the-magic.py-for-dosocs2-to-fix-the-error-a.patch
deleted file mode 100644
index 1383df4e..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-magic-5.25/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/external/meta-spdxscanner/recipes-devtools/python/python3-magic_5.25.bb b/external/meta-spdxscanner/recipes-devtools/python/python3-magic_5.25.bb
deleted file mode 100644
index edc815c5..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-magic_5.25.bb
+++ /dev/null
@@ -1,27 +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] = "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/external/meta-spdxscanner/recipes-devtools/python/python3-markupsafe_%.bbappend b/external/meta-spdxscanner/recipes-devtools/python/python3-markupsafe_%.bbappend
deleted file mode 100644
index d3267ac4..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-markupsafe_%.bbappend
+++ /dev/null
@@ -1 +0,0 @@
-BBCLASSEXTEND = "native"
diff --git a/external/meta-spdxscanner/recipes-devtools/python/python3-nltk_3.0.3.bb b/external/meta-spdxscanner/recipes-devtools/python/python3-nltk_3.0.3.bb
deleted file mode 100644
index 0c9e5d2c..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-nltk_3.0.3.bb
+++ /dev/null
@@ -1,22 +0,0 @@
-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/external/meta-spdxscanner/recipes-devtools/python/python3-psycopg2-native_2.6.1.bb b/external/meta-spdxscanner/recipes-devtools/python/python3-psycopg2-native_2.6.1.bb
deleted file mode 100644
index 9f7f7b04..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-psycopg2-native_2.6.1.bb
+++ /dev/null
@@ -1,23 +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"
-
-DEPENDS += "postgresql-native"
-
-inherit native python3native
-
-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 distutils3
-
diff --git a/external/meta-spdxscanner/recipes-devtools/python/python3-six_1.10.0.bb b/external/meta-spdxscanner/recipes-devtools/python/python3-six_1.10.0.bb
deleted file mode 100644
index 5fd29182..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-six_1.10.0.bb
+++ /dev/null
@@ -1,13 +0,0 @@
-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/external/meta-spdxscanner/recipes-devtools/python/python3-sphinx-native_1.6.6.bb b/external/meta-spdxscanner/recipes-devtools/python/python3-sphinx-native_1.6.6.bb
deleted file mode 100644
index 1fd2507b..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-sphinx-native_1.6.6.bb
+++ /dev/null
@@ -1,18 +0,0 @@
-DESCRIPTION = "Python documentation generator"
-HOMEPAGE = "http://sphinx-doc.org/"
-SECTION = "devel/python"
-LICENSE = "BSD"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=d5575c977f2e4659ece47f731f2b8319"
-
-PR = "r0"
-SRCNAME = "sphinx"
-
-SRC_URI = "https://github.com/sphinx-doc/sphinx/archive/${PV}.tar.gz"
-
-SRC_URI[md5sum] = "567457f488771643ea4d8adffacc6b2a"
-SRC_URI[sha256sum] = "1ce2041ef4538eba0dc8394a5add4a97fbfa54f026322ae4a7e6fb2c2ea51ae7"
-
-S = "${WORKDIR}/${SRCNAME}-${PV}"
-
-inherit setuptools3 native python3native
-
diff --git a/external/meta-spdxscanner/recipes-devtools/python/python3-sqlalchemy_%.bbappend b/external/meta-spdxscanner/recipes-devtools/python/python3-sqlalchemy_%.bbappend
deleted file mode 100644
index c5e10df5..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-sqlalchemy_%.bbappend
+++ /dev/null
@@ -1,3 +0,0 @@
-BBCLASSEXTEND = "native"
-
-RDEPENDS_${PN}_remove = "python3-numbers python3-misc"
diff --git a/external/meta-spdxscanner/recipes-devtools/python/python3-whatthepatch_0.0.5.bb b/external/meta-spdxscanner/recipes-devtools/python/python3-whatthepatch_0.0.5.bb
deleted file mode 100644
index c0b76821..00000000
--- a/external/meta-spdxscanner/recipes-devtools/python/python3-whatthepatch_0.0.5.bb
+++ /dev/null
@@ -1,22 +0,0 @@
-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"
-
-inherit distutils3 python3native setuptools3 python3-dir
-
-BBCLASSEXTEND = "native"
-
-
diff --git a/external/meta-spdxscanner/recipes-devtools/scancode-toolkit/scancode-toolkit-native_3.1.1.bb b/external/meta-spdxscanner/recipes-devtools/scancode-toolkit/scancode-toolkit-native_3.1.1.bb
new file mode 100644
index 00000000..8f6f4667
--- /dev/null
+++ b/external/meta-spdxscanner/recipes-devtools/scancode-toolkit/scancode-toolkit-native_3.1.1.bb
@@ -0,0 +1,40 @@
+SUMMARY = "ScanCode toolkit"
+DESCRIPTION = "A typical software project often reuses hundreds of third-party \
+packages. License and origin information is not always easy to find and not \
+normalized: ScanCode discovers and normalizes this data for you."
+HOMEPAGE = "https://github.com/nexB/scancode-toolkit"
+SECTION = "devel"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://NOTICE;md5=8aedb84647f637c585e71f8f2e96e5c8"
+
+EXTRANATIVEPATH_remove = "python-native"
+
+inherit setuptools pypi distutils native
+
+DEPENDS = "python-setuptools-native xz-native zlib-native libxml2-native \
+ libxslt-native bzip2-native \
+ "
+
+SRC_URI = "git://github.com/nexB/scancode-toolkit;branch=master \
+ "
+
+SRCREV = "1af5ac8449cbb1ce98a0b461a6d9a5ad42a5d248"
+
+
+S = "${WORKDIR}/git"
+
+do_configure(){
+ ./scancode --help
+}
+
+do_install_append(){
+ install -d ${D}${bindir}/bin
+ install -d ${D}${bindir}/include
+ install -d ${D}${bindir}/local
+
+ install ${S}/scancode ${D}${bindir}/
+ install ${S}/bin/* ${D}${bindir}/bin/
+ mv ${S}/include/* ${D}${bindir}/include/
+}
+
diff --git a/external/meta-spdxscanner/recipes-extended/glib-2.0/glib-2.0_%.bbappend b/external/meta-spdxscanner/recipes-extended/glib-2.0/glib-2.0_%.bbappend
deleted file mode 100644
index fdc10279..00000000
--- a/external/meta-spdxscanner/recipes-extended/glib-2.0/glib-2.0_%.bbappend
+++ /dev/null
@@ -1 +0,0 @@
-STATIC_LINK = "${@bb.utils.contains('PACKAGECONFIG', 'system-pcre', 'system-pcre', '', d)}"
diff --git a/external/meta-spdxscanner/recipes-extended/perl/perl_%.bbappend b/external/meta-spdxscanner/recipes-extended/perl/perl_%.bbappend
deleted file mode 100644
index 0042c866..00000000
--- a/external/meta-spdxscanner/recipes-extended/perl/perl_%.bbappend
+++ /dev/null
@@ -1 +0,0 @@
-CONTAINED=" File-Path-2.12 "
diff --git a/external/meta-spdxscanner/recipes-support/postgresql/files/0001-Use-pkg-config-for-libxml2-detection.patch b/external/meta-spdxscanner/recipes-support/postgresql/files/0001-Use-pkg-config-for-libxml2-detection.patch
deleted file mode 100644
index d08ec6af..00000000
--- a/external/meta-spdxscanner/recipes-support/postgresql/files/0001-Use-pkg-config-for-libxml2-detection.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From d52e330be895bb8c5f0fb3e2884766acbd942a85 Mon Sep 17 00:00:00 2001
-From: Philip Balister <philip@balister.org>
-Date: Tue, 1 Jul 2014 09:40:44 -0400
-Subject: [PATCH] Use pkg-config for libxml2 detection.
-
-Upstream-Status: Inappropriate [configuration]
-
-xml2-config does not work. Use pkgconfig to set CPPFLAGS and LIBS.
-
-Signed-off-by: Philip Balister <philip@balister.org>
----
- configure.in | 15 ++-------------
- 1 file changed, 2 insertions(+), 13 deletions(-)
-
-diff --git a/configure.in b/configure.in
-index f8bf466..1f4fabf 100644
---- a/configure.in
-+++ b/configure.in
-@@ -734,19 +734,8 @@ PGAC_ARG_BOOL(with, libxml, no, [build with XML support],
- [AC_DEFINE([USE_LIBXML], 1, [Define to 1 to build with XML support. (--with-libxml)])])
-
- if test "$with_libxml" = yes ; then
-- AC_CHECK_PROGS(XML2_CONFIG, xml2-config)
-- if test -n "$XML2_CONFIG"; then
-- for pgac_option in `$XML2_CONFIG --cflags`; do
-- case $pgac_option in
-- -I*|-D*) CPPFLAGS="$CPPFLAGS $pgac_option";;
-- esac
-- done
-- for pgac_option in `$XML2_CONFIG --libs`; do
-- case $pgac_option in
-- -L*) LDFLAGS="$LDFLAGS $pgac_option";;
-- esac
-- done
-- fi
-+ CPPFLAGS="$CPPFLAGS `pkg-config --short-errors --print-errors --cflags "libxml-2.0" 2>&1`"
-+ LIBS="`pkg-config --short-errors --print-errors --libs "libxml-2.0" 2>&1` $LIBS"
- fi
-
- AC_SUBST(with_libxml)
---
-1.8.3.1
-
diff --git a/external/meta-spdxscanner/recipes-support/postgresql/postgresql-native_9.4.11.bb b/external/meta-spdxscanner/recipes-support/postgresql/postgresql-native_9.4.11.bb
deleted file mode 100644
index 0bd69908..00000000
--- a/external/meta-spdxscanner/recipes-support/postgresql/postgresql-native_9.4.11.bb
+++ /dev/null
@@ -1,91 +0,0 @@
-SUMMARY = "PostgreSQL is a powerful, open source relational database system."
-DESCRIPTION = "\
- PostgreSQL is an advanced Object-Relational database management system \
- (DBMS) that supports almost all SQL constructs (including \
- transactions, subselects and user-defined types and functions). The \
- postgresql package includes the client programs and libraries that \
- you'll need to access a PostgreSQL DBMS server. These PostgreSQL \
- client programs are programs that directly manipulate the internal \
- structure of PostgreSQL databases on a PostgreSQL server. These client \
- programs can be located on the same machine with the PostgreSQL \
- server, or may be on a remote machine which accesses a PostgreSQL \
- server over a network connection. This package contains the docs \
- in HTML for the whole package, as well as command-line utilities for \
- managing PostgreSQL databases on a PostgreSQL server. \
- \
- If you want to manipulate a PostgreSQL database on a local or remote \
- PostgreSQL server, you need this package. You also need to install \
- this package if you're installing the postgresql-server package. \
-"
-HOMEPAGE = "http://www.postgresql.com"
-LICENSE = "BSD"
-DEPENDS = "tcl-native libxml2-native libxslt-native perl-native"
-
-LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=81b69ddb31a8be66baafd14a90146ee2"
-
-SRC_URI[md5sum] = "2fee03f2034034dbfcb3321a0bb0f829"
-SRC_URI[sha256sum] = "e3eb51d045c180b03d2de1f0c3af9356e10be49448e966ca01dfc2c6d1cc9d23"
-
-SRC_URI = "http://ftp.postgresql.org/pub/source/v${PV}/${BP}.tar.bz2 \
- file://0001-Use-pkg-config-for-libxml2-detection.patch \
-"
-
-LEAD_SONAME = "libpq.so"
-
-# LDFLAGS for shared libraries
-export LDFLAGS_SL = "${LDFLAGS}"
-
-inherit autotools-brokensep pkgconfig perlnative native python3-dir
-
-CFLAGS += "-I${STAGING_INCDIR}/${PYTHON_DIR} -I${STAGING_INCDIR}/tcl8.6"
-
-EXTRA_OECONF = " --with-tclconfig=${STAGING_LIBDIR_NATIVE} \
- --with-includes=${STAGING_INCDIR_NATIVE}/tcl${TCL_VER} \
-"
-
-EXTRA_OECONF_append = " \
- --with-tcl --with-openssl --with-perl \
- --with-libxml --with-libxslt \
- ${COMMON_CONFIGURE_FLAGS} \
-"
-
-do_configure_append() {
- test -d build_py3 || mkdir build_py3
- cd build_py3
- ../configure --host=${HOST_SYS} \
- --build=${BUILD_SYS} \
- --target=${TARGET_SYS} \
- ${COMMON_CONFIGURE_FLAGS}
- cd ${S}
-}
-
-do_compile_append() {
- oe_runmake -C contrib all
- cd build_py3
- #cp ${S}/src/pl/plpython/*.o ${S}/build_py3/src/pl/plpython
- oe_runmake -C src/backend/ submake-errcodes
- oe_runmake -C src/pl/plpython
-}
-
-# server needs to configure user and group
-usernum = "28"
-groupnum = "28"
-USERADD_PACKAGES = "${PN}"
-USERADD_PARAM_${PN} = "-M -g postgres -o -r -d ${localstatedir}/lib/${BPN} \
- -s /bin/bash -c 'PostgreSQL Server' -u ${usernum} postgres"
-GROUPADD_PARAM_${PN} = "-g ${groupnum} -o -r postgres"
-
-do_install_append() {
- # Follow Deian, some files belong to /usr/bin
- install -d ${D}${bindir}
- oe_runmake -C ${S}/contrib install DESTDIR=${D}
- install -m 0644 ${S}/src/pl/plpython/plpython3u* \
- ${D}${datadir}/${MAJOR_VER}/extension/
- #install -m 0755 ${S}/build_py3/src/pl/plpython/plpython3.so ${D}${libdir}/${MAJOR_VER}/lib
-
- # Remove the the absolute path to sysroot
- sed -i -e "s|${STAGING_LIBDIR}|${libdir}|" \
- ${D}${libdir}/pkgconfig/*.pc
-}
-
-SSTATE_SCAN_FILES += "Makefile.global"