Exemplo n.º 1
0
 def msb(self):
     """Creating MATE local library
     """
     ar = "x86"
     arch = self.meta.arch
     repo = Repo().msb()
     log = self.log_path + "msb/"
     lib = self.lib_path + "msb_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)
     if arch == "x86_64":
         ar = "x86_64"
     PACKAGES_TXT = "{0}{1}/{2}/{3}/{4}".format(
         repo, slack_ver(), self.meta.msb_sub_repo[1:-1], ar, lib_file)
     FILELIST_TXT = ""
     CHECKSUMS_MD5 = "{0}{1}/{2}/{3}/{4}".format(
         repo, slack_ver(), self.meta.msb_sub_repo[1:-1], ar, md5_file)
     ChangeLog_txt = "{0}{1}".format(repo, log_file)
     if self.check:
         return self.checks_logs(log, ChangeLog_txt)
     self.down(lib, PACKAGES_TXT, repo_name)
     self.down(lib, CHECKSUMS_MD5, repo_name)
     self.down(log, ChangeLog_txt, repo_name)
     self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
                 FILELIST_TXT, repo_name)
Exemplo n.º 2
0
 def studio(self):
     """Creating studio local library
     """
     ar = ""
     arch = self.meta.arch
     repo = Repo().studioware()
     log = self.log_path + "studio/"
     lib = self.lib_path + "studio_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)
     if arch == "x86_64":
         ar = "64"
     PACKAGES_TXT = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
                                                     lib_file)
     FILELIST_TXT = ""
     CHECKSUMS_MD5 = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
                                                      md5_file)
     ChangeLog_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
                                                      log_file)
     if self.check:
         return self.checks_logs(log, ChangeLog_txt)
     self.down(lib, PACKAGES_TXT, repo_name)
     self.down(lib, CHECKSUMS_MD5, repo_name)
     self.down(log, ChangeLog_txt, repo_name)
     self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
                 FILELIST_TXT, repo_name)
Exemplo n.º 3
0
 def slacke(self):
     """Creating Slacke local library
     """
     ar = ""
     arch = self.meta.arch
     repo = self.def_repos_dict["slacke"]
     log = self.log_path + "slacke/"
     lib = self.lib_path + "slacke_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)
     if arch == "x86_64":
         ar = "64"
     PACKAGES_TXT = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
         repo, self.meta.slacke_sub_repo[1:-1], ar, slack_ver(), lib_file)
     FILELIST_TXT = ""
     CHECKSUMS_MD5 = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
         repo, self.meta.slacke_sub_repo[1:-1], ar, slack_ver(), md5_file)
     ChangeLog_txt = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
         repo, self.meta.slacke_sub_repo[1:-1], ar, slack_ver(), log_file)
     if self.check:
         return self.checks_logs(log, ChangeLog_txt)
     self.down(lib, PACKAGES_TXT, repo_name)
     self.down(lib, CHECKSUMS_MD5, repo_name)
     self.down(log, ChangeLog_txt, repo_name)
     self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
                 FILELIST_TXT, repo_name)
Exemplo n.º 4
0
    def connos(self):
        """Creating connochaetos (slack-n-free) local library
        """
        nickname = "slack-n-free"
        ar = ""
        arch = self.meta.arch
        repo = self.def_repos_dict["connos"]
        log = self.log_path + "connos/"
        lib = self.lib_path + "connos_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)
        if arch == "x86_64":
            ar = "64"
        PACKAGES_TXT = "{0}{1}{2}-{3}/{4}".format(repo, nickname, ar,
                                                  slack_ver(), lib_file)
        FILELIST_TXT = ""
        CHECKSUMS_MD5 = "{0}{1}{2}-{3}/{4}".format(repo, nickname, ar,
                                                   slack_ver(), md5_file)

        ChangeLog_txt = "{0}{1}{2}-{3}/{4}".format(repo, nickname, ar,
                                                   slack_ver(), log_file)
        if self.check:
            return self.checks_logs(log, ChangeLog_txt)
        self.down(lib, PACKAGES_TXT, repo_name)
        self.down(lib, CHECKSUMS_MD5, repo_name)
        self.down(log, ChangeLog_txt, repo_name)
        self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
                    FILELIST_TXT, repo_name)
