diff options
17 files changed, 795 insertions, 29 deletions
diff --git a/classes/spdx-dosocs.bbclass b/classes/spdx-dosocs.bbclass index 78a878e..2fc9035 100644 --- a/classes/spdx-dosocs.bbclass +++ b/classes/spdx-dosocs.bbclass @@ -10,7 +10,7 @@ # # 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_MANIFEST_DIR] +# 2) By default,spdx files will be output to the path which is defined as[SPDX_DEPLOY_DIR] # in ./meta/conf/spdx-dosocs.conf. SPDXOUTPUTDIR = "${WORKDIR}/spdx_output_dir" @@ -32,7 +32,6 @@ python do_spdx () { ## gcc is too big to get spdx file. if 'gcc' in d.getVar('PN', True): return None - info = {} info['workdir'] = (d.getVar('WORKDIR', True) or "") info['pn'] = (d.getVar( 'PN', True ) or "") @@ -51,7 +50,7 @@ python do_spdx () { info['package_summary'] = info['package_summary'].replace("'"," ") spdx_sstate_dir = (d.getVar('SPDXSSTATEDIR', True) or "") - manifest_dir = (d.getVar('SPDX_MANIFEST_DIR', 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" ) @@ -75,15 +74,13 @@ python do_spdx () { cache_cur = True create_manifest(info,sstatefile) if not cache_cur: - ## setup dosocs2 command - dosocs2_command = "dosocs2 oneshot %s" % info['sourcedir'] - ## no necessary to scan the git directory. git_path = "%s/.git" % info['sourcedir'] if os.path.exists(git_path): remove_dir_tree(git_path) ## Get spdx file - run_dosocs2(dosocs2_command,sstatefile) + 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 ) @@ -95,7 +92,7 @@ python do_spdx () { ## Get the src after do_patch. python do_get_spdx_s() { - ## It's no necessary to get spdx files for *-native + ## It's no necessary to get spdx files for *-native if d.getVar('PN', True) == d.getVar('BPN', True) + "-native": return None @@ -127,6 +124,26 @@ python do_get_spdx_s() { addtask get_spdx_s after do_patch before do_configure addtask spdx after do_get_spdx_s before do_configure +def invoke_dosocs2( OSS_src_dir, spdx_file): + import subprocess + import string + import json + import codecs + + cmd = "dosocs2 oneshot %s" % (OSS_src_dir) + bb.note("*********dosocs cmd = %s" % cmd) + + p = subprocess.Popen(cmd.split(), + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + dosocs2_output, dosocs2_error = p.communicate() + if p.returncode != 0: + 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']) @@ -222,21 +239,6 @@ def hash_string( data ): sha1.update( data.encode('utf-8') ) return sha1.hexdigest() -def run_dosocs2( dosocs2_command, spdx_file ): - import subprocess, codecs - import string, re - - p = subprocess.Popen(dosocs2_command.split(), - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - dosocs2_output, dosocs2_error = p.communicate() - if p.returncode != 0: - return None - - dosocs2_output = dosocs2_output.decode('utf-8') - - f = codecs.open(spdx_file,'w','utf-8') - f.write(dosocs2_output) - def get_ver_code( dirname ): chksums = [] for f_dir, f in list_files( dirname ): diff --git a/conf/include/security_flags.inc b/conf/include/security_flags.inc new file mode 100644 index 0000000..8c5fbea --- /dev/null +++ b/conf/include/security_flags.inc @@ -0,0 +1 @@ +SECURITY_CFLAGS_pn-fossology-nomos = "${SECURITY_NO_PIE_CFLAGS}" diff --git a/conf/spdx-dosocs.conf b/conf/spdx-dosocs.conf index b182e60..55fbd0a 100644 --- a/conf/spdx-dosocs.conf +++ b/conf/spdx-dosocs.conf @@ -1,3 +1,5 @@ SPDX_TEMP_DIR ?= "${WORKDIR}/spdx_temp" -SPDX_MANIFEST_DIR ?= "/home/yocto/spdx_scans" +SPDX_DEPLOY_DIR ?= "/home/yocto/spdx_scans" + +ASSUME_PROVIDED_remove = "file-native" diff --git a/lib/oe/spdx.py b/lib/oe/spdx.py new file mode 100644 index 0000000..b62b838 --- /dev/null +++ b/lib/oe/spdx.py @@ -0,0 +1,40 @@ +import os +import glob +import subprocess +import shutil +import multiprocessing +import re +import bb +import tempfile +import oe.utils +import string + +class Dosocs2(PackageManager): + def __init__(self): + self.dosocs2_cmd = bb.utils.which(os.getenv('PATH'), "dosocs2") + dosocs2_init_cmd = "%s dbinit --no-confirm" % (self.smart_cmd) + bb.note(dosocs2_init_cmd) + try: + complementary_pkgs = subprocess.check_output(dosocs2_init_cmd, + stderr=subprocess.STDOUT, + shell=True) + return + except subprocess.CalledProcessError as e: + bb.fatal("Could not invoke dosocs2 dbinit Command " + "'%s' returned %d:\n%s" % (dosocs2_init_cmd, e.returncode, e.output)) + + def _invoke_dosocs2( self, spdx_file): + cmd = "%s oneshot %s" % (self.smart_cmd, args) + + p = subprocess.Popen(cmd.split(), + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + dosocs2_output, dosocs2_error = p.communicate() + if p.returncode != 0: + return None + + dosocs2_output = dosocs2_output.decode('utf-8') + + f = codecs.open(spdx_file,'w','utf-8') + f.write(dosocs2_output) + + diff --git a/recipes-devtools/file/file/0001-magic.py-modified-for-dosocs2.patch b/recipes-devtools/file/file/0001-magic.py-modified-for-dosocs2.patch new file mode 100644 index 0000000..0d2bb40 --- /dev/null +++ b/recipes-devtools/file/file/0001-magic.py-modified-for-dosocs2.patch @@ -0,0 +1,501 @@ +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/recipes-devtools/file/file_%.bbappend b/recipes-devtools/file/file_%.bbappend new file mode 100644 index 0000000..8bb8199 --- /dev/null +++ b/recipes-devtools/file/file_%.bbappend @@ -0,0 +1,3 @@ +SRC_URI_native += " 0001-magic.py-modified-for-dosocs2.patch \ + " + diff --git a/recipes-devtools/fossology/fossology-nomos-native_git.bb b/recipes-devtools/fossology/fossology-nomos-native_git.bb new file mode 100644 index 0000000..2f55ed1 --- /dev/null +++ b/recipes-devtools/fossology/fossology-nomos-native_git.bb @@ -0,0 +1,27 @@ +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" + +SRCREV = "34467fd530b832f08c095936a72c22c40fa13278" +BRANCH = "release/${PV}/master" +SRC_URI = "git://github.com/fossology/fossology.git" + +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/recipes-devtools/python/python-docopt_0.6.2.bb b/recipes-devtools/python/python-docopt_0.6.2.bb index e51aeba..7115d0e 100644 --- a/recipes-devtools/python/python-docopt_0.6.2.bb +++ b/recipes-devtools/python/python-docopt_0.6.2.bb @@ -2,16 +2,16 @@ DESCRIPTION = "Pythonic command line arguments parser, that will make you smile HOMEPAGE = "http://docopt.org" SECTION = "devel/python" LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE-MIT;md5=2c9872d13fa571e7ba6de95055da1fe2" +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] = "842b44f8c95517ed5b792081a2370da1" -SRC_URI[sha256sum] = "6acf9abbbe757ef75dc2ecd9d91ba749547941abaffbe69ff2086a9e37d4904c" +SRC_URI[md5sum] = "a6c44155426fd0f7def8b2551d02fef6" +SRC_URI[sha256sum] = "2113eed1e7fbbcd43fb7ee6a977fb02d0b482753586c9dc1a8e3b7d541426e99" -inherit distutils +inherit setuptools python-dir -BBCLASSEXTEND = "native"
\ No newline at end of file +BBCLASSEXTEND = "native" diff --git a/recipes-devtools/python/python-dosocs2-native_0.16.1.bb b/recipes-devtools/python/python-dosocs2-native_0.16.1.bb new file mode 100644 index 0000000..60f3029 --- /dev/null +++ b/recipes-devtools/python/python-dosocs2-native_0.16.1.bb @@ -0,0 +1,45 @@ +DESCRIPTION = "SPDX 2.0 document creation and storage" +HOMEPAGE = "https://github.com/DoSOCSv2/DoSOCSv2" +SECTION = "devel/python" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +DEPENDS += "python-docopt-native" +DEPENDS += "python-native" + +SRC_URI = "https://github.com/DoSOCSv2/DoSOCSv2/archive/v0.16.1.tar.gz \ + file://0001-setup.py-delete-the-depends-install.patch \ + " + +SRC_URI[md5sum] = "ecb3f47eb9f7cdd01f520e7843ef09b1" +SRC_URI[sha256sum] = "868e4c1658bd54546f6f65be9770a80ac98793da3dcb71120a52237b07a1a656" + +S = "${WORKDIR}/DoSOCSv2-${PV}/" + +inherit distutils native + +DEPENDS += "python-jinja2-native python-native" +DEPENDS += "python-psycopg2-native python-docopt-native python-sqlalchemy-native file-native" + +python do_dosocs2_init(){ + import os + import subprocess + import bb + import oe.utils + import string + + bb.note("*********PATH = %s!" % os.getenv('PATH')) + dosocs2_cmd = bb.utils.which(os.getenv('PATH'), "dosocs2") + dosocs2_init_cmd = "%s dbinit --no-confirm" % (dosocs2_cmd) + bb.note(dosocs2_init_cmd) + try: + complementary_pkgs = subprocess.check_output(dosocs2_init_cmd, + stderr=subprocess.STDOUT, + shell=True) + return + except subprocess.CalledProcessError as e: + bb.fatal("Could not invoke dosocs2 dbinit Command " + "'%s' returned %d:\n%s" % (dosocs2_init_cmd, e.returncode, e.output)) +} + +addtask do_dosocs2_init after do_populate_sysroot diff --git a/recipes-devtools/python/python-dosocs2-natives b/recipes-devtools/python/python-dosocs2-natives new file mode 100644 index 0000000..41f6bb2 --- /dev/null +++ b/recipes-devtools/python/python-dosocs2-natives @@ -0,0 +1,34 @@ +From d282ba074625922d12615af676ac1f0e922db88f Mon Sep 17 00:00:00 2001 +From: Lei Maohui <leimaohui@cn.fujitsu.com> +Date: Wed, 15 Feb 2017 23:23:53 +0900 +Subject: [PATCH] setup.py: delete the depends install + +Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com> +--- + setup.py | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/setup.py b/setup.py +index 527b161..b35863f 100644 +--- a/setup.py ++++ b/setup.py +@@ -3,16 +3,9 @@ from setuptools import setup + _dosocs2_version = '0.16.1' + + install_requires=[ +- 'jinja2', +- 'python-magic', +- 'docopt', +- 'SQLAlchemy', +- 'psycopg2' + ] + + tests_require=[ +- 'pytest', +- 'mock' + ] + + setup( +-- +1.8.4.2 + diff --git a/recipes-devtools/python/python-dosocs2/0001-setup.py-delete-the-depends-install.patch b/recipes-devtools/python/python-dosocs2/0001-setup.py-delete-the-depends-install.patch new file mode 100644 index 0000000..41f6bb2 --- /dev/null +++ b/recipes-devtools/python/python-dosocs2/0001-setup.py-delete-the-depends-install.patch @@ -0,0 +1,34 @@ +From d282ba074625922d12615af676ac1f0e922db88f Mon Sep 17 00:00:00 2001 +From: Lei Maohui <leimaohui@cn.fujitsu.com> +Date: Wed, 15 Feb 2017 23:23:53 +0900 +Subject: [PATCH] setup.py: delete the depends install + +Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com> +--- + setup.py | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/setup.py b/setup.py +index 527b161..b35863f 100644 +--- a/setup.py ++++ b/setup.py +@@ -3,16 +3,9 @@ from setuptools import setup + _dosocs2_version = '0.16.1' + + install_requires=[ +- 'jinja2', +- 'python-magic', +- 'docopt', +- 'SQLAlchemy', +- 'psycopg2' + ] + + tests_require=[ +- 'pytest', +- 'mock' + ] + + setup( +-- +1.8.4.2 + diff --git a/recipes-devtools/python/python-jinja2_%.bbappend b/recipes-devtools/python/python-jinja2_%.bbappend new file mode 100644 index 0000000..8fd4f24 --- /dev/null +++ b/recipes-devtools/python/python-jinja2_%.bbappend @@ -0,0 +1,3 @@ +BBCLASSEXTEND = "native" + +RDEPENDS_${PN} = "python-sphinx python-markupsafe" diff --git a/recipes-devtools/python/python-magic_5.22.bb b/recipes-devtools/python/python-magic_5.22.bb new file mode 100644 index 0000000..5e0a4a2 --- /dev/null +++ b/recipes-devtools/python/python-magic_5.22.bb @@ -0,0 +1,21 @@ +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 \ + " + +SRC_URI[md5sum] = "8fb13e5259fe447e02c4a37bc7225add" +SRC_URI[sha256sum] = "c4e3a8e44cb888c5e4b476e738503e37fb9de3b25a38c143e214bfc12109fc0b" + +S="${WORKDIR}/file-${PV}/python" + +inherit setuptools python-dir + +BBCLASSEXTEND = "native" diff --git a/recipes-devtools/python/python-markupsafe-native_0.23.bb b/recipes-devtools/python/python-markupsafe-native_0.23.bb new file mode 100644 index 0000000..18860e9 --- /dev/null +++ b/recipes-devtools/python/python-markupsafe-native_0.23.bb @@ -0,0 +1,14 @@ +DESCRIPTION = "Implements a XML/HTML/XHTML Markup safe string for Python" +HOMEPAGE = "http://github.com/mitsuhiko/markupsafe" +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=c6d1adcf45d69359f256c1cea3254127" + +PR = "r0" + +SRC_URI[md5sum] = "f5ab3deee4c37cd6a922fb81e730da6e" +SRC_URI[sha256sum] = "a4ec1aff59b95a14b45eb2e23761a0179e98319da5a7eb76b56ea8cdc7b871c3" + +PYPI_PACKAGE = "MarkupSafe" +inherit pypi setuptools native + +DEPENDS_${PN} += "${PYTHON_PN}-native" diff --git a/recipes-devtools/python/python-psycopg2-native_2.6.1.bb b/recipes-devtools/python/python-psycopg2-native_2.6.1.bb new file mode 100644 index 0000000..6f52621 --- /dev/null +++ b/recipes-devtools/python/python-psycopg2-native_2.6.1.bb @@ -0,0 +1,21 @@ +DESCRIPTION = "Python-PostgreSQL Database Adapter" +HOMEPAGE = "http://initd.org/psycopg/" +SECTION = "devel/python" +LICENSE = "GPLv3+" +LIC_FILES_CHKSUM = "file://LICENSE;md5=2c9872d13fa571e7ba6de95055da1fe2" + +PR = "r0" +SRCNAME = "psycopg2" + +inherit native + +SRC_URI = "https://pypi.python.org/packages/source/p/${SRCNAME}/${SRCNAME}-${PV}.tar.gz \ + " + +SRC_URI[md5sum] = "842b44f8c95517ed5b792081a2370da1" +SRC_URI[sha256sum] = "6acf9abbbe757ef75dc2ecd9d91ba749547941abaffbe69ff2086a9e37d4904c" + +S = "${WORKDIR}/${SRCNAME}-${PV}" + +inherit distutils + diff --git a/recipes-devtools/python/python-sphinx-native_1.3.1.bb b/recipes-devtools/python/python-sphinx-native_1.3.1.bb new file mode 100644 index 0000000..113764b --- /dev/null +++ b/recipes-devtools/python/python-sphinx-native_1.3.1.bb @@ -0,0 +1,17 @@ +DESCRIPTION = "Python documentation generator" +HOMEPAGE = "http://sphinx-doc.org/" +SECTION = "devel/python" +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://LICENSE;md5=6dd095eaa1e7a662b279daf80ecad7e6" + +PR = "r0" +SRCNAME = "Sphinx" + +SRC_URI = "http://pypi.python.org/packages/source/S/${SRCNAME}/${SRCNAME}-${PV}.tar.gz" + +SRC_URI[md5sum] = "8786a194acf9673464c5455b11fd4332" +SRC_URI[sha256sum] = "1a6e5130c2b42d2de301693c299f78cc4bd3501e78b610c08e45efc70e2b5114" + +S = "${WORKDIR}/${SRCNAME}-${PV}" + +inherit setuptools native diff --git a/recipes-devtools/python/python-sqlalchemy_0.7.9.bbappend b/recipes-devtools/python/python-sqlalchemy_0.7.9.bbappend new file mode 100644 index 0000000..d3267ac --- /dev/null +++ b/recipes-devtools/python/python-sqlalchemy_0.7.9.bbappend @@ -0,0 +1 @@ +BBCLASSEXTEND = "native" |