예제 #1
0
파일: patches.py 프로젝트: fatman2021/slpkg
 def slackpkg_update(self):
     """
     This replace slackpkg ChangeLog.txt file with new
     from Slackware official mirrors after update distribution.
     """
     changelog_txt = "ChangeLog.txt"
     changelog_old = changelog_txt + ".old"
     arch = "64" if os.uname()[4] == "x86_64" else ""
     slackware_mirror = self.utils.read_config(self.utils.read_file(
         self.meta.conf_path + "slackware-changelogs-mirror"))
     slackpkg_mirror = self.utils.read_config(
         self.utils.read_file("{0}{1}".format(self.meta.slackpkg_conf,
                                              "mirrors")))
     if slackpkg_mirror and "current" in slackpkg_mirror:
         log_mirror = "{0}slackware{1}-current/{2}".format(slackware_mirror,
                                                           arch,
                                                           changelog_txt)
     else:
         log_mirror = "{0}slackware{1}-{2}/{3}".format(slackware_mirror,
                                                       arch,
                                                       slack_ver(),
                                                       changelog_txt)
     slackware_log = URL(log_mirror).reading()
     if os.path.isfile(self.meta.slackpkg_lib_path + changelog_txt):
         if os.path.isfile(self.meta.slackpkg_lib_path + changelog_old):
             os.remove(self.meta.slackpkg_lib_path + changelog_old)
         shutil.copy2(self.meta.slackpkg_lib_path + changelog_txt,
                      self.meta.slackpkg_lib_path + changelog_old)
         os.remove(self.meta.slackpkg_lib_path + changelog_txt)
         with open(self.meta.slackpkg_lib_path + changelog_txt, "w") as log:
             log.write(slackware_log)
             log.close()
예제 #2
0
파일: patches.py 프로젝트: fatman2021/slpkg
 def start(self):
     """
     Install new patches from official Slackware mirrors
     """
     try:
         self.store()
         Msg().done()
         if self.upgrade_all:
             print("\nThese packages need upgrading:\n")
             Msg().template(78)
             print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
                 "| Package", " " * 17,
                 "New Version", " " * 8,
                 "Arch", " " * 4,
                 "Build", " " * 2,
                 "Repos", " " * 10,
                 "Size"))
             Msg().template(78)
             print("Upgrading:")
             self.views()
             unit, size = units(self.comp_sum, self.uncomp_sum)
             print("\nInstalling summary")
             print("=" * 79)
             print("{0}Total {1} {2} will be upgraded and {3} will be "
                   "installed.".format(self.meta.color["GREY"],
                                       self.count_upg,
                                       Msg().pkg(self.upgrade_all),
                                       self.count_added))
             print("Need to get {0} {1} of archives.".format(size[0],
                                                             unit[0]))
             print("After this process, {0} {1} of additional disk space "
                   "will be used.{2}".format(size[1], unit[1],
                                             self.meta.color["ENDC"]))
             print("")
             if Msg().answer() in ["y", "Y"]:
                 Download(self.patch_path, self.dwn_links,
                          repo="slack").start()
                 self.upgrade_all = self.utils.check_downloaded(
                     self.patch_path, self.upgrade_all)
                 self.upgrade()
                 self.kernel()
                 if self.meta.slackpkg_log in ["on", "ON"]:
                     self.slackpkg_update()
                 Msg().reference(self.installed, self.upgraded)
                 delete(self.patch_path, self.upgrade_all)
         else:
             slack_arch = ""
             if os.uname()[4] == "x86_64":
                 slack_arch = 64
             print("\nSlackware{0} '{1}' v{2} distribution is up to "
                   "date\n".format(slack_arch, self.version, slack_ver()))
     except KeyboardInterrupt:
         print("")   # new line at exit
         sys.exit(0)