Exemplo n.º 5
0
 def mles(self):
     """Creating Microlinux local library
     """
     ar = "32"
     arch = self.meta.arch
     repo = self.def_repos_dict["mles"]
     log = self.log_path + "mles/"
     lib = self.lib_path + "mles_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)
     if arch == "x86_64":
         ar = "64"
     version = self.meta.mles_sub_repo[1:-1]
     PACKAGES_TXT = "{0}{1}-{2}-{3}bit/{4}".format(
         repo, version, slack_ver(), ar, lib_file)
     FILELIST_TXT = ""
     CHECKSUMS_MD5 = "{0}{1}-{2}-{3}bit/{4}".format(
         repo, version, slack_ver(), ar, md5_file)
     ChangeLog_txt = "{0}{1}-{2}-{3}bit/{4}".format(
         repo, version, slack_ver(), ar, log_file)
     if self.check:
         return self.checks_logs(log, ChangeLog_txt)
     self.down(lib, PACKAGES_TXT, repo_name)
     self.down(lib, CHECKSUMS_MD5, repo_name)
     self.down(log, ChangeLog_txt, repo_name)
     self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
                 FILELIST_TXT, repo_name)
Exemplo n.º 6
0
 def rlw(self):
     """Creating rlw local library
     """
     repo = Repo().rlw()
     log = self.log_path + "rlw/"
     lib = self.lib_path + "rlw_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)
     PACKAGES_TXT = "{0}{1}/{2}".format(repo, slack_ver(), lib_file)
     FILELIST_TXT = ""
     CHECKSUMS_MD5 = "{0}{1}/{2}".format(repo, slack_ver(), md5_file)
     ChangeLog_txt = "{0}{1}/{2}".format(repo, slack_ver(), log_file)
     if self.check:
         return self.checks_logs(log, ChangeLog_txt)
     self.down(lib, PACKAGES_TXT, repo_name)
     self.down(lib, CHECKSUMS_MD5, repo_name)
     self.down(log, ChangeLog_txt, repo_name)
     self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
                 FILELIST_TXT, repo_name)
Exemplo n.º 7
0
 def sbo(self):
     """Creating sbo local library
     """
     repo = Repo().sbo()
     log = self.log_path + "sbo/"
     lib = self.lib_path + "sbo_repo/"
     repo_name = log[:-1].split("/")[-1]
     lib_file = "SLACKBUILDS.TXT"
     # lst_file = ""
     # md5_file = ""
     log_file = "ChangeLog.txt"
     if not os.path.exists(log):
         os.mkdir(log)
     if not os.path.exists(lib):
         os.mkdir(lib)
     SLACKBUILDS_TXT = "{0}{1}/{2}".format(repo, slack_ver(), lib_file)
     FILELIST_TXT = ""
     CHECKSUMS_MD5 = ""
     ChangeLog_txt = "{0}{1}/{2}".format(repo, slack_ver(), log_file)
     if self.check:
         return self.checks_logs(log, ChangeLog_txt)
     self.down(lib, SLACKBUILDS_TXT, repo_name)
     self.down(log, ChangeLog_txt, repo_name)
     self.remote(log, ChangeLog_txt, lib, SLACKBUILDS_TXT, CHECKSUMS_MD5,
                 FILELIST_TXT, repo_name)
Exemplo n.º 8
0
 def _init_msb(self):
     arch = "x86"
     if self.meta.arch == "x86_64":
         arch = "x86_64"
     self.mirror = "{0}{1}/{2}/{3}/".format(
         self.def_repo_dict["msb"], slack_ver(),
         self.meta.msb_sub_repo[1:-1], arch)
Exemplo n.º 9
0
 def _init_slacke(self):
     arch = ""
     if self.meta.arch == "x86_64":
         arch = "64"
     self.mirror = "{0}slacke{1}/slackware{2}-{3}/".format(
         self.def_repo_dict["slacke"], self.meta.slacke_sub_repo[1:-1],
         arch, slack_ver())
