Пример #1
0
 def slack(self):
     """Creating slack local libraries
     """
     log = self.log_path + "slack/"
     lib = self.lib_path + "slack_repo/"
     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)
     dirs = ["core/", "extra/", "pasture/", "patches/"]
     for d in dirs:
         if not os.path.exists(lib + d):
             os.mkdir(lib + d)
     PACKAGES_TXT = mirrors(lib_file, "")
     FILELIST_TXT = ""
     CHECKSUMS_MD5 = mirrors(md5_file, "")
     self.EXTRA = mirrors(lib_file, dirs[1])
     self.EXT_CHECKSUMS = mirrors(md5_file, dirs[1])
     self.PASTURE = mirrors(lib_file, dirs[2])
     self.PAS_CHECKSUMS = mirrors(md5_file, dirs[2])
     self.PATCHES = mirrors(lib_file, dirs[3])
     self.PAT_CHECKSUMS = mirrors(md5_file, dirs[3])
     ChangeLog_txt = mirrors(log_file, "")
     if self.check:
         return self.checks_logs(log, ChangeLog_txt)
     self.down(lib + dirs[0], PACKAGES_TXT, repo_name)
     self.down(lib + dirs[0], CHECKSUMS_MD5, repo_name)
     self.down(lib + dirs[1], self.EXTRA, repo_name)
     self.down(lib + dirs[1], self.EXT_CHECKSUMS, repo_name)
     if slack_ver() != "14.0":   # no pasture/ folder for 14.0 version
         self.down(lib + dirs[2], self.PASTURE, repo_name)
         self.down(lib + dirs[2], self.PAS_CHECKSUMS, repo_name)
     self.down(lib + dirs[3], self.PATCHES, repo_name)
     self.down(lib + dirs[3], self.PAT_CHECKSUMS, repo_name)
     self.down(log, ChangeLog_txt, repo_name)
     self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
                 FILELIST_TXT, repo_name)
     self.merge(lib, "PACKAGES.TXT", ["core/PACKAGES.TXT",
                                      "extra/PACKAGES.TXT",
                                      "pasture/PACKAGES.TXT",
                                      "patches/PACKAGES.TXT"])
     self.merge(lib, "CHECKSUMS.md5", ["core/CHECKSUMS.md5",
                                       "extra/CHECKSUMS.md5",
                                       "pasture/CHECKSUMS.md5",
                                       "patches/CHECKSUMS_md5"])
Пример #2
0
 def slack(self):
     """Creating slack local libraries
     """
     log = self.log_path + "slack/"
     lib = self.lib_path + "slack_repo/"
     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)
     dirs = ["core/", "extra/", "pasture/", "patches/"]
     for d in dirs:
         if not os.path.exists(lib + d):
             os.mkdir(lib + d)
     PACKAGES_TXT = mirrors(lib_file, "")
     FILELIST_TXT = ""
     CHECKSUMS_MD5 = mirrors(md5_file, "")
     self.EXTRA = mirrors(lib_file, dirs[1])
     self.EXT_CHECKSUMS = mirrors(md5_file, dirs[1])
     self.PASTURE = mirrors(lib_file, dirs[2])
     self.PAS_CHECKSUMS = mirrors(md5_file, dirs[2])
     self.PATCHES = mirrors(lib_file, dirs[3])
     self.PAT_CHECKSUMS = mirrors(md5_file, dirs[3])
     ChangeLog_txt = mirrors(log_file, "")
     if self.check:
         return self.checks_logs(log, ChangeLog_txt)
     self.down(lib + dirs[0], PACKAGES_TXT, repo_name)
     self.down(lib + dirs[0], CHECKSUMS_MD5, repo_name)
     self.down(lib + dirs[1], self.EXTRA, repo_name)
     self.down(lib + dirs[1], self.EXT_CHECKSUMS, repo_name)
     if slack_ver() != "14.0":   # no pasture/ folder for 14.0 version
         self.down(lib + dirs[2], self.PASTURE, repo_name)
         self.down(lib + dirs[2], self.PAS_CHECKSUMS, repo_name)
     self.down(lib + dirs[3], self.PATCHES, repo_name)
     self.down(lib + dirs[3], self.PAT_CHECKSUMS, repo_name)
     self.down(log, ChangeLog_txt, repo_name)
     self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
                 FILELIST_TXT, repo_name)
     self.merge(lib, "PACKAGES.TXT", ["core/PACKAGES.TXT",
                                      "extra/PACKAGES.TXT",
                                      "pasture/PACKAGES.TXT",
                                      "patches/PACKAGES.TXT"])
     self.merge(lib, "CHECKSUMS.md5", ["core/CHECKSUMS.md5",
                                       "extra/CHECKSUMS.md5",
                                       "pasture/CHECKSUMS.md5",
                                       "patches/CHECKSUMS_md5"])
