Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcodefiles <11915375+codefiles@users.noreply.github.com>2024-03-07 08:41:25 -0500
committerGitHub <noreply@github.com>2024-03-07 14:41:25 +0100
commit9b1fd2e44f0b08188a609edaefe696c00869a8b8 (patch)
tree65b4386e60bd55878d8f44f81c6c146ad28f05cb
parentb39e3dc88637732df5356cf503436531cccd24d8 (diff)
Fix enabling of testing repositories (#2340)
-rw-r--r--archinstall/lib/installer.py2
-rw-r--r--archinstall/lib/pacman/config.py23
-rw-r--r--archinstall/lib/pacman/repo.py1
3 files changed, 17 insertions, 9 deletions
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 2ea728bb..443e2b90 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -661,8 +661,6 @@ class Installer:
if testing:
info("The testing flag is set. This system will be installed with testing repositories enabled.")
pacman_conf.enable(pacman.Repo.Testing)
- if multilib:
- pacman_conf.enable(pacman.Repo.MultilibTesting)
else:
info("The testing flag is not set. This system will be installed without testing repositories enabled.")
diff --git a/archinstall/lib/pacman/config.py b/archinstall/lib/pacman/config.py
index 60d202bc..6686f4a9 100644
--- a/archinstall/lib/pacman/config.py
+++ b/archinstall/lib/pacman/config.py
@@ -10,24 +10,35 @@ class Config:
def __init__(self, target: Path):
self.path = Path("/etc") / "pacman.conf"
self.chroot_path = target / "etc" / "pacman.conf"
- self.patterns: List[re.Pattern] = []
+ self.repos: List[Repo] = []
def enable(self, repo: Repo):
- self.patterns.append(re.compile(r"^#\s*\[{}\]$".format(repo.value)))
+ self.repos.append(repo)
def apply(self):
- if not self.patterns:
+ if not self.repos:
return
+
+ if Repo.Testing in self.repos:
+ if Repo.Multilib in self.repos:
+ repos_pattern = f'({Repo.Multilib.value}|.+-{Repo.Testing.value})'
+ else:
+ repos_pattern = f'(?!{Repo.Multilib.value}).+-{Repo.Testing.value}'
+ else:
+ repos_pattern = Repo.Multilib.value
+
+ pattern = re.compile(rf"^#\s*\[{repos_pattern}\]$")
+
lines = iter(self.path.read_text().splitlines(keepends=True))
with open(self.path, 'w') as f:
for line in lines:
- if any(pattern.match(line) for pattern in self.patterns):
+ if pattern.match(line):
# Uncomment this line and the next.
f.write(line.lstrip('#'))
f.write(next(lines).lstrip('#'))
else:
f.write(line)
-
+
def persist(self):
- if self.patterns:
+ if self.repos:
copy2(self.path, self.chroot_path)
diff --git a/archinstall/lib/pacman/repo.py b/archinstall/lib/pacman/repo.py
index b4106f97..7a461431 100644
--- a/archinstall/lib/pacman/repo.py
+++ b/archinstall/lib/pacman/repo.py
@@ -3,4 +3,3 @@ from enum import Enum
class Repo(Enum):
Multilib = "multilib"
Testing = "testing"
- MultilibTesting = "multilib-testing"