Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def is_available(cls):
try:
return ProcessHelper.run_subprocess([cls.CMD, '--help'], output_file=ProcessHelper.DEV_NULL) == 0
except (IOError, OSError):
return False
def is_available(cls):
try:
return ProcessHelper.run_subprocess([cls.CMD, '--help'], output_file=ProcessHelper.DEV_NULL) == 0
except (IOError, OSError):
return False
"""
logger.info("Building RPMs")
output = os.path.join(results_dir, "mock_output.log")
cmd = [cls.CMD, '--old-chroot', '--rebuild', srpm, '--resultdir', results_dir]
if root is not None:
cmd.extend(['--root', root])
if arch is not None:
cmd.extend(['--arch', arch])
if builder_options is not None:
cmd.extend(builder_options)
if not check_mock_privileges():
cmd = ['pkexec'] + cmd
ret = ProcessHelper.run_subprocess(cmd, output_file=output)
logs = []
for log in PathHelper.find_all_files(results_dir, '*.log'):
logs.append(os.path.join(rpm_results_dir, os.path.basename(log)))
if ret == 0:
return [f for f in PathHelper.find_all_files(results_dir, '*.rpm') if not f.endswith('.src.rpm')], logs
else:
logfile = get_mock_logfile_path(ret, rpm_results_dir, tmp_path=results_dir)
raise BinaryPackageBuildError("Building RPMs failed!", rpm_results_dir, logfile=logfile, logs=logs)