Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
# 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,
)
def handle_not_found_aur_pkgs(
aur_pkg_name: str,
aur_pkgs_info: List[AURPackageInfo],
not_found_aur_deps: List[str],
) -> None:
if not not_found_aur_deps:
return
all_repo_provided_packages = PackageDB.get_repo_provided_dict()
all_local_provided_packages = PackageDB.get_local_provided_dict()
problem_packages_names = []
for aur_pkg in aur_pkgs_info:
version_matchers = get_aur_pkg_deps_and_version_matchers(aur_pkg)
deps = version_matchers.keys()
for not_found_pkg in not_found_aur_deps:
if not_found_pkg in deps:
version_matcher = version_matchers[not_found_pkg]
try:
failed_pkg = PackageDB.find_repo_package(not_found_pkg)
except PackagesNotFoundInRepo:
pass
else:
version_found = failed_pkg.version
if not_found_pkg in all_repo_provided_packages:
def get_last_installed_package_date(cls) -> int:
repo_names = []
for repo in PackageDB.get_repo_list():
repo_names.append(repo.name)
packages = []
for package in PackageDB.get_local_list():
if package.name in repo_names:
packages.append(package)
packages_by_date = sorted(packages, key=lambda x: -x.installdate)
return int(packages_by_date[0].installdate)
def _get_local_version(package_name: str) -> str:
return PackageDB.get_local_dict()[package_name].version
def package_search_thread_repo(query: str) -> List[pyalpm.Package]:
args = parse_args()
if query:
result = PackageDB.search_repo(
query, names_only=args.namesonly
)
else:
result = PackageDB.get_repo_list(quiet=True)
if not args.quiet:
sys.stderr.write('#')
return result
if repo_pkg_info.replaces:
for dep_name in repo_pkg_info.replaces:
repo_pkg_name = repo_pkg_info.name
if dep_name != repo_pkg_name:
replaces_lists.setdefault(repo_pkg_name, []).append(dep_name)
new_pkgs_replaces: Dict[str, List[str]] = {}
for pkg_name, replace_list in replaces_lists.items():
for replace_pkg_name in replace_list:
try:
if (replace_pkg_name in all_local_pkgs_names) and (
(pkg_name not in all_repo_pkg_names) or (
replace_pkg_name not in all_repo_pkg_names or (
PackageDB.get_repo_priority(
PackageDB.find_repo_package(replace_pkg_name).db.name
) >= PackageDB.get_repo_priority(
PackageDB.find_repo_package(pkg_name).db.name
)
)
)
):
new_pkgs_replaces.setdefault(pkg_name, []).append(replace_pkg_name)
except PackagesNotFoundInRepo as exc:
print_warning(
_n(
"'{packages}' package is available in the repo but can't be installed",
"'{packages}' packages are available in the repo but can't be installed",
len(exc.packages)
).format(
packages=', '.join(exc.packages)
)
)
def cli_getpkgbuild() -> None:
check_runtime_deps(['asp'])
args = parse_args()
pwd = os.path.abspath(os.path.curdir)
aur_pkg_names = args.positional
aur_pkgs, not_found_aur_pkgs = find_aur_packages(aur_pkg_names)
repo_pkgs = []
not_found_repo_pkgs = []
for pkg_name in not_found_aur_pkgs:
try:
repo_pkg = PackageDB.find_repo_package(pkg_name)
except PackagesNotFoundInRepo:
not_found_repo_pkgs.append(pkg_name)
else:
repo_pkgs.append(repo_pkg)
if not_found_repo_pkgs:
print_not_found_packages(not_found_repo_pkgs)
if args.deps:
aur_pkgs = aur_pkgs + get_aur_deps_list(aur_pkgs)
for aur_pkg in aur_pkgs:
name = aur_pkg.name
repo_path = os.path.join(pwd, name)
print_stdout()
interactive_spawn([
def check_deps_versions(
deps_pkg_names: List[str],
version_matchers: Dict[str, VersionMatcher],
source: PackageSource
) -> List[str]:
not_found_deps: List[str] = []
deps_lines = [
version_matchers[dep_name].line
for dep_name in deps_pkg_names
]
if source == PackageSource.REPO:
not_found_deps = PackageDB.get_not_found_repo_packages(deps_lines)
else:
not_found_deps = PackageDB.get_not_found_local_packages(deps_lines)
return not_found_deps