コード例 #1
0
ファイル: main.py プロジェクト: websafe/slpkg
 def pkg_blacklist(self):
     """Manage blacklist packages
     """
     blacklist = BlackList()
     options = [
         "-b",
         "--blacklist"
     ]
     flag = [
         "--add",
         "--remove"
     ]
     command = ["list"]
     if (len(self.args) == 2 and self.args[0] in options and
             self.args[1] == command[0]):
         blacklist.listed()
     elif (len(self.args) > 2 and self.args[0] in options and
             self.args[-1] == flag[0]):
         blacklist.add(self.args[1:-1])
     elif (len(self.args) == 3 and self.args[0] in options and
             self.args[1] == "ALL" and self.args[-1] == flag[1]):
         blacklist.remove(blacklist.get_black())
     elif (len(self.args) > 2 and self.args[0] in options and
             self.args[-1] == flag[1]):
         blacklist.remove(self.args[1:-1])
     else:
         usage("")
コード例 #2
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def pkg_queue(self):
     """Manage packages in queue
     """
     queue = QueuePkgs()
     options = ["-q", "--queue"]
     flag = ["--add", "--remove"]
     command = ["list", "build", "install", "build-install"]
     if (len(self.args) > 2 and self.args[0] in options
             and flag[0] in self.args):
         self.args.remove(flag[0])
         queue.add(self.args[1:])
     elif (len(self.args) == 3 and self.args[0] in options
           and "ALL" in self.args and flag[1] in self.args):
         self.args.remove(flag[1])
         queue.remove(queue.packages())
     elif (len(self.args) > 2 and self.args[0] in options
           and flag[1] in self.args):
         self.args.remove(flag[1])
         queue.remove(self.args[1:])
     elif (len(self.args) == 2 and self.args[0] in options
           and self.args[1] == command[0]):
         queue.listed()
     elif (len(self.args) == 2 and self.args[0] in options
           and self.args[1] == command[1]):
         queue.build()
     elif (len(self.args) == 2 and self.args[0] in options
           and self.args[1] == command[2]):
         queue.install()
     elif (len(self.args) == 2 and self.args[0] in options
           and self.args[1] == command[3]):
         queue.build()
         queue.install()
     else:
         usage("")
コード例 #3
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def bin_remove(self):
     """Remove Slackware packages
     """
     packages = self.args[1:]
     options = ["-r", "--removepkg"]
     additional_options = ["--deps", "--check-deps", "--tag", "--checklist"]
     flag, extra = "", []
     flags = ["-warn", "-preserve", "-copy", "-keep"]
     # merge --check-deps and --deps options
     if (additional_options[1] in self.args
             and additional_options[0] not in self.args):
         self.args.append(additional_options[0])
     if len(self.args) > 1 and self.args[0] in options:
         for additional in additional_options:
             if additional in self.args:
                 extra.append(additional)
                 self.args.remove(additional)
             packages = self.args[1:]
         for fl in flags:
             if fl in self.args:
                 flag = self.args[1]
                 packages = self.args[2:]
         PackageManager(packages).remove(flag, extra)
     else:
         usage("")
コード例 #4
0
ファイル: main.py プロジェクト: websafe/slpkg
 def command_new_config(self):
     """Manage .new configuration files
     """
     if len(self.args) == 1 and self.args[0] == "new-config":
         NewConfig().run()
     else:
         usage("")
コード例 #5
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def command_repo_list(self):
     """Repositories list
     """
     if len(self.args) == 1 and self.args[0] == "repo-list":
         RepoList().repos()
     else:
         usage("")
コード例 #6
0
 def bin_install(self):
     """Install Slackware binary packages
     """
     packages = self.args[1:]
     options = [
         "-i",
         "--installpkg"
     ]
     flag = ""
     flags = [
         "--warn",
         "--md5sum",
         "--root",
         "--infobox",
         "--menu",
         "--terse",
         "--ask",
         "--priority",
         "--tagfile"
     ]
     if len(self.args) > 1 and self.args[0] in options:
         if self.args[1] in flags:
             flag = self.args[1]
             packages = self.args[2:]
         PackageManager(packages).install(flag)
     else:
         usage("")
