コード例 #1
0
ファイル: patches.py プロジェクト: omdbsd/slpkg
def store(*args):
    '''
    Store and return packages for upgrading
    '''
    (dwn, upgrade, comp_sum, uncomp_sum) = ([] for i in range(4))
    if args[4] == "stable":  # stables versions upgrade
        for name, loc, comp, uncomp in zip(args[0], args[1], args[2], args[3]):
            if (not os.path.isfile(pkg_path + name[:-4])
                    and split_package(name)[0] not in BlackList().packages()):
                dwn.append("{0}{1}/{2}".format(mirrors("", "", args[4]), loc,
                                               name))
                comp_sum.append(comp)
                uncomp_sum.append(uncomp)
                upgrade.append(name)
    else:  # current version upgrade
        installed = []
        # get all installed packages and store the package name.
        for pkg in os.listdir(pkg_path):
            installed.append(split_package(pkg)[0])
        for name, loc, comp, uncomp in zip(args[0], args[1], args[2], args[3]):
            # If the package from the current repository is installed
            # (check with the name) but not is in the path (check with
            # all package like 'apr-1.5.0-x86_64-1') then add to list for
            # upgrade.
            # etc. 'apr' in list 'installed' ?? if yes 'apr-1.5.0-x86_64-1'
            # exist in /var/log/packages ?? if no add to upgrade.
            if split_package(name)[0] in installed:
                if (not os.path.isfile(pkg_path + name[:-4]) and
                        split_package(name)[0] not in BlackList().packages()):
                    dwn.append("{0}{1}/{2}".format(mirrors("", "", args[4]),
                                                   loc, name))
                    comp_sum.append(comp)
                    uncomp_sum.append(uncomp)
                    upgrade.append(name)
    return [dwn, upgrade, comp_sum, uncomp_sum]
コード例 #2
0
ファイル: patches.py プロジェクト: unixbhaskar/slpkg
def store(*args):
    '''
    Store and return packages for upgrading
    '''
    (dwn, upgrade, comp_sum, uncomp_sum) = ([] for i in range(4))
    if args[4] == "stable":    # stables versions upgrade
        for name, loc, comp, uncomp in zip(args[0], args[1], args[2], args[3]):
            if (not os.path.isfile(pkg_path + name[:-4]) and split_package(
                    name)[0] not in BlackList().packages()):
                dwn.append("{0}{1}/{2}".format(
                    mirrors("", "", args[4]), loc, name))
                comp_sum.append(comp)
                uncomp_sum.append(uncomp)
                upgrade.append(name)
    else:   # current version upgrade
        installed = []
        # get all installed packages and store the package name.
        for pkg in os.listdir(pkg_path):
            installed.append(split_package(pkg)[0])
        for name, loc, comp, uncomp in zip(args[0], args[1], args[2], args[3]):
            # If the package from the current repository is installed
            # (check with the name) but not is in the path (check with
            # all package like 'apr-1.5.0-x86_64-1') then add to list for
            # upgrade.
            # etc. 'apr' in list 'installed' ?? if yes 'apr-1.5.0-x86_64-1'
            # exist in /var/log/packages ?? if no add to upgrade.
            if split_package(name)[0] in installed:
                if (not os.path.isfile(pkg_path + name[:-4]) and
                        split_package(name)[0] not in BlackList().packages()):
                    dwn.append("{0}{1}/{2}".format(
                        mirrors("", "", args[4]), loc, name))
                    comp_sum.append(comp)
                    uncomp_sum.append(uncomp)
                    upgrade.append(name)
    return [dwn, upgrade, comp_sum, uncomp_sum]
コード例 #3
0
ファイル: install.py プロジェクト: omdbsd/slpkg
 def __init__(self, slack_pkg, version):
     self.slack_pkg = slack_pkg
     self.version = version
     self.tmp_path = slpkg_tmp + "packages/"
     print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
         CYAN, self.slack_pkg, ENDC))
     sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
     sys.stdout.flush()
     if not os.path.exists(slpkg_tmp):
         os.mkdir(slpkg_tmp)
     if not os.path.exists(self.tmp_path):
         os.mkdir(self.tmp_path)
     PACKAGES = URL(mirrors("PACKAGES.TXT", "", self.version)).reading()
     EXTRA = URL(mirrors("PACKAGES.TXT", "extra/", self.version)).reading()
     PASTURE = URL(mirrors("PACKAGES.TXT", "pasture/",
                           self.version)).reading()
     self.PACKAGES_TXT = PACKAGES + EXTRA + PASTURE
