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)
def view(self, repo): """ View repository information """ status = "{0}disabled{1}".format(self.meta.color["RED"], self.meta.color["ENDC"]) self.form["Status:"] = status self.form["Default:"] = "no" if repo in self.meta.default_repositories: self.form["Default:"] = "yes" if (repo in self.meta.repositories and os.path.isfile(self.meta.lib_path + "{0}_repo/PACKAGES." "TXT".format(repo))): status = "{0}enabled{1}".format(self.meta.color["GREEN"], self.meta.color["ENDC"]) if repo != "sbo": data = self.repository_data(repo) size = units(data[1], data[2]) self.form["Repo id:"] = repo self.form["Repo url:"] = self.all_repos[repo] self.form["Total compressed packages:"] = "{0} {1}".format( str(size[1][0]), str(size[0][0])) self.form["Total uncompressed packages:"] = "{0} {1}".format( str(size[1][1]), str(size[0][1])) self.form["Number of packages:"] = data[0] self.form["Status:"] = status self.form["Last updated:"] = data[3] elif (repo == "sbo" and os.path.isfile(self.meta.lib_path + "{0}_repo/" "SLACKBUILDS.TXT".format(repo))): status = "{0}enabled{1}".format(self.meta.color["GREEN"], self.meta.color["ENDC"]) sum_sbo_pkgs = 0 for line in (Utils().read_file(self.meta.lib_path + "sbo_repo/SLACKBUILDS." "TXT").splitlines()): if line.startswith("SLACKBUILD NAME: "): sum_sbo_pkgs += 1 changelog_txt = Utils().read_file(self.meta.log_path + "sbo/ChangeLog.txt") last_upd = changelog_txt.split("\n", 1)[0] self.form["Repo id:"] = repo self.form["Repo url:"] = self.all_repos[repo] self.form["Total compressed packages:"] = "" self.form["Total uncompressed packages:"] = "" self.form["Number of packages:"] = sum_sbo_pkgs self.form["Status:"] = status self.form["Last updated:"] = last_upd print("") for key, value in sorted(self.form.iteritems()): print self.meta.color["GREY"] + key + self.meta.color["ENDC"], value print("") raise SystemExit()
def view(self, repo): """ View repository information """ status = "{0}disabled{1}".format(self.meta.color["RED"], self.meta.color["ENDC"]) self.form["Status:"] = status self.form["Default:"] = "no" if repo in self.meta.default_repositories: self.form["Default:"] = "yes" if (repo in self.meta.repositories and os.path.isfile(self.meta.lib_path + "{0}_repo/PACKAGES." "TXT".format(repo))): status = "{0}enabled{1}".format(self.meta.color["GREEN"], self.meta.color["ENDC"]) if repo != "sbo": data = self.repository_data(repo) size = units(data[1], data[2]) self.form["Repo id:"] = repo self.form["Repo url:"] = self.all_repos[repo] self.form["Total compressed packages:"] = "{0} {1}".format( str(size[1][0]), str(size[0][0])) self.form["Total uncompressed packages:"] = "{0} {1}".format( str(size[1][1]), str(size[0][1])) self.form["Number of packages:"] = data[0] self.form["Status:"] = status self.form["Last updated:"] = data[3] elif (repo == "sbo" and os.path.isfile(self.meta.lib_path + "{0}_repo/" "SLACKBUILDS.TXT".format(repo))): status = "{0}enabled{1}".format(self.meta.color["GREEN"], self.meta.color["ENDC"]) sum_sbo_pkgs = 0 for line in (Utils().read_file( self.meta.lib_path + "sbo_repo/SLACKBUILDS." "TXT").splitlines()): if line.startswith("SLACKBUILD NAME: "): sum_sbo_pkgs += 1 changelog_txt = Utils().read_file( self.meta.log_path + "sbo/ChangeLog.txt") last_upd = changelog_txt.split("\n", 1)[0] self.form["Repo id:"] = repo self.form["Repo url:"] = self.all_repos[repo] self.form["Total compressed packages:"] = "" self.form["Total uncompressed packages:"] = "" self.form["Number of packages:"] = sum_sbo_pkgs self.form["Status:"] = status self.form["Last updated:"] = last_upd print("") for key, value in sorted(self.form.iteritems()): print self.meta.color["GREY"] + key + self.meta.color["ENDC"], value print("") raise SystemExit()
def start(self): """ Install new patches from official Slackware mirrors """ self.store() self.msg.done() if self.upgrade_all: if "--checklist" in self.flag: self.dialog_checklist() print("\nThese packages need upgrading:\n") self.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")) self.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, self.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 self.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() self.msg.reference(self.installed, self.upgraded) delete_package(self.patch_path, self.upgrade_all) self.update_lists() else: slack_arch = "" if self.meta.arch == "x86_64": slack_arch = "64" print("\nSlackware{0} '{1}' v{2} distribution is up to " "date\n".format(slack_arch, self.version, slack_ver()))
def start(self, if_upgrade): """ Install packages from official Slackware distribution """ self.case_insensitive() # fix if packages is for upgrade self.if_upgrade = if_upgrade mas_sum = dep_sum = sums = [0, 0, 0] self.msg.done() self.dependencies = self.resolving_deps() self.update_deps() (self.dep_dwn, self.dep_install, self.dep_comp_sum, self.dep_uncomp_sum) = self.store(self.dependencies) self.clear_masters() (self.dwn, self.install, self.comp_sum, self.uncomp_sum) = self.store(self.packages) if (self.meta.rsl_deps in ["on", "ON"] and "--resolve-off" not in self.flag): self.msg.done() if self.install: print("\nThe following packages will be automatically " "installed or upgraded \nwith new version:\n") self.top_view() self.msg.upg_inst(self.if_upgrade) mas_sum = self.views(self.install, self.comp_sum) if self.dependencies: print("Installing for dependencies:") dep_sum = self.views(self.dep_install, self.dep_comp_sum) # sums[0] --> installed # sums[1] --> upgraded # sums[2] --> uninstall sums = [sum(i) for i in zip(mas_sum, dep_sum)] unit, size = units(self.comp_sum + self.dep_comp_sum, self.uncomp_sum + self.dep_uncomp_sum) print("\nInstalling summary") print("=" * 79) print("{0}Total {1} {2}.".format(self.meta.color["GREY"], sum(sums), self.msg.pkg(sum(sums)))) print("{0} {1} will be installed, {2} will be upgraded and " "{3} will be reinstalled.".format(sums[2], self.msg.pkg(sums[2]), sums[1], sums[0])) 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 self.msg.answer() in ["y", "Y"]: self.install.reverse() Download(self.tmp_path, self.dep_dwn + self.dwn, self.repo).start() if "--download-only" in self.flag: raise SystemExit() self.dep_install = Utils().check_downloaded( self.tmp_path, self.dep_install) self.install = Utils().check_downloaded( self.tmp_path, self.install) ins, upg = self.install_packages() self.msg.reference(ins, upg) write_deps(self.deps_dict) delete_package(self.tmp_path, self.install) else: self.msg.not_found(self.if_upgrade)
def start(self, is_upgrade): """ Install packages from official Slackware distribution """ self.case_insensitive() # fix if packages is for upgrade self.is_upgrade = is_upgrade mas_sum = dep_sum = sums = [0, 0, 0] self.msg.done() self.dependencies = self.resolving_deps() self.update_deps() (self.dep_dwn, self.dep_install, self.dep_comp_sum, self.dep_uncomp_sum) = self.store(self.dependencies) self.clear_masters() (self.dwn, self.install, self.comp_sum, self.uncomp_sum) = self.store(self.packages) if (self.meta.rsl_deps in ["on", "ON"] and "--resolve-off" not in self.flag): self.msg.done() if self.install: print("\nThe following packages will be automatically " "installed or upgraded \nwith new version:\n") if self.matching: self.msg.matching(self.packages) self.top_view() self.msg.upg_inst(self.is_upgrade) mas_sum = self.views(self.install, self.comp_sum) if self.dependencies: print("Installing for dependencies:") dep_sum = self.views(self.dep_install, self.dep_comp_sum) # sums[0] --> installed # sums[1] --> upgraded # sums[2] --> uninstall sums = [sum(i) for i in zip(mas_sum, dep_sum)] unit, size = units(self.comp_sum + self.dep_comp_sum, self.uncomp_sum + self.dep_uncomp_sum) print("\nInstalling summary") print("=" * 79) print("{0}Total {1} {2}.".format(self.meta.color["GREY"], sum(sums), self.msg.pkg(sum(sums)))) print("{0} {1} will be installed, {2} will be upgraded and " "{3} will be reinstalled.".format(sums[2], self.msg.pkg(sums[2]), sums[1], sums[0])) 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("") self.if_all_installed() if self.msg.answer() in ["y", "Y"]: for inst, dwn in zip(self.dep_install + self.install, self.dep_dwn + self.dwn): if (self.meta.not_downgrade == "on" and self.not_downgrade(inst) is True): continue if (not os.path.isfile(self.meta.pkg_path + inst[:-4]) or "--download-only" in self.flag or "--reinstall" in self.flag): Download(self.tmp_path, dwn.split(), self.repo).start() else: self.msg.template(78) self.msg.pkg_found(inst) self.msg.template(78) if "--download-only" in self.flag: raise SystemExit() self.dep_install = Utils().check_downloaded( self.tmp_path, self.dep_install) self.install = Utils().check_downloaded( self.tmp_path, self.install) ins, upg = self.install_packages() self.msg.reference(ins, upg) write_deps(self.deps_dict) delete_package(self.tmp_path, self.dep_install + self.install) else: self.msg.not_found(self.is_upgrade) raise SystemExit(1)