diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7bcaf83f..2bd38056 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -34,8 +34,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- upgrade:
- upgrading firstly the keyring packages declared in **SyncFirst** (**/etc/pacman.conf**) to avoid pacman downloading issues
- only removing packages after downloading the required ones
- - "Multi-threaded download (repositories)" is not the default behavior anymore (current pacman download approach is faster). If your settings has this property set as 'Yes', just change it to 'No'.
- - AUR: caching the PKGBUILD file used for the package installation/upgrade/downgrade (**~/.cache/bauh/arch/installed/$pkgname/PKGBUILD**)
+ - "Multi-threaded download (repositories)" is not the default behavior anymore (current pacman download approach is faster). If your settings has this property set as 'Yes', just change it to 'No'.
+ - AUR:
+ - caching the PKGBUILD file used for the package installation/upgrade/downgrade (**~/.cache/bauh/arch/installed/$pkgname/PKGBUILD**)
+ - new settings property **aur_build_dir** -> it allows to define a custom build dir.
+
+
+
+ - preventing a possible error when the optional deps of a given package cannot be found
- Flatpak
- creating the exports path **~/.local/share/flatpak/exports/share** (if it does not exist) and adding it to install/upgrade/downgrade/remove commands path to prevent warning messages. [#128](https://github.com/vinifmor/bauh/issues/128)
diff --git a/README.md b/README.md
index 342ab957..09d02cb9 100644
--- a/README.md
+++ b/README.md
@@ -194,6 +194,7 @@ repositories: true # allows to manage packages from the configured repositories
repositories_mthread_download: false # enable multi-threaded download for repository packages if aria2/axel is installed
automatch_providers: true # if a possible provider for a given package dependency exactly matches its name, it will be chosen instead of asking for the user to decide (false).
edit_aur_pkgbuild: false # if the AUR PKGBUILD file should be displayed for edition before the make process. true (PKGBUILD will always be displayed for edition), false (PKGBUILD never will be displayed), null (a popup will ask if the user want to edit the PKGBUILD)
+aur_build_dir: null # defines a custom build directory for AUR packages (a null value will point to /tmp/bauh/arch (non-root user) or /tmp/bauh_root/arch (root user))
```
- Required dependencies:
- **pacman**
diff --git a/bauh/api/abstract/view.py b/bauh/api/abstract/view.py
index fe39b081..06ead95c 100644
--- a/bauh/api/abstract/view.py
+++ b/bauh/api/abstract/view.py
@@ -156,7 +156,8 @@ class TextInputType(Enum):
class TextInputComponent(ViewComponent):
def __init__(self, label: str, value: str = '', placeholder: str = None, tooltip: str = None, read_only: bool =False,
- id_: str = None, only_int: bool = False, max_width: int = -1, type_: TextInputType = TextInputType.SINGLE_LINE):
+ id_: str = None, only_int: bool = False, max_width: int = -1, type_: TextInputType = TextInputType.SINGLE_LINE,
+ capitalize_label: bool = True):
super(TextInputComponent, self).__init__(id_=id_)
self.label = label
self.value = value
@@ -166,6 +167,7 @@ class TextInputComponent(ViewComponent):
self.only_int = only_int
self.max_width = max_width
self.type = type_
+ self.capitalize_label = capitalize_label
def get_value(self) -> str:
if self.value is not None:
@@ -189,6 +191,12 @@ class TextInputComponent(ViewComponent):
if val:
return int(self.value)
+ def get_label(self) -> str:
+ if not self.label:
+ return ''
+ else:
+ return self.label.capitalize() if self.capitalize_label else self.label
+
class FormComponent(ViewComponent):
diff --git a/bauh/gems/arch/__init__.py b/bauh/gems/arch/__init__.py
index 8471a7d6..9751ae48 100644
--- a/bauh/gems/arch/__init__.py
+++ b/bauh/gems/arch/__init__.py
@@ -6,7 +6,6 @@ from bauh.commons import resource
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
BUILD_DIR = '{}/arch'.format(TEMP_DIR)
-PACKAGE_CACHE_DIR = '{}/pkg_cache'.format(BUILD_DIR)
ARCH_CACHE_PATH = CACHE_PATH + '/arch'
CATEGORIES_FILE_PATH = ARCH_CACHE_PATH + '/categories.txt'
URL_CATEGORIES_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/arch/categories.txt'
diff --git a/bauh/gems/arch/config.py b/bauh/gems/arch/config.py
index f2d6b5a1..0cae1f54 100644
--- a/bauh/gems/arch/config.py
+++ b/bauh/gems/arch/config.py
@@ -1,5 +1,7 @@
+from pathlib import Path
+
from bauh.commons.config import read_config as read
-from bauh.gems.arch import CONFIG_FILE
+from bauh.gems.arch import CONFIG_FILE, BUILD_DIR
def read_config(update_file: bool = False) -> dict:
@@ -13,5 +15,16 @@ def read_config(update_file: bool = False) -> dict:
'mirrors_sort_limit': 5,
'repositories_mthread_download': False,
'automatch_providers': True,
- 'edit_aur_pkgbuild': False}
+ 'edit_aur_pkgbuild': False,
+ 'aur_build_dir': None}
return read(CONFIG_FILE, template, update_file=update_file)
+
+
+def get_build_dir(arch_config: dict) -> str:
+ build_dir = arch_config.get('aur_build_dir')
+
+ if not build_dir:
+ build_dir = BUILD_DIR
+
+ Path(build_dir).mkdir(parents=True, exist_ok=True)
+ return build_dir
diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py
index 598f0858..db615b10 100644
--- a/bauh/gems/arch/controller.py
+++ b/bauh/gems/arch/controller.py
@@ -30,12 +30,12 @@ from bauh.commons.config import save_config
from bauh.commons.html import bold
from bauh.commons.system import SystemProcess, ProcessHandler, new_subprocess, run_cmd, SimpleProcess
from bauh.commons.view_utils import new_select
-from bauh.gems.arch import BUILD_DIR, aur, pacman, makepkg, message, confirmation, disk, git, \
+from bauh.gems.arch import aur, pacman, makepkg, message, confirmation, disk, git, \
gpg, URL_CATEGORIES_FILE, CATEGORIES_FILE_PATH, CUSTOM_MAKEPKG_FILE, SUGGESTIONS_FILE, \
CONFIG_FILE, get_icon_path, database, mirrors, sorting, cpu_manager, ARCH_CACHE_PATH, UPDATES_IGNORED_FILE, \
- CONFIG_DIR, EDITABLE_PKGBUILDS_FILE, URL_GPG_SERVERS
+ CONFIG_DIR, EDITABLE_PKGBUILDS_FILE, URL_GPG_SERVERS, BUILD_DIR
from bauh.gems.arch.aur import AURClient
-from bauh.gems.arch.config import read_config
+from bauh.gems.arch.config import read_config, get_build_dir
from bauh.gems.arch.dependencies import DependenciesAnalyser
from bauh.gems.arch.download import MultithreadedDownloadService, ArchDownloadException
from bauh.gems.arch.exceptions import PackageNotFoundException
@@ -571,7 +571,7 @@ class ArchManager(SoftwareManager):
return SearchResult(pkgs, None, len(pkgs))
def _downgrade_aur_pkg(self, context: TransactionContext):
- context.build_dir = '{}/build_{}'.format(BUILD_DIR, int(time.time()))
+ context.build_dir = '{}/build_{}'.format(get_build_dir(context.config), int(time.time()))
try:
if not os.path.exists(context.build_dir):
@@ -1318,7 +1318,8 @@ class ArchManager(SoftwareManager):
return self._get_info_repo_pkg(pkg)
def _get_history_aur_pkg(self, pkg: ArchPackage) -> PackageHistory:
- temp_dir = '{}/build_{}'.format(BUILD_DIR, int(time.time()))
+ arch_config = read_config()
+ temp_dir = '{}/build_{}'.format(get_build_dir(arch_config), int(time.time()))
try:
Path(temp_dir).mkdir(parents=True)
@@ -1814,7 +1815,7 @@ class ArchManager(SoftwareManager):
return True
def _install_optdeps(self, context: TransactionContext) -> bool:
- odeps = pacman.map_optional_deps({context.name}, remote=False, not_installed=True)[context.name]
+ odeps = pacman.map_optional_deps({context.name}, remote=False, not_installed=True).get(context.name)
if not odeps:
return True
@@ -2107,7 +2108,7 @@ class ArchManager(SoftwareManager):
def _install_from_aur(self, context: TransactionContext) -> bool:
self._optimize_makepkg(context.config, context.watcher)
- context.build_dir = '{}/build_{}'.format(BUILD_DIR, int(time.time()))
+ context.build_dir = '{}/build_{}'.format(get_build_dir(context.config), int(time.time()))
try:
if not os.path.exists(context.build_dir):
@@ -2484,7 +2485,14 @@ class ArchManager(SoftwareManager):
value=local_config['edit_aur_pkgbuild'],
max_width=max_width,
type_=SelectViewType.RADIO,
- capitalize_label=False)
+ capitalize_label=False),
+ TextInputComponent(id_='aur_build_dir',
+ label=self.i18n['arch.config.aur_build_dir'],
+ tooltip=self.i18n['arch.config.aur_build_dir.tip'].format(BUILD_DIR),
+ only_int=False,
+ max_width=max_width,
+ value=local_config.get('aur_build_dir', ''),
+ capitalize_label=False)
]
@@ -2505,6 +2513,10 @@ class ArchManager(SoftwareManager):
config['repositories_mthread_download'] = form_install.get_component('mthread_download').get_selected()
config['automatch_providers'] = form_install.get_component('autoprovs').get_selected()
config['edit_aur_pkgbuild'] = form_install.get_component('edit_aur_pkgbuild').get_selected()
+ config['aur_build_dir'] = form_install.get_component('aur_build_dir').get_value().strip()
+
+ if not config['aur_build_dir']:
+ config['aur_build_dir'] = None
try:
save_config(config, CONFIG_FILE)
diff --git a/bauh/gems/arch/pacman.py b/bauh/gems/arch/pacman.py
index 1c7b7aa0..f4474115 100644
--- a/bauh/gems/arch/pacman.py
+++ b/bauh/gems/arch/pacman.py
@@ -754,9 +754,8 @@ def remove_several(pkgnames: Iterable[str], root_password: str, skip_checks: boo
def map_optional_deps(names: Iterable[str], remote: bool, not_installed: bool = False) -> Dict[str, Dict[str, str]]:
output = run_cmd('pacman -{}i {}'.format('S' if remote else 'Q', ' '.join(names)))
-
+ res = {}
if output:
- res = {}
latest_name, deps = None, None
for l in output.split('\n'):
@@ -801,7 +800,7 @@ def map_optional_deps(names: Iterable[str], remote: bool, not_installed: bool =
sev_deps = {dep.strip(): '' for dep in l.split(' ') if dep and (not not_installed or '[installed]' not in dep)}
deps.update(sev_deps)
- return res
+ return res
def map_all_deps(names: Iterable[str], only_installed: bool = False) -> Dict[str, Set[str]]:
diff --git a/bauh/gems/arch/resources/locale/ca b/bauh/gems/arch/resources/locale/ca
index a8b0ae4d..6b46ef39 100644
--- a/bauh/gems/arch/resources/locale/ca
+++ b/bauh/gems/arch/resources/locale/ca
@@ -30,6 +30,8 @@ arch.config.aur=AUR packages
arch.config.aur.tip=It allows to manage AUR packages
arch.config.automatch_providers=Auto-define dependency providers
arch.config.automatch_providers.tip=It automatically chooses which provider will be used for a package dependency when both names are equal.
+arch.config.aur_build_dir=Build directory (AUR)
+arch.config.aur_build_dir.tip=It define a custom directory where the AUR packages will be built. Default: {}.
arch.config.clean_cache=Elimina les versions antigues
arch.config.clean_cache.tip=Si cal eliminar les versions antigues d'un paquet emmagatzemat al disc durant la desinstal·lació
arch.config.edit_aur_pkgbuild=Edit PKGBUILD (AUR)
diff --git a/bauh/gems/arch/resources/locale/de b/bauh/gems/arch/resources/locale/de
index add22c05..caacf7d8 100644
--- a/bauh/gems/arch/resources/locale/de
+++ b/bauh/gems/arch/resources/locale/de
@@ -30,6 +30,8 @@ arch.config.aur=AUR packages
arch.config.aur.tip=It allows to manage AUR packages
arch.config.automatch_providers=Auto-define dependency providers
arch.config.automatch_providers.tip=It automatically chooses which provider will be used for a package dependency when both names are equal.
+arch.config.aur_build_dir=Build directory (AUR)
+arch.config.aur_build_dir.tip=It define a custom directory where the AUR packages will be built. Default: {}.
arch.config.clean_cache=Remove old versions
arch.config.clean_cache.tip=Whether old versions of a package stored on disk should be removed during uninstall
arch.config.edit_aur_pkgbuild=Edit PKGBUILD (AUR)
diff --git a/bauh/gems/arch/resources/locale/en b/bauh/gems/arch/resources/locale/en
index 581655f1..f530e0c1 100644
--- a/bauh/gems/arch/resources/locale/en
+++ b/bauh/gems/arch/resources/locale/en
@@ -31,6 +31,8 @@ arch.config.aur=AUR packages
arch.config.aur.tip=It allows to manage AUR packages
arch.config.automatch_providers=Auto-define dependency providers
arch.config.automatch_providers.tip=It automatically chooses which provider will be used for a package dependency when both names are equal.
+arch.config.aur_build_dir=Build directory (AUR)
+arch.config.aur_build_dir.tip=It define a custom directory where the AUR packages will be built. Default: {}.
arch.config.clean_cache=Remove old versions
arch.config.clean_cache.tip=Whether old versions of a package stored on disk should be removed during uninstall
arch.config.edit_aur_pkgbuild=Edit PKGBUILD (AUR)
diff --git a/bauh/gems/arch/resources/locale/es b/bauh/gems/arch/resources/locale/es
index 01ffa1fe..a9f3f302 100644
--- a/bauh/gems/arch/resources/locale/es
+++ b/bauh/gems/arch/resources/locale/es
@@ -30,6 +30,8 @@ arch.config.aur=Paquetes de AUR
arch.config.aur.tip=Permite gestionar paquetes del AUR
arch.config.automatch_providers=Autodefinir proveedores de dependencia
arch.config.automatch_providers.tip=Elige automáticamente qué proveedor se usará para una dependencia de paquete cuando ambos nombres son iguales.
+arch.config.aur_build_dir=Directorio de compilación (AUR)
+arch.config.aur_build_dir.tip=Define un directorio personalizado donde se construirán los paquetes AUR. Defecto: {}.
arch.config.clean_cache=Eliminar versiones antiguas
arch.config.clean_cache.tip=Si las versiones antiguas de un paquete almacenado en el disco deben ser eliminadas durante la desinstalación
arch.config.edit_aur_pkgbuild=Editar PKGBUILD (AUR)
diff --git a/bauh/gems/arch/resources/locale/it b/bauh/gems/arch/resources/locale/it
index 50301ffb..a74eb7f2 100644
--- a/bauh/gems/arch/resources/locale/it
+++ b/bauh/gems/arch/resources/locale/it
@@ -30,6 +30,8 @@ arch.config.aur=AUR packages
arch.config.aur.tip=It allows to manage AUR packages
arch.config.automatch_providers=Auto-define dependency providers
arch.config.automatch_providers.tip=It automatically chooses which provider will be used for a package dependency when both names are equal.
+arch.config.aur_build_dir=Build directory (AUR)
+arch.config.aur_build_dir.tip=It define a custom directory where the AUR packages will be built. Default: {}.
arch.config.clean_cache=Rimuovi le vecchie versioni
arch.config.clean_cache.tip=Se le vecchie versioni di un pacchetto memorizzate sul disco devono essere rimosse durante la disinstallazione
arch.config.edit_aur_pkgbuild=Edit PKGBUILD (AUR)
diff --git a/bauh/gems/arch/resources/locale/pt b/bauh/gems/arch/resources/locale/pt
index 109e02ad..9b07819c 100644
--- a/bauh/gems/arch/resources/locale/pt
+++ b/bauh/gems/arch/resources/locale/pt
@@ -31,6 +31,8 @@ arch.config.aur=Pacotes do AUR
arch.config.aur.tip=Permite gerenciar pacotes dos AUR
arch.config.automatch_providers=Auto-definir provedores de dependências
arch.config.automatch_providers.tip=Escolhe automaticamente qual provedor será utilizado para determinada dependência de um pacote caso os nomes de ambos sejam iguais.
+arch.config.aur_build_dir=Diretório de construção (AUR)
+arch.config.aur_build_dir.tip=Define um diretório personalizado onde pacotes do AUR serão construídos. Padrão: {}.
arch.config.clean_cache=Remover versões antigas
arch.config.clean_cache.tip=Se versões antigas de um pacote armazenadas em disco devem ser removidas durante a desinstalação
arch.config.edit_aur_pkgbuild=Editar PKGBUILD (AUR)
diff --git a/bauh/gems/arch/resources/locale/ru b/bauh/gems/arch/resources/locale/ru
index cd80b584..2604e90a 100644
--- a/bauh/gems/arch/resources/locale/ru
+++ b/bauh/gems/arch/resources/locale/ru
@@ -30,6 +30,8 @@ arch.config.aur=пакеты AUR
arch.config.aur.tip=Это позволяет управлять пакетами AUR
arch.config.automatch_providers=Auto-define dependency providers
arch.config.automatch_providers.tip=It automatically chooses which provider will be used for a package dependency when both names are equal.
+arch.config.aur_build_dir=Build directory (AUR)
+arch.config.aur_build_dir.tip=It define a custom directory where the AUR packages will be built. Default: {}.
arch.config.clean_cache=Remove old versions
arch.config.clean_cache.tip=Whether old versions of a package stored on disk should be removed during uninstall
arch.config.edit_aur_pkgbuild=Edit PKGBUILD (AUR)
diff --git a/bauh/gems/arch/resources/locale/tr b/bauh/gems/arch/resources/locale/tr
index ce5ed856..9e50bd93 100644
--- a/bauh/gems/arch/resources/locale/tr
+++ b/bauh/gems/arch/resources/locale/tr
@@ -30,6 +30,8 @@ arch.config.aur=AUR paketleri
arch.config.aur.tip=AUR paketlerinin yönetilmesine izin verir
arch.config.automatch_providers=Auto-define dependency providers
arch.config.automatch_providers.tip=It automatically chooses which provider will be used for a package dependency when both names are equal.
+arch.config.aur_build_dir=Build directory (AUR)
+arch.config.aur_build_dir.tip=It define a custom directory where the AUR packages will be built. Default: {}.
arch.config.clean_cache=Önbelleği temizle
arch.config.clean_cache.tip=Disk üzerinde kurulu bir paketin eski sürümlerinin kaldırma sırasında kaldırılıp kaldırılmayacağı
arch.config.edit_aur_pkgbuild=Edit PKGBUILD (AUR)
diff --git a/bauh/gems/arch/worker.py b/bauh/gems/arch/worker.py
index ea8487ac..29261571 100644
--- a/bauh/gems/arch/worker.py
+++ b/bauh/gems/arch/worker.py
@@ -13,8 +13,8 @@ from bauh.api.abstract.context import ApplicationContext
from bauh.api.abstract.handler import TaskManager
from bauh.commons.html import bold
from bauh.commons.system import run_cmd, new_root_subprocess, ProcessHandler
-from bauh.gems.arch import pacman, disk, CUSTOM_MAKEPKG_FILE, CONFIG_DIR, BUILD_DIR, \
- AUR_INDEX_FILE, get_icon_path, database, mirrors, ARCH_CACHE_PATH
+from bauh.gems.arch import pacman, disk, CUSTOM_MAKEPKG_FILE, CONFIG_DIR, AUR_INDEX_FILE, get_icon_path, database, \
+ mirrors, ARCH_CACHE_PATH, BUILD_DIR
from bauh.gems.arch.aur import URL_INDEX
from bauh.view.util.translation import I18n
diff --git a/bauh/view/qt/components.py b/bauh/view/qt/components.py
index 006d4f95..616e754c 100644
--- a/bauh/view/qt/components.py
+++ b/bauh/view/qt/components.py
@@ -461,7 +461,8 @@ class TextInputQt(QGroupBox):
self.model = model
self.setLayout(QGridLayout())
self.setStyleSheet('QGridLayout {margin-left: 0} QLabel { font-weight: bold}')
- self.layout().addWidget(QLabel(model.label.capitalize() + ' :' if model.label else ''), 0, 0)
+
+ self.layout().addWidget(QLabel(model.get_label()), 0, 0)
if self.model.max_width > 0:
self.setMaximumWidth(self.model.max_width)
@@ -825,7 +826,7 @@ class FormQt(QGroupBox):
label.layout().addWidget(label_component)
if label:
- label_component.setText(c.label.capitalize())
+ label_component.setText(c.get_label())
if c.tooltip:
label.layout().addWidget(self.gen_tip_icon(c.tooltip))