Exemplo n.º 10
0
    def remote(self, *args):
        """Remove and recreate files
        """
        log_path = args[0]
        ChangeLog_txt = args[1]
        lib_path = args[2]
        PACKAGES_TXT = args[3]
        CHECKSUMS_MD5 = args[4]
        FILELIST_TXT = args[5]
        repo = args[6]

        if self.checks_logs(log_path, ChangeLog_txt):
            # remove old files
            self.file_remove(log_path, ChangeLog_txt.split("/")[-1])
            self.file_remove(lib_path, PACKAGES_TXT.split("/")[-1])
            self.file_remove(lib_path, CHECKSUMS_MD5.split("/")[-1])
            self.file_remove(lib_path, FILELIST_TXT.split("/")[-1])
            if repo == "slack":
                dirs = ["core/", "extra/", "pasture/"]
                for d in dirs:
                    self.file_remove(lib_path + d, "PACKAGES.TXT")
                    self.file_remove(lib_path + d, "CHECKSUMS.md5")
                self.down(lib_path + "core/", PACKAGES_TXT, repo)
                self.down(lib_path + "core/", CHECKSUMS_MD5, repo)
                self.down(lib_path + "extra/", self.EXTRA, repo)
                self.down(lib_path + "extra/", self.EXT_CHECKSUMS, repo)
                if slack_ver() != "14.0":  # no pasture/ folder for 14.0 version
                    self.down(lib_path + "pasture/", self.PASTURE, repo)
                    self.down(lib_path + "pasture/", self.PAS_CHECKSUMS, repo)
            # download new files
            if repo != "slack":
                self.down(lib_path, PACKAGES_TXT, repo)
                self.down(lib_path, CHECKSUMS_MD5, repo)
            self.down(lib_path, FILELIST_TXT, repo)
            self.down(log_path, ChangeLog_txt, repo)
Exemplo n.º 11
0
    def start(self):
        """Download files using wget or other downloader.
        Optional curl, aria2c and httpie
        """
        dwn_count = 1
        self._directory_prefix()
        for dwn in self.url:
            # get file name from url and fix passing char '+'
            self.file_name = dwn.split("/")[-1].replace("%2B", "+")

            if dwn.startswith("file:///"):
                source_dir = dwn[7:-7].replace(slack_ver(), "")
                self._make_tarfile(self.file_name, source_dir)

            self._check_certificate()
            print("\n[{0}/{1}][ {2}Download{3} ] --> {4}\n".format(
                dwn_count, len(self.url), self.meta.color["GREEN"],
                self.meta.color["ENDC"],
                self.file_name))
            if self.downder in ["wget"]:
                subprocess.call("{0} {1} {2}{3} {4}".format(
                                self.downder, self.downder_options,
                                self.dir_prefix, self.path, dwn),
                                shell=True)
            if self.downder in ["aria2c"]:
                subprocess.call("{0} {1} {2}{3} {4}".format(
                                self.downder, self.downder_options,
                                self.dir_prefix, self.path[:-1], dwn),
                                shell=True)
            elif self.downder in ["curl", "http"]:
                subprocess.call("{0} {1} {2}{3} {4}".format(
                                self.downder, self.downder_options,
                                self.path, self.file_name, dwn), shell=True)
            self._check_if_downloaded()
            dwn_count += 1
Exemplo n.º 12
0
 def slonly(self):
     """Creating slackers local library
     """
     ver = slack_ver()
     ar = "{0}-x86".format(ver)
     arch = self.meta.arch
     repo = Repo().slackonly()
     log = self.log_path + "slonly/"
     lib = self.lib_path + "slonly_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)
     if arch == "x86_64":
         ar = "{0}-x86_64".format(ver)
     if self.meta.slack_rel == "current":
         ar = "{0}-x86".format(self.meta.slack_rel)
     if self.meta.slack_rel == "current" and arch == "x86_64":
         ar = "{0}-x86_64".format(self.meta.slack_rel)
     PACKAGES_TXT = "{0}{1}/{2}".format(repo, ar, lib_file)
     FILELIST_TXT = ""
     CHECKSUMS_MD5 = "{0}{1}/{2}".format(repo, ar, md5_file)
     ChangeLog_txt = "{0}{1}/{2}".format(repo, ar, log_file)
     if self.check:
         return self.checks_logs(log, ChangeLog_txt)
     self.down(lib, PACKAGES_TXT, repo_name)
     self.down(lib, CHECKSUMS_MD5, repo_name)
     self.down(log, ChangeLog_txt, repo_name)
     self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
                 FILELIST_TXT, repo_name)
