mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Added '--deps' additional option
This commit is contained in:
parent
2a27d70171
commit
34c804dc55
5 changed files with 136 additions and 41 deletions
15
README.rst
15
README.rst
|
@ -282,7 +282,8 @@ The next four commands '# slpkg --installpkg, --upgradepkg, --removepkg <package
|
|||
remove packages from your system events.
|
||||
Notable mention must give the command '# slpkg --removepkg <packages>' which can remove a packages
|
||||
with all dependencies together after editing configuration file '/etc/slpkg/slpkg.conf'
|
||||
(default is disable). Also you can check if packages used as dependency with additional option
|
||||
(default is disable) or add additional option "--deps". Also you can check if packages used as
|
||||
dependency with additional option
|
||||
"--check-deps". Option "--tag" allow to remove packages with by TAG.
|
||||
Optional you can use dialog utility with additional option "--checklist" (require python2-pythondialog).
|
||||
|
||||
|
@ -465,9 +466,10 @@ Command Line Tool Usage
|
|||
options=[--dry-run, --install-new, binary packages from an older
|
||||
--reinstall, --verbose] version to a newer one.
|
||||
-r, --removepkg, [options] [package...], Removes a previously installed
|
||||
--check-deps, --tag, --checklist Slackware binary packages,
|
||||
options=[-warn, -preserve, -copy, while writing a progress report
|
||||
-keep] to the standard output.
|
||||
--deps, --check-deps, --tag, Slackware binary packages,
|
||||
--checklist while writing a progress report
|
||||
options=[-warn, -preserve, -copy to the standard output.
|
||||
-keep] Use only package name.
|
||||
-d, --display, [package...] Display the installed packages
|
||||
contents and file list.
|
||||
|
||||
|
@ -1401,12 +1403,11 @@ Removes a previously installed Slackware binary packages:
|
|||
|
||||
|
||||
Remove packages with all dependencies and check if used as dependency:
|
||||
Presupposes facility with the option '# slpkg -s <repository> <packages>' and
|
||||
enabled from configuration file.
|
||||
Presupposes facility with the option '# slpkg -s <repository> <packages>'.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ slpkg -r Flask --check-deps
|
||||
$ slpkg -r Flask --deps --check-deps
|
||||
|
||||
Packages with name matching [ Flask ]
|
||||
|
||||
|
|
|
@ -46,7 +46,8 @@ Usage: slpkg Commands:
|
|||
[-f [package...]]
|
||||
[-i [options] [package...]]
|
||||
[-u [options] [package...]]
|
||||
[-r [options] [package...], --check-deps, --tag, --checklist]
|
||||
[-r [options] [package...], --deps, --check-deps, --tag,
|
||||
--checklist]
|
||||
[-d [package...]]
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
@ -290,7 +291,7 @@ and will skip any packages that do not already have a version installed.
|
|||
More information please read "man upgradepkg".
|
||||
|
||||
.SS -r, --removepkg, remove previously installed Slackware binary packages
|
||||
\fBslpkg\fP \fB-r\fP \fB[-copy, -keep, -preserve, -warn]\fP <\fInames of packages\fP>, \fB--check-deps\fP, \fB--tag\fP, \fB--checklist\fP
|
||||
\fBslpkg\fP \fB-r\fP \fB[-copy, -keep, -preserve, -warn]\fP <\fInames of packages\fP>, \fB--deps\fP, \fB--check-deps\fP, \fB--tag\fP, \fB--checklist\fP
|
||||
.PP
|
||||
Removes a previously installed Slackware package, while writing a progress report to
|
||||
the standard output. A package may be specified either by the full package name (as
|
||||
|
@ -301,8 +302,10 @@ More information please read "man removepkg".
|
|||
.PP
|
||||
Additional options:
|
||||
.PP
|
||||
\fB--deps\fP : Remove packages with dependencies.
|
||||
.PP
|
||||
\fB--check-deps\fP : Check if installed packages used by other packages.
|
||||
.pp
|
||||
.PP
|
||||
\fB--tag\fP : Remove packages with by TAG.
|
||||
.PP
|
||||
\fB--checklist\fP : Enable dialog utility and checklist option. (Require python2-pythondialog)
|
||||
|
|
|
@ -120,9 +120,10 @@ Optional arguments:
|
|||
options=[--dry-run, --install-new, binary packages from an older
|
||||
--reinstall, --verbose] version to a newer one.
|
||||
-r, --removepkg, [options] [package...], Removes a previously installed
|
||||
--check-deps, --tag, --checklist Slackware binary packages,
|
||||
options=[-warn, -preserve, -copy, while writing a progress report
|
||||
-keep] to the standard output.
|
||||
--deps, --check-deps, --tag, Slackware binary packages,
|
||||
--checklist while writing a progress report
|
||||
options=[-warn, -preserve, -copy, to the standard output.
|
||||
-keep] Use only package name.
|
||||
-d, --display, [package...] Display the installed packages
|
||||
contents and file list.
|
||||
|
||||
|
@ -166,7 +167,8 @@ def usage(repo):
|
|||
[-f [package...], --case-ins]
|
||||
[-i [options] [package...]]
|
||||
[-u [options] [package...]]
|
||||
[-r [options] [package...], --check-deps, --tag, --checklist]
|
||||
[-r [options] [package...], --deps, --check-deps, --tag,
|
||||
--checklist]
|
||||
[-d [package...]]
|
||||
"""
|
||||
error_repo = ""
|
||||
|
|
140
slpkg/main.py
140
slpkg/main.py
|
@ -223,7 +223,10 @@ class ArgParse(object):
|
|||
def auto_build(self):
|
||||
"""Auto built tool
|
||||
"""
|
||||
options = ["-a", "--autobuild"]
|
||||
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:
|
||||
|
@ -232,7 +235,10 @@ class ArgParse(object):
|
|||
def pkg_list(self):
|
||||
"""List of packages by repository
|
||||
"""
|
||||
options = ["-l", "--list"]
|
||||
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):
|
||||
|
@ -259,8 +265,16 @@ class ArgParse(object):
|
|||
def pkg_upgrade(self):
|
||||
"""Check and upgrade packages by repository
|
||||
"""
|
||||
options = ["-c", "--check"]
|
||||
flags = ["--upgrade", "--skip=", "--resolve-off", "--checklist"]
|
||||
options = [
|
||||
"-c",
|
||||
"--check"
|
||||
]
|
||||
flags = [
|
||||
"--upgrade",
|
||||
"--skip=",
|
||||
"--resolve-off",
|
||||
"--checklist"
|
||||
]
|
||||
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
|
||||
|
@ -307,8 +321,14 @@ class ArgParse(object):
|
|||
"""Install packages by repository
|
||||
"""
|
||||
flag = []
|
||||
options = ["-s", "--sync"]
|
||||
additional_options = ["--resolve-off", "--case-ins"]
|
||||
options = [
|
||||
"-s",
|
||||
"--sync"
|
||||
]
|
||||
additional_options = [
|
||||
"--resolve-off",
|
||||
"--case-ins"
|
||||
]
|
||||
for arg in self.args:
|
||||
if arg in additional_options:
|
||||
flag.append(arg)
|
||||
|
@ -329,8 +349,14 @@ class ArgParse(object):
|
|||
"""Tracking package dependencies
|
||||
"""
|
||||
flag = []
|
||||
options = ["-t", "--tracking"]
|
||||
additional_options = ["--check-deps", "--graph="]
|
||||
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:
|
||||
|
@ -349,8 +375,14 @@ class ArgParse(object):
|
|||
"""View slackbuilds packages
|
||||
"""
|
||||
flag = []
|
||||
options = ["-n", "--network"]
|
||||
additional_options = ["--checklist", "--case-ins"]
|
||||
options = [
|
||||
"-n",
|
||||
"--network"
|
||||
]
|
||||
additional_options = [
|
||||
"--checklist",
|
||||
"--case-ins"
|
||||
]
|
||||
for arg in self.args[2:]:
|
||||
if arg in additional_options:
|
||||
flag.append(arg)
|
||||
|
@ -365,8 +397,14 @@ class ArgParse(object):
|
|||
"""Manage blacklist packages
|
||||
"""
|
||||
blacklist = BlackList()
|
||||
options = ["-b", "--blacklist"]
|
||||
flag = ["--add", "--remove"]
|
||||
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]):
|
||||
|
@ -387,9 +425,20 @@ class ArgParse(object):
|
|||
"""Manage packages in queue
|
||||
"""
|
||||
queue = QueuePkgs()
|
||||
options = ["-q", "--queue"]
|
||||
flag = ["--add", "--remove"]
|
||||
command = ["list", "build", "install", "build-install"]
|
||||
options = [
|
||||
"-q",
|
||||
"--queue"
|
||||
]
|
||||
flag = [
|
||||
"--add",
|
||||
"--remove"
|
||||
]
|
||||
command = [
|
||||
"list",
|
||||
"build",
|
||||
"install",
|
||||
"build-install"
|
||||
]
|
||||
if (len(self.args) > 2 and self.args[0] in options and
|
||||
self.args[-1] == flag[0]):
|
||||
queue.add(self.args[1:-1])
|
||||
|
@ -419,7 +468,10 @@ class ArgParse(object):
|
|||
"""Install Slackware binary packages
|
||||
"""
|
||||
packages = self.args[1:]
|
||||
options = ["-i", "--installpkg"]
|
||||
options = [
|
||||
"-i",
|
||||
"--installpkg"
|
||||
]
|
||||
flag = ""
|
||||
flags = [
|
||||
"--warn",
|
||||
|
@ -444,7 +496,10 @@ class ArgParse(object):
|
|||
"""Install-upgrade Slackware binary packages
|
||||
"""
|
||||
packages = self.args[1:]
|
||||
options = ["-u", "--upgradepkg"]
|
||||
options = [
|
||||
"-u",
|
||||
"--upgradepkg"
|
||||
]
|
||||
flag = ""
|
||||
flags = [
|
||||
"--dry-run",
|
||||
|
@ -464,8 +519,16 @@ class ArgParse(object):
|
|||
"""Remove Slackware packages
|
||||
"""
|
||||
packages = self.args[1:]
|
||||
options = ["-r", "--removepkg"]
|
||||
additional_options = ["--check-deps", "--tag", "--checklist"]
|
||||
options = [
|
||||
"-r",
|
||||
"--removepkg"
|
||||
]
|
||||
additional_options = [
|
||||
"--deps",
|
||||
"--check-deps",
|
||||
"--tag",
|
||||
"--checklist"
|
||||
]
|
||||
flag, extra = "", []
|
||||
flags = [
|
||||
"-warn",
|
||||
|
@ -490,7 +553,10 @@ class ArgParse(object):
|
|||
"""Find installed packages
|
||||
"""
|
||||
flag = []
|
||||
options = ["-f", "--find"]
|
||||
options = [
|
||||
"-f",
|
||||
"--find"
|
||||
]
|
||||
additional_options = ["--case-ins"]
|
||||
for arg in self.args:
|
||||
if arg in additional_options:
|
||||
|
@ -505,9 +571,18 @@ class ArgParse(object):
|
|||
def pkg_desc(self):
|
||||
"""Print slack-desc by repository
|
||||
"""
|
||||
options = ["-p", "--desc"]
|
||||
options = [
|
||||
"-p",
|
||||
"--desc"
|
||||
]
|
||||
flag = ["--color="]
|
||||
colors = ["red", "green", "yellow", "cyan", "grey"]
|
||||
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()
|
||||
|
@ -528,7 +603,10 @@ class ArgParse(object):
|
|||
"""Find packages from all enabled repositories
|
||||
"""
|
||||
flag = []
|
||||
options = ["-F", "--FIND"]
|
||||
options = [
|
||||
"-F",
|
||||
"--FIND"
|
||||
]
|
||||
additional_options = ["--case-ins"]
|
||||
for arg in self.args:
|
||||
if arg in additional_options:
|
||||
|
@ -544,7 +622,10 @@ class ArgParse(object):
|
|||
"""Print packages contents
|
||||
"""
|
||||
packages = self.args[1:]
|
||||
options = ["-d", "--display"]
|
||||
options = [
|
||||
"-d",
|
||||
"--display"
|
||||
]
|
||||
if len(self.args) > 1 and self.args[0] in options:
|
||||
PackageManager(packages).display()
|
||||
else:
|
||||
|
@ -553,8 +634,15 @@ class ArgParse(object):
|
|||
def congiguration(self):
|
||||
"""Manage slpkg configuration file
|
||||
"""
|
||||
options = ["-g", "--config"]
|
||||
command = ["print", "edit", "reset"]
|
||||
options = [
|
||||
"-g",
|
||||
"--config"
|
||||
]
|
||||
command = [
|
||||
"print",
|
||||
"edit",
|
||||
"reset"
|
||||
]
|
||||
if (len(self.args) == 2 and self.args[0] in options and
|
||||
self.args[1] == command[1]):
|
||||
Config().edit()
|
||||
|
|
|
@ -115,7 +115,8 @@ class PackageManager(object):
|
|||
# then look log file for dependencies in /var/log/slpkg/dep,
|
||||
# read and remove all else remove only the package.
|
||||
if (os.path.isfile(self.dep_path + rmv) and
|
||||
self.meta.del_deps in ["on", "ON"]):
|
||||
self.meta.del_deps in ["on", "ON"] or
|
||||
"--deps" in self.extra):
|
||||
dependencies = self._view_deps(self.dep_path, rmv)
|
||||
if dependencies and self._rmv_deps_answer() in ["y",
|
||||
"Y"]:
|
||||
|
|
Loading…
Reference in a new issue