mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 17:54:15 +02:00
[arch] fix: not informing all the provided packages on the transaction context to the dependency sorting algorithm
This commit is contained in:
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
### Fixes
|
### Fixes
|
||||||
- Arch
|
- Arch
|
||||||
- not upgrading a package when a dependent package relies on a specific version with epoch (e.g: alsa-plugins 1:1.2.6-1 would not be upgraded to 1:1.2.6-2 because lib32-alsa-plugins relies on 1:1.2.6)
|
- not upgrading a package when a dependent package relies on a specific version with epoch (e.g: alsa-plugins 1:1.2.6-1 would not be upgraded to 1:1.2.6-2 because lib32-alsa-plugins relies on 1:1.2.6)
|
||||||
|
- not informing all the provided packages on the transaction context to the dependency sorting algorithm (could lead to a wrong installation order)
|
||||||
|
|
||||||
### UI
|
### UI
|
||||||
- new logo by [DN-debug](https://github.com/DN-debug)
|
- new logo by [DN-debug](https://github.com/DN-debug)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Dict, Set, Tuple, List, Collection
|
from typing import Dict, Set, Tuple, List, Collection, Optional
|
||||||
|
|
||||||
|
|
||||||
def __add_dep_to_sort(pkgname: str, pkgs_data: Dict[str, dict], sorted_names: dict, not_sorted: Set[str],
|
def __add_dep_to_sort(pkgname: str, pkgs_data: Dict[str, dict], sorted_names: dict, not_sorted: Set[str],
|
||||||
@@ -35,16 +35,18 @@ def __add_dep_to_sort(pkgname: str, pkgs_data: Dict[str, dict], sorted_names: di
|
|||||||
return idx
|
return idx
|
||||||
|
|
||||||
|
|
||||||
def sort(pkgs: Collection[str], pkgs_data: Dict[str, dict], provided_map: Dict[str, Set[str]] = None) -> List[Tuple[str, str]]:
|
def sort(pkgs: Collection[str], pkgs_data: Dict[str, dict], provided_map: Optional[Dict[str, Set[str]]] = None) -> List[Tuple[str, str]]:
|
||||||
sorted_list, sorted_names, not_sorted = [], set(), set()
|
sorted_list, sorted_names, not_sorted = [], set(), set()
|
||||||
provided = provided_map if provided_map else {}
|
all_provided = {**provided_map} if provided_map else {}
|
||||||
|
|
||||||
# add all packages with no dependencies first
|
# adding all packages with no dependencies first
|
||||||
for pkgname in pkgs:
|
for pkgname in pkgs:
|
||||||
data = pkgs_data[pkgname]
|
data = pkgs_data[pkgname]
|
||||||
if not provided_map and data['p']: # mapping provided if reeded
|
|
||||||
|
if data['p']: # adding providers not mapped to the sorting context
|
||||||
for p in data['p']:
|
for p in data['p']:
|
||||||
provided[p] = {pkgname}
|
if p not in all_provided:
|
||||||
|
all_provided[p] = {pkgname}
|
||||||
|
|
||||||
if not data['d']:
|
if not data['d']:
|
||||||
sorted_list.append(pkgname)
|
sorted_list.append(pkgname)
|
||||||
@@ -57,7 +59,7 @@ def sort(pkgs: Collection[str], pkgs_data: Dict[str, dict], provided_map: Dict[s
|
|||||||
pkgsdeps = set()
|
pkgsdeps = set()
|
||||||
data = pkgs_data[pkg]
|
data = pkgs_data[pkg]
|
||||||
for dep in data['d']:
|
for dep in data['d']:
|
||||||
providers = provided.get(dep)
|
providers = all_provided.get(dep)
|
||||||
|
|
||||||
if providers:
|
if providers:
|
||||||
for p in providers:
|
for p in providers:
|
||||||
|
|||||||
Reference in New Issue
Block a user