diff --git a/slpkg/binary/repo_init.py b/slpkg/binary/repo_init.py index 9206f057..6bcfe73f 100644 --- a/slpkg/binary/repo_init.py +++ b/slpkg/binary/repo_init.py @@ -38,6 +38,7 @@ class RepoInit(object): def __init__(self, repo): self.repo = repo self.meta = _meta_ + self.def_repo_dict = Repo().default_repository() self.mirror = "" def fetch(self): @@ -57,7 +58,7 @@ class RepoInit(object): self.mirror = mirrors(name="", location="") def _init_rlw(self): - self.mirror = "{0}{1}/".format(Repo().rlw(), slack_ver()) + self.mirror = "{0}{1}/".format(self.def_repo_dict["rlw"], slack_ver()) def _init_alien(self): ver = slack_ver() @@ -66,21 +67,22 @@ class RepoInit(object): arch = "x86_64" if self.meta.slack_rel == "current": ver = self.meta.slack_rel - self.mirror = "{0}{1}/{2}/".format(Repo().alien(), ver, arch) + self.mirror = "{0}{1}/{2}/".format(self.def_repo_dict["alien"], + ver, arch) def _init_slacky(self): arch = "" if self.meta.arch == "x86_64": arch = "64" - self.mirror = "{0}slackware{1}-{2}/".format(Repo().slacky(), arch, - slack_ver()) + self.mirror = "{0}slackware{1}-{2}/".format( + self.def_repo_dict["slacky"], arch, slack_ver()) def _init_studio(self): arch = "" if self.meta.arch == "x86_64": arch = "64" - self.mirror = "{0}slackware{1}-{2}/".format(Repo().studioware(), - arch, slack_ver()) + self.mirror = "{0}slackware{1}-{2}/".format( + self.def_repo_dict["studio"], arch, slack_ver()) def _init_slackr(self): self.mirror = Repo().slackers() @@ -92,35 +94,38 @@ class RepoInit(object): arch = "{0}-x86_64".format(ver) if self.meta.slack_rel == "current": arch = "{0}-x86_64".format(self.meta.slack_rel) - self.mirror = "{0}{1}/".format(Repo().slackonly(), arch) + self.mirror = "{0}{1}/".format(self.def_repo_dict["slonly"], arch) def _init_ktown(self): - self.mirror = Repo().ktown() + self.mirror = self.def_repo_dict["ktown"] def _init_multi(self): ver = slack_ver() if self.meta.slack_rel == "current": ver = self.meta.slack_rel - self.mirror = Repo().multi() + ver + "/" + self.mirror = self.def_repo_dict["multi"] + ver + "/" def _init_slacke(self): arch = "" if self.meta.arch == "x86_64": arch = "64" self.mirror = "{0}slacke{1}/slackware{2}-{3}/".format( - Repo().slacke(), self.meta.slacke_sub_repo[1:-1], arch, slack_ver()) + self.def_repo_dict["slacke"], self.meta.slacke_sub_repo[1:-1], + arch, slack_ver()) def _init_salix(self): arch = "i486" if self.meta.arch == "x86_64": arch = "x86_64" - self.mirror = "{0}{1}/{2}/".format(Repo().salix(), arch, slack_ver()) + self.mirror = "{0}{1}/{2}/".format(self.def_repo_dict["salix"], + arch, slack_ver()) def _init_slackl(self): arch = "i486" if self.meta.arch == "x86_64": arch = "x86_64" - self.mirror = "{0}{1}/current/".format(Repo().slackel(), arch) + self.mirror = "{0}{1}/current/".format(self.def_repo_dict["slackl"], + arch) def _init_rested(self): self.mirror = Repo().restricted() @@ -130,4 +135,5 @@ class RepoInit(object): if self.meta.arch == "x86_64": arch = "x86_64" self.mirror = "{0}{1}/{2}/{3}/".format( - Repo().msb(), slack_ver(), self.meta.msb_sub_repo[1:-1], arch) + self.def_repo_dict["msb"], slack_ver(), + self.meta.msb_sub_repo[1:-1], arch) diff --git a/slpkg/init.py b/slpkg/init.py index 7b6d32d8..b53d1941 100644 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -42,6 +42,7 @@ class Initialization(object): def __init__(self, check): self.check = check self.meta = _meta_ + self.def_repos_dict = Repo().default_repository() self.conf_path = self.meta.conf_path self.log_path = self.meta.log_path self.lib_path = self.meta.lib_path @@ -139,7 +140,7 @@ class Initialization(object): def sbo(self): """Creating sbo local library """ - repo = Repo().sbo() + repo = self.def_repos_dict["sbo"] log = self.log_path + "sbo/" lib = self.lib_path + "sbo_repo/" repo_name = log[:-1].split("/")[-1] @@ -165,7 +166,7 @@ class Initialization(object): def rlw(self): """Creating rlw local library """ - repo = Repo().rlw() + repo = self.def_repos_dict["rlw"] log = self.log_path + "rlw/" lib = self.lib_path + "rlw_repo/" repo_name = log[:-1].split("/")[-1] @@ -195,7 +196,7 @@ class Initialization(object): ar = "x86" ver = slack_ver() arch = self.meta.arch - repo = Repo().alien() + repo = self.def_repos_dict["alien"] log = self.log_path + "alien/" lib = self.lib_path + "alien_repo/" repo_name = log[:-1].split("/")[-1] @@ -228,7 +229,7 @@ class Initialization(object): """ ar = "" arch = self.meta.arch - repo = Repo().slacky() + repo = self.def_repos_dict["slacky"] log = self.log_path + "slacky/" lib = self.lib_path + "slacky_repo/" repo_name = log[:-1].split("/")[-1] @@ -263,7 +264,7 @@ class Initialization(object): """ ar = "" arch = self.meta.arch - repo = Repo().studioware() + repo = self.def_repos_dict["studio"] log = self.log_path + "studio/" lib = self.lib_path + "studio_repo/" repo_name = log[:-1].split("/")[-1] @@ -295,7 +296,7 @@ class Initialization(object): def slackr(self): """Creating slackers local library """ - repo = Repo().slackers() + repo = self.def_repos_dict["slackr"] log = self.log_path + "slackr/" lib = self.lib_path + "slackr_repo/" repo_name = log[:-1].split("/")[-1] @@ -325,7 +326,7 @@ class Initialization(object): ver = slack_ver() ar = "{0}-x86".format(ver) arch = self.meta.arch - repo = Repo().slackonly() + repo = self.def_repos_dict["slonly"] log = self.log_path + "slonly/" lib = self.lib_path + "slonly_repo/" repo_name = log[:-1].split("/")[-1] @@ -358,7 +359,7 @@ class Initialization(object): def ktown(self): """Creating alien ktown local library """ - repo = Repo().ktown() + repo = self.def_repos_dict["ktown"] log = self.log_path + "ktown/" lib = self.lib_path + "ktown_repo/" repo_name = log[:-1].split("/")[-1] @@ -386,7 +387,7 @@ class Initialization(object): """Creating alien multilib local library """ ver = slack_ver() - repo = Repo().multi() + repo = self.def_repos_dict["multi"] log = self.log_path + "multi/" lib = self.lib_path + "multi_repo/" repo_name = log[:-1].split("/")[-1] @@ -417,7 +418,7 @@ class Initialization(object): """ ar = "" arch = self.meta.arch - repo = Repo().slacke() + repo = self.def_repos_dict["slacke"] log = self.log_path + "slacke/" lib = self.lib_path + "slacke_repo/" repo_name = log[:-1].split("/")[-1] @@ -451,7 +452,7 @@ class Initialization(object): """ ar = "i486" arch = self.meta.arch - repo = Repo().salix() + repo = self.def_repos_dict["salix"] log = self.log_path + "salix/" lib = self.lib_path + "salix_repo/" repo_name = log[:-1].split("/")[-1] @@ -482,7 +483,7 @@ class Initialization(object): """ ar = "i486" arch = self.meta.arch - repo = Repo().slackel() + repo = self.def_repos_dict["slackl"] log = self.log_path + "slackl/" lib = self.lib_path + "slackl_repo/" repo_name = log[:-1].split("/")[-1] @@ -511,7 +512,7 @@ class Initialization(object): def rested(self): """Creating alien restricted local library """ - repo = Repo().restricted() + repo = self.def_repos_dict["rested"] log = self.log_path + "rested/" lib = self.lib_path + "rested_repo/" repo_name = log[:-1].split("/")[-1] @@ -540,7 +541,7 @@ class Initialization(object): """ ar = "x86" arch = self.meta.arch - repo = Repo().msb() + repo = self.def_repos_dict["msb"] log = self.log_path + "msb/" lib = self.lib_path + "msb_repo/" repo_name = log[:-1].split("/")[-1] diff --git a/slpkg/repoinfo.py b/slpkg/repoinfo.py index 4b51812c..e4b5556e 100644 --- a/slpkg/repoinfo.py +++ b/slpkg/repoinfo.py @@ -46,7 +46,7 @@ class RepoInfo(object): "Total uncompressed packages:": "" } self.meta = _meta_ - self.all_repos = RepoList().all_repos + self.all_repos = Repo().default_repository() self.all_repos.update(Repo().custom_repository()) del RepoList().all_repos diff --git a/slpkg/repolist.py b/slpkg/repolist.py index 14d55348..e84f16fa 100644 --- a/slpkg/repolist.py +++ b/slpkg/repolist.py @@ -35,23 +35,7 @@ class RepoList(object): def __init__(self): self.meta = _meta_ self.msg = Msg() - self.all_repos = { - "slack": Repo().slack(), - "sbo": Repo().sbo(), - "rlw": Repo().rlw(), - "alien": Repo().alien(), - "slacky": Repo().slacky(), - "studio": Repo().studioware(), - "slackr": Repo().slackers(), - "slonly": Repo().slackonly(), - "ktown": Repo().ktown(), - "multi": Repo().multi(), - "slacke": Repo().slacke(), - "salix": Repo().salix(), - "slackl": Repo().slackel(), - "rested": Repo().restricted(), - "msb": Repo().msb() - } + self.all_repos = Repo().default_repository() self.all_repos.update(Repo().custom_repository()) def repos(self): diff --git a/slpkg/repositories.py b/slpkg/repositories.py index 9c14d8fc..027dc90c 100644 --- a/slpkg/repositories.py +++ b/slpkg/repositories.py @@ -33,7 +33,6 @@ class Repo(object): """ def __init__(self): self.meta = _meta_ - self.default_dict_repo = {} self.custom_repo_file = "/etc/slpkg/custom-repositories" self.default_repo_file = "/etc/slpkg/default-repositories" self.custom_repositories_list = Utils().read_file(self.custom_repo_file) @@ -89,20 +88,22 @@ class Repo(object): def custom_repository(self): """Return dictionary with repo name and url (used external) """ - dict_repo = {} + custom_dict_repo = {} for line in self.custom_repositories_list.splitlines(): line = line.lstrip() if not line.startswith("#"): - dict_repo[line.split()[0]] = line.split()[1] - return dict_repo + custom_dict_repo[line.split()[0]] = line.split()[1] + return custom_dict_repo def default_repository(self): """Return dictionary with default repo name and url """ + default_dict_repo = {} for line in self.default_repositories_list.splitlines(): line = line.lstrip() if not line.startswith("#"): - self.default_dict_repo[line.split()[0]] = line.split()[1] + default_dict_repo[line.split()[0]] = line.split()[1] + return default_dict_repo def slack(self): """Official slackware repository @@ -120,73 +121,3 @@ class Repo(object): if not default.endswith("/"): default += "/" return default - - def sbo(self): - """SlackBuilds.org repository - """ - return self.default_dict_repo["sbo"] - - def rlw(self): - """Robby"s repoisitory - """ - return self.default_dict_repo["rlw"] - - def alien(self): - """Alien"s slackbuilds repository - """ - return self.default_dict_repo["alien"] - - def slacky(self): - """Slacky.eu repository - """ - return self.default_dict_repo["slacky"] - - def studioware(self): - """Studioware repository - """ - return self.default_dict_repo["studio"] - - def slackers(self): - """Slackers.it repository - """ - return self.default_dict_repo["slackr"] - - def slackonly(self): - """Slackonly.com repository - """ - return self.default_dict_repo["slonly"] - - def ktown(self): - """Alien"s ktown repository - """ - return self.default_dict_repo["ktown"] - - def multi(self): - """Alien"s multilib repository - """ - return self.default_dict_repo["multi"] - - def slacke(self): - """Slacke slacke{17|18} repository - """ - return self.default_dict_repo["slacke"] - - def salix(self): - """SalixOS salix repository - """ - return self.default_dict_repo["salix"] - - def slackel(self): - """Slackel.gr slackel repository - """ - return self.default_dict_repo["slackl"] - - def restricted(self): - """Slackel.gr slackel repository - """ - return self.default_dict_repo["rested"] - - def msb(self): - """MSB mate repository - """ - return self.default_dict_repo["msb"]