コード例 #7
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def pkg_install(self):
     """Install packages by repository
     """
     flag = []
     options = ["-s", "--sync"]
     additional_options = [
         "--resolve-off", "--download-only", "--directory-prefix=",
         "--case-ins", "--rebuild", "--reinstall"
     ]
     for arg in self.args:
         if arg.startswith(additional_options[2]):
             flag.append(arg)
             arg = ""
         if arg in additional_options:
             flag.append(arg)
     if len(self.args) >= 3 and self.args[0] in options:
         if (self.args[1] in self.meta.repositories
                 and self.args[1] not in ["sbo"]):
             BinaryInstall(self.args[2:], self.args[1],
                           flag).start(is_upgrade=False)
         elif (self.args[1] == "sbo"
               and self.args[1] in self.meta.repositories):
             SBoInstall(self.args[2:], flag).start(is_upgrade=False)
         else:
             usage(self.args[1])
     else:
         usage("")
コード例 #8
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def pkg_desc(self):
     """Print slack-desc by repository
     """
     options = ["-p", "--desc"]
     flag = ["--color="]
     colors = ["red", "green", "yellow", "cyan", "grey"]
     tag = ""
     for arg in self.args:
         if arg.startswith(flag[0]):
             tag = arg[len(flag[0]):]
             self.args.remove(arg)
             break
     if tag and tag not in colors:
         print("\nslpkg: Error: Available colors {0}\n".format(colors))
         raise SystemExit()
     if (len(self.args) == 3 and self.args[0] in options
             and self.args[1] in self.meta.repositories and tag in colors):
         PkgDesc(self.args[2], self.args[1], tag).view()
     elif (len(self.args) == 3 and self.args[0] in options
           and self.args[1] in self.meta.repositories):
         PkgDesc(self.args[2], self.args[1], paint="").view()
     elif (len(self.args) > 1 and self.args[0] in options
           and self.args[1] not in self.meta.repositories):
         usage(self.args[1])
     else:
         usage("")
コード例 #9
0
ファイル: main.py プロジェクト: websafe/slpkg
 def bin_install(self):
     """Install Slackware binary packages
     """
     packages = self.args[1:]
     options = [
         "-i",
         "--installpkg"
     ]
     flag = ""
     flags = [
         "--warn",
         "--md5sum",
         "--root",
         "--infobox",
         "--menu",
         "--terse",
         "--ask",
         "--priority",
         "--tagfile"
     ]
     if len(self.args) > 1 and self.args[0] in options:
         if self.args[1] in flags:
             flag = self.args[1]
             packages = self.args[2:]
         PackageManager(packages).install(flag)
     else:
         usage("")
コード例 #10
0
ファイル: main.py プロジェクト: websafe/slpkg
 def command_repo_add(self):
     """Add custom repositories
     """
     if len(self.args) == 3 and self.args[0] == "repo-add":
         Repo().add(self.args[1], self.args[2])
     else:
         usage("")
コード例 #11
0
ファイル: main.py プロジェクト: websafe/slpkg
 def command_repo_list(self):
     """Repositories list
     """
     if len(self.args) == 1 and self.args[0] == "repo-list":
         RepoList().repos()
     else:
         usage("")
コード例 #12
0
ファイル: main.py プロジェクト: websafe/slpkg
 def command_repo_remove(self):
     """Remove custom repositories
     """
     if len(self.args) == 2 and self.args[0] == "repo-remove":
         Repo().remove(self.args[1])
     else:
         usage("")
コード例 #13
0
ファイル: main.py プロジェクト: websafe/slpkg
 def command_repo_enable(self):
     """Repositories enable/disable
     """
     if len(self.args) == 1 and self.args[0] == "repo-enable":
         RepoEnable().choose()
     else:
         usage("")
コード例 #14
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def command_repo_add(self):
     """Add custom repositories
     """
     if len(self.args) == 3 and self.args[0] == "repo-add":
         Repo().add(self.args[1], self.args[2])
     else:
         usage("")
コード例 #15
0
ファイル: main.py プロジェクト: websafe/slpkg
 def bin_remove(self):
     """Remove Slackware packages
     """
     packages = self.args[1:]
     options = [
         "-r",
         "--removepkg"
     ]
     additional_options = [
         "--deps",
         "--check-deps",
         "--tag",
         "--checklist"
     ]
     flag, extra = "", []
     flags = [
         "-warn",
         "-preserve",
         "-copy",
         "-keep"
     ]
     if len(self.args) > 1 and self.args[0] in options:
         for additional in additional_options:
             if additional in self.args:
                 extra.append(additional)
                 self.args.remove(additional)
             packages = self.args[1:]
         if self.args[1] in flags:
             flag = self.args[1]
             packages = self.args[2:]
         PackageManager(packages).remove(flag, extra)
     else:
         usage("")