Exemplo n.º 13
0
 def csb(self):
     """Creating Cinnamon local library
     """
     ar = "x86"
     ver_slack = slack_ver()
     arch = self.meta.arch
     repo = self.def_repos_dict["csb"]
     log = self.log_path + "csb/"
     lib = self.lib_path + "csb_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)
     if arch == "x86_64":
         ar = "x86_64"
     if self.meta.slack_rel == "current":
         ver_slack = self.meta.slack_rel
     PACKAGES_TXT = "{0}{1}/{2}/{3}".format(
         repo, ver_slack, ar, lib_file)
     FILELIST_TXT = ""
     CHECKSUMS_MD5 = "{0}{1}/{2}/{3}".format(
         repo, ver_slack, ar, md5_file)
     ChangeLog_txt = "{0}{1}".format(repo, log_file)
     if self.check:
         return self.checks_logs(log, ChangeLog_txt)
     self.down(lib, PACKAGES_TXT, repo_name)
     self.down(lib, CHECKSUMS_MD5, repo_name)
     self.down(log, ChangeLog_txt, repo_name)
     self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
                 FILELIST_TXT, repo_name)
Exemplo n.º 14
0
 def multi(self):
     """Creating alien multilib local library
     """
     ver = slack_ver()
     repo = Repo().multi()
     log = self.log_path + "multi/"
     lib = self.lib_path + "multi_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)
     if self.meta.slack_rel == "current":
         ver = self.meta.slack_rel
     PACKAGES_TXT = "{0}{1}/{2}".format(repo, ver, lib_file)
     FILELIST_TXT = ""
     CHECKSUMS_MD5 = "{0}{1}/{2}".format(repo, ver, md5_file)
     ChangeLog_txt = "{0}{1}".format(repo, log_file)
     if self.check:
         return self.checks_logs(log, ChangeLog_txt)
     self.down(lib, PACKAGES_TXT, repo_name)
     self.down(lib, CHECKSUMS_MD5, repo_name)
     self.down(log, ChangeLog_txt, repo_name)
     self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
                 FILELIST_TXT, repo_name)
Exemplo n.º 15
0
 def _init_slonly(self):
     ver = slack_ver()
     arch = "{0}-x86".format(ver)
     if os.uname()[4] == "x86_64":
         arch = "{0}-x86_64".format(ver)
     if self.meta.slack_rel == "current":
         arch = "{0}-x86_64".format(self.meta.slack_rel)
     self.mirror = "{0}{1}/".format(Repo().slackonly(), arch)
Exemplo n.º 16
0
 def _init_alien(self):
     ver = slack_ver()
     arch = "x86"
     if os.uname()[4] == "x86_64":
         arch = "x86_64"
     if self.meta.slack_rel == "current":
         ver = self.meta.slack_rel
     self.mirror = "{0}{1}/{2}/".format(Repo().alien(), ver, arch)
Exemplo n.º 17
0
 def _init_slacke(self):
     arch = ""
     if os.uname()[4] == "x86_64":
         arch = "64"
     elif os.uname()[4] == "arm":
         arch = "arm"
     self.mirror = "{0}slacke{1}/slackware{2}-{3}/".format(
         Repo().slacke(), self.meta.slacke_sub_repo[1:-1], arch, slack_ver())
Exemplo n.º 18
0
 def _init_slonly(self):
     ver = slack_ver()
     arch = "{0}-x86".format(ver)
     if self.meta.arch == "x86_64":
         arch = "{0}-x86_64".format(ver)
     if self.meta.slack_rel == "current":
         arch = "{0}-x86_64".format(self.meta.slack_rel)
     self.mirror = "{0}{1}/".format(self.def_repo_dict["slonly"], arch)
Exemplo n.º 19
0
 def _init_alien(self):
     ver = slack_ver()
     arch = "x86"
     if self.meta.arch == "x86_64":
         arch = "x86_64"
     if self.meta.slack_rel == "current":
         ver = self.meta.slack_rel
     self.mirror = "{0}{1}/{2}/".format(self.def_repo_dict["alien"],
                                        ver, arch)
