diff --git a/docs/setup.rst b/docs/setup.rst index 3c930c45..eb682d20 100644 --- a/docs/setup.rst +++ b/docs/setup.rst @@ -32,11 +32,11 @@ Initial setup ln -s /usr/bin/archbuild /usr/local/bin/ahriman-x86_64-build #. - Create configuration file (same as previous ``pacman-{name}.conf``): + Create configuration file (same as previous ``{name}.conf``): .. code-block:: shell - cp /usr/share/devtools/pacman-{extra,ahriman}.conf + cp /usr/share/devtools/pacman.conf.d/{extra,ahriman}.conf #. Change configuration file, add your own repository, add multilib repository etc: @@ -44,11 +44,11 @@ Initial setup .. code-block:: shell echo '[multilib]' | tee -a /usr/share/devtools/pacman-ahriman.conf - echo 'Include = /etc/pacman.d/mirrorlist' | tee -a /usr/share/devtools/pacman-ahriman.conf + echo 'Include = /etc/pacman.d/mirrorlist' | tee -a /usr/share/devtools/pacman.conf.d/ahriman.conf echo '[aur-clone]' | tee -a /usr/share/devtools/pacman-ahriman.conf - echo 'SigLevel = Optional TrustAll' | tee -a /usr/share/devtools/pacman-ahriman.conf - echo 'Server = file:///var/lib/ahriman/repository/$arch' | tee -a /usr/share/devtools/pacman-ahriman.conf + echo 'SigLevel = Optional TrustAll' | tee -a /usr/share/devtools/pacman.conf.d/ahriman.conf + echo 'Server = file:///var/lib/ahriman/repository/$arch' | tee -a /usr/share/devtools/pacman.conf.d/ahriman.conf #. Set ``build_command`` option to point to your command: diff --git a/package/share/ahriman/settings/ahriman.ini b/package/share/ahriman/settings/ahriman.ini index 9008c57d..e246a2f9 100644 --- a/package/share/ahriman/settings/ahriman.ini +++ b/package/share/ahriman/settings/ahriman.ini @@ -7,7 +7,7 @@ suppress_http_log_errors = yes [alpm] database = /var/lib/pacman mirror = https://geo.mirror.pkgbuild.com/$repo/os/$arch -repositories = core extra community multilib +repositories = core extra multilib root = / use_ahriman_cache = yes diff --git a/src/ahriman/application/ahriman.py b/src/ahriman/application/ahriman.py index 61234551..3ace5315 100644 --- a/src/ahriman/application/ahriman.py +++ b/src/ahriman/application/ahriman.py @@ -70,7 +70,8 @@ def _parser() -> argparse.ArgumentParser: fromfile_prefix_chars="@", formatter_class=_formatter) parser.add_argument("-a", "--architecture", help="target architectures. For several subcommands it can be used " "multiple times", action="append") - parser.add_argument("-c", "--configuration", help="configuration path", type=Path, default=Path("/etc/ahriman.ini")) + parser.add_argument("-c", "--configuration", help="configuration path", type=Path, + 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") @@ -822,7 +823,7 @@ def _set_service_setup_parser(root: SubParserAction) -> argparse.ArgumentParser: parser.add_argument("--build-as-user", help="force makepkg user to the specific one") parser.add_argument("--build-command", help="build command prefix", default="ahriman") parser.add_argument("--from-configuration", help="path to default devtools pacman configuration", - type=Path, default=Path("/usr/share/devtools/pacman-extra.conf")) + type=Path, default=Path("/usr") / "share" / "devtools" / "pacman.conf.d" / "extra.conf") parser.add_argument("--makeflags-jobs", help="append MAKEFLAGS variable with parallelism set to number of cores", action=argparse.BooleanOptionalAction, default=True) parser.add_argument("--mirror", help="use the specified explicitly mirror instead of including mirrorlist") diff --git a/src/ahriman/application/handlers/setup.py b/src/ahriman/application/handlers/setup.py index d3ffe97d..8db02618 100644 --- a/src/ahriman/application/handlers/setup.py +++ b/src/ahriman/application/handlers/setup.py @@ -40,9 +40,9 @@ class Setup(Handler): ALLOW_AUTO_ARCHITECTURE_RUN = False - 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, architecture: str, configuration: Configuration, *, @@ -178,7 +178,7 @@ class Setup(Handler): configuration.set_option(repository, "SigLevel", "Optional TrustAll") # we don't care configuration.set_option(repository, "Server", f"file://{paths.repository}") - target = source.parent / f"pacman-{prefix}-{architecture}.conf" + target = source.parent / f"{prefix}-{architecture}.conf" with target.open("w") as devtools_configuration: configuration.write(devtools_configuration) diff --git a/src/ahriman/core/alpm/remote/official.py b/src/ahriman/core/alpm/remote/official.py index 5b7e48e4..1034441c 100644 --- a/src/ahriman/core/alpm/remote/official.py +++ b/src/ahriman/core/alpm/remote/official.py @@ -34,13 +34,15 @@ class Official(Remote): Attributes: DEFAULT_ARCHLINUX_URL(str): (class attribute) default archlinux url + DEFAULT_ARCHLINUX_GIT_URL(str): (class attribute) default url for git packages DEFAULT_SEARCH_REPOSITORIES(list[str]): (class attribute) default list of repositories to search DEFAULT_RPC_URL(str): (class attribute) default archlinux repositories RPC url DEFAULT_TIMEOUT(int): (class attribute) HTTP request timeout in seconds """ + DEFAULT_ARCHLINUX_GIT_URL = "https://gitlab.archlinux.org" DEFAULT_ARCHLINUX_URL = "https://archlinux.org" - DEFAULT_SEARCH_REPOSITORIES = ["Core", "Extra", "Multilib", "Community"] + DEFAULT_SEARCH_REPOSITORIES = ["Core", "Extra", "Multilib"] DEFAULT_RPC_URL = "https://archlinux.org/packages/search/json" DEFAULT_TIMEOUT = 30 @@ -56,9 +58,7 @@ class Official(Remote): Returns: str: git url for the specific base """ - if repository.lower() in ("core", "extra", "testing", "kde-unstable"): - return "https://github.com/archlinux/svntogit-packages.git" # hardcoded, ok - return "https://github.com/archlinux/svntogit-community.git" + return f"{Official.DEFAULT_ARCHLINUX_GIT_URL}/archlinux/packaging/packages/{package_base}.git" @classmethod def remote_web_url(cls, package_base: str) -> str: diff --git a/src/ahriman/models/remote_source.py b/src/ahriman/models/remote_source.py index 4960b7c6..15c89f95 100644 --- a/src/ahriman/models/remote_source.py +++ b/src/ahriman/models/remote_source.py @@ -105,8 +105,8 @@ class RemoteSource: return cls( git_url=Official.remote_git_url(package_base, repository), web_url=Official.remote_web_url(package_base), - path="trunk", - branch=f"packages/{package_base}", + path=".", + branch="main", source=source, ) return None diff --git a/tests/ahriman/application/handlers/test_handler_setup.py b/tests/ahriman/application/handlers/test_handler_setup.py index 90024ded..984f4348 100644 --- a/tests/ahriman/application/handlers/test_handler_setup.py +++ b/tests/ahriman/application/handlers/test_handler_setup.py @@ -25,7 +25,7 @@ def _default_args(args: argparse.Namespace) -> argparse.Namespace: """ args.build_as_user = "ahriman" args.build_command = "ahriman" - args.from_configuration = Path("/usr/share/devtools/pacman-extra.conf") + args.from_configuration = Path("/usr/share/devtools/pacman.conf.d/extra.conf") args.makeflags_jobs = True args.mirror = "mirror" args.multilib = True diff --git a/tests/ahriman/core/alpm/remote/test_official.py b/tests/ahriman/core/alpm/remote/test_official.py index aa01c7e0..0431c72c 100644 --- a/tests/ahriman/core/alpm/remote/test_official.py +++ b/tests/ahriman/core/alpm/remote/test_official.py @@ -50,19 +50,7 @@ def test_remote_git_url(aur_package_akonadi: AURPackage) -> None: Official.remote_git_url(aur_package_akonadi.package_base, repository) for repository in ("core", "extra", "Core", "Extra") ] - assert all(git_url.endswith("svntogit-packages.git") for git_url in git_urls) - assert len(set(git_urls)) == 1 - - -def test_remote_git_url_community(aur_package_akonadi: AURPackage) -> None: - """ - must generate package git url for core packages - """ - git_urls = [ - Official.remote_git_url(aur_package_akonadi.package_base, repository) - for repository in ("community", "multilib", "Community", "Multilib") - ] - assert all(git_url.endswith("svntogit-community.git") for git_url in git_urls) + assert all(git_url.endswith(f"{aur_package_akonadi.package_base}.git") for git_url in git_urls) assert len(set(git_urls)) == 1 diff --git a/tests/ahriman/models/test_remote_source.py b/tests/ahriman/models/test_remote_source.py index c1817cec..9d9969fd 100644 --- a/tests/ahriman/models/test_remote_source.py +++ b/tests/ahriman/models/test_remote_source.py @@ -67,8 +67,8 @@ def test_from_source_official(package_ahriman: Package, mocker: MockerFixture) - remote = RemoteSource.from_source(PackageSource.Repository, package_ahriman.base, "community") remote_git_url_mock.assert_called_once_with(package_ahriman.base, "community") remote_web_url_mock.assert_called_once_with(package_ahriman.base) - assert remote.pkgbuild_dir == Path("trunk") - assert remote.branch.endswith(package_ahriman.base) + assert remote.pkgbuild_dir == Path(".") + assert remote.branch == "main" assert remote.source == PackageSource.Repository diff --git a/tests/testresources/core/ahriman.ini b/tests/testresources/core/ahriman.ini index bc7b5a85..8dfb33fe 100644 --- a/tests/testresources/core/ahriman.ini +++ b/tests/testresources/core/ahriman.ini @@ -6,7 +6,7 @@ database = ../../../ahriman-test.db [alpm] database = /var/lib/pacman mirror = https://geo.mirror.pkgbuild.com/$repo/os/$arch -repositories = core extra community multilib +repositories = core extra multilib root = / use_ahriman_cache = no