mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-27 09:58:10 +01:00
Added additional option
This commit is contained in:
parent
d352e92e0f
commit
7fe6fc07ae
5 changed files with 62 additions and 17 deletions
24
README.rst
24
README.rst
|
@ -683,7 +683,7 @@ and also displays installed packages:
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ slpkg -t sbo brasero
|
$ slpkg -t sbo brasero
|
||||||
Reading package lists... Done
|
Resolving dependencies... Done
|
||||||
|
|
||||||
+=========================
|
+=========================
|
||||||
| brasero dependencies :
|
| brasero dependencies :
|
||||||
|
@ -701,6 +701,28 @@ and also displays installed packages:
|
||||||
|
|
|
|
||||||
+--5 libunique
|
+--5 libunique
|
||||||
|
|
||||||
|
|
||||||
|
Check if dependencies used:
|
||||||
|
|
||||||
|
$ slpkg -t sbo Flask --check-deps
|
||||||
|
Resolving dependencies... Done
|
||||||
|
|
||||||
|
+=============================
|
||||||
|
| Package Flask dependencies :
|
||||||
|
+=============================
|
||||||
|
\
|
||||||
|
+---[ Tree of dependencies ]
|
||||||
|
|
|
||||||
|
+--1: pysetuptools is dependency --> Flask, bpython, pip, pylint
|
||||||
|
|
|
||||||
|
+--2: MarkupSafe is dependency --> Flask
|
||||||
|
|
|
||||||
|
+--3: itsdangerous is dependency --> Flask
|
||||||
|
|
|
||||||
|
+--4: Jinja2 is dependency --> Flask
|
||||||
|
|
|
||||||
|
+--5: werkzeug is dependency --> Flask
|
||||||
|
|
||||||
|
|
||||||
Check if your packages is up to date or changes in ChangeLog.txt:
|
Check if your packages is up to date or changes in ChangeLog.txt:
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ Usage: slpkg Commands:
|
||||||
[-l [repository], --index, --installed]
|
[-l [repository], --index, --installed]
|
||||||
[-c [repository] --upgrade, --skip=[...] --resolve-off]
|
[-c [repository] --upgrade, --skip=[...] --resolve-off]
|
||||||
[-s [repository] [package...], --resolve-off]
|
[-s [repository] [package...], --resolve-off]
|
||||||
[-t [repository] [package]]
|
[-t [repository] [package], --check-deps]
|
||||||
[-p [repository] [package], --color=[]]
|
[-p [repository] [package], --color=[]]
|
||||||
[-n [SBo package]] [-F [...]] [-f [...]]
|
[-n [SBo package]] [-F [...]] [-f [...]]
|
||||||
[-i [options] [...]] [-u [options] [...]]
|
[-i [options] [...]] [-u [options] [...]]
|
||||||
|
@ -163,11 +163,12 @@ dependencies of the package. Switch off automatic resolve dependencies with addi
|
||||||
"--resolve-off".
|
"--resolve-off".
|
||||||
|
|
||||||
.SS -t, --tracking, tracking dependencies
|
.SS -t, --tracking, tracking dependencies
|
||||||
\fBslpkg\fP \fB-t\fP <\fIrepository\fP> <\fIname of package\fP>
|
\fBslpkg\fP \fB-t\fP <\fIrepository\fP> <\fIname of package\fP>, \fB--check-deps\fP
|
||||||
.PP
|
.PP
|
||||||
Tracking all dependencies of that package.
|
Tracking all dependencies of that package.
|
||||||
The sequence shown is that you must follow to correctly install package.
|
The sequence shown is that you must follow to correctly install package.
|
||||||
Also you can check if the installed package has all the required dependencies.
|
Also you can check if the installed package has all the required dependencies and with
|
||||||
|
additional option "--check-deps" if used by other packages.
|
||||||
|
|
||||||
.SS -p, --desk, print packages description
|
.SS -p, --desk, print packages description
|
||||||
\fBslpkg\fP \fB-p\fP <\fIrepository\fP> <\fIname of package\fP>, \fB--color=[]\fP
|
\fBslpkg\fP \fB-p\fP <\fIrepository\fP> <\fIname of package\fP>, \fB--color=[]\fP
|
||||||
|
|
|
@ -85,8 +85,8 @@ Optional arguments:
|
||||||
-s, --sync, [repository] [package...], Sync packages. Install packages
|
-s, --sync, [repository] [package...], Sync packages. Install packages
|
||||||
--resolve-off directly from remote repositories
|
--resolve-off directly from remote repositories
|
||||||
with all dependencies.
|
with all dependencies.
|
||||||
-t, --tracking, [repository] [package] Tracking package dependencies and
|
-t, --tracking, [repository] [package], Tracking package dependencies and
|
||||||
print package dependenies tree with
|
--check-deps print package dependenies tree with
|
||||||
highlight if packages is installed.
|
highlight if packages is installed.
|
||||||
-p, --desc, [repository] [package], Print description of a package
|
-p, --desc, [repository] [package], Print description of a package
|
||||||
--color=[] directly from the repository and
|
--color=[] directly from the repository and
|
||||||
|
@ -140,7 +140,7 @@ def usage(repo):
|
||||||
[-l [repository], --index, --installed]
|
[-l [repository], --index, --installed]
|
||||||
[-c [repository], --upgrade, --skip=[...] --resolve-off]
|
[-c [repository], --upgrade, --skip=[...] --resolve-off]
|
||||||
[-s [repository] [package...], --resolve-off]
|
[-s [repository] [package...], --resolve-off]
|
||||||
[-t [repository] [package]]
|
[-t [repository] [package], --check-deps]
|
||||||
[-p [repository] [package], --color=[]]
|
[-p [repository] [package], --color=[]]
|
||||||
[-n [SBo package]] [-F [...]] [-f [...]]
|
[-n [SBo package]] [-F [...]] [-f [...]]
|
||||||
[-i [options] [...]] [-u [options] [...]]
|
[-i [options] [...]] [-u [options] [...]]
|
||||||
|
|
|
@ -291,9 +291,14 @@ class ArgParse(object):
|
||||||
"""Tracking package dependencies
|
"""Tracking package dependencies
|
||||||
"""
|
"""
|
||||||
options = ["-t", "--tracking"]
|
options = ["-t", "--tracking"]
|
||||||
|
flag = ["--check-deps"]
|
||||||
if (len(self.args) == 3 and self.args[0] in options and
|
if (len(self.args) == 3 and self.args[0] in options and
|
||||||
self.args[1] in self.meta.repositories):
|
self.args[1] in self.meta.repositories):
|
||||||
track_dep(self.args[2], self.args[1])
|
track_dep(self.args[2], self.args[1], flag="")
|
||||||
|
elif (len(self.args) == 4 and self.args[0] in options and
|
||||||
|
self.args[1] in self.meta.repositories and
|
||||||
|
self.args[3] == flag[0]):
|
||||||
|
track_dep(self.args[2], self.args[1], flag[0])
|
||||||
elif (len(self.args) > 1 and self.args[0] in options and
|
elif (len(self.args) > 1 and self.args[0] in options and
|
||||||
self.args[1] not in self.meta.repositories):
|
self.args[1] not in self.meta.repositories):
|
||||||
usage(self.args[1])
|
usage(self.args[1])
|
||||||
|
|
|
@ -36,7 +36,7 @@ from binary.search import search_pkg
|
||||||
from binary.dependency import Dependencies
|
from binary.dependency import Dependencies
|
||||||
|
|
||||||
|
|
||||||
def track_dep(name, repo):
|
def track_dep(name, repo, flag):
|
||||||
"""
|
"""
|
||||||
View tree of dependencies and also
|
View tree of dependencies and also
|
||||||
highlight packages with color green
|
highlight packages with color green
|
||||||
|
@ -75,25 +75,42 @@ def track_dep(name, repo):
|
||||||
_meta_.color["YELLOW"], _meta_.color["ENDC"]))
|
_meta_.color["YELLOW"], _meta_.color["ENDC"]))
|
||||||
index = 0
|
index = 0
|
||||||
for pkg in dependencies:
|
for pkg in dependencies:
|
||||||
|
used = ""
|
||||||
|
if flag == "--check-deps":
|
||||||
|
used = "{0} {1}{2}{3}".format(
|
||||||
|
"is dependency -->", _meta_.color["CYAN"],
|
||||||
|
", ".join(check_used(pkg)), _meta_.color["ENDC"])
|
||||||
index += 1
|
index += 1
|
||||||
installed = ""
|
installed = ""
|
||||||
if find_package(pkg + _meta_.sp, _meta_.pkg_path):
|
if find_package(pkg + _meta_.sp, _meta_.pkg_path):
|
||||||
if _meta_.use_colors in ["off", "OFF"]:
|
if _meta_.use_colors in ["off", "OFF"]:
|
||||||
installed = "*"
|
installed = "*"
|
||||||
print(" |")
|
print(" |")
|
||||||
print(" {0}{1}: {2}{3}{4} {5}".format("+--", index,
|
print(" {0}{1}: {2}{3}{4} {5}{6}".format(
|
||||||
_meta_.color["GREEN"],
|
"+--", index, _meta_.color["GREEN"], pkg,
|
||||||
pkg, _meta_.color["ENDC"],
|
_meta_.color["ENDC"], installed, used))
|
||||||
installed))
|
|
||||||
else:
|
else:
|
||||||
print(" |")
|
print(" |")
|
||||||
print(" {0}{1}: {2}{3}{4} {5}".format("+--", index,
|
print(" {0}{1}: {2}{3}{4} {5}{6}".format(
|
||||||
_meta_.color["RED"], pkg,
|
"+--", index, _meta_.color["RED"], pkg,
|
||||||
_meta_.color["ENDC"],
|
_meta_.color["ENDC"], installed, used))
|
||||||
installed))
|
|
||||||
if _meta_.use_colors in ["off", "OFF"]:
|
if _meta_.use_colors in ["off", "OFF"]:
|
||||||
print("\n *: Installed\n")
|
print("\n *: Installed\n")
|
||||||
else:
|
else:
|
||||||
print("") # new line at end
|
print("") # new line at end
|
||||||
else:
|
else:
|
||||||
print("\nNo package was found to match\n")
|
print("\nNo package was found to match\n")
|
||||||
|
|
||||||
|
|
||||||
|
def check_used(pkg):
|
||||||
|
"""Check if dependencies used
|
||||||
|
"""
|
||||||
|
used = []
|
||||||
|
dep_path = _meta_.log_path + "dep/"
|
||||||
|
logs = find_package("", dep_path)
|
||||||
|
for log in logs:
|
||||||
|
deps = Utils().read_file(dep_path + log)
|
||||||
|
for dep in deps.splitlines():
|
||||||
|
if pkg == dep:
|
||||||
|
used.append(log)
|
||||||
|
return used
|
||||||
|
|
Loading…
Reference in a new issue