mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
add list of installed packages
This commit is contained in:
parent
4aa0ca8250
commit
9e4c38239f
5 changed files with 30 additions and 12 deletions
|
@ -251,7 +251,7 @@ Command Line Tool Usage
|
|||
-q, --list, [package...] --add, --remove add, remove SBo packages in queue
|
||||
-q, --build, --install, --build-install build, install packages from queue
|
||||
-g, --config, --config=[editor] configuration file management
|
||||
-l, [repository], --index list of repositories packages
|
||||
-l, [repository], --index, --installed list of repositories packages
|
||||
-c, [repository] --upgrade check for updated packages
|
||||
-s, [repository] [package...] download, build & install packages
|
||||
-t, [repository] [package] package tracking dependencies
|
||||
|
@ -572,6 +572,7 @@ Read fies, download, build or install:
|
|||
|
||||
Choose an option: _
|
||||
|
||||
|
||||
Auto tool to build package:
|
||||
|
||||
.. code-block:: bash
|
||||
|
|
|
@ -169,7 +169,7 @@ Build or install or build and install packages are queued.
|
|||
Print configuration file or edit with editor.
|
||||
|
||||
.SS -l , list of installed packages
|
||||
\fBslpkg\fP \fB-l\fP <\fIrepository\fP>, \fI--index\fP
|
||||
\fBslpkg\fP \fB-l\fP <\fIrepository\fP>, \fI--index\fP, \fI--installed\fP
|
||||
.PP
|
||||
List of packages per repository. Support command 'grep' like '# slpkg -l sbo | grep "python"'.
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ def options():
|
|||
"from queue",
|
||||
" -g, --config, --config=[editor] configuration file "
|
||||
"management",
|
||||
" -l, [repository], --index list of repositories "
|
||||
" -l, [repository], --index, --installed list of repositories "
|
||||
"packages",
|
||||
" -c, [repository] --upgrade check for updated "
|
||||
"packages",
|
||||
|
@ -100,7 +100,7 @@ def usage(repo):
|
|||
" [-q --list, [...] --add, --remove]",
|
||||
" [-q --build, --install, --build-install]",
|
||||
" [-g --config, --config=[editor]]",
|
||||
" [-l [repository], --index]",
|
||||
" [-l [repository], --index, --installed]",
|
||||
" [-c [repository] --upgrade]",
|
||||
" [-s [repository] [package...]",
|
||||
" [-t [repository] [package]",
|
||||
|
|
|
@ -137,14 +137,17 @@ def main():
|
|||
elif (len(args) == 2 and args[0] == 'repo-info' and
|
||||
args[1] not in RepoList().all_repos):
|
||||
usage(args[1])
|
||||
|
||||
if len(args) == 3 and args[0] == '-a':
|
||||
BuildPackage(args[1], args[2:], _m.path).build()
|
||||
elif (len(args) == 3 and args[0] == '-l' and args[2] == '--index' and
|
||||
args[1] in _m.repositories):
|
||||
PackageManager(None).list(args[1], True)
|
||||
elif (len(args) == 3 and args[0] == '-l' and args[1] in _m.repositories):
|
||||
if args[2] == '--index':
|
||||
PackageManager(None).list(args[1], True, False)
|
||||
elif args[2] == '--installed':
|
||||
PackageManager(None).list(args[1], False, True)
|
||||
else:
|
||||
usage(args[1])
|
||||
elif len(args) == 2 and args[0] == '-l' and args[1] in _m.repositories:
|
||||
PackageManager(None).list(args[1], False)
|
||||
PackageManager(None).list(args[1], False, False)
|
||||
elif len(args) == 3 and args[0] == '-c' and args[2] == '--upgrade':
|
||||
if args[1] in _m.repositories and args[1] not in ['slack', 'sbo']:
|
||||
Case('').binary_upgrade(args[1])
|
||||
|
|
|
@ -264,7 +264,7 @@ class PackageManager(object):
|
|||
bol = eol = "\n"
|
||||
Msg().pkg_not_found(bol, pkg, message, eol)
|
||||
|
||||
def list(self, repo, INDEX):
|
||||
def list(self, repo, INDEX, installed):
|
||||
'''
|
||||
List with the installed packages
|
||||
'''
|
||||
|
@ -290,9 +290,9 @@ class PackageManager(object):
|
|||
if line.startswith("PACKAGE NAME: "):
|
||||
pkg_list.append(line[15:].strip())
|
||||
for pkg in sorted(pkg_list):
|
||||
pkg = self._list_color_tag(pkg)
|
||||
if INDEX:
|
||||
index += 1
|
||||
pkg = self._list_color_tag(pkg)
|
||||
print("{0}{1}:{2} {3}".format(_m.color['GREY'], index,
|
||||
_m.color['ENDC'], pkg))
|
||||
if index == page:
|
||||
|
@ -304,8 +304,12 @@ class PackageManager(object):
|
|||
break
|
||||
print("") # new line after page
|
||||
page += row
|
||||
elif installed:
|
||||
if self._list_of_installed(pkg):
|
||||
print('{0}{1}{2}'.format(_m.color['GREEN'], pkg,
|
||||
_m.color['ENDC']))
|
||||
else:
|
||||
print pkg
|
||||
print(pkg)
|
||||
print("") # new line at end
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
|
@ -322,3 +326,13 @@ class PackageManager(object):
|
|||
pkg = '{0}{1}{2}'.format(_m.color['GREEN'], pkg,
|
||||
_m.color['ENDC'])
|
||||
return pkg
|
||||
|
||||
def _list_of_installed(self, pkg):
|
||||
'''
|
||||
Return installed packages
|
||||
'''
|
||||
find = pkg + '-'
|
||||
if pkg.endswith('.txz') or pkg.endswith('.tgz'):
|
||||
find = pkg[:-4]
|
||||
if find_package(find, _m.pkg_path):
|
||||
return pkg
|
||||
|
|
Loading…
Add table
Reference in a new issue