예제 #3
0
def mirrors(name, location, version):
    '''
    Select Slackware official mirror packages
    based architecture and version.
    '''
    if arch == "x86_64":
        if version == "stable":
            http = ("http://mirrors.slackware.com/slackware/slackware64-"
                    "{0}/{1}{2}".format(slack_ver(), location, name))
        else:
            http = ("http://mirrors.slackware.com/slackware/slackware64-"
                    "{0}/{1}{2}".format(version, location, name))
    else:
        if version == "stable":
            http = ("http://mirrors.slackware.com/slackware/slackware-"
                    "{0}/{1}{2}".format(slack_ver(), location, name))
        else:
            http = ("http://mirrors.slackware.com/slackware/slackware-"
                    "{0}/{1}{2}".format(version, location, name))
    return http
예제 #4
0
 def start(self):
     '''
     Install new patches from official Slackware mirrors
     '''
     try:
         data = slack_data(self.PACKAGES_TXT, self.step)
         (dwn_links, upgrade_all,
          comp_sum, uncomp_sum) = store(data[0], data[1], data[2], data[3],
                                        self.version)
         sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
         if upgrade_all:
             print("\nThese packages need upgrading:\n")
             template(78)
             print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
                 "| Package", " " * 17,
                 "Version", " " * 12,
                 "Arch", " " * 4,
                 "Build", " " * 2,
                 "Repos", " " * 10,
                 "Size"))
             template(78)
             print("Upgrading:")
             views(upgrade_all, comp_sum)
             unit, size = units(comp_sum, uncomp_sum)
             print("\nInstalling summary")
             print("=" * 79)
             print("{0}Total {1} {2} will be upgraded.".format(
                 GREY, len(upgrade_all), msgs(upgrade_all)))
             print("Need to get {0} {1} of archives.".format(size[0],
                                                             unit[0]))
             print("After this process, {0} {1} of additional disk space "
                   "will be used.{2}".format(size[1], unit[1], ENDC))
             read = raw_input("\nWould you like to upgrade [Y/n]? ")
             if read == "Y" or read == "y":
                 slack_dwn(self.patch_path, dwn_links)
                 upgrade(self.patch_path, upgrade_all)
                 kernel(upgrade_all)
                 delete(self.patch_path, upgrade_all)
         else:
             slack_arch = ""
             if os.uname()[4] == "x86_64":
                 slack_arch = 64
             print("\nSlackware{0} '{1}' v{2} distribution is up to "
                   "date\n".format(slack_arch, self.version, slack_ver()))
     except KeyboardInterrupt:
         print   # new line at exit
         sys.exit()
예제 #5
0
파일: mirrors.py 프로젝트: fatman2021/slpkg
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)
    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
예제 #6
0
파일: patches.py 프로젝트: omdbsd/slpkg
 def start(self):
     '''
     Install new patches from official Slackware mirrors
     '''
     try:
         data = slack_data(self.PACKAGES_TXT, self.step)
         (dwn_links, upgrade_all, comp_sum,
          uncomp_sum) = store(data[0], data[1], data[2], data[3],
                              self.version)
         sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
         if upgrade_all:
             print("\nThese packages need upgrading:\n")
             template(78)
             print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
                 "| Package", " " * 17, "Version", " " * 12, "Arch",
                 " " * 4, "Build", " " * 2, "Repos", " " * 10, "Size"))
             template(78)
             print("Upgrading:")
             views(upgrade_all, comp_sum)
             unit, size = units(comp_sum, uncomp_sum)
             print("\nInstalling summary")
             print("=" * 79)
             print("{0}Total {1} {2} will be upgraded.".format(
                 GREY, len(upgrade_all), msgs(upgrade_all)))
             print("Need to get {0} {1} of archives.".format(
                 size[0], unit[0]))
             print("After this process, {0} {1} of additional disk space "
                   "will be used.{2}".format(size[1], unit[1], ENDC))
             read = raw_input("\nWould you like to upgrade [Y/n]? ")
             if read == "Y" or read == "y":
                 slack_dwn(self.patch_path, dwn_links)
                 upgrade(self.patch_path, upgrade_all)
                 kernel(upgrade_all)
                 delete(self.patch_path, upgrade_all)
         else:
             slack_arch = ""
             if os.uname()[4] == "x86_64":
                 slack_arch = 64
             print("\nSlackware{0} '{1}' v{2} distribution is up to "
                   "date\n".format(slack_arch, self.version, slack_ver()))
     except KeyboardInterrupt:
         print  # new line at exit
         sys.exit()