migrate to the latest devtools & archlinux git changes

This migration includes
* removal of community repository as it is no more
* fixed paths for devtools configurations
* migration of archlinux packaging git url
This commit is contained in:
Evgenii Alekseev 2023-05-22 16:28:53 +03:00
parent 8c55438140
commit 70e9e3e822
10 changed files with 24 additions and 35 deletions

View File

@ -32,11 +32,11 @@ Initial setup
ln -s /usr/bin/archbuild /usr/local/bin/ahriman-x86_64-build 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 .. 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: Change configuration file, add your own repository, add multilib repository etc:
@ -44,11 +44,11 @@ Initial setup
.. code-block:: shell .. code-block:: shell
echo '[multilib]' | tee -a /usr/share/devtools/pacman-ahriman.conf 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 '[aur-clone]' | tee -a /usr/share/devtools/pacman-ahriman.conf
echo 'SigLevel = Optional TrustAll' | 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-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: Set ``build_command`` option to point to your command:

View File

@ -7,7 +7,7 @@ suppress_http_log_errors = yes
[alpm] [alpm]
database = /var/lib/pacman database = /var/lib/pacman
mirror = https://geo.mirror.pkgbuild.com/$repo/os/$arch mirror = https://geo.mirror.pkgbuild.com/$repo/os/$arch
repositories = core extra community multilib repositories = core extra multilib
root = / root = /
use_ahriman_cache = yes use_ahriman_cache = yes

View File

@ -70,7 +70,8 @@ def _parser() -> argparse.ArgumentParser:
fromfile_prefix_chars="@", formatter_class=_formatter) fromfile_prefix_chars="@", formatter_class=_formatter)
parser.add_argument("-a", "--architecture", help="target architectures. For several subcommands it can be used " parser.add_argument("-a", "--architecture", help="target architectures. For several subcommands it can be used "
"multiple times", action="append") "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("--force", help="force run, remove file lock", action="store_true")
parser.add_argument("-l", "--lock", help="lock file", type=Path, parser.add_argument("-l", "--lock", help="lock file", type=Path,
default=Path(tempfile.gettempdir()) / "ahriman.lock") 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-as-user", help="force makepkg user to the specific one")
parser.add_argument("--build-command", help="build command prefix", default="ahriman") parser.add_argument("--build-command", help="build command prefix", default="ahriman")
parser.add_argument("--from-configuration", help="path to default devtools pacman configuration", 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", parser.add_argument("--makeflags-jobs", help="append MAKEFLAGS variable with parallelism set to number of cores",
action=argparse.BooleanOptionalAction, default=True) action=argparse.BooleanOptionalAction, default=True)
parser.add_argument("--mirror", help="use the specified explicitly mirror instead of including mirrorlist") parser.add_argument("--mirror", help="use the specified explicitly mirror instead of including mirrorlist")

View File

@ -40,9 +40,9 @@ class Setup(Handler):
ALLOW_AUTO_ARCHITECTURE_RUN = False ALLOW_AUTO_ARCHITECTURE_RUN = False
ARCHBUILD_COMMAND_PATH = Path("/usr/bin/archbuild") ARCHBUILD_COMMAND_PATH = Path("/usr") / "bin" / "archbuild"
MIRRORLIST_PATH = Path("/etc/pacman.d/mirrorlist") MIRRORLIST_PATH = Path("/etc") / "pacman.d" / "mirrorlist"
SUDOERS_DIR_PATH = Path("/etc/sudoers.d") SUDOERS_DIR_PATH = Path("/etc") / "sudoers.d"
@classmethod @classmethod
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, 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, "SigLevel", "Optional TrustAll") # we don't care
configuration.set_option(repository, "Server", f"file://{paths.repository}") 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: with target.open("w") as devtools_configuration:
configuration.write(devtools_configuration) configuration.write(devtools_configuration)

View File

@ -34,13 +34,15 @@ class Official(Remote):
Attributes: Attributes:
DEFAULT_ARCHLINUX_URL(str): (class attribute) default archlinux url 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_SEARCH_REPOSITORIES(list[str]): (class attribute) default list of repositories to search
DEFAULT_RPC_URL(str): (class attribute) default archlinux repositories RPC url DEFAULT_RPC_URL(str): (class attribute) default archlinux repositories RPC url
DEFAULT_TIMEOUT(int): (class attribute) HTTP request timeout in seconds 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_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_RPC_URL = "https://archlinux.org/packages/search/json"
DEFAULT_TIMEOUT = 30 DEFAULT_TIMEOUT = 30
@ -56,9 +58,7 @@ class Official(Remote):
Returns: Returns:
str: git url for the specific base str: git url for the specific base
""" """
if repository.lower() in ("core", "extra", "testing", "kde-unstable"): return f"{Official.DEFAULT_ARCHLINUX_GIT_URL}/archlinux/packaging/packages/{package_base}.git"
return "https://github.com/archlinux/svntogit-packages.git" # hardcoded, ok
return "https://github.com/archlinux/svntogit-community.git"
@classmethod @classmethod
def remote_web_url(cls, package_base: str) -> str: def remote_web_url(cls, package_base: str) -> str:

View File

@ -105,8 +105,8 @@ class RemoteSource:
return cls( return cls(
git_url=Official.remote_git_url(package_base, repository), git_url=Official.remote_git_url(package_base, repository),
web_url=Official.remote_web_url(package_base), web_url=Official.remote_web_url(package_base),
path="trunk", path=".",
branch=f"packages/{package_base}", branch="main",
source=source, source=source,
) )
return None return None

View File

@ -25,7 +25,7 @@ def _default_args(args: argparse.Namespace) -> argparse.Namespace:
""" """
args.build_as_user = "ahriman" args.build_as_user = "ahriman"
args.build_command = "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.makeflags_jobs = True
args.mirror = "mirror" args.mirror = "mirror"
args.multilib = True args.multilib = True

View File

@ -50,19 +50,7 @@ def test_remote_git_url(aur_package_akonadi: AURPackage) -> None:
Official.remote_git_url(aur_package_akonadi.package_base, repository) Official.remote_git_url(aur_package_akonadi.package_base, repository)
for repository in ("core", "extra", "Core", "Extra") for repository in ("core", "extra", "Core", "Extra")
] ]
assert all(git_url.endswith("svntogit-packages.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
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 len(set(git_urls)) == 1 assert len(set(git_urls)) == 1

View File

@ -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 = RemoteSource.from_source(PackageSource.Repository, package_ahriman.base, "community")
remote_git_url_mock.assert_called_once_with(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) remote_web_url_mock.assert_called_once_with(package_ahriman.base)
assert remote.pkgbuild_dir == Path("trunk") assert remote.pkgbuild_dir == Path(".")
assert remote.branch.endswith(package_ahriman.base) assert remote.branch == "main"
assert remote.source == PackageSource.Repository assert remote.source == PackageSource.Repository

View File

@ -6,7 +6,7 @@ database = ../../../ahriman-test.db
[alpm] [alpm]
database = /var/lib/pacman database = /var/lib/pacman
mirror = https://geo.mirror.pkgbuild.com/$repo/os/$arch mirror = https://geo.mirror.pkgbuild.com/$repo/os/$arch
repositories = core extra community multilib repositories = core extra multilib
root = / root = /
use_ahriman_cache = no use_ahriman_cache = no