How to use pikaur - 10 common examples

To help you get started, we’ve selected a few pikaur examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github actionless / pikaur / pikaur_test / test_sysupgrade.py View on Github external
spawn(f'rm -fr ./{self.dev_pkg_name}')
        pikaur(f'-G -d {self.dev_pkg_name}')
        dev_pkg_url = self.dev_pkg_url.replace('/', r'\/')
        spawn([
            "bash",
            "-c",
            f"cd ./{self.dev_pkg_name}/ && "
            "sed -e 's/"
            "^source=.*"
            "/"
            f'source=("git+{dev_pkg_url}#branch=master~1")'
            "/' PKGBUILD > PKGBUILD_prev"
        ])
        pikaur(f'-P -i --noconfirm ./{self.dev_pkg_name}/PKGBUILD_prev')
        self.assertInstalled(self.dev_pkg_name)
        self.dev_old_version = PackageDB.get_local_dict()[self.dev_pkg_name].version
github actionless / pikaur / pikaur_test / helpers.py View on Github external
# re-parse args:
            sys.argv = new_args
            CachedArgs.args = None  # pylint:disable=protected-access
            MakePkgCommand._cmd = None  # pylint:disable=protected-access
            parse_args()
            # monkey-patch to force always uncolored output:
            CachedArgs.args.color = 'never'  # type: ignore # pylint:disable=protected-access

            # finally run pikaur's mainloop
            main()

        except FakeExit:
            pass
        intercepted = _intercepted

    PackageDB.discard_local_cache()
    PackageDB.discard_repo_cache()

    return CmdResult(
        returncode=intercepted.returncode,
        stdout=intercepted.stdout_text,
        stderr=intercepted.stderr_text,
    )
github actionless / pikaur / pikaur_test / test_sysupgrade.py View on Github external
PackageDB.get_local_dict()[self.repo2_pkg_name].version,
            self.repo2_old_version
        )
        self.assertEqual(
            PackageDB.get_local_dict()[self.aur2_pkg_name].version,
            self.aur2_old_version
        )

        # ignore one of repo pkgs and one of AUR pkgs
        pikaur(
            '-Su --noconfirm '
            f'--ignore {self.repo_pkg_name} '
            f'--ignore {self.aur_pkg_name}'
        )
        self.assertEqual(
            PackageDB.get_local_dict()[self.repo_pkg_name].version,
            self.repo_old_version
        )
        self.assertEqual(
            PackageDB.get_local_dict()[self.aur_pkg_name].version,
            self.aur_old_version
        )
        self.assertNotEqual(
            PackageDB.get_local_dict()[self.repo2_pkg_name].version,
            self.repo2_old_version
        )
        self.assertNotEqual(
            PackageDB.get_local_dict()[self.aur2_pkg_name].version,
            self.aur2_old_version
        )

        # ignore the only remaining AUR package
github actionless / pikaur / pikaur_test / test_sysupgrade.py View on Github external
self.assertEqual(
            PackageDB.get_local_dict()[self.aur_pkg_name].version,
            self.aur_old_version
        )

        self.downgrade_repo1_pkg()

        # ignore the only one remaining repo package
        pikaur('-Su --noconfirm '
               f'--ignore {self.repo_pkg_name}')
        self.assertEqual(
            PackageDB.get_local_dict()[self.repo_pkg_name].version,
            self.repo_old_version
        )
        self.assertNotEqual(
            PackageDB.get_local_dict()[self.aur_pkg_name].version,
            self.aur_old_version
        )
github actionless / pikaur / pikaur_test / test_sysupgrade.py View on Github external
self.repo_old_version
        )
        self.assertEqual(
            PackageDB.get_local_dict()[self.aur_pkg_name].version,
            self.aur_old_version
        )

        self.downgrade_repo1_pkg()

        pikaur('-Su --noconfirm --aur')
        self.assertEqual(
            PackageDB.get_local_dict()[self.repo_pkg_name].version,
            self.repo_old_version
        )
        self.assertNotEqual(
            PackageDB.get_local_dict()[self.aur_pkg_name].version,
            self.aur_old_version
        )