コード例 #16
0
ファイル: main.py プロジェクト: websafe/slpkg
 def pkg_tracking(self):
     """Tracking package dependencies
     """
     flag = []
     options = [
         "-t",
         "--tracking"
     ]
     additional_options = [
         "--check-deps",
         "--graph="
     ]
     if (len(self.args) >= 3 and len(self.args) < 6 and
             self.args[0] in options):
         if self.args[1] in self.meta.repositories:
             for arg in self.args[3:]:
                 if arg.startswith(additional_options[1]):
                     flag.append(arg)
                 if arg in additional_options:
                     flag.append(arg)
             TrackingDeps(self.args[2], self.args[1], flag).run()
         else:
             usage(self.args[1])
     else:
         usage("")
コード例 #17
0
ファイル: main.py プロジェクト: websafe/slpkg
 def pkg_install(self):
     """Install packages by repository
     """
     flag = []
     options = [
         "-s",
         "--sync"
     ]
     additional_options = [
         "--resolve-off",
         "--case-ins"
     ]
     for arg in self.args:
         if arg in additional_options:
             flag.append(arg)
     if len(self.args) >= 3 and self.args[0] in options:
         if (self.args[1] in self.meta.repositories and
                 self.args[1] not in ["sbo"]):
             BinaryInstall(self.args[2:], self.args[1], flag).start(
                 if_upgrade=False)
         elif (self.args[1] == "sbo" and
                 self.args[1] in self.meta.repositories):
             SBoInstall(self.args[2:], flag).start(if_upgrade=False)
         else:
             usage(self.args[1])
     else:
         usage("")
コード例 #18
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def command_new_config(self):
     """Manage .new configuration files
     """
     if len(self.args) == 1 and self.args[0] == "new-config":
         NewConfig().run()
     else:
         usage("")
コード例 #19
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def command_repo_remove(self):
     """Remove custom repositories
     """
     if len(self.args) == 2 and self.args[0] == "repo-remove":
         Repo().remove(self.args[1])
     else:
         usage("")
コード例 #20
0
ファイル: main.py プロジェクト: websafe/slpkg
 def command_update_slpkg(self):
     """Slpkg it self update
     """
     if len(self.args) == 2 and self.args[0] == "update-slpkg":
         it_self_update()
     else:
         usage("")
コード例 #21
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def command_update_slpkg(self):
     """Slpkg it self update
     """
     if len(self.args) == 2 and self.args[0] == "update-slpkg":
         it_self_update()
     else:
         usage("")
コード例 #22
0
 def pkg_blacklist(self):
     """Manage blacklist packages
     """
     blacklist = BlackList()
     options = [
         "-b",
         "--blacklist"
     ]
     flag = [
         "--add",
         "--remove"
     ]
     command = ["list"]
     if (len(self.args) == 2 and self.args[0] in options and
             self.args[1] == command[0]):
         blacklist.listed()
     elif (len(self.args) > 2 and self.args[0] in options and
             flag[0] in self.args):
         self.args.remove(flag[0])
         blacklist.add(self.args[1:])
     elif (len(self.args) == 3 and self.args[0] in options and
             "ALL" in self.args and flag[1] in self.args):
         self.args.remove(flag[1])
         blacklist.remove(blacklist.get_black())
     elif (len(self.args) > 2 and self.args[0] in options and
             flag[1] in self.args):
         self.args.remove(flag[1])
         blacklist.remove(self.args[1:])
     else:
         usage("")
コード例 #23
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def command_repo_enable(self):
     """Repositories enable/disable
     """
     if len(self.args) == 1 and self.args[0] == "repo-enable":
         RepoEnable().choose()
     else:
         usage("")
コード例 #24
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def auto_build(self):
     """Auto built tool
     """
     options = ["-a", "--autobuild"]
     if len(self.args) >= 3 and self.args[0] in options:
         AutoBuild(self.args[1], self.args[2:], self.meta.path).run()
     else:
         usage("")
コード例 #25
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def pkg_contents(self):
     """Print packages contents
     """
     packages = self.args[1:]
     options = ["-d", "--display"]
     if len(self.args) > 1 and self.args[0] in options:
         PackageManager(packages).display()
     else:
         usage("")
