From 24c877b36e9eab79df342a2c2856b2d20ff75b90 Mon Sep 17 00:00:00 2001 From: udeved Date: Fri, 7 Apr 2017 22:11:41 +0200 Subject: [PATCH] chrootcfg: rank mirrors fasttrack on host The ranking at boot is too unreliable --- src/modules/chrootcfg/chrootcfg.conf | 2 ++ src/modules/chrootcfg/main.py | 21 ++++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/modules/chrootcfg/chrootcfg.conf b/src/modules/chrootcfg/chrootcfg.conf index ef90975c2..1f900c21a 100644 --- a/src/modules/chrootcfg/chrootcfg.conf +++ b/src/modules/chrootcfg/chrootcfg.conf @@ -7,6 +7,8 @@ requirements: - name: /var/lib/pacman mode: "0o755" +isRank: true + keyrings: - archlinux - manjaro diff --git a/src/modules/chrootcfg/main.py b/src/modules/chrootcfg/main.py index b971c26e3..59f9409b6 100644 --- a/src/modules/chrootcfg/main.py +++ b/src/modules/chrootcfg/main.py @@ -24,6 +24,7 @@ import libcalamares from libcalamares.utils import check_target_env_call, target_env_call, debug from os.path import join +from subprocess import call class OperationTracker: def __init__(self): @@ -107,9 +108,6 @@ class PacmanController: def populate_keyring(self): target_env_call(["pacman-key", "--populate"] + self.keyrings) - def rank_mirrors(self): - check_target_env_call(["pacman-mirrors", "-g", "-m", "rank"]) - def parse_output(self, cmd): cal_env = os.environ cal_env["LC_ALL"] = "C" @@ -167,7 +165,7 @@ class PacmanController: cmd = args + pkglist check_target_env_call(cmd) - def run(self, rank=False): + def run(self): pkgs = [] for key in self.operations.keys(): if key == "install": @@ -194,8 +192,6 @@ class PacmanController: self.init_keyring() self.populate_keyring() - if rank: - self.rank_mirrors() return None @@ -203,11 +199,16 @@ class ChrootController: def __init__(self): self.__root = libcalamares.globalstorage.value('rootMountPoint') self.__requirements = libcalamares.job.configuration.get('requirements', []) + self.__isRank = libcalamares.job.configuration['isRank'] @property def root(self): return self.__root + @property + def isRank(self): + return self.__isRank + @property def requirements(self): return self.__requirements @@ -221,6 +222,9 @@ class ChrootController: debug("Mode: {}".format(oct(mod))) os.makedirs(dest, mode=mod) + def rank_mirrors(self): + call(["pacman-mirrors", "-f", "5"]) + def copy_file(self, file): if os.path.exists(os.path.join("/",file)): shutil.copy2(os.path.join("/",file), os.path.join(self.root, file)) @@ -236,10 +240,13 @@ class ChrootController: self.copy_file('etc/resolv.conf') def run(self): + if self.isRank: + self.rank_mirrors() + self.prepare() pacman = PacmanController(self.root) - return pacman.run(rank=False) + return pacman.run() def run(): """ Create chroot dirs and install pacman, kernel and netinstall selection """