Skip to content

Commit

Permalink
Merge pull request #19 from matthewb66/dev
Browse files Browse the repository at this point in the history
v1.0.19 - Minor fix to BD connect logic
  • Loading branch information
matthewb66 authored Aug 2, 2024
2 parents 691ab72 + 034e66d commit d84e9f5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 187 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Synopsys Scan Yocto Script - bd_scan_yocto.py - BETA v1.0.18
# Synopsys Scan Yocto Script - bd_scan_yocto.py - BETA v1.0.19

# PROVISION OF THIS SCRIPT
This script is provided under the Apache v2 OSS license (see LICENSE file).
Expand Down Expand Up @@ -460,3 +460,6 @@ The identification of the Linux Kernel version from the Bitbake recipes and asso

## V1.0.16, V1.0.17, V1.0.18
- minor fix to file copying for Sig scan

## V1.0.19
- Minor fix to BD connect logic
2 changes: 1 addition & 1 deletion bd_scan_yocto/bd_asyncdata.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import aiohttp
import asyncio
# import platform
import logging
# import logging

from bd_scan_yocto import global_values

Expand Down
184 changes: 1 addition & 183 deletions bd_scan_yocto/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def connect():
token=global_values.bd_api,
base_url=global_values.bd_url,
timeout=30,
verify=global_values.bd_trustcert # TLS certificate verification
verify=(not global_values.bd_trustcert) # TLS certificate verification
)
try:
bd.list_resources()
Expand Down Expand Up @@ -392,185 +392,3 @@ def find_yocto_files():
global_values.cve_check_file = cvefile

return


# def input_number(prompt):
# print(f'{prompt} (q to quit): ', end='')
# val = input()
# while not val.isnumeric() and val.lower() != 'q':
# print('Please enter a number (or q)')
# print(f'{prompt}: ', end='')
# val = input()
# if val.lower() != 'q':
# return int(val)
# else:
# logging.info('Terminating')
# sys.exit(2)
#

# def input_file(prompt, accept_null, file_exists):
# if accept_null:
# prompt_help = '(q to quit, Enter to skip)'
# else:
# prompt_help = '(q to quit)'
# print(f'{prompt} {prompt_help}: ', end='')
# val = input()
# while (file_exists and not os.path.isfile(val)) and val.lower() != 'q':
# if accept_null and val == '':
# break
# print(f'Invalid input ("{val}" is not a file)')
# print(f'{prompt} {prompt_help}: ', end='')
# val = input()
# if val.lower() != 'q' or (accept_null and val == ''):
# return val
# else:
# logging.info('Terminating')
# sys.exit(2)
#
#
# def input_folder(prompt, default):
# prompt_help = '(q to quit)'
# print(f'{prompt} {prompt_help}: ', end='')
# val = input()
# while not os.path.isdir(val) and val.lower() != 'q':
# if val == '':
# break
# print(f'Invalid input ("{val}" is not a folder)')
# print(f'{prompt} {prompt_help}: ', end='')
# val = input()
# if val.lower() != 'q':
# return val
# else:
# logging.info('Terminating')
# sys.exit(2)
#
#
# def input_string(prompt):
# print(f'{prompt} (q to quit): ', end='')
# val = input()
# while len(val) == 0 and val != 'q':
# print(f'{prompt}: ', end='')
# val = input()
# if val.lower() != 'q':
# return val
# else:
# logging.info('Terminating')
# sys.exit(2)
#
#
# def input_string_default(prompt, default):
# print(f"{prompt} [Press return for '{default}'] (q to quit): ", end='')
# val = input()
# if val.lower() == 'q':
# sys.exit(2)
# if len(val) == 0:
# logging.info('Terminating')
# return default
# else:
# return val
#
#
# def input_yesno(prompt):
# accept_other = ['n', 'q', 'no', 'quit']
# accept_yes = ['y', 'yes']
#
# print(f'{prompt} (y/n/q): ', end='')
# val = input()
# while val.lower() not in accept_yes and val.lower() not in accept_other:
# print('Please enter y or n')
# print(f'{prompt}: ', end='')
# val = input()
# if val.lower() == 'q':
# sys.exit(2)
# if val.lower() in accept_yes:
# return True
# return False
#
#
# def input_filepattern(pattern, filedesc, path):
# retval = ''
# enterfile = False
# if input_yesno(f"Do you want to search recursively for '{filedesc}'?"):
# files_list = glob.glob(os.path.join(path, pattern), recursive=True)
# if len(files_list) > 0:
# print(f'Please select the {filedesc} file to be used: ')
# files_list = ['None of the below'] + files_list
# for i, f in enumerate(files_list):
# print(f'\t{i}: {f}')
# val = input_number('Please enter file entry number')
# if val == 0:
# enterfile = True
# else:
# retval = files_list[val]
# else:
# print(f'Unable to find {filedesc} ...')
# enterfile = True
# else:
# enterfile = True
#
# if enterfile:
# retval = input_file(f'Please enter the {filedesc} path', False, True)
#
# if not os.path.isfile(retval):
# logging.error(f'Unable to locate {filedesc} - exiting')
# sys.exit(2)
# return retval