コード例 #26
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def command_health(self):
     """Check package health
     """
     if len(self.args) == 1 and self.args[0] == "health":
         PackageHealth(mode="").test()
     elif (len(self.args) == 2 and self.args[0] == "health"
           and self.args[1] == "--silent"):
         PackageHealth(mode=self.args[1]).test()
     else:
         usage("")
コード例 #27
0
ファイル: main.py プロジェクト: websafe/slpkg
 def command_health(self):
     """Check package health
     """
     if len(self.args) == 1 and self.args[0] == "health":
         PackageHealth(mode="").test()
     elif (len(self.args) == 2 and self.args[0] == "health" and
             self.args[1] == "--silent"):
         PackageHealth(mode=self.args[1]).test()
     else:
         usage("")
コード例 #28
0
ファイル: main.py プロジェクト: websafe/slpkg
 def auto_build(self):
     """Auto built tool
     """
     options = [
         "-a",
         "--autobuild"
     ]
     if len(self.args) >= 3 and self.args[0] in options:
         AutoBuild(self.args[1], self.args[2:], self.meta.path).run()
     else:
         usage("")
コード例 #29
0
ファイル: main.py プロジェクト: websafe/slpkg
 def command_upgrade(self):
     """Recreate repositories package lists
     """
     if len(self.args) == 1 and self.args[0] == "upgrade":
         Initialization(False).upgrade(only="")
     elif (len(self.args) == 2 and self.args[0] == "upgrade" and
             self.args[1].startswith("--only=")):
         repos = self.args[1].split("=")[-1].split(",")
         Initialization(False).upgrade(repos)
     else:
         usage("")
コード例 #30
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def help_version(self):
     """Help and version info
     """
     if (len(self.args) == 1 and self.args[0] in ["-h", "--help"]
             and self.args[1:] == []):
         options()
     elif (len(self.args) == 1 and self.args[0] in ["-v", "--version"]
           and self.args[1:] == []):
         prog_version()
     else:
         usage("")
コード例 #31
0
ファイル: main.py プロジェクト: websafe/slpkg
 def help_version(self):
     """Help and version info
     """
     if (len(self.args) == 1 and self.args[0] in ["-h", "--help"] and
             self.args[1:] == []):
         options()
     elif (len(self.args) == 1 and self.args[0] in ["-v", "--version"] and
             self.args[1:] == []):
         prog_version()
     else:
         usage("")
コード例 #32
0
ファイル: main.py プロジェクト: websafe/slpkg
 def command_repo_info(self):
     """Repositories informations
     """
     if (len(self.args) == 2 and self.args[0] == "repo-info" and
             self.args[1] in RepoList().all_repos):
         del RepoList().all_repos
         RepoInfo().view(self.args[1])
     elif (len(self.args) > 1 and self.args[0] == "repo-info" and
             self.args[1] not in RepoList().all_repos):
         usage(self.args[1])
     else:
         usage("")
コード例 #33
0
ファイル: main.py プロジェクト: websafe/slpkg
 def pkg_contents(self):
     """Print packages contents
     """
     packages = self.args[1:]
     options = [
         "-d",
         "--display"
     ]
     if len(self.args) > 1 and self.args[0] in options:
         PackageManager(packages).display()
     else:
         usage("")
コード例 #34
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def command_repo_info(self):
     """Repositories informations
     """
     if (len(self.args) == 2 and self.args[0] == "repo-info"
             and self.args[1] in RepoList().all_repos):
         del RepoList().all_repos
         RepoInfo().view(self.args[1])
     elif (len(self.args) > 1 and self.args[0] == "repo-info"
           and self.args[1] not in RepoList().all_repos):
         usage(self.args[1])
     else:
         usage("")
コード例 #35
0
ファイル: main.py プロジェクト: websafe/slpkg
 def command_update(self):
     """Update package lists repositories
     """
     if len(self.args) == 1 and self.args[0] == "update":
         Update().repository(only="")
     elif (len(self.args) == 2 and self.args[0] == "update" and
             self.args[1].startswith("--only=")):
         repos = self.args[1].split("=")[-1].split(",")
         for rp in repos:
             if rp not in self.meta.repositories:
                 repos.remove(rp)
         Update().repository(repos)
     else:
         usage("")
