[fix][arch] displaying the wrong subtypes due to previous renaming

This commit is contained in:
Vinícius Moreira
2020-04-13 16:51:53 -03:00
parent 1fdf3d6952
commit 8d55ae28b0
12 changed files with 64 additions and 68 deletions

View File

@@ -198,13 +198,13 @@ class AURClient:
if info.get('provides'): if info.get('provides'):
provided.update(info.get('provides')) provided.update(info.get('provides'))
return {'c': info.get('conflicts'), 's': None, 'p': provided, 'r': 'arch', return {'c': info.get('conflicts'), 's': None, 'p': provided, 'r': 'aur',
'v': info['pkgver'], 'd': self.extract_required_dependencies(info)} 'v': info['pkgver'], 'd': self.extract_required_dependencies(info)}
else: else:
if latest_version: if latest_version:
provided.add('{}={}'.format(pkgname, latest_version)) provided.add('{}={}'.format(pkgname, latest_version))
return {'c': None, 's': None, 'p': provided, 'r': 'arch', 'v': latest_version, 'd': set()} return {'c': None, 's': None, 'p': provided, 'r': 'aur', 'v': latest_version, 'd': set()}
def fill_update_data(self, output: Dict[str, dict], pkgname: str, latest_version: str, srcinfo: dict = None): def fill_update_data(self, output: Dict[str, dict], pkgname: str, latest_version: str, srcinfo: dict = None):
data = self.map_update_data(pkgname=pkgname, latest_version=latest_version, srcinfo=srcinfo) data = self.map_update_data(pkgname=pkgname, latest_version=latest_version, srcinfo=srcinfo)

View File

