Compare commits

..

7 Commits

7 changed files with 14 additions and 53 deletions

View File

@ -96,8 +96,8 @@ def add_file(ctx: ArchBuilderContext, file: dict):
# at least path content # at least path content
if "path" not in file: if "path" not in file:
raise ArchBuilderConfigError("no path set in file") raise ArchBuilderConfigError("no path set in file")
if "content" not in file and "source" not in file and "url" not in file: if "content" not in file and "source" not in file:
raise ArchBuilderConfigError(f"no content, source or url set in file") raise ArchBuilderConfigError("no content or source set in file")
root = ctx.get_rootfs() root = ctx.get_rootfs()
path: str = file["path"] path: str = file["path"]
if path.startswith("/"): path = path[1:] if path.startswith("/"): path = path[1:]
@ -109,7 +109,7 @@ def add_file(ctx: ArchBuilderContext, file: dict):
# follow symbolic links # follow symbolic links
follow = file["follow"] if "follow" in file else True follow = file["follow"] if "follow" in file else True
# source is a folder # source is a folder
folder = file["folder"] if "folder" in file else False folder = file["folder"] if "folder" in file else False
# files mode # files mode
@ -142,10 +142,6 @@ def add_file(ctx: ArchBuilderContext, file: dict):
shutil.copytree(src, real, symlinks=follow, dirs_exist_ok=True) shutil.copytree(src, real, symlinks=follow, dirs_exist_ok=True)
else: else:
shutil.copyfile(src, real, follow_symlinks=follow) shutil.copyfile(src, real, follow_symlinks=follow)
elif "url" in file:
cmds = ["wget", file["url"], "-O", real]
ret = ctx.run_external(cmds)
if ret != 0: raise OSError(f"wget failed with {ret}")
else: else:
assert False assert False
log.debug(f"chmod file {real} to {mode:04o}") log.debug(f"chmod file {real} to {mode:04o}")

View File

@ -64,7 +64,7 @@ def gen_config(ctx: ArchBuilderContext, pacman: Pacman):
conf = os.path.join(ctx.get_rootfs(), "etc/pacman.conf") conf = os.path.join(ctx.get_rootfs(), "etc/pacman.conf")
lines: list[str] = [] lines: list[str] = []
append_config(ctx, lines) append_config(ctx, lines)
pacman.append_repos(lines, True) pacman.append_repos(lines)
with open_config(conf) as f: with open_config(conf) as f:
f.writelines(lines) f.writelines(lines)
log.info(f"generated pacman config {conf}") log.info(f"generated pacman config {conf}")

View File