コード例 #36
0
ファイル: main.py プロジェクト: websafe/slpkg
 def command_deps_status(self):
     """Print dependencies status
     """
     if len(self.args) == 1 and self.args[0] == "deps-status":
         DependenciesStatus(image="").show()
     elif (len(self.args) == 2 and self.args[0] == "deps-status" and
             self.args[1].startswith("--graph=")):
         image = self.args[1].split("=")[1]
         DependenciesStatus(image).show()
     elif (len(self.args) == 2 and self.args[0] == "deps-status" and
             self.args[1] == "--tree"):
         DependenciesStatus(image="").tree()
     else:
         usage("")
コード例 #37
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def bin_upgrade(self):
     """Install-upgrade Slackware binary packages
     """
     packages = self.args[1:]
     options = ["-u", "--upgradepkg"]
     flag = ""
     flags = ["--dry-run", "--install-new", "--reinstall", "--verbose"]
     if len(self.args) > 1 and self.args[0] in options:
         if self.args[1] in flags:
             flag = self.args[1]
             packages = self.args[2:]
         PackageManager(packages).upgrade(flag)
     else:
         usage("")
コード例 #38
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def command_update(self):
     """Update package lists repositories
     """
     if len(self.args) == 1 and self.args[0] == "update":
         Update().repository(only="")
     elif (len(self.args) == 2 and self.args[0] == "update"
           and self.args[1].startswith("--only=")):
         repos = self.args[1].split("=")[-1].split(",")
         for rp in repos:
             if rp not in self.meta.repositories:
                 repos.remove(rp)
         Update().repository(repos)
     else:
         usage("")
コード例 #39
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def command_upgrade(self):
     """Recreate repositories package lists
     """
     if len(self.args) == 1 and self.args[0] == "upgrade":
         Initialization(False).upgrade(only="")
     elif (len(self.args) == 2 and self.args[0] == "upgrade"
           and self.args[1].startswith("--only=")):
         repos = self.args[1].split("=")[-1].split(",")
         for rp in repos:
             if rp not in self.meta.repositories:
                 repos.remove(rp)
         Initialization(False).upgrade(repos)
     else:
         usage("")
コード例 #40
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def sbo_network(self):
     """View slackbuilds packages
     """
     flag = []
     options = ["-n", "--network"]
     additional_options = ["--checklist", "--case-ins"]
     for add in additional_options:
         if add in self.args:
             flag.append(add)
             self.args.remove(add)
     if (len(self.args) == 2 and self.args[0] in options
             and "sbo" in self.meta.repositories):
         SBoNetwork(self.args[1], flag).view()
     else:
         usage("sbo")
コード例 #41
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def bin_find(self):
     """Find installed packages
     """
     flag = []
     options = ["-f", "--find"]
     additional_options = ["--case-ins"]
     for arg in self.args:
         if arg in additional_options:
             flag.append(arg)
             self.args.remove(arg)
     packages = self.args[1:]
     if len(self.args) > 1 and self.args[0] in options:
         PackageManager(packages).find(flag)
     else:
         usage("")
コード例 #42
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def pkg_find(self):
     """Find packages from all enabled repositories
     """
     flag = []
     options = ["-F", "--FIND"]
     additional_options = ["--case-ins"]
     for arg in self.args:
         if arg in additional_options:
             flag.append(arg)
             self.args.remove(arg)
     packages = self.args[1:]
     if len(self.args) > 1 and self.args[0] in options:
         FindFromRepos().find(packages, flag)
     else:
         usage("")
コード例 #43
0
ファイル: checks.py プロジェクト: fabioalvaro/slpkg
 def ALL(self):
     """Check ALL enabled repositories ChangeLogs
     """
     self.status_bar()
     for repo in self.meta.repositories:
         if repo in self.meta.default_repositories:
             try:
                 self.check = self.all_repos[repo]()
             except OSError:
                 usage(self.repo)
                 raise SystemExit()
         elif repo in self.meta.repositories:
             self.check = self._init.custom(repo)
         self.status()
         self.print_status(repo)
     self.summary()
コード例 #44
0
 def ALL(self):
     """Check ALL enabled repositories ChangeLogs
     """
     self.status_bar()
     for repo in self.meta.repositories:
         if repo in self.meta.default_repositories:
             try:
                 self.check = self.all_repos[repo]()
             except OSError:
                 usage(self.repo)
                 raise SystemExit()
         elif repo in self.meta.repositories:
             self.check = self._init.custom(repo)
         self.status()
         self.print_status(repo)
     self.summary()
