Exemple #1
0
def pkg_upgrade(repo, skip, flag):
    """
    Checking packages for upgrade
    """
    Msg().checking()
    PACKAGES_TXT = RepoInit(repo).fetch()[0]
    pkgs_for_upgrade = []
    # name = data[0]
    # location = data[1]
    # size = data[2]
    # unsize = data[3]
    data = repo_data(PACKAGES_TXT, repo, flag="")
    for pkg in installed():
        status(0.0005)
        inst_pkg = split_package(pkg)
        for name in data[0]:
            if name:    # this tips because some pkg_name is empty
                repo_pkg = split_package(name[:-4])
            if (repo_pkg[0] == inst_pkg[0] and
                LooseVersion(repo_pkg[1]) > LooseVersion(inst_pkg[1]) and
                repo_pkg[3] >= inst_pkg[3] and
                    inst_pkg[0] not in skip and
                    repo_pkg[1] != "blacklist"):
                pkgs_for_upgrade.append(repo_pkg[0])
    Msg().done()
    if "--checklist" in flag:
        pkgs_for_upgrade = choose_upg(pkgs_for_upgrade)
    return pkgs_for_upgrade
Exemple #2
0
def pkg_upgrade(repo, skip, flag):
    """Checking packages for upgrade
    """
    Msg().checking()
    PACKAGES_TXT = RepoInit(repo).fetch()[0]
    pkgs_for_upgrade = []
    # name = data[0]
    # location = data[1]
    # size = data[2]
    # unsize = data[3]
    data = repo_data(PACKAGES_TXT, repo, flag="")
    for pkg in installed():
        status(0.0005)
        inst_pkg = split_package(pkg)
        for name in data[0]:
            if name:  # this tips because some pkg_name is empty
                repo_pkg = split_package(name[:-4])
            if (repo_pkg[0] == inst_pkg[0]
                    and LooseVersion(repo_pkg[1]) > LooseVersion(inst_pkg[1])
                    and repo_pkg[3] >= inst_pkg[3] and inst_pkg[0] not in skip
                    and repo_pkg[1] != "blacklist"):
                pkgs_for_upgrade.append(repo_pkg[0])
    Msg().done()
    if "--checklist" in flag:
        pkgs_for_upgrade = choose_upg(pkgs_for_upgrade)
    return pkgs_for_upgrade
Exemple #3
0
 def __init__(self, packages, repo, flag):
     self.packages = packages
     pkg_security(packages)
     self.repo = repo
     self.flag = flag
     self.meta = _meta_
     self.msg = Msg()
     self.version = self.meta.slack_rel
     self.tmp_path = self.meta.slpkg_tmp_packages
     for fl in self.flag:
         if fl.startswith("--directory-prefix="):
             self.tmp_path = fl.split("=")[1]
             if not self.tmp_path.endswith("/"):
                 self.tmp_path += "/"
     self.dwn, self.dep_dwn = [], []
     self.install, self.dep_install = [], []
     self.comp_sum, self.dep_comp_sum = [], []
     self.uncomp_sum, self.dep_uncomp_sum = [], []
     self.dependencies = []
     self.deps_dict = {}
     self.answer = ""
     self.msg.reading()
     self.PACKAGES_TXT, self.mirror = RepoInit(self.repo).fetch()
     self.data = repo_data(self.PACKAGES_TXT, self.repo, self.flag)
     self.repo_pkg_names = []
     for name in self.data[0]:
         self.repo_pkg_names.append(split_package(name)[0])
     self.blacklist = BlackList().packages(self.data[0], self.repo)
     self.matching = False
Exemple #4
0
 def __init__(self, packages, repo, flag):
     self.packages = packages
     pkg_security(packages)
     self.repo = repo
     self.flag = flag
     self.meta = _meta_
     self.msg = Msg()
     self.version = self.meta.slack_rel
     self.tmp_path = self.meta.slpkg_tmp_packages
     for fl in self.flag:
         if fl.startswith("--directory-prefix="):
             self.tmp_path = fl.split("=")[1]
             if not self.tmp_path.endswith("/"):
                 self.tmp_path += "/"
     self.dwn, self.dep_dwn = [], []
     self.install, self.dep_install = [], []
     self.comp_sum, self.dep_comp_sum = [], []
     self.uncomp_sum, self.dep_uncomp_sum = [], []
     self.dependencies = []
     self.deps_dict = {}
     self.answer = ""
     self.msg.reading()
     self.PACKAGES_TXT, self.mirror = RepoInit(self.repo).fetch()
     self.data = repo_data(self.PACKAGES_TXT, self.repo, self.flag)
     self.repo_pkg_names = []
     for name in self.data[0]:
         self.repo_pkg_names.append(split_package(name)[0])
     self.blacklist = BlackList().packages(self.data[0], self.repo)
     self.matching = False
Exemple #5
0
 def __init__(self, packages, repo, flag):
     self.packages = packages
     self.repo = repo
     self.flag = flag
     self.meta = _meta_
     self.msg = Msg()
     self.version = self.meta.slack_rel
     self.tmp_path = self.meta.slpkg_tmp_packages
     self.dwn, self.dep_dwn = [], []
     self.install, self.dep_install = [], []
     self.comp_sum, self.dep_comp_sum = [], []
     self.uncomp_sum, self.dep_uncomp_sum = [], []
     self.dependencies = []
     self.deps_dict = {}
     self.answer = ""
     self.msg.reading()
     self.PACKAGES_TXT, self.mirror = RepoInit(self.repo).fetch()
     self.data = repo_data(self.PACKAGES_TXT, self.repo, self.flag)
     self.blacklist = BlackList().packages(self.data[0], self.repo)
Exemple #6
0
 def store(self):
     """
     Store and return packages for upgrading
     """
     data = repo_data(self.PACKAGES_TXT, "slack", self.flag)
     black = BlackList().packages(pkgs=data[0], repo="slack")
     for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]):
         status(0.0003)
         repo_pkg_name = split_package(name)[0]
         if (not os.path.isfile(self.meta.pkg_path + name[:-4]) and
                 repo_pkg_name not in black and
                 repo_pkg_name not in self.skip):
             self.dwn_links.append("{0}{1}/{2}".format(mirrors("", ""),
                                                       loc, name))
             self.comp_sum.append(comp)
             self.uncomp_sum.append(uncomp)
             self.upgrade_all.append(name)
             self.count_upg += 1
             if not find_package(repo_pkg_name, self.meta.pkg_path):
                 self.count_added += 1
                 self.count_upg -= 1
     return self.count_upg
Exemple #7
0
 def store(self):
     """
     Store and return packages for upgrading
     """
     data = repo_data(self.PACKAGES_TXT, "slack", self.flag)
     black = BlackList().packages(pkgs=data[0], repo="slack")
     for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]):
         status(0.0003)
         repo_pkg_name = split_package(name)[0]
         if (not os.path.isfile(self.meta.pkg_path + name[:-4])
                 and repo_pkg_name not in black
                 and repo_pkg_name not in self.skip):
             self.dwn_links.append("{0}{1}/{2}".format(
                 mirrors("", ""), loc, name))
             self.comp_sum.append(comp)
             self.uncomp_sum.append(uncomp)
             self.upgrade_all.append(name)
             self.count_upg += 1
             if not find_package(repo_pkg_name + self.meta.sp,
                                 self.meta.pkg_path):
                 self.count_added += 1
                 self.count_upg -= 1
     return self.count_upg