github actionless / pikaur / pikaur_test / helpers.py View on Github external
new_args += ['--mflags=--noextract', ]

    print(color_line('\n => ', 10) + ' '.join(new_args))

    intercepted: InterceptSysOutput
    with InterceptSysOutput(
            capture_stderr=capture_stderr,
            capture_stdout=capture_stdout
    ) as _intercepted:
        try:

            # re-parse args:
            sys.argv = new_args
            CachedArgs.args = None  # pylint:disable=protected-access
            MakePkgCommand._cmd = None  # pylint:disable=protected-access
            parse_args()
            # monkey-patch to force always uncolored output:
            CachedArgs.args.color = 'never'  # type: ignore # pylint:disable=protected-access

            # finally run pikaur's mainloop
            main()

        except FakeExit:
            pass
        intercepted = _intercepted

    PackageDB.discard_local_cache()
    PackageDB.discard_repo_cache()

    return CmdResult(
        returncode=intercepted.returncode,
        stdout=intercepted.stdout_text,
github actionless / pikaur / pikaur / build.py View on Github external
_("[a] abort building all the packages"),
                    ))
                )
                answer = get_input(
                    prompt,
                    _('r').upper() + _('p') + _('c') + _('i') + _('d') + _('e') +
                    _('s') + _('a')
                )

            answer = answer.lower()[0]
            if answer == _("r"):  # pragma: no cover
                continue
            if answer == _("p"):  # pragma: no cover
                skip_pgp_check = True
                continue
            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',
github actionless / pikaur / pikaur / install_cli.py View on Github external
if self.args.noconfirm:
                    answer = _("a")
                else:  # pragma: no cover
                    prompt = '{} {}\n{}\n{}\n{}\n{}\n> '.format(
                        color_line('::', 11),
                        _("Try recovering?"),
                        _("[c] git checkout -- '*'"),
                        # _("[c] git checkout -- '*' ; git clean -f -d -x"),
                        _("[r] remove dir and clone again"),
                        _("[s] skip this package"),
                        _("[a] abort")
                    )
                    answer = get_input(prompt, _('c') + _('r') + _('s') + _('a').upper())

                answer = answer.lower()[0]
                if answer == _("c"):  # pragma: no cover
                    package_build.git_reset_changed()
                elif answer == _("r"):  # pragma: no cover
                    remove_dir(package_build.repo_path)
                elif answer == _("s"):  # pragma: no cover
                    for skip_pkg_name in package_build.package_names:
                        self.discard_install_info(skip_pkg_name)
                else:
                    raise SysExit(125)
github actionless / pikaur / pikaur / install_cli.py View on Github external
if index >= len(packages_to_be_built):
                index = 0

            pkg_name = packages_to_be_built[index]
            repo_status = self.package_builds_by_name[pkg_name]
            if self.args.needed and repo_status.version_already_installed:
                packages_to_be_built.remove(pkg_name)
                continue

            try:
                repo_status.build(
                    all_package_builds=self.package_builds_by_name,
                    resolved_conflicts=self.resolved_conflicts
                )
            except (BuildError, DependencyError) as exc:
                print_stderr(exc)
                print_stderr(
                    color_line(_("Can't build '{name}'.").format(name=pkg_name) + '\n', 9)
                )
                # if not ask_to_continue():
                #     raise SysExit(125)
                for _pkg_name in repo_status.package_names:
                    failed_to_build_package_names.append(_pkg_name)
                    self.discard_install_info(_pkg_name)
                    for remaining_aur_pkg_name in packages_to_be_built[:]:
                        if remaining_aur_pkg_name not in self.all_aur_packages_names:
                            packages_to_be_built.remove(remaining_aur_pkg_name)
            except DependencyNotBuiltYet:
                index += 1
                for _pkg_name in repo_status.package_names:
                    deps_fails_counter.setdefault(_pkg_name, 0)
                    deps_fails_counter[_pkg_name] += 1
github actionless / pikaur / pikaur / build.py View on Github external
).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