コード例 #45
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def congiguration(self):
     """Manage slpkg configuration file
     """
     options = ["-g", "--config"]
     command = ["print", "edit", "reset"]
     conf = Config()
     if (len(self.args) == 2 and self.args[0] in options
             and self.args[1] == command[1]):
         conf.edit()
     elif (len(self.args) == 2 and self.args[0] in options
           and self.args[1] == (command[0])):
         conf.view()
     elif (len(self.args) == 2 and self.args[0] in options
           and self.args[1] == (command[2])):
         conf.reset()
     else:
         usage("")
コード例 #46
0
ファイル: main.py プロジェクト: dslackw/slpkg
 def pkg_queue(self):
     """Manage packages in queue
     """
     queue = QueuePkgs()
     options = [
         "-q",
         "--queue"
     ]
     flag = [
         "--add",
         "--remove"
     ]
     command = [
         "list",
         "build",
         "install",
         "build-install"
     ]
     if (len(self.args) > 2 and self.args[0] in options and
             flag[0] in self.args):
         self.args.remove(flag[0])
         queue.add(self.args[1:])
     elif (len(self.args) == 3 and self.args[0] in options and
             "ALL" in self.args and flag[1] in self.args):
         self.args.remove(flag[1])
         queue.remove(queue.packages())
     elif (len(self.args) > 2 and self.args[0] in options and
             flag[1] in self.args):
         self.args.remove(flag[1])
         queue.remove(self.args[1:])
     elif (len(self.args) == 2 and self.args[0] in options and
             self.args[1] == command[0]):
         queue.listed()
     elif (len(self.args) == 2 and self.args[0] in options and
             self.args[1] == command[1]):
         queue.build()
     elif (len(self.args) == 2 and self.args[0] in options and
             self.args[1] == command[2]):
         queue.install()
     elif (len(self.args) == 2 and self.args[0] in options and
             self.args[1] == command[3]):
         queue.build()
         queue.install()
     else:
         usage("")
コード例 #47
0
ファイル: main.py プロジェクト: websafe/slpkg
 def bin_find(self):
     """Find installed packages
     """
     flag = []
     options = [
         "-f",
         "--find"
     ]
     additional_options = ["--case-ins"]
     for arg in self.args:
         if arg in additional_options:
             flag.append(arg)
             self.args.remove(arg)
     packages = self.args[1:]
     if len(self.args) > 1 and self.args[0] in options:
         PackageManager(packages).find(flag)
     else:
         usage("")
コード例 #48
0
ファイル: main.py プロジェクト: websafe/slpkg
 def pkg_find(self):
     """Find packages from all enabled repositories
     """
     flag = []
     options = [
         "-F",
         "--FIND"
     ]
     additional_options = ["--case-ins"]
     for arg in self.args:
         if arg in additional_options:
             flag.append(arg)
             self.args.remove(arg)
     packages = self.args[1:]
     if len(self.args) > 1 and self.args[0] in options:
         find_from_repos(packages, flag)
     else:
         usage("")
コード例 #49
0
ファイル: checks.py プロジェクト: fabioalvaro/slpkg
 def run(self):
     """Run and check if new in ChangeLog.txt
     """
     if (self.repo in self.meta.default_repositories and
             self.repo in self.meta.repositories):
         try:
             self.check = self.all_repos[self.repo]()
         except OSError:
             usage(self.repo)
             raise SystemExit()
     elif self.repo in self.meta.repositories:
         self.check = self._init.custom(self.repo)
     else:
         usage(self.repo)
         raise SystemExit()
     self.status_bar()
     self.status()
     self.print_status(self.repo)
     self.summary()
コード例 #50
0
ファイル: main.py プロジェクト: dslackw/slpkg
 def command_deps_status(self):
     """Print dependencies status
     """
     image = ""
     for arg in self.args:
         if arg.startswith("--graph="):
             image = arg.split("=")[1]
     if len(self.args) == 1 and self.args[0] == "deps-status":
         DependenciesStatus(image).show()
     elif len(self.args) == 2 and self.args[0] == "deps-status" and image:
         DependenciesStatus(image).show()
     elif (len(self.args) == 2 and self.args[0] == "deps-status" and
             "--tree" in self.args):
         DependenciesStatus(image).tree()
     elif (len(self.args) == 3 and self.args[0] == "deps-status" and
             "--tree" in self.args and image):
         DependenciesStatus(image).tree()
     else:
         usage("")