Exemplo n.º 20
0
    def view_sbo(self):
        """View slackbuild.org
        """
        sbo_url = self.sbo_url.replace("/slackbuilds/", "/repository/")
        br1, br2, fix_sp = "", "", " "
        if self.meta.use_colors in ["off", "OFF"]:
            br1 = "("
            br2 = ")"
            fix_sp = ""
        print("")   # new line at start
        self.msg.template(78)
        print("| {0}{1}SlackBuilds Repository{2}".format(" " * 28, self.grey,
                                                         self.endc))
        self.msg.template(78)
        print("| {0} > {1} > {2}{3}{4}".format(slack_ver(),
                                               sbo_url.split("/")[-3].title(),
                                               self.cyan, self.name, self.endc))
        self.msg.template(78)
        print("| {0}Package url{1}: {2}".format(self.green, self.endc, sbo_url))
        self.msg.template(78)
        print("| {0}Description: {1}{2}".format(self.green,
                                                self.endc, self.sbo_desc))
        print("| {0}SlackBuild: {1}{2}".format(self.green, self.endc,
                                               self.sbo_dwn.split("/")[-1]))
        print("| {0}Sources: {1}{2}".format(
            self.green, self.endc,
            (", ".join([src.split("/")[-1] for src in self.source_dwn]))))
        print("| {0}Requirements: {1}{2}".format(self.yellow,
                                                 self.endc,
                                                 ", ".join(self.sbo_req)))
        self.msg.template(78)
        print("| {0}R{1}{2}EADME               View the README file".format(
            self.red, self.endc, br2))
        print("| {0}S{1}{2}lackBuild           View the .SlackBuild "
              "file".format(self.red, self.endc, br2))
        print("| In{0}{1}f{2}{3}o{4}                View the .info "
              "file".format(br1, self.red, self.endc, br2, fix_sp))
        if "doinst.sh" in self.sbo_files.split():
            print("| D{0}{1}o{2}{3}inst.sh{4}           View the doinst.sh "
                  "file".format(br1, self.red, self.endc, br2, fix_sp))
        print("| {0}D{1}{2}ownload             Download this package".format(
            self.red, self.endc, br2))
        print("| {0}B{1}{2}uild                Download and build".format(
            self.red, self.endc, br2))
        print("| {0}I{1}{2}nstall              Download/Build/Install".format(
            self.red, self.endc, br2))
        print("| {0}C{1}{2}lear                Clear screen".format(self.red,
                                                                    self.endc,
                                                                    br2))
        print("| {0}Q{1}{2}uit                 Quit".format(self.red,
                                                            self.endc, br2))

        self.msg.template(78)
Exemplo n.º 21
0
 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()))
Exemplo n.º 22
0
def sbo_search_pkg(name):
    """Search for package path from SLACKBUILDS.TXT file and
    return url
    """
    repo = Repo().default_repository()["sbo"]
    sbo_url = "{0}{1}/".format(repo, slack_ver())
    SLACKBUILDS_TXT = Utils().read_file(
        _meta_.lib_path + "sbo_repo/SLACKBUILDS.TXT")
    for line in SLACKBUILDS_TXT.splitlines():
        if line.startswith("SLACKBUILD LOCATION"):
            sbo_name = (line[23:].split("/")[-1].replace("\n", "")).strip()
            if name == sbo_name:
                return (sbo_url + line[23:].strip() + "/")
    return ""
Exemplo n.º 23
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"])
Exemplo n.º 24
0
 def patches(self, dwn, install, comp_sum, uncomp_sum):
     """Seperates packages from patches/ directory
     """
     dwnp, installp, comp_sump, uncomp_sump = ([] for i in range(4))
     for d, i, c, u in zip(dwn, install, comp_sum, uncomp_sum):
         if "_slack" + slack_ver() in i:
             dwnp.append(d)
             dwn.remove(d)
             installp.append(i)
             install.remove(i)
             comp_sump.append(c)
             comp_sum.remove(c)
             uncomp_sump.append(u)
             uncomp_sum.remove(u)
     if "--patches" in self.flag:
         return dwnp, installp, comp_sump, uncomp_sump
     return dwn, install, comp_sum, uncomp_sum
Exemplo n.º 25
0
def rested_filter(name, location, size, unsize):
    """Filter Alien"s repository data
    """
    ver = slack_ver()
    if _meta_.slack_rel == "current":
        ver = "current"
    path_pkg = "pkg"
    if _meta_.arch == "x86_64":
        path_pkg = "pkg64"
    (fname, flocation, fsize, funsize) = ([] for i in range(4))
    for n, l, s, u in zip(name, location, size, unsize):
        if path_pkg == l.split("/")[-2] and ver == l.split("/")[-1]:
            fname.append(n)
            flocation.append(l)
            fsize.append(s)
            funsize.append(u)
    return [fname, flocation, fsize, funsize]
