Added dependencies status

This commit is contained in:
Dimitris Zlatanidis 2015-07-23 03:45:17 +03:00
parent 1c9c5f827b
commit 1a4713b188
5 changed files with 146 additions and 4 deletions

View file

@ -131,6 +131,14 @@ run '$ slpkg update' to update package list.
View list of repositories with command '$ slpkg repo-list' or get repository information with
command '$ slpkg repo-info <repository>.
Update slpkg itself simply run "$ slpkg update slpkg", and slpkg check from GitHub repository if
new versions are available.
Checking packages health with command "$ slpkg health" and slpkg check if files missing from
package file list.
Print dependencies status used by packages with command "$ slpkg deps-status".
If you have already downloaded the script and the source code you can build the package with
the command '$ slpkg <script.tar.gz> <sources>'.
@ -350,6 +358,8 @@ Command Line Tool Usage
update slpkg Upgrade the program directly from
repository.
health, --silent Health check installed packages.
deps-status Print dependencies status used by
packages.
Optional arguments:
-h, --help Print this help message and exit.
@ -724,6 +734,38 @@ and also displays installed packages:
+--5: werkzeug is dependency --> Flask
Print dependencies status used by packages:
$ slpkg deps-status
+==============================================================================
| Dependencies Packages
+==============================================================================
astroid pylint
logilab-common pylint
werkzeug Flask
cryptography bpython
ndg_httpsclient bpython
enum34 bpython
pyOpenSSL bpython
curtsies bpython
six bpython, pylint
cffi bpython
python-requests bpython
pysetuptools Flask, bpython, pip, pylint
MarkupSafe Flask
Pygments bpython
Jinja2 Flask
pycparser bpython
blessings bpython
greenlet bpython
pyasn1 bpython
Summary
===============================================================================
Found 19 dependencies in 4 packages.
Check if your packages is up to date or changes in ChangeLog.txt:
.. code-block:: bash

View file

@ -20,7 +20,7 @@ Usage: slpkg Commands:
[repo-add [repository name] [URL]]
[repo-remove [repository]] [repo-list]
[repo-info [repository]] [update [slpkg]]
[health, --silent]
[health, --silent] [deps-status]
Optional arguments:
[-h] [-v]
@ -89,7 +89,7 @@ Lists all enabled or disabled repositories.
.PP
View repository information.
.SS update slpkg
.SS update slpkg, update slpkg itself
\fBslpkg\fP \fBupdate\fP \fBslpkg\fP
.PP
You can check for new versions and update slpkg itself.
@ -100,6 +100,12 @@ You can check for new versions and update slpkg itself.
Check file list from packages of files installed. The option "--silent" it allows
reference only errors.
.SS deps-status, print dependencies status
\fBslpkg\fP \fBdeps-status\fP
.PP
Print dependencies status used by packages. Prerequisite packages have been installed
with the option "slpkg -s <repository> <packages>".
.SH OPTIONS
.PP
The following arguments are available.

View file

@ -55,6 +55,8 @@ Commands:
update slpkg Upgrade the program directly from
repository.
health, --silent Health check installed packages.
deps-status Print dependencies status used by
packages.
Optional arguments:
-h, --help Print this help message and exit.
@ -128,7 +130,7 @@ def usage(repo):
[repo-add [repository name] [URL]]
[repo-remove [repository]] [repo-list]
[repo-info [repository]] [update [slpkg]]
[health, --silent]
[health, --silent] [deps-status]
Optional arguments:
[-h] [-v]

View file

@ -43,6 +43,8 @@ from health import PackageHealth
from pkg_find import find_from_repos
from arguments import options, usage
from slpkg_update import it_self_update
from status_deps import DependenciesStatus
from init import (
Update,
Initialization,
@ -75,7 +77,8 @@ class ArgParse(object):
"repo-list",
"repo-info",
"update-slpkg",
"health"
"health",
"deps-status"
]
# checking if repositories exists
@ -181,6 +184,14 @@ class ArgParse(object):
else:
usage("")
def command_deps_status(self):
"""Print dependencies status
"""
if len(self.args) == 1 and self.args[0] == "deps-status":
DependenciesStatus().show()
else:
usage("")
def auto_build(self):
"""Auto built tool
"""
@ -555,6 +566,7 @@ def main():
"repo-remove": argparse.command_repo_remove,
"repo-info": argparse.command_repo_info,
"health": argparse.command_health,
"deps-status": argparse.command_deps_status,
"-a": argparse.auto_build,
"--autobuild": argparse.auto_build,
"-l": argparse.pkg_list,

80
slpkg/status_deps.py Normal file
View file

@ -0,0 +1,80 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# status_deps.py file is part of slpkg.
# Copyright 2014-2015 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://github.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from utils import Utils
from messages import Msg
from splitting import split_package
from __metadata__ import MetaData as _meta_
from pkg.find import find_package
class DependenciesStatus(object):
def __init__(self):
self.meta = _meta_
self.dmap = {}
self.count_pkg = 0
self.count_dep = 0
self.dep_path = self.meta.log_path + "dep/"
self.logs = find_package("", self.dep_path)
self.installed = find_package("", self.meta.pkg_path)
def data(self):
"""Check all installed packages and create
dictionary database
"""
for pkg in self.installed:
name = split_package(pkg)[0]
for log in self.logs:
deps = Utils().read_file(self.dep_path + log)
for dep in deps.splitlines():
if name == dep:
if name not in self.dmap.keys():
self.dmap[name] = [log]
self.count_dep += 1
else:
self.dmap[name] += [log]
self.count_pkg += 1
def show(self):
"""Show dependencies status
"""
self.data()
grey = self.meta.color["GREY"]
green = self.meta.color["GREEN"]
yellow = self.meta.color["YELLOW"]
endc = self.meta.color["ENDC"]
print("")
Msg().template(78)
print("| {0}{1}{2}".format("Dependencies", " " * 20, "Packages"))
Msg().template(78)
for key, value in self.dmap.iteritems():
print(" {0}{1}{2}{3}{4}{5}{6}".format(
yellow, key, endc, " " * (32-len(key)),
green, ", ".join(value), endc))
print("\nSummary")
print("=" * 79)
print("{0}Found {1} dependencies in {2} packages.{3}\n".format(
grey, self.count_dep, self.count_pkg, endc))