Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if answer == _("c"): # pragma: no cover
skip_file_checksums = True
continue
if answer == _("i"): # pragma: no cover
self.skip_carch_check = True
continue
if answer == _("d"): # pragma: no cover
self.prepare_build_destination(flush=True)
continue
if answer == _('e'): # pragma: no cover
editor_cmd = get_editor_or_exit()
if editor_cmd:
interactive_spawn(
editor_cmd + [self.pkgbuild_path]
)
interactive_spawn(isolate_root_cmd([
'cp',
self.pkgbuild_path,
os.path.join(self.build_dir, 'PKGBUILD')
]))
continue
if answer == _("a"):
raise SysExit(125)
# "s"kip
break
return build_succeeded
def regenerate(self) -> None:
result = spawn(
isolate_root_cmd(
MakePkgCommand.get() + ['--printsrcinfo'] +
['-p', os.path.basename(self.pkgbuild_path)],
cwd=self.repo_path
), cwd=self.repo_path
)
if result.returncode != 0:
print_error(_("failed to generate .SRCINFO from {}:").format(self.pkgbuild_path))
print_stderr(result.stderr_text)
raise SysExit(5)
with open_file(self.path, 'w') as srcinfo_file:
srcinfo_file.write(result.stdout_text)
self.load_config()
) or (
(self.last_installed_hash != self.current_hash) and not self.reviewed
):
return
print_stdout('{} {}...'.format(
color_line('::', 15),
_n(
"Downloading the latest sources for a devel package {}",
"Downloading the latest sources for devel packages {}",
len(self.package_names)
).format(
bold_line(', '.join(self.package_names))
)
))
pkgver_result = joined_spawn(
isolate_root_cmd(
MakePkgCommand.get() + [
'--nobuild', '--noprepare', '--nocheck', '--nodeps'
],
cwd=self.build_dir
),
cwd=self.build_dir,
)
if pkgver_result.returncode != 0:
print_error(_("failed to retrieve latest dev sources:"))
print_stderr(pkgver_result.stdout_text)
if not ask_to_continue(default_yes=False):
raise SysExit(125)
SrcInfo(self.build_dir).regenerate()
self._source_repo_updated = True
def copy_aur_repo(from_path, to_path) -> None:
from_path = os.path.realpath(from_path)
to_path = os.path.realpath(to_path)
if not os.path.exists(to_path):
mkdir(to_path)
from_paths = []
for src_path in glob(f'{from_path}/*') + glob(f'{from_path}/.*'):
if os.path.basename(src_path) != '.git':
from_paths.append(src_path)
to_path = f'{to_path}/'
cmd_args = isolate_root_cmd(['cp', '-r'] + from_paths + [to_path])
result = spawn(cmd_args)
if result.returncode != 0:
if os.path.exists(to_path):
remove_dir(to_path)
mkdir(to_path)
result = interactive_spawn(cmd_args)
if result.returncode != 0:
raise Exception(_(f"Can't copy '{from_path}' to '{to_path}'."))
def _set_built_package_path(self) -> None:
pkg_paths = spawn(
isolate_root_cmd(MakePkgCommand.get() + ['--packagelist'],
cwd=self.build_dir),
cwd=self.build_dir
).stdout_text.splitlines()
if not pkg_paths:
return
pkg_paths.sort(key=len)
for pkg_name in self.package_names:
pkg_path = pkg_paths[0]
if len(pkg_paths) > 1:
arch = MakepkgConfig.get('CARCH')
for each_path in pkg_paths:
each_filename = os.path.basename(each_path)
if pkg_name in each_filename and (
(f'-{arch}.' in each_filename) or ('-any.' in each_filename)
):
pkg_path = each_filename