Exemplo n.º 26
0
def ktown_filter(name, location, size, unsize):
    """Filter Alien"s ktown repository data
    """
    ver = slack_ver()
    if _meta_.slack_rel == "current":
        ver = "current"
    path_pkg = "x86"
    if _meta_.arch == "x86_64":
        path_pkg = _meta_.arch
    (fname, flocation, fsize, funsize) = ([] for i in range(4))
    for n, l, s, u in zip(name, location, size, unsize):
        if (path_pkg in l and _meta_.ktown_kde_repo[1:-1] in l and
                l.startswith(ver)):
            fname.append(n)
            flocation.append(l)
            fsize.append(s)
            funsize.append(u)
    return [fname, flocation, fsize, funsize]
Exemplo n.º 27
0
def sbo_search_pkg(name):
    """
    Search for package path from SLACKBUILDS.TXT file
    """
    try:
        repo = Repo().sbo()
        sbo_url = "{0}{1}/".format(repo, slack_ver())
        SLACKBUILDS_TXT = Utils().read_file(
            _meta_.lib_path + "sbo_repo/SLACKBUILDS.TXT")
        for line in SLACKBUILDS_TXT.splitlines():
            if line.startswith("SLACKBUILD LOCATION"):
                sbo_name = (line[23:].split("/")[-1].replace("\n", "")).strip()
                if name == sbo_name:
                    return (sbo_url + line[23:].strip() + "/")
        return ""
    except KeyboardInterrupt:
        print("")   # new line at exit
        sys.exit(0)
Exemplo n.º 28
0
def sbo_search_pkg(name):
    '''
    Search for package path from SLACKBUILDS.TXT file
    '''
    try:
        blacklist = BlackList().packages()
        sbo_url = ("http://slackbuilds.org/slackbuilds/{0}/".format(
            slack_ver()))
        with open(lib_path + "sbo_repo/SLACKBUILDS.TXT",
                  "r") as SLACKBUILDS_TXT:
            for line in SLACKBUILDS_TXT:
                if line.startswith("SLACKBUILD LOCATION"):
                    sbo_name = (line[23:].split("/")[-1].replace("\n",
                                                                 "")).strip()
                    if name == sbo_name and name not in blacklist:
                        SLACKBUILDS_TXT.close()
                        return (sbo_url + line[23:].strip() + "/")
    except KeyboardInterrupt:
        print  # new line at exit
        sys.exit()
Exemplo n.º 29
0
def sbo_search_pkg(name):
    '''
    Search for package path from SLACKBUILDS.TXT file
    '''
    try:
        blacklist = BlackList().packages()
        sbo_url = ("http://slackbuilds.org/slackbuilds/{0}/".format(
            slack_ver()))
        with open(lib_path + "sbo_repo/SLACKBUILDS.TXT",
                  "r") as SLACKBUILDS_TXT:
            for line in SLACKBUILDS_TXT:
                if line.startswith("SLACKBUILD LOCATION"):
                    sbo_name = (line[23:].split("/")[-1].replace("\n",
                                                                 "")).strip()
                    if name == sbo_name and name not in blacklist:
                        SLACKBUILDS_TXT.close()
                        return (sbo_url + line[23:].strip() + "/")
    except KeyboardInterrupt:
        print   # new line at exit
        sys.exit()
Exemplo n.º 30
0
 def msb(self):
     """Creating MATE local library
     """
     ar = "x86"
     ver_slack = slack_ver()
     arch = self.meta.arch
     repo = self.def_repos_dict["msb"]
     log = self.log_path + "msb/"
     lib = self.lib_path + "msb_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)
     if arch == "x86_64":
         ar = "x86_64"
     version = ""
     version = self.meta.msb_sub_repo[1:-1]
     if self.meta.slack_rel == "current":
         ver_slack = self.meta.slack_rel
     PACKAGES_TXT = "{0}{1}/{2}/{3}/{4}".format(repo, ver_slack, version,
                                                ar, lib_file)
     FILELIST_TXT = ""
     CHECKSUMS_MD5 = "{0}{1}/{2}/{3}/{4}".format(repo, ver_slack, version,
                                                 ar, md5_file)
     ChangeLog_txt = "{0}{1}".format(repo, log_file)
     if self.check:
         return self.checks_logs(log, ChangeLog_txt)
     self.down(lib, PACKAGES_TXT, repo_name)
     self.down(lib, CHECKSUMS_MD5, repo_name)
     self.down(log, ChangeLog_txt, repo_name)
     self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
                 FILELIST_TXT, repo_name)