コード例 #4
0
ファイル: patches.py プロジェクト: omdbsd/slpkg
 def __init__(self, version):
     self.version = version
     self.patch_path = slpkg_tmp + "patches/"
     sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
     sys.stdout.flush()
     if not os.path.exists(slpkg_tmp):
         os.mkdir(slpkg_tmp)
     if not os.path.exists(self.patch_path):
         os.mkdir(self.patch_path)
     if version == "stable":
         self.PACKAGES_TXT = URL(
             mirrors("PACKAGES.TXT", "patches/", version)).reading()
         self.step = 100
     else:
         self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "",
                                         version)).reading()
         self.step = 700
コード例 #5
0
ファイル: patches.py プロジェクト: unixbhaskar/slpkg
 def __init__(self, version):
     self.version = version
     self.patch_path = slpkg_tmp + "patches/"
     sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
     sys.stdout.flush()
     if not os.path.exists(slpkg_tmp):
         os.mkdir(slpkg_tmp)
     if not os.path.exists(self.patch_path):
         os.mkdir(self.patch_path)
     if version == "stable":
         self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "patches/",
                                         version)).reading()
         self.step = 100
     else:
         self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "",
                                         version)).reading()
         self.step = 700
コード例 #6
0
ファイル: install.py プロジェクト: unixbhaskar/slpkg
 def __init__(self, slack_pkg, version):
     self.slack_pkg = slack_pkg
     self.version = version
     self.tmp_path = slpkg_tmp + "packages/"
     print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
           CYAN, self.slack_pkg, ENDC))
     sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
     sys.stdout.flush()
     if not os.path.exists(slpkg_tmp):
         os.mkdir(slpkg_tmp)
     if not os.path.exists(self.tmp_path):
         os.mkdir(self.tmp_path)
     PACKAGES = URL(mirrors("PACKAGES.TXT", "", self.version)).reading()
     EXTRA = URL(mirrors("PACKAGES.TXT", "extra/", self.version)).reading()
     PASTURE = URL(mirrors("PACKAGES.TXT", "pasture/",
                           self.version)).reading()
     self.PACKAGES_TXT = PACKAGES + EXTRA + PASTURE
コード例 #7
0
ファイル: install.py プロジェクト: unixbhaskar/slpkg
def store(*args):
    '''
    Store and return packages for install
    '''
    dwn, install, comp_sum, uncomp_sum = ([] for i in range(4))
    for name, loc, comp, uncomp in zip(args[0], args[1], args[2], args[3]):
        if args[4] in name and args[4] not in BlackList().packages():
            dwn.append("{0}{1}/{2}".format(mirrors("", "", args[5]), loc, name))
            install.append(name)
            comp_sum.append(comp)
            uncomp_sum.append(uncomp)
    return [dwn, install, comp_sum, uncomp_sum]
コード例 #8
0
ファイル: install.py プロジェクト: omdbsd/slpkg
def store(*args):
    '''
    Store and return packages for install
    '''
    dwn, install, comp_sum, uncomp_sum = ([] for i in range(4))
    for name, loc, comp, uncomp in zip(args[0], args[1], args[2], args[3]):
        if args[4] in name and args[4] not in BlackList().packages():
            dwn.append("{0}{1}/{2}".format(mirrors("", "", args[5]), loc,
                                           name))
            install.append(name)
            comp_sum.append(comp)
            uncomp_sum.append(uncomp)
    return [dwn, install, comp_sum, uncomp_sum]
コード例 #9
0
ファイル: patches.py プロジェクト: fatman2021/slpkg
 def __init__(self, skip, flag):
     self.skip = skip
     self.flag = flag
     self.meta = _meta_
     self.version = self.meta.slack_rel
     self.patch_path = self.meta.slpkg_tmp_patches
     self.pkg_for_upgrade = []
     self.dwn_links = []
     self.upgrade_all = []
     self.count_added = 0
     self.count_upg = 0
     self.upgraded = []
     self.installed = []
     self.comp_sum = []
     self.uncomp_sum = []
     self.utils = Utils()
     Msg().checking()
     if self.version == "stable":
         self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT",
                                         "patches/")).reading()
     else:
         self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "")).reading()
コード例 #10
0
ファイル: patches.py プロジェクト: fatman2021/slpkg
 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