Example #1
0
 def command_repo_add(self):
     """Add custom repositories
     """
     if len(self.args) == 3 and self.args[0] == "repo-add":
         Repo().add(self.args[1], self.args[2])
     else:
         usage("")
Example #2
0
 def command_repo_remove(self):
     """Remove custom repositories
     """
     if len(self.args) == 2 and self.args[0] == "repo-remove":
         Repo().remove(self.args[1])
     else:
         usage("")
Example #3
0
 def __init__(self):
     self.form = {
         "Last updated:": "",
         "Number of packages:": "",
         "Repo id:": "",
         "Default:": "",
         "Repo url:": "",
         "Status:": "",
         "Total compressed packages:": "",
         "Total uncompressed packages:": ""
     }
     self.meta = _meta_
     self.all_repos = Repo().default_repository()
     self.all_repos["slack"] = Repo().slack()
     self.all_repos.update(Repo().custom_repository())
     del RepoList().all_repos
Example #4
0
 def custom(self, name):
     """Creating user select repository local library
     """
     repo = Repo().custom_repository()[name]
     log = self.log_path + name + "/"
     lib = self.lib_path + "{0}_repo/".format(name)
     repo_name = log[:-1].split("/")[-1]
     lib_file = "PACKAGES.TXT"
     # lst_file = ""
     md5_file = "CHECKSUMS.md5"
     log_file = "ChangeLog.txt"
     if not os.path.exists(log):
         os.mkdir(log)
     if not os.path.exists(lib):
         os.mkdir(lib)
     PACKAGES_TXT = "{0}{1}".format(repo, lib_file)
     FILELIST_TXT = ""
     CHECKSUMS_MD5 = "{0}{1}".format(repo, md5_file)
     ChangeLog_txt = "{0}{1}".format(repo, log_file)
     if self.check:
         return self.checks_logs(log, ChangeLog_txt)
     self.down(lib, PACKAGES_TXT, repo_name)
     self.down(lib, CHECKSUMS_MD5, repo_name)
     self.down(log, ChangeLog_txt, repo_name)
     self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
                 FILELIST_TXT, repo_name)
Example #5
0
 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
     self.tmp_path = self.meta.tmp_path
     self.build_path = self.meta.build_path
     self._SOURCES = self.meta.SBo_SOURCES
     self.slpkg_tmp_packages = self.meta.slpkg_tmp_packages
     self.slpkg_tmp_patches = self.meta.slpkg_tmp_patches
     if not os.path.exists(self.conf_path):
         os.mkdir(self.conf_path)
     if not os.path.exists(self.log_path):
         os.mkdir(self.log_path)
     if not os.path.exists(self.lib_path):
         os.mkdir(self.lib_path)
     if not os.path.exists(self.tmp_path):
         os.mkdir(self.tmp_path)
     if not os.path.exists(self.build_path):
         os.makedirs(self.build_path)
     if not os.path.exists(self._SOURCES):
         os.makedirs(self._SOURCES)
     if not os.path.exists(self.slpkg_tmp_packages):
         os.makedirs(self.slpkg_tmp_packages)
     if not os.path.exists(self.slpkg_tmp_patches):
         os.makedirs(self.slpkg_tmp_patches)
Example #6
0
def check_for_local_repos(repo):
    """Check if repository is local
    """
    repos_dict = Repo().default_repository()
    if repo in repos_dict:
        repo_url = repos_dict[repo]
        if repo_url.startswith("file:///"):
            return True
Example #7
0
def sbo_search_pkg(name):
    """Search for package path from SLACKBUILDS.TXT file and
    return url
    """
    repo = Repo().default_repository()["sbo"]
    sbo_url = "{0}{1}/".format(repo, slack_ver())
    SLACKBUILDS_TXT = Utils().read_file(_meta_.lib_path +
                                        "sbo_repo/SLACKBUILDS.TXT")
    for line in SLACKBUILDS_TXT.splitlines():
        if line.startswith("SLACKBUILD LOCATION"):
            sbo_name = (line[23:].split("/")[-1].replace("\n", "")).strip()
            if name == sbo_name:
                return (sbo_url + line[23:].strip() + "/")
    return ""
Example #8
0
def mirrors(name, location):
    """
    Select Slackware official mirror packages
    based architecture and version.
    """
    rel = _meta_.slack_rel
    ver = slack_ver()
    repo = Repo().slack()
    if _meta_.arch == "x86_64":
        if rel == "stable":
            http = repo + "slackware64-{0}/{1}{2}".format(ver, location, name)
        else:
            http = repo + "slackware64-{0}/{1}{2}".format(rel, location, name)
    elif _meta_.arch.startswith("arm"):
        if rel == "stable":
            http = repo + "slackwarearm-{0}/{1}{2}".format(ver, location, name)
        else:
            http = repo + "slackwarearm-{0}/{1}{2}".format(rel, location, name)
    else:
        if rel == "stable":
            http = repo + "slackware-{0}/{1}{2}".format(ver, location, name)
        else:
            http = repo + "slackware-{0}/{1}{2}".format(rel, location, name)
    return http
Example #9
0
 def _init_custom(self):
     self.mirror = "{0}".format(Repo().custom_repository()[self.repo])
Example #10
0
 def __init__(self, repo):
     self.repo = repo
     self.meta = _meta_
     self.def_repo_dict = Repo().default_repository()
     self.mirror = ""
Example #11
0
 def __init__(self):
     self.meta = _meta_
     self.msg = Msg()
     self.all_repos = Repo().default_repository()
     self.all_repos["slack"] = Repo().slack()
     self.all_repos.update(Repo().custom_repository())