Exemplo n.º 31
0
    def remote(self, *args):
        """Remove and recreate files
        """
        log_path = args[0]
        ChangeLog_txt = args[1]
        lib_path = args[2]
        PACKAGES_TXT = args[3]
        CHECKSUMS_MD5 = args[4]
        FILELIST_TXT = args[5]
        repo = args[6]

        if self.checks_logs(log_path, ChangeLog_txt):
            # remove old files
            self.file_remove(log_path, ChangeLog_txt.split("/")[-1])
            self.file_remove(lib_path, PACKAGES_TXT.split("/")[-1])
            self.file_remove(lib_path, CHECKSUMS_MD5.split("/")[-1])
            self.file_remove(lib_path, FILELIST_TXT.split("/")[-1])
            if repo == "slack":
                dirs = ["core/", "extra/", "pasture/"]
                for d in dirs:
                    self.file_remove(lib_path + d, "PACKAGES.TXT")
                    self.file_remove(lib_path + d, "CHECKSUMS.md5")
                self.down(lib_path + "core/", PACKAGES_TXT, repo)
                self.down(lib_path + "core/", CHECKSUMS_MD5, repo)
                self.down(lib_path + "extra/", self.EXTRA, repo)
                self.down(lib_path + "extra/", self.EXT_CHECKSUMS, repo)
                if slack_ver(
                ) != "14.0":  # no pasture/ folder for 14.0 version
                    self.down(lib_path + "pasture/", self.PASTURE, repo)
                    self.down(lib_path + "pasture/", self.PAS_CHECKSUMS, repo)
            # download new files
            if repo != "slack":
                self.down(lib_path, PACKAGES_TXT, repo)
                self.down(lib_path, CHECKSUMS_MD5, repo)
            self.down(lib_path, FILELIST_TXT, repo)
            self.down(log_path, ChangeLog_txt, repo)
Exemplo n.º 32
0
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)
    elif _meta_.arch.startswith("arm"):
        if rel == "stable":
            http = repo + "slackwarearm-{0}/{1}{2}".format(ver, location, name)
        else:
            http = repo + "slackwarearm-{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
Exemplo n.º 33
0
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)
    elif _meta_.arch.startswith("arm"):
        if rel == "stable":
            http = repo + "slackwarearm-{0}/{1}{2}".format(ver, location, name)
        else:
            http = repo + "slackwarearm-{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
Exemplo n.º 34
0
 def _init_rlw(self):
     self.mirror = "{0}{1}/".format(self.def_repo_dict["rlw"], slack_ver())
Exemplo n.º 35
0
 def _init_connos(self):
     arch = ""
     if self.meta.arch == "x86_64":
         arch = "64"
     self.mirror = "{0}slack-n-free{1}-{2}/".format(
         self.def_repo_dict["connos"], arch, slack_ver())
Exemplo n.º 36
0
 def _init_csb(self):
     arch = "x86"
     if self.meta.arch == "x86_64":
         arch = "x86_64"
     self.mirror = "{0}{1}/{2}".format(self.def_repo_dict["csb"],
                                       slack_ver(), arch)
Exemplo n.º 37
0
 def _init_salix(self):
     arch = "i486"
     if self.meta.arch == "x86_64":
         arch = "x86_64"
     self.mirror = "{0}{1}/{2}/".format(self.def_repo_dict["salix"], arch,
                                        slack_ver())
Exemplo n.º 38
0
 def _init_studio(self):
     arch = ""
     if os.uname()[4] == "x86_64":
         arch = "64"
     self.mirror = "{0}slackware{1}-{2}/".format(Repo().studioware(),
                                                 arch, slack_ver())
Exemplo n.º 39
0
 def _init_slacky(self):
     arch = ""
     if self.meta.arch == "x86_64":
         arch = "64"
     self.mirror = "{0}slackware{1}-{2}/".format(
         self.def_repo_dict["slacky"], arch, slack_ver())
Exemplo n.º 40
0
 def _init_multi(self):
     ver = slack_ver()
     if self.meta.slack_rel == "current":
         ver = self.meta.slack_rel
     self.mirror = self.def_repo_dict["multi"] + ver + "/"
Exemplo n.º 41
0
def header():
    """help header message"""
    print("\nslpkg - version {0} | Slackware release: {1} - {2}\n".format(
        _meta_.__version__, _meta_.slack_rel, slack_ver()))