Пример #3
0
def pkg_checksum(binary, repo):
    """Return checksum from CHECKSUMS.md5 file by repository
    """
    md5 = "None"
    if repo == "slack_patches" and _meta_.slack_rel == "stable":
        CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "patches/")).reading()
    elif repo == "slack_patches" and _meta_.slack_rel == "current":
        CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "")).reading()
    elif repo == "slpkg":
        CHECKSUMS_md5 = URL(_meta_.CHECKSUMS_link).reading()
    else:
        lib = "{0}{1}_repo/CHECKSUMS.md5".format(_meta_.lib_path, repo)
        f = open(lib, "r")
        CHECKSUMS_md5 = f.read()
        f.close()
    for line in CHECKSUMS_md5.splitlines():
        if line.endswith("/{0}".format(binary)):
            md5 = line.split()[0]
    return md5
Пример #4
0
def pkg_checksum(binary, repo):
    """Return checksum from CHECKSUMS.md5 file by repository
    """
    md5 = "None"
    if repo == "slack_patches" and _meta_.slack_rel == "stable":
        CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "patches/")).reading()
    elif repo == "slack_patches" and _meta_.slack_rel == "current":
        CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "")).reading()
    elif repo == "slpkg":
        CHECKSUMS_md5 = URL(_meta_.CHECKSUMS_link).reading()
    else:
        lib = "{0}{1}_repo/CHECKSUMS.md5".format(_meta_.lib_path, repo)
        f = open(lib, "r")
        CHECKSUMS_md5 = f.read()
        f.close()
    for line in CHECKSUMS_md5.splitlines():
        if line.endswith("/{0}".format(binary)):
            md5 = line.split()[0]
    return md5
Пример #5
0
 def __init__(self, skip, flag):
     self.skip = skip
     self.flag = flag
     self.meta = _meta_
     self.msg = Msg()
     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()
     self.msg.checking()
     if self.version == "stable":
         self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT",
                                         "patches/")).reading()
     else:
         self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "")).reading()
Пример #6
0
 def slackpkg_update(self):
     """This replace slackpkg ChangeLog.txt file with new
     from Slackware official mirrors after update distribution.
     """
     NEW_ChangeLog_txt = URL(mirrors("ChangeLog.txt", "")).reading()
     if os.path.isfile(self.meta.slackpkg_lib_path + "ChangeLog.txt.old"):
         os.remove(self.meta.slackpkg_lib_path + "ChangeLog.txt.old")
     if os.path.isfile(self.meta.slackpkg_lib_path + "ChangeLog.txt"):
         shutil.copy2(self.meta.slackpkg_lib_path + "ChangeLog.txt",
                      self.meta.slackpkg_lib_path + "ChangeLog.txt.old")
         os.remove(self.meta.slackpkg_lib_path + "ChangeLog.txt")
     with open(self.meta.slackpkg_lib_path + "ChangeLog.txt", "w") as log:
         log.write(NEW_ChangeLog_txt)
         log.close()
Пример #7
0
 def __init__(self, skip, flag):
     self.skip = skip
     self.flag = flag
     self.meta = _meta_
     self.msg = Msg()
     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()
     self.msg.checking()
     if self.version == "stable":
         self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT",
                                         "patches/")).reading()
     else:
         self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "")).reading()
Пример #8
0
 def slackpkg_update(self):
     """This replace slackpkg ChangeLog.txt file with new
     from Slackware official mirrors after update distribution.
     """
     NEW_ChangeLog_txt = URL(mirrors("ChangeLog.txt", "")).reading()
     if os.path.isfile(self.meta.slackpkg_lib_path + "ChangeLog.txt.old"):
         os.remove(self.meta.slackpkg_lib_path + "ChangeLog.txt.old")
     if os.path.isfile(self.meta.slackpkg_lib_path + "ChangeLog.txt"):
         shutil.copy2(self.meta.slackpkg_lib_path + "ChangeLog.txt",
                      self.meta.slackpkg_lib_path + "ChangeLog.txt.old")
         os.remove(self.meta.slackpkg_lib_path + "ChangeLog.txt")
     with open(self.meta.slackpkg_lib_path + "ChangeLog.txt", "w") as log:
                 log.write(NEW_ChangeLog_txt)
                 log.close()
Пример #9
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
Пример #10
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
Пример #11
0
 def _init_slack(self):
     self.mirror = mirrors(name="", location="")
Пример #12
0
 def _init_slack(self):
     self.mirror = mirrors(name="", location="")