# def do_wizard():
# print('\nRUNNING WIZARD (Use --nowizard to disable) ...')
#
# wiz_dict = [
# {'value': 'global_values.bd_url', 'prompt': 'Black Duck server URL', 'vtype': 'string'},
# {'value': 'global_values.bd_api', 'prompt': 'Black Duck API token', 'vtype': 'string'},
# {'value': 'global_values.bd_trustcert', 'prompt': 'Trust BD Server certificate', 'vtype': 'yesno'},
# {'value': 'global_values.bd_project', 'prompt': 'Black Duck project name', 'vtype': 'string'},
# {'value': 'global_values.bd_version', 'prompt': 'Black Duck version name', 'vtype': 'string'},
# {'value': 'global_values.target', 'prompt': 'Yocto target name', 'vtype': 'string',
# 'condition': 'global_values.skip_detect_for_bitbake'},
# {'value': 'global_values.build_dir', 'prompt': 'Yocto build folder', 'vtype': 'folder',
# 'default': os.path.join(os.path.abspath('.'), 'build')},
# {'value': 'global_values.manifest_file', 'prompt': 'Manifest file path', 'vtype': 'file_pattern',
# 'pattern': 'license.manifest', 'filedesc': 'license.manifest file',
# 'searchpath': os.path.join(global_values.build_dir, 'tmp', 'deploy')},
#
# # {'value': 'global_values.deploy_dir', 'prompt': 'Yocto deploy folder', 'vtype': 'folder'},
# # {'value': 'global_values.download_dir', 'prompt': 'Yocto OSS source download folder', 'vtype': 'folder'},
# # {'value': 'global_values.pkg_dir', 'prompt': 'Yocto package download folder', 'vtype': 'folder'},
# # {'value': 'global_values.cve_check',
# # 'prompt': 'Do you want to run a CVE check to patch CVEs in the BD project which have been patched locally?',
# # 'vtype': 'yesno'},
# # {'value': 'global_values.cve_check_file', 'prompt': 'CVE check file path',
# # 'vtype': 'file_pattern', 'pattern': '**/rootfs.cve', 'filename': 'CVE check output file',
# # 'condition': 'global_values.cve_check'},
# # {'value': 'global_values.report_file', 'prompt': 'Output report file', 'vtype': 'string'},
# ]
#
# wiz_count = 0
# for wiz_entry in wiz_dict:
# val = ''
# existingval = eval(wiz_entry['value'])
# if existingval == '':
# if 'condition' in wiz_entry:
# conditionval = eval(wiz_entry['condition'])
# if conditionval:
# continue
# if wiz_entry['vtype'] == 'string':
# val = input_string(wiz_entry['prompt'])
# elif wiz_entry['vtype'] == 'string_default':
# val = input_string_default(wiz_entry['prompt'], wiz_entry['default'])
# elif wiz_entry['vtype'] == 'yesno':
# val = input_yesno(wiz_entry['prompt'])
# elif wiz_entry['vtype'] == 'file':
# val = input_file(wiz_entry['prompt'], False, True)
# elif wiz_entry['vtype'] == 'folder':
# val = input_folder(wiz_entry['prompt'], wiz_entry['default'])
# elif wiz_entry['vtype'] == 'file_pattern':
# val = input_filepattern(wiz_entry['pattern'], wiz_entry['filedesc'], eval(wiz_entry['searchpath']))
# wiz_count += 1
# globals()[wiz_entry['value']] = val
# logging.debug(f"{wiz_entry['value']}={val}")
#
# if wiz_count == 0:
# print("- Nothing for Wizard to do - continuing ...\n")
# return
2 changes: 1 addition & 1 deletion bd_scan_yocto/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import subprocess
import logging

from bd_scan_yocto import global_values
# from bd_scan_yocto import global_values
# from bd_scan_yocto import config


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "bd_scan_yocto"
version = "1.0.18"
version = "1.0.19"
authors = [
{ name="Matthew Brady", email="[email protected]" },
]
Expand Down

0 comments on commit d84e9f5

Please sign in to comment.