@ -52,7 +52,6 @@ class PacmanRepo(SerializableDict):
name: str = None name: str = None
priority: int = 10000 priority: int = 10000
servers: list[PacmanRepoServer] = None servers: list[PacmanRepoServer] = None
mirrorlist: str = None
publickey: str = None publickey: str = None
keyid: str = None keyid: str = None
@ -61,7 +60,6 @@ class PacmanRepo(SerializableDict):
name: str = None, name: str = None,
priority: int = None, priority: int = None,
servers: list[PacmanRepoServer] = None, servers: list[PacmanRepoServer] = None,
mirrorlist: str = None,
publickey: str = None, publickey: str = None,
keyid: str = None keyid: str = None
): ):
@ -69,7 +67,6 @@ class PacmanRepo(SerializableDict):
if priority is not None: self.priority = priority if priority is not None: self.priority = priority
if servers is not None: self.servers = servers if servers is not None: self.servers = servers
else: self.servers = [] else: self.servers = []
if mirrorlist is not None: self.mirrorlist = mirrorlist
if publickey is not None: self.publickey = publickey if publickey is not None: self.publickey = publickey
if keyid is not None: self.keyid = keyid if keyid is not None: self.keyid = keyid
@ -95,23 +92,20 @@ class Pacman:
caches: list[str] caches: list[str]
repos: list[PacmanRepo] repos: list[PacmanRepo]
def append_repos(self, lines: list[str], rootfs: bool = False): def append_repos(self, lines: list[str]):
""" """
Add all databases into config Add all databases into config
""" """
for repo in self.repos: for repo in self.repos:
lines.append(f"[{repo.name}]\n") lines.append(f"[{repo.name}]\n")
if rootfs and repo.mirrorlist is not None: for server in repo.servers:
lines.append(f"Include = /etc/pacman.d/{repo.name}-mirrorlist\n") if server.mirror:
else: lines.append(f"# Mirror {server.name}\n")
for server in repo.servers: log.debug(f"use mirror {server.name} url {server.url}")
if server.mirror: else:
lines.append(f"# Mirror {server.name}\n") lines.append("# Original Repo\n")
log.debug(f"use mirror {server.name} url {server.url}") log.debug(f"use original repo url {server.url}")
else: lines.append(f"Server = {server.url}\n")
lines.append("# Original Repo\n")
log.debug(f"use original repo url {server.url}")
lines.append(f"Server = {server.url}\n")
def append_config(self, lines: list[str]): def append_config(self, lines: list[str]):
""" """
@ -148,13 +142,8 @@ class Pacman:
log.info("initializing pacman keyring") log.info("initializing pacman keyring")
self.pacman_key(["--init"]) self.pacman_key(["--init"])
# Download and add public keys and mirrorlist # Download and add public keys
for repo in self.repos: for repo in self.repos:
if repo.mirrorlist is not None:
mirrorlist = os.path.join(self.ctx.work, f"etc/pacman.d/{repo.name}-mirrorlist")
cmds = ["wget", repo.mirrorlist, "-O", keypath]
ret = self.ctx.run_external(cmds)
if ret != 0: raise OSError(f"wget failed with {ret}")
if repo.publickey is not None: if repo.publickey is not None:
keypath = os.path.join(self.ctx.work, f"{repo.name}.pub") keypath = os.path.join(self.ctx.work, f"{repo.name}.pub")
cmds = ["wget", repo.publickey, "-O", keypath] cmds = ["wget", repo.publickey, "-O", keypath]
@ -312,9 +301,6 @@ class Pacman:
if "priority" in repo: if "priority" in repo:
pacman_repo.priority = repo["priority"] pacman_repo.priority = repo["priority"]
if "mirrorlist" in repo:
pacman_repo.mirrorlist = repo["mirrorlist"]
# add public key url and id # add public key url and id
if "publickey" in repo and "keyid" not in repo: if "publickey" in repo and "keyid" not in repo:
raise ArchBuilderConfigError("publickey is provided without keyid") raise ArchBuilderConfigError("publickey is provided without keyid")

View File

@ -3,7 +3,6 @@ pacman:
install: install:
- plasma - plasma
- konsole - konsole
- kate
- dolphin - dolphin
- sddm - sddm
- packagekit-qt6 - packagekit-qt6

View File

@ -4,10 +4,6 @@ locale:
- "en_US.UTF-8 UTF-8" - "en_US.UTF-8 UTF-8"
default: en_US.UTF-8 default: en_US.UTF-8
systemd:
enable:
- systemd-timesyncd
filesystem: filesystem:
files: files:
# Wireless regulatory # Wireless regulatory

View File

@ -5,10 +5,6 @@ locale:
- "en_US.UTF-8 UTF-8" - "en_US.UTF-8 UTF-8"
default: en_US.UTF-8 default: en_US.UTF-8
systemd:
enable:
- systemd-timesyncd
filesystem: filesystem:
files: files:
# Wireless regulatory # Wireless regulatory

View File

@ -1,12 +0,0 @@
pacman:
repo:
- name: endeavouros
priority: 200
server: https://github.com/endeavouros-team/repo/raw/master/$$repo/$$arch/
mirrorlist: https://raw.githubusercontent.com/endeavouros-team/PKGBUILDS/master/endeavouros-mirrorlist/endeavouros-mirrorlist
trust:
- info@endeavouros.com
- manuel@endeavouros.com
install:
- endeavouros/endeavouros-keyring
- endeavouros/endeavouros-mirrorlist