@@ -6,7 +6,7 @@ def read_config(update_file: bool = False) -> dict:
template = {'optimize': True, template = {'optimize': True,
"sync_databases": True, "sync_databases": True,
"clean_cached": True, "clean_cached": True,
'arch': True, 'aur': True,
'repositories': True, 'repositories': True,
"refresh_mirrors_startup": False, "refresh_mirrors_startup": False,
"sync_databases_startup": True, "sync_databases_startup": True,

View File

@@ -11,13 +11,13 @@ from bauh.view.util.translation import I18n
def _get_repo_icon(repository: str): def _get_repo_icon(repository: str):
return resource.get_path('img/{}.svg'.format('arch' if repository == 'arch' else 'repo'), ROOT_DIR) return resource.get_path('img/{}.svg'.format('arch' if repository == 'aur' else 'repo'), ROOT_DIR)
def request_optional_deps(pkgname: str, pkg_repos: dict, watcher: ProcessWatcher, i18n: I18n) -> Set[str]: def request_optional_deps(pkgname: str, pkg_repos: dict, watcher: ProcessWatcher, i18n: I18n) -> Set[str]:
opts = [] opts = []
repo_deps = [p for p, data in pkg_repos.items() if data['repository'] != 'arch'] repo_deps = [p for p, data in pkg_repos.items() if data['repository'] != 'aur']
sizes = pacman.get_update_size(repo_deps) if repo_deps else None sizes = pacman.get_update_size(repo_deps) if repo_deps else None
for p, d in pkg_repos.items(): for p, d in pkg_repos.items():
@@ -49,7 +49,7 @@ def request_install_missing_deps(pkgname: str, deps: List[Tuple[str, str]], watc
opts = [] opts = []
repo_deps = [d[0] for d in deps if d[1] != 'arch'] repo_deps = [d[0] for d in deps if d[1] != 'aur']
sizes = pacman.get_update_size(repo_deps) if repo_deps else None sizes = pacman.get_update_size(repo_deps) if repo_deps else None
for dep in deps: for dep in deps:
@@ -83,10 +83,10 @@ def request_providers(providers_map: Dict[str, Set[str]], repo_map: Dict[str, st
providers_list.sort() providers_list.sort()
for p in providers_list: for p in providers_list:
repo = repo_map.get(p, 'arch') repo = repo_map.get(p, 'aur')
opts.append(InputOption(label=p, opts.append(InputOption(label=p,
value=p, value=p,
icon_path=aur_icon_path if repo == 'arch' else repo_icon_path, icon_path=aur_icon_path if repo == 'aur' else repo_icon_path,
tooltip='{}: {}'.format(i18n['repository'].capitalize(), repo))) tooltip='{}: {}'.format(i18n['repository'].capitalize(), repo)))
form.components.append(SingleSelectComponent(label=bold(dep.lower()), form.components.append(SingleSelectComponent(label=bold(dep.lower()),

View File

@@ -119,7 +119,7 @@ class TransactionContext:
def get_aur_idx(self, aur_client: AURClient) -> Set[str]: def get_aur_idx(self, aur_client: AURClient) -> Set[str]:
if self.aur_idx is None: if self.aur_idx is None:
if bool(self.config['arch']): if self.config['aur']:
self.aur_idx = aur_client.read_index() self.aur_idx = aur_client.read_index()
else: else:
self.aur_idx = set() self.aur_idx = set()
@@ -362,24 +362,24 @@ class ArchManager(SoftwareManager):
arch_config = read_config() arch_config = read_config()
if not any([arch_config['repositories'], arch_config['arch']]): if not any([arch_config['repositories'], arch_config['aur']]):
return SearchResult([], [], 0) return SearchResult([], [], 0)
installed = {} installed = {}
read_installed = Thread(target=lambda: installed.update(pacman.map_installed(repositories=bool(arch_config['repositories']), read_installed = Thread(target=lambda: installed.update(pacman.map_installed(repositories=arch_config['repositories'],
aur=bool(arch_config['arch']))), daemon=True) aur=arch_config['aur'])), daemon=True)
read_installed.start() read_installed.start()
res = SearchResult([], [], 0) res = SearchResult([], [], 0)
if not any((arch_config['arch'], arch_config['repositories'])): if not any((arch_config['aur'], arch_config['repositories'])):
return res return res
mapped_words = self.get_semantic_search_map().get(words) mapped_words = self.get_semantic_search_map().get(words)
final_words = mapped_words or words final_words = mapped_words or words
aur_search = None aur_search = None
if arch_config['arch']: if arch_config['aur']:
aur_search = Thread(target=self._search_in_aur_and_fill, args=(final_words, disk_loader, read_installed, installed, res), daemon=True) aur_search = Thread(target=self._search_in_aur_and_fill, args=(final_words, disk_loader, read_installed, installed, res), daemon=True)
aur_search.start() aur_search.start()
@@ -418,7 +418,7 @@ class ArchManager(SoftwareManager):
for name, data in not_signed.items(): for name, data in not_signed.items():
pkg = ArchPackage(name=name, version=data.get('version'), pkg = ArchPackage(name=name, version=data.get('version'),
latest_version=data.get('version'), description=data.get('description'), latest_version=data.get('version'), description=data.get('description'),
installed=True, repository='arch', i18n=self.i18n) installed=True, repository='aur', i18n=self.i18n)
pkg.categories = self.categories.get(pkg.name) pkg.categories = self.categories.get(pkg.name)
pkg.downgrade_enabled = downgrade_enabled pkg.downgrade_enabled = downgrade_enabled
@@ -473,7 +473,7 @@ class ArchManager(SoftwareManager):
def read_installed(self, disk_loader: DiskCacheLoader, limit: int = -1, only_apps: bool = False, pkg_types: Set[Type[SoftwarePackage]] = None, internet_available: bool = None) -> SearchResult: def read_installed(self, disk_loader: DiskCacheLoader, limit: int = -1, only_apps: bool = False, pkg_types: Set[Type[SoftwarePackage]] = None, internet_available: bool = None) -> SearchResult:
self.aur_client.clean_caches() self.aur_client.clean_caches()
arch_config = read_config() arch_config = read_config()
installed = pacman.map_installed(repositories=arch_config['repositories'], aur=arch_config['arch']) installed = pacman.map_installed(repositories=arch_config['repositories'], aur=arch_config['aur'])
pkgs = [] pkgs = []
if installed and (installed['not_signed'] or installed['signed']): if installed and (installed['not_signed'] or installed['signed']):
@@ -636,7 +636,7 @@ class ArchManager(SoftwareManager):
watcher.change_progress(5) watcher.change_progress(5)
if pkg.repository == 'arch': if pkg.repository == 'aur':
return self._downgrade_aur_pkg(context) return self._downgrade_aur_pkg(context)
else: else:
return self._downgrade_repo_pkg(context) return self._downgrade_repo_pkg(context)
@@ -646,7 +646,7 @@ class ArchManager(SoftwareManager):
shutil.rmtree(pkg.get_disk_cache_path()) shutil.rmtree(pkg.get_disk_cache_path())
def _check_action_allowed(self, pkg: ArchPackage, watcher: ProcessWatcher) -> bool: def _check_action_allowed(self, pkg: ArchPackage, watcher: ProcessWatcher) -> bool:
if user.is_root() and pkg.repository == 'arch': if user.is_root() and pkg.repository == 'aur':
watcher.show_message(title=self.i18n['arch.install.arch.root_error.title'], watcher.show_message(title=self.i18n['arch.install.arch.root_error.title'],
body=self.i18n['arch.install.arch.root_error.body'], body=self.i18n['arch.install.arch.root_error.body'],
type_=MessageType.ERROR) type_=MessageType.ERROR)
@@ -695,7 +695,7 @@ class ArchManager(SoftwareManager):
aur_pkgs, repo_pkgs = [], [] aur_pkgs, repo_pkgs = [], []
for req in (*requirements.to_install, *requirements.to_upgrade): for req in (*requirements.to_install, *requirements.to_upgrade):
if req.pkg.repository == 'arch': if req.pkg.repository == 'aur':
aur_pkgs.append(req.pkg) aur_pkgs.append(req.pkg)
else: else:
repo_pkgs.append(req.pkg) repo_pkgs.append(req.pkg)
@@ -913,7 +913,7 @@ class ArchManager(SoftwareManager):
return info return info
def get_info(self, pkg: ArchPackage) -> dict: def get_info(self, pkg: ArchPackage) -> dict:
if pkg.repository == 'arch': if pkg.repository == 'aur':
return self._get_info_aur_pkg(pkg) return self._get_info_aur_pkg(pkg)
else: else:
return self._get_info_repo_pkg(pkg) return self._get_info_repo_pkg(pkg)
@@ -1039,7 +1039,7 @@ class ArchManager(SoftwareManager):
raise raise
def get_history(self, pkg: ArchPackage) -> PackageHistory: def get_history(self, pkg: ArchPackage) -> PackageHistory:
if pkg.repository == 'arch': if pkg.repository == 'aur':
return self._get_history_aur_pkg(pkg) return self._get_history_aur_pkg(pkg)
else: else:
return self._get_history_repo_pkg(pkg) return self._get_history_repo_pkg(pkg)
@@ -1080,7 +1080,7 @@ class ArchManager(SoftwareManager):
for dep in deps: for dep in deps:
context.watcher.change_substatus(self.i18n['arch.install.dependency.install'].format(bold('{} ({})'.format(dep[0], dep[1])))) context.watcher.change_substatus(self.i18n['arch.install.dependency.install'].format(bold('{} ({})'.format(dep[0], dep[1]))))
if dep[1] == 'arch': if dep[1] == 'aur':
dep_context = context.gen_dep_context(dep[0], dep[1]) dep_context = context.gen_dep_context(dep[0], dep[1])
dep_src = self.aur_client.get_src_info(dep[0]) dep_src = self.aur_client.get_src_info(dep[0])
dep_context.base = dep_src['pkgbase'] dep_context.base = dep_src['pkgbase']
@@ -1135,7 +1135,7 @@ class ArchManager(SoftwareManager):
norepos = {p for p in pkgnames if p not in pkg_repos} norepos = {p for p in pkgnames if p not in pkg_repos}
for pkginfo in self.aur_client.get_info(norepos): for pkginfo in self.aur_client.get_info(norepos):
if pkginfo.get('Name') in norepos: if pkginfo.get('Name') in norepos:
pkg_repos[pkginfo['Name']] = 'arch' pkg_repos[pkginfo['Name']] = 'aur'
return pkg_repos return pkg_repos
@@ -1253,7 +1253,7 @@ class ArchManager(SoftwareManager):
context.watcher.change_substatus(self.i18n['arch.checking.deps'].format(bold(context.name))) context.watcher.change_substatus(self.i18n['arch.checking.deps'].format(bold(context.name)))
ti = time.time() ti = time.time()
if context.repository == 'arch': if context.repository == 'aur':
with open('{}/.SRCINFO'.format(context.project_dir)) as f: with open('{}/.SRCINFO'.format(context.project_dir)) as f:
srcinfo = aur.map_srcinfo(f.read()) srcinfo = aur.map_srcinfo(f.read())
@@ -1347,7 +1347,7 @@ class ArchManager(SoftwareManager):
opt_repo_deps, aur_threads = [], [] opt_repo_deps, aur_threads = [], []
for dep in deps_to_install: for dep in deps_to_install:
if repo_mapping[dep] == 'arch': if repo_mapping[dep] == 'aur':
t = Thread(target=self.aur_client.fill_update_data, args=(deps_data, dep, None, None), daemon=True) t = Thread(target=self.aur_client.fill_update_data, args=(deps_data, dep, None, None), daemon=True)
t.start() t.start()
aur_threads.append(t) aur_threads.append(t)
@@ -1599,7 +1599,7 @@ class ArchManager(SoftwareManager):
self._sync_databases(arch_config=install_context.config, root_password=root_password, handler=handler) self._sync_databases(arch_config=install_context.config, root_password=root_password, handler=handler)
if pkg.repository == 'arch': if pkg.repository == 'aur':
res = self._install_from_aur(install_context) res = self._install_from_aur(install_context)
else: else:
res = self._install_from_repository(install_context) res = self._install_from_repository(install_context)
@@ -1624,7 +1624,7 @@ class ArchManager(SoftwareManager):
return False # called off by the user return False # called off by the user
if missing_deps: if missing_deps:
if any((dep for dep in missing_deps if dep[1] == 'arch')): if any((dep for dep in missing_deps if dep[1] == 'aur')):
context.watcher.show_message(title=self.i18n['error'].capitalize(), context.watcher.show_message(title=self.i18n['error'].capitalize(),
body=self.i18n['arch.install.repo_pkg.error.aur_deps'], body=self.i18n['arch.install.repo_pkg.error.aur_deps'],
type_=MessageType.ERROR) type_=MessageType.ERROR)
@@ -1693,10 +1693,10 @@ class ArchManager(SoftwareManager):
def prepare(self, task_manager: TaskManager, root_password: str, internet_available: bool): def prepare(self, task_manager: TaskManager, root_password: str, internet_available: bool):
arch_config = read_config(update_file=True) arch_config = read_config(update_file=True)
if arch_config['arch'] or arch_config['repositories']: if arch_config['aur'] or arch_config['repositories']:
ArchDiskCacheUpdater(task_manager, arch_config, self.i18n, self.context.logger).start() ArchDiskCacheUpdater(task_manager, arch_config, self.i18n, self.context.logger).start()
if arch_config['arch']: if arch_config['aur']:
ArchCompilationOptimizer(arch_config, self.i18n, self.context.logger, task_manager).start() ArchCompilationOptimizer(arch_config, self.i18n, self.context.logger, task_manager).start()
CategoriesDownloader(id_='Arch', http_client=self.context.http_client, logger=self.context.logger, CategoriesDownloader(id_='Arch', http_client=self.context.http_client, logger=self.context.logger,
@@ -1705,7 +1705,7 @@ class ArchManager(SoftwareManager):
before=lambda: self._start_category_task(task_manager), before=lambda: self._start_category_task(task_manager),
after=lambda: self._finish_category_task(task_manager)).start() after=lambda: self._finish_category_task(task_manager)).start()
if arch_config['arch'] and internet_available: if arch_config['aur'] and internet_available:
self.index_aur = AURIndexUpdater(self.context) self.index_aur = AURIndexUpdater(self.context)
self.index_aur.start() self.index_aur.start()
@@ -1813,10 +1813,10 @@ class ArchManager(SoftwareManager):
tooltip_key='arch.config.repos.tip', tooltip_key='arch.config.repos.tip',
value=bool(local_config['repositories']), value=bool(local_config['repositories']),
max_width=max_width), max_width=max_width),
self._gen_bool_selector(id_='arch', self._gen_bool_selector(id_='aur',
label_key='arch.config.arch', label_key='arch.config.arch',
tooltip_key='arch.config.arch.tip', tooltip_key='arch.config.arch.tip',
value=bool(local_config['arch']), value=local_config['aur'],
max_width=max_width, max_width=max_width,
capitalize_label=False), capitalize_label=False),
self._gen_bool_selector(id_='opts', self._gen_bool_selector(id_='opts',
@@ -1855,7 +1855,7 @@ class ArchManager(SoftwareManager):
form_install = component.components[0] form_install = component.components[0]
config['repositories'] = form_install.get_component('repos').get_selected() config['repositories'] = form_install.get_component('repos').get_selected()
config['arch'] = form_install.get_component('arch').get_selected() config['aur'] = form_install.get_component('aur').get_selected()
config['optimize'] = form_install.get_component('opts').get_selected() config['optimize'] = form_install.get_component('opts').get_selected()
config['sync_databases'] = form_install.get_component('sync_dbs').get_selected() config['sync_databases'] = form_install.get_component('sync_dbs').get_selected()
config['sync_databases_startup'] = form_install.get_component('sync_dbs_start').get_selected() config['sync_databases_startup'] = form_install.get_component('sync_dbs_start').get_selected()
@@ -1899,7 +1899,7 @@ class ArchManager(SoftwareManager):
installed, new, all_names, installed_names = [], [], [], [] installed, new, all_names, installed_names = [], [], [], []
for p in pkgs: for p in pkgs:
if p.repository != 'arch': if p.repository != 'aur':
all_names.append(p.name) all_names.append(p.name)
if p.installed: if p.installed:
installed.append(p) installed.append(p)

View File

@@ -13,7 +13,7 @@ SYNC_FILE = '{}/arch/db_sync'.format(CACHE_PATH)
def should_sync(arch_config: dict, handler: ProcessHandler, logger: logging.Logger): def should_sync(arch_config: dict, handler: ProcessHandler, logger: logging.Logger):
if arch_config['arch'] or arch_config['repositories']: if arch_config['aur'] or arch_config['repositories']:
if os.path.exists(SYNC_FILE): if os.path.exists(SYNC_FILE):
with open(SYNC_FILE) as f: with open(SYNC_FILE) as f:
sync_file = f.read() sync_file = f.read()

View File

@@ -34,7 +34,7 @@ class DependenciesAnalyser:
aur_info = self.aur_client.get_src_info(name) aur_info = self.aur_client.get_src_info(name)
if aur_info: if aur_info:
output.append((name, 'arch')) output.append((name, 'aur'))
return return
output.append((name, '')) output.append((name, ''))
@@ -79,9 +79,7 @@ class DependenciesAnalyser:
missing_sub = [] missing_sub = []
for rdep in missing_root: for rdep in missing_root:
subdeps = self.aur_client.get_required_dependencies(rdep[0]) if rdep[ subdeps = self.aur_client.get_required_dependencies(rdep[0]) if rdep[1] == 'aur' else pacman.read_dependencies(rdep[0])
1] == 'arch' else pacman.read_dependencies(
rdep[0])
subdeps_not_analysis = {sd for sd in subdeps if sd not in global_in_analysis} subdeps_not_analysis = {sd for sd in subdeps if sd not in global_in_analysis}
if subdeps_not_analysis: if subdeps_not_analysis:
@@ -103,8 +101,7 @@ class DependenciesAnalyser:
in_analyses = {*names} in_analyses = {*names}
for name in names: for name in names:
subdeps = self.aur_client.get_required_dependencies( subdeps = self.aur_client.get_required_dependencies(name) if repository == 'aur' else pacman.read_dependencies(name)
name) if repository == 'arch' else pacman.read_dependencies(name)
if subdeps: if subdeps:
missing_subdeps = self.get_missing_packages(subdeps, in_analysis=in_analyses) missing_subdeps = self.get_missing_packages(subdeps, in_analysis=in_analyses)
@@ -123,9 +120,8 @@ class DependenciesAnalyser:
already_added = {name} already_added = {name}
in_analyses = {name} in_analyses = {name}
if repository == 'arch': if repository == 'aur':
subdeps = self.aur_client.get_required_dependencies( subdeps = self.aur_client.get_required_dependencies(name) if not srcinfo else self.aur_client.extract_required_dependencies(srcinfo)
name) if not srcinfo else self.aur_client.extract_required_dependencies(srcinfo)
else: else:
subdeps = pacman.read_dependencies(name) subdeps = pacman.read_dependencies(name)
@@ -148,13 +144,13 @@ class DependenciesAnalyser:
repo_deps, aur_deps = set(), set() repo_deps, aur_deps = set(), set()
for dep, repo in known_deps.items(): for dep, repo in known_deps.items():
if repo == 'arch': if repo == 'aur':
aur_deps.add(dep) aur_deps.add(dep)
else: else:
repo_deps.add(dep) repo_deps.add(dep)
if check_subdeps: if check_subdeps:
for deps in ((repo_deps, 'repo'), (aur_deps, 'arch')): for deps in ((repo_deps, 'repo'), (aur_deps, 'aur')):
if deps[0]: if deps[0]:
missing_subdeps = self.get_missing_subdeps_of(deps[0], deps[1]) missing_subdeps = self.get_missing_subdeps_of(deps[0], deps[1])
@@ -169,13 +165,13 @@ class DependenciesAnalyser:
sorted_deps.append(dep) sorted_deps.append(dep)
for dep, repo in known_deps.items(): for dep, repo in known_deps.items():
if repo != 'arch': if repo != 'aur':
data = (dep, repo) data = (dep, repo)
if data not in sorted_deps: if data not in sorted_deps:
sorted_deps.append(data) sorted_deps.append(data)
for dep in aur_deps: for dep in aur_deps:
sorted_deps.append((dep, 'arch')) sorted_deps.append((dep, 'aur'))
return sorted_deps return sorted_deps
@@ -236,7 +232,7 @@ class DependenciesAnalyser:
elif aur_index and dep_name in aur_index: elif aur_index and dep_name in aur_index:
aur_deps.add(dep_name) aur_deps.add(dep_name)
missing_deps.add((dep_name, 'arch')) missing_deps.add((dep_name, 'aur'))
else: else:
if watcher: if watcher:
message.show_dep_not_found(dep_name, self.i18n, watcher) message.show_dep_not_found(dep_name, self.i18n, watcher)
@@ -420,7 +416,7 @@ class DependenciesAnalyser:
for idx, to_remove in enumerate(to_remove): for idx, to_remove in enumerate(to_remove):
del missing_deps[to_remove - idx] del missing_deps[to_remove - idx]
missing_deps.extend(((p, providers_repos.get(p, 'arch')) for p in selected_providers)) missing_deps.extend(((p, providers_repos.get(p, 'aur')) for p in selected_providers))
for dep in providers_deps: for dep in providers_deps:
if dep not in missing_deps and dep[1] != '__several__': if dep not in missing_deps and dep[1] != '__several__':

View File

@@ -117,7 +117,7 @@ class ArchDataMapper:
def map_api_data(self, apidata: dict, installed: dict, categories: dict) -> ArchPackage: def map_api_data(self, apidata: dict, installed: dict, categories: dict) -> ArchPackage:
data = installed.get(apidata.get('Name')) data = installed.get(apidata.get('Name'))
app = ArchPackage(name=apidata.get('Name'), installed=bool(data), repository='arch', i18n=self.i18n) app = ArchPackage(name=apidata.get('Name'), installed=bool(data), repository='aur', i18n=self.i18n)
app.status = PackageStatus.LOADING_DATA app.status = PackageStatus.LOADING_DATA
if categories: if categories:

View File

@@ -22,7 +22,7 @@ class ArchPackage(SoftwarePackage):
self.package_base = package_base self.package_base = package_base
self.votes = votes self.votes = votes
self.popularity = popularity self.popularity = popularity
self.maintainer = maintainer if maintainer else (repository if repository != 'arch' else None) self.maintainer = maintainer if maintainer else (repository if repository != 'aur' else None)
self.url_download = url_download self.url_download = url_download
self.first_submitted = first_submitted self.first_submitted = first_submitted
self.last_modified = last_modified self.last_modified = last_modified
@@ -45,23 +45,23 @@ class ArchPackage(SoftwarePackage):
return 'https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=' + self.package_base return 'https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=' + self.package_base
def has_history(self): def has_history(self):
return self.installed and self.repository == 'arch' return self.installed and self.repository == 'aur'
def has_info(self): def has_info(self):
return True return True
def can_be_installed(self) -> bool: def can_be_installed(self) -> bool:
if super(ArchPackage, self).can_be_installed(): if super(ArchPackage, self).can_be_installed():
return bool(self.url_download) if self.repository == 'arch' else True return bool(self.url_download) if self.repository == 'aur' else True
def can_be_downgraded(self): def can_be_downgraded(self):
return self.installed and self.downgrade_enabled and self.repository == 'arch' return self.installed and self.downgrade_enabled and self.repository == 'aur'
def get_type(self): def get_type(self):
return 'arch' if self.repository == 'arch' else 'arch_repo' return 'aur' if self.repository == 'aur' else 'arch_repo'
def get_update_type(self): def get_update_type(self):
return 'Arch - {}'.format('AUR' if self.repository == 'arch' else 'Repository') return 'Arch - {}'.format('AUR' if self.repository == 'aur' else 'Repository')
def get_default_icon_path(self) -> str: def get_default_icon_path(self) -> str:
return self.get_type_icon_path() return self.get_type_icon_path()
@@ -70,7 +70,7 @@ class ArchPackage(SoftwarePackage):
return self.icon_path return self.icon_path
def get_type_icon_path(self): def get_type_icon_path(self):
return resource.get_path('img/{}.svg'.format('arch' if self.get_type() == 'arch' else 'repo'), ROOT_DIR) return resource.get_path('img/{}.svg'.format('arch' if self.get_type() == 'aur' else 'repo'), ROOT_DIR)
def is_application(self): def is_application(self):
return self.can_be_run() return self.can_be_run()

View File

@@ -119,11 +119,11 @@ def sort(pkgs: Iterable[str], pkgs_data: Dict[str, dict], provided_map: Dict[str
for name in sorted_list: for name in sorted_list:
repo = pkgs_data[name]['r'] repo = pkgs_data[name]['r']
if repo == 'arch': if repo == 'aur':
if not aur_pkgs: if not aur_pkgs:
aur_pkgs = [] aur_pkgs = []
aur_pkgs.append((name, 'arch')) aur_pkgs.append((name, 'aur'))
else: else:
res.append((name, repo)) res.append((name, repo))

View File

@@ -222,7 +222,7 @@ class UpdatesSummarizer:
def _map_and_add_package(self, pkg_data: Tuple[str, str], idx: int, output: dict): def _map_and_add_package(self, pkg_data: Tuple[str, str], idx: int, output: dict):
version = None version = None
if pkg_data[1] == 'arch': if pkg_data[1] == 'aur':
try: try:
info = self.aur_client.get_src_info(pkg_data[0]) info = self.aur_client.get_src_info(pkg_data[0])
@@ -274,7 +274,7 @@ class UpdatesSummarizer:
sorted_pkgs[idx] = pkg sorted_pkgs[idx] = pkg
context.to_install[dep[0]] = pkg context.to_install[dep[0]] = pkg
if pkg.repository == 'arch': if pkg.repository == 'aur':
context.aur_to_install[pkg.name] = pkg context.aur_to_install[pkg.name] = pkg
aur_to_install_data[pkg.name] = data aur_to_install_data[pkg.name] = data
else: else:
@@ -324,7 +324,7 @@ class UpdatesSummarizer:
self.logger.info("Filling provided names took {0:.2f} seconds".format(tf - ti)) self.logger.info("Filling provided names took {0:.2f} seconds".format(tf - ti))
def __fill_aur_index(self, context: UpdateRequirementsContext): def __fill_aur_index(self, context: UpdateRequirementsContext):
if context.arch_config['arch']: if context.arch_config['aur']:
self.logger.info("Loading AUR index") self.logger.info("Loading AUR index")
names = self.aur_client.read_index() names = self.aur_client.read_index()
@@ -335,7 +335,7 @@ class UpdatesSummarizer:
def _map_requirement(self, pkg: ArchPackage, context: UpdateRequirementsContext, installed_sizes: Dict[str, int] = None) -> UpgradeRequirement: def _map_requirement(self, pkg: ArchPackage, context: UpdateRequirementsContext, installed_sizes: Dict[str, int] = None) -> UpgradeRequirement:
requirement = UpgradeRequirement(pkg) requirement = UpgradeRequirement(pkg)
if pkg.repository != 'arch': if pkg.repository != 'aur':
data = context.pkgs_data[pkg.name] data = context.pkgs_data[pkg.name]
requirement.required_size = data['ds'] requirement.required_size = data['ds']
requirement.extra_size = data['s'] requirement.extra_size = data['s']
@@ -363,7 +363,7 @@ class UpdatesSummarizer:
aur_srcinfo_threads = [] aur_srcinfo_threads = []
for p in pkgs: for p in pkgs:
context.to_update[p.name] = p context.to_update[p.name] = p
if p.repository == 'arch': if p.repository == 'aur':
context.aur_to_update[p.name] = p context.aur_to_update[p.name] = p
t = Thread(target=self._fill_aur_pkg_update_data, args=(p, aur_data), daemon=True) t = Thread(target=self._fill_aur_pkg_update_data, args=(p, aur_data), daemon=True)
t.start() t.start()

View File

@@ -73,7 +73,7 @@ class ArchDiskCacheUpdater(Thread):
self.to_index = 0 self.to_index = 0
self.progress = 0 # progress is defined by the number of packages prepared and indexed self.progress = 0 # progress is defined by the number of packages prepared and indexed
self.repositories = arch_config['repositories'] self.repositories = arch_config['repositories']
self.aur = arch_config['arch'] self.aur = bool(arch_config['aur'])
def update_prepared(self, pkgname: str, add: bool = True): def update_prepared(self, pkgname: str, add: bool = True):
if add: if add:
@@ -109,7 +109,7 @@ class ArchDiskCacheUpdater(Thread):
repo_map = {} repo_map = {}
if installed['not_signed']: if installed['not_signed']:
repo_map.update({p: 'arch' for p in installed['not_signed']}) repo_map.update({p: 'aur' for p in installed['not_signed']})
if installed['signed']: if installed['signed']:
repo_map.update(pacman.map_repositories(installed['signed'])) repo_map.update(pacman.map_repositories(installed['signed']))

View File

@@ -10,7 +10,7 @@ class PackageViewStatus(Enum):
def get_type_label(type_: str, gem: str, i18n: I18n) -> str: def get_type_label(type_: str, gem: str, i18n: I18n) -> str:
type_label = 'gem.{}.type.{}.label'.format(gem, type_) type_label = 'gem.{}.type.{}.label'.format(gem, type_.lower())
return i18n.get(type_label, type_.capitalize()).strip() return i18n.get(type_label, type_.capitalize()).strip()