Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
parser_pack.set_defaults(func=pack)
# combine command
parser_combine = subparsers.add_parser(
'combine',
help="Combine multiple traces into one (possibly as subsequent runs)")
add_options(parser_combine)
parser_combine.add_argument('traces', nargs=argparse.ONE_OR_MORE)
parser_combine.set_defaults(func=combine)
args = parser.parse_args()
setup_logging('REPROZIP', args.verbosity)
if getattr(args, 'func', None) is None:
parser.print_help(sys.stderr)
sys.exit(2)
setup_usage_report('reprozip', reprozip_version)
if 'cmdline' in args and not args.cmdline:
parser.error("missing command-line")
record_usage(command=args.selected_command)
try:
status = args.func(args)
except Exception as e:
traceback.print_exc()
submit_usage_report(result=type(e).__name__)
sys.exit(125)
else:
submit_usage_report(result='success')
if status is None:
sys.exit(0)
else:
sys.exit(int(status))
'system': [platform.system(), platform.release()],
'environ': environ,
'uid': os.getuid(),
'gid': os.getgid(),
'signal' if r_exitcode & 0x0100 else 'exitcode':
r_exitcode & 0xFF})
cur.close()
conn.close()
if find_inputs_outputs:
inputs_outputs = compile_inputs_outputs(runs, inputs, outputs)
else:
inputs_outputs = {}
save_config(config, runs, packages, files, reprozip_version,
inputs_outputs)
print("Configuration file written in {0!s}".format(config))
print("Edit that file then run the packer -- "
"use 'reprozip pack -h' for help")
'system': [platform.system(), platform.release()],
'environ': environ,
'uid': os.getuid(),
'gid': os.getgid(),
'signal' if r_exitcode & 0x0100 else 'exitcode':
r_exitcode & 0xFF})
cur.close()
conn.close()
if find_inputs_outputs:
inputs_outputs = compile_inputs_outputs(runs, inputs, outputs)
else:
inputs_outputs = {}
save_config(config, runs, packages, files, reprozip_version,
inputs_outputs)
print("Configuration file written in {0!s}".format(config))
print("Edit that file then run the packer -- "
"use 'reprozip pack -h' for help")
# Checks that input files are packed
for name, f in iteritems(inputs_outputs):
if f.read_runs and not Path(f.path).exists():
logger.warning("File is designated as input (name %s) but is not "
"to be packed: %s", name, f.path)
# Generates a unique identifier for the pack (for usage reports purposes)
pack_id = str(uuid.uuid4())
# Stores canonical config
fd, can_configfile = Path.tempfile(suffix='.yml', prefix='rpz_config_')
os.close(fd)
try:
save_config(can_configfile, runs, packages, other_files,
reprozip_version,
inputs_outputs, canonical=True,
pack_id=pack_id)
tar.add(str(can_configfile), 'METADATA/config.yml')
finally:
can_configfile.remove()
tar.close()
# Record some info to the usage report
record_usage_package(runs, packages, other_files,
inputs_outputs,
pack_id)
def add_options(opt):
opt.add_argument('--version', action='version',
version="reprozip version %s" % reprozip_version)
opt.add_argument('-d', '--dir', default='.reprozip-trace',
help="where to store database and configuration file "
"(default: ./.reprozip-trace)")
opt.add_argument(
'--dont-identify-packages', action='store_false', default=True,
dest='identify_packages',
help="do not try identify which package each file comes from")
opt.add_argument(
'--dont-find-inputs-outputs', action='store_false',
default=True, dest='find_inputs_outputs',
help="do not try to identify input and output files")