コード例 #51
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def command_deps_status(self):
     """Print dependencies status
     """
     image = ""
     for arg in self.args:
         if arg.startswith("--graph="):
             image = arg.split("=")[1]
     if len(self.args) == 1 and self.args[0] == "deps-status":
         DependenciesStatus(image).show()
     elif len(self.args) == 2 and self.args[0] == "deps-status" and image:
         DependenciesStatus(image).show()
     elif (len(self.args) == 2 and self.args[0] == "deps-status"
           and "--tree" in self.args):
         DependenciesStatus(image).tree()
     elif (len(self.args) == 3 and self.args[0] == "deps-status"
           and "--tree" in self.args and image):
         DependenciesStatus(image).tree()
     else:
         usage("")
コード例 #52
0
 def run(self):
     """Run and check if new in ChangeLog.txt
     """
     if (self.repo in self.meta.default_repositories
             and self.repo in self.meta.repositories):
         try:
             self.check = self.all_repos[self.repo]()
         except OSError:
             usage(self.repo)
             raise SystemExit()
     elif self.repo in self.meta.repositories:
         self.check = self._init.custom(self.repo)
     else:
         usage(self.repo)
         raise SystemExit()
     self.status_bar()
     self.status()
     self.print_status(self.repo)
     self.summary()
コード例 #53
0
ファイル: main.py プロジェクト: websafe/slpkg
 def sbo_network(self):
     """View slackbuilds packages
     """
     flag = []
     options = [
         "-n",
         "--network"
     ]
     additional_options = [
         "--checklist",
         "--case-ins"
     ]
     for arg in self.args[2:]:
         if arg in additional_options:
             flag.append(arg)
             self.args.remove(arg)
     if (len(self.args) == 2 and self.args[0] in options and
             "sbo" in self.meta.repositories):
         SBoNetwork(self.args[1], flag).view()
     else:
         usage("sbo")
コード例 #54
0
ファイル: main.py プロジェクト: websafe/slpkg
 def pkg_desc(self):
     """Print slack-desc by repository
     """
     options = [
         "-p",
         "--desc"
     ]
     flag = ["--color="]
     colors = [
         "red",
         "green",
         "yellow",
         "cyan",
         "grey"
     ]
     if (len(self.args) == 3 and self.args[0] in options and
             self.args[1] in self.meta.repositories):
         PkgDesc(self.args[2], self.args[1], paint="").view()
     elif (len(self.args) == 4 and self.args[0] in options and
             self.args[3].startswith(flag[0])):
         tag = self.args[3][len(flag[0]):]
         if self.args[1] in self.meta.repositories and tag in colors:
             PkgDesc(self.args[2], self.args[1], tag).view()
         else:
             usage(self.args[1])
     elif (len(self.args) > 1 and self.args[0] in options and
             self.args[1] not in self.meta.repositories):
         usage(self.args[1])
     else:
         usage("")
コード例 #55
0
ファイル: main.py プロジェクト: dslackw/slpkg
 def pkg_list(self):
     """List of packages by repository
     """
     options = [
         "-l",
         "--list"
     ]
     flag = ["--index", "--installed", "--name"]
     name = INDEX = installed = False
     for arg in self.args[2:]:
         if flag[0] == arg:
             INDEX = True
         if flag[1] in arg:
             installed = True
         if flag[2] == arg:
             name = True
         if arg not in flag:
             usage("")
             raise SystemExit()
     if (len(self.args) > 1 and len(self.args) <= 5 and
             self.args[0] in options):
         if self.args[1] in self.meta.repositories:
             PackageManager(binary=None).package_list(self.args[1],
                                                      name,
                                                      INDEX,
                                                      installed)
         else:
             usage(self.args[1])
     else:
         usage("")
コード例 #56
0
ファイル: main.py プロジェクト: websafe/slpkg
 def pkg_list(self):
     """List of packages by repository
     """
     options = [
         "-l",
         "--list"
     ]
     flag = ["--index", "--installed"]
     if (len(self.args) == 3 and self.args[0] in options and
             self.args[1] in self.meta.repositories):
         if self.args[2] == flag[0]:
             PackageManager(binary=None).package_list(self.args[1],
                                                      INDEX=True,
                                                      installed=False)
         elif self.args[2] == flag[1]:
             PackageManager(binary=None).package_list(self.args[1],
                                                      INDEX=False,
                                                      installed=True)
         else:
             usage("")
     elif (len(self.args) == 2 and self.args[0] in options and
             self.args[1] in self.meta.repositories):
         PackageManager(None).package_list(self.args[1], INDEX=False,
                                           installed=False)
     elif (len(self.args) > 1 and self.args[0] in options and
             self.args[1] not in self.meta.repositories):
         usage(self.args[1])
     else:
         usage("")
