[api] refactoring: caching directory for root user is now /var/cache/bauh

This commit is contained in:
Vinicius Moreira
2021-11-24 10:34:04 -03:00
parent f78498c1ec
commit aa889dcd51
18 changed files with 49 additions and 42 deletions

View File

@@ -1,19 +1,19 @@
import os
from pathlib import Path
from bauh.api.paths import CACHE_PATH, CONFIG_PATH, TEMP_DIR
from bauh.api.paths import CONFIG_PATH, TEMP_DIR, CACHE_PATH
from bauh.commons import resource
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
BUILD_DIR = '{}/arch'.format(TEMP_DIR)
ARCH_CACHE_PATH = CACHE_PATH + '/arch'
CATEGORIES_FILE_PATH = ARCH_CACHE_PATH + '/categories.txt'
ARCH_CACHE_PATH = f'{CACHE_PATH}/arch'
CATEGORIES_FILE_PATH = f'{ARCH_CACHE_PATH}/categories.txt'
URL_CATEGORIES_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/arch/categories.txt'
URL_GPG_SERVERS = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/arch/gpgservers.txt'
CONFIG_DIR = '{}/.config/bauh/arch'.format(str(Path.home()))
CUSTOM_MAKEPKG_FILE = '{}/makepkg.conf'.format(CONFIG_DIR)
AUR_INDEX_FILE = '{}/aur/index.txt'.format(ARCH_CACHE_PATH)
AUR_INDEX_TS_FILE = '{}/aur/index.ts'.format(ARCH_CACHE_PATH)
AUR_INDEX_FILE = f'{ARCH_CACHE_PATH}/aur/index.txt'
AUR_INDEX_TS_FILE = f'{ARCH_CACHE_PATH}/aur/index.ts'
CONFIG_FILE = '{}/arch.yml'.format(CONFIG_PATH)
SUGGESTIONS_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/arch/aur_suggestions.txt'
UPDATES_IGNORED_FILE = '{}/updates_ignored.txt'.format(CONFIG_DIR)

View File

@@ -10,7 +10,7 @@ from typing import Optional
from bauh.api.paths import CACHE_PATH
from bauh.commons.system import ProcessHandler
SYNC_FILE = '{}/arch/db_sync'.format(CACHE_PATH)
SYNC_FILE = f'{CACHE_PATH}/arch/db_sync'
def should_sync(arch_config: dict, aur_supported: bool, handler: Optional[ProcessHandler], logger: logging.Logger):

View File

@@ -8,7 +8,7 @@ from pathlib import Path
from bauh.api.paths import CACHE_PATH
SYNC_FILE = '{}/arch/mirrors_sync'.format(CACHE_PATH)
SYNC_FILE = f'{CACHE_PATH}/arch/mirrors_sync'
def should_sync(logger: logging.Logger):

View File

@@ -85,7 +85,7 @@ class ArchPackage(SoftwarePackage):
@staticmethod
def disk_cache_path(pkgname: str):
return ARCH_CACHE_PATH + '/installed/' + pkgname
return f'{ARCH_CACHE_PATH}/installed/{pkgname}'
def get_pkg_build_url(self):
if self.package_base:

View File

@@ -156,8 +156,8 @@ class ArchDiskCacheUpdater(Thread):
self.progress = 0 # progress is defined by the number of packages prepared and indexed
self.controller = controller
self.internet_available = internet_available
self.installed_hash_path = '{}/installed.sha1'.format(ARCH_CACHE_PATH)
self.installed_cache_dir = '{}/installed'.format(ARCH_CACHE_PATH)
self.installed_hash_path = f'{ARCH_CACHE_PATH}/installed.sha1'
self.installed_cache_dir = f'{ARCH_CACHE_PATH}/installed'
self.aur_indexer = aur_indexer
self.create_config = create_config
self.taskman.register_task(self.task_id, self.i18n['arch.task.disk_cache'], get_icon_path())