示例#1
0
文件: check.py 项目: fatman2021/slpkg
def pkg_upgrade(repo, skip):
    """
    Checking packages for upgrade
    """
    try:
        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
                ):
                    pkgs_for_upgrade.append(repo_pkg[0])
        Msg().done()
        return pkgs_for_upgrade
    except KeyboardInterrupt:
        print("")  # new line at exit
        sys.exit(0)
示例#2
0
 def __init__(self, packages, repo, flag):
     self.packages = packages
     self.repo = repo
     self.flag = flag
     self.meta = _meta_
     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 = ""
     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)