コード例 #57
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def pkg_list(self):
     """List of packages by repository
     """
     options = ["-l", "--list"]
     flag = ["--index", "--installed", "--name"]
     name = INDEX = installed = False
     for arg in self.args[2:]:
         if flag[0] == arg:
             INDEX = True
         if flag[1] in arg:
             installed = True
         if flag[2] == arg:
             name = True
         if arg not in flag:
             usage("")
             raise SystemExit()
     if (len(self.args) > 1 and len(self.args) <= 5
             and self.args[0] in options):
         if self.args[1] in self.meta.repositories:
             PackageManager(binary=None).package_list(
                 self.args[1], name, INDEX, installed)
         else:
             usage(self.args[1])
     else:
         usage("")
コード例 #58
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def pkg_upgrade(self):
     """Check and upgrade packages by repository
     """
     options = ["-c", "--check"]
     flags = [
         "--upgrade", "--skip=", "--resolve-off", "--checklist", "--rebuild"
     ]
     flag, skip = self.__pkg_upgrade_flags(flags)
     if (len(self.args) == 3 and self.args[0] in options
             and self.args[2] == flags[0]
             and self.args[1] in self.meta.repositories):
         if self.args[1] not in ["slack", "sbo"]:
             BinaryInstall(pkg_upgrade(self.args[1], skip, flag),
                           self.args[1], flag).start(is_upgrade=True)
         elif self.args[1] == "slack":
             if self.meta.only_installed in ["on", "ON"]:
                 BinaryInstall(pkg_upgrade("slack", skip, flag), "slack",
                               flag).start(is_upgrade=True)
             else:
                 Patches(skip, flag).start()
         elif self.args[1] == "sbo":
             SBoInstall(sbo_upgrade(skip, flag),
                        flag).start(is_upgrade=True)
         else:
             usage(self.args[1])
     elif len(self.args) == 2 and self.args[0] in options:
         if self.args[1] == "ALL":
             Updates(repo="").ALL()
         else:
             Updates(self.args[1]).run()
     elif (len(self.args) >= 2 and self.args[0] in options
           and self.args[1] not in self.meta.repositories):
         usage(self.args[1])
     else:
         usage("")
コード例 #59
0
ファイル: main.py プロジェクト: metemaddar/slpkg
 def pkg_tracking(self):
     """Tracking package dependencies
     """
     flag = []
     options = ["-t", "--tracking"]
     additional_options = ["--check-deps", "--graph=", "--case-ins"]
     for arg in self.args[2:]:
         if arg.startswith(additional_options[1]):
             flag.append(arg)
             self.args.remove(arg)
         if arg in additional_options:
             flag.append(arg)
     # clean additional options from args
     for f in flag:
         if f in self.args:
             self.args.remove(f)
     # print usage message if wrong additional option
     for arg in self.args:
         if arg.startswith("--"):
             if arg not in additional_options:
                 usage("")
                 raise SystemExit()
     if (len(self.args) >= 3 and len(self.args) <= 3
             and self.args[0] in options
             and self.args[1] in self.meta.repositories):
         TrackingDeps(self.args[2], self.args[1], flag).run()
     elif (len(self.args) >= 2
           and self.args[1] not in self.meta.repositories):
         usage(self.args[1])
     else:
         usage("")
コード例 #60
0
ファイル: main.py プロジェクト: websafe/slpkg
 def bin_upgrade(self):
     """Install-upgrade Slackware binary packages
     """
     packages = self.args[1:]
     options = [
         "-u",
         "--upgradepkg"
     ]
     flag = ""
     flags = [
         "--dry-run",
         "--install-new",
         "--reinstall",
         "--verbose"
     ]
     if len(self.args) > 1 and self.args[0] in options:
         if self.args[1] in flags:
             flag = self.args[1]
             packages = self.args[2:]
         PackageManager(packages).upgrade(flag)
     else:
         usage("")