From 7e5f21c26d35852eefb48b59b2620f6739e686cd Mon Sep 17 00:00:00 2001 From: Evgenii Alekseev Date: Fri, 5 Jan 2024 15:22:46 +0200 Subject: [PATCH] refactor: split Path elements to / and first directory --- src/ahriman/application/ahriman.py | 4 ++-- src/ahriman/application/handlers/setup.py | 6 +++--- src/ahriman/core/log/log_loader.py | 2 +- src/ahriman/core/support/pkgbuild/mirrorlist_generator.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ahriman/application/ahriman.py b/src/ahriman/application/ahriman.py index 323b67c3..5673da68 100644 --- a/src/ahriman/application/ahriman.py +++ b/src/ahriman/application/ahriman.py @@ -71,7 +71,7 @@ def _parser() -> argparse.ArgumentParser: fromfile_prefix_chars="@", formatter_class=_formatter) parser.add_argument("-a", "--architecture", help="filter by target architecture") parser.add_argument("-c", "--configuration", help="configuration path", type=Path, - default=Path("/etc") / "ahriman.ini") + default=Path("/") / "etc" / "ahriman.ini") parser.add_argument("--force", help="force run, remove file lock", action="store_true") parser.add_argument("-l", "--lock", help="lock file", type=Path, default=Path(tempfile.gettempdir()) / "ahriman.lock") @@ -999,7 +999,7 @@ def _set_service_setup_parser(root: SubParserAction) -> argparse.ArgumentParser: formatter_class=_formatter) parser.add_argument("--build-as-user", help="force makepkg user to the specific one") parser.add_argument("--from-configuration", help="path to default devtools pacman configuration", - type=Path, default=Path("/usr") / "share" / "devtools" / "pacman.conf.d" / "extra.conf") + type=Path, default=Path("/") / "usr" / "share" / "devtools" / "pacman.conf.d" / "extra.conf") parser.add_argument("--generate-salt", help="generate salt for user passwords", action=argparse.BooleanOptionalAction, default=False) parser.add_argument("--makeflags-jobs", help="append MAKEFLAGS variable with parallelism set to number of cores", diff --git a/src/ahriman/application/handlers/setup.py b/src/ahriman/application/handlers/setup.py index 9889b5f3..469505d4 100644 --- a/src/ahriman/application/handlers/setup.py +++ b/src/ahriman/application/handlers/setup.py @@ -44,9 +44,9 @@ class Setup(Handler): ALLOW_MULTI_ARCHITECTURE_RUN = False # conflicting io - ARCHBUILD_COMMAND_PATH = Path("/usr") / "bin" / "archbuild" - MIRRORLIST_PATH = Path("/etc") / "pacman.d" / "mirrorlist" - SUDOERS_DIR_PATH = Path("/etc") / "sudoers.d" + ARCHBUILD_COMMAND_PATH = Path("/") / "usr" / "bin" / "archbuild" + MIRRORLIST_PATH = Path("/") / "etc" / "pacman.d" / "mirrorlist" + SUDOERS_DIR_PATH = Path("/") / "etc" / "sudoers.d" @classmethod def run(cls, args: argparse.Namespace, repository_id: RepositoryId, configuration: Configuration, *, diff --git a/src/ahriman/core/log/log_loader.py b/src/ahriman/core/log/log_loader.py index 4f99610e..6514a344 100644 --- a/src/ahriman/core/log/log_loader.py +++ b/src/ahriman/core/log/log_loader.py @@ -40,7 +40,7 @@ class LogLoader: DEFAULT_LOG_FORMAT = "[%(levelname)s %(asctime)s] [%(filename)s:%(lineno)d %(funcName)s]: %(message)s" DEFAULT_LOG_LEVEL = logging.DEBUG - DEFAULT_SYSLOG_DEVICE = Path("/dev") / "log" + DEFAULT_SYSLOG_DEVICE = Path("/") / "dev" / "log" @staticmethod def handler(selected: LogHandler | None) -> LogHandler: diff --git a/src/ahriman/core/support/pkgbuild/mirrorlist_generator.py b/src/ahriman/core/support/pkgbuild/mirrorlist_generator.py index e341a22e..2f0f4499 100644 --- a/src/ahriman/core/support/pkgbuild/mirrorlist_generator.py +++ b/src/ahriman/core/support/pkgbuild/mirrorlist_generator.py @@ -51,7 +51,7 @@ class MirrorlistGenerator(PkgbuildGenerator): # configuration fields self.servers = configuration.getlist(section, "servers") self.path = configuration.getpath( - section, "path", fallback=Path("/etc") / "pacman.d" / f"{repository_id.name}-mirrorlist") + section, "path", fallback=Path("/") / "etc" / "pacman.d" / f"{repository_id.name}-mirrorlist") self.path = self.path.relative_to("/") # in pkgbuild we are always operating with relative to / path # pkgbuild description fields self.pkgbuild_pkgname = configuration.get(section, "package", fallback=f"{repository_id.name}-mirrorlist")