Added third-party option in the remove

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2019-01-13 12:53:22 +01:00
parent de4273f587
commit 5ffaff2c1a
5 changed files with 37 additions and 14 deletions

View file

@ -203,7 +203,7 @@ Command Line Tool Usage
-r | --removepkg, [options] [package...], Removes a previously installed
--deps, --check-deps, --tag, Slackware binary packages,
--checklist while writing a progress report
--checklist, --third-party while writing a progress report
options=[-warn, -preserve, -copy, to the standard output.
-keep] Use only package name.

View file

@ -291,7 +291,8 @@ Example you can view all installed sbo packages like "# slpkg -f _SBo".
Additional options:
.PP
\fB--case-ins\fP : Search package name with case insensitive.
\fB--third-party\fP : View third party packages.
.PP
\fB--third-party\fP : View all the third-party packages.
.SS -n, --network, view SBo packages
\fBslpkg\fP \fB-n\fP <\fIname of package\fP>, <\fI[pattern], --checklist\fP>, \fI--case-ins\fP
@ -321,7 +322,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--deps\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, \fB--third-party\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
@ -339,6 +340,8 @@ Additional options:
\fB--tag\fP : Remove packages with by TAG.
.PP
\fB--checklist\fP : Enable dialog utility and checklist option. (Require python2-pythondialog)
.PP
\fB--third-party\fP : Remove all the third-party packages.
.SS -d, --display, display the installed packages contents and file list
\fBslpkg\fP \fB-d\fP <\fInames of packages\fP>

View file

@ -154,7 +154,7 @@ Optional arguments:
-r | --removepkg, [options] [package...], Removes a previously installed
--deps, --check-deps, --tag, Slackware binary packages,
--checklist while writing a progress report
--checklist, --third-party while writing a progress report
options=[-warn, -preserve, -copy, to the standard output.
-keep] Use only package name.
@ -209,7 +209,7 @@ def usage(repo):
[-i [options] [package...]]
[-u [options] [package...]]
[-r [options] [package...], --deps, --check-deps, --tag,
--checklist]
--checklist, --third-party]
[-d [package...]]
"""
if repo and repo not in _meta_.repositories:

View file

@ -583,7 +583,8 @@ class ArgParse(object):
"--deps",
"--check-deps",
"--tag",
"--checklist"
"--checklist",
"--third-party"
]
flag, extra = "", []
flags = [

View file

@ -156,16 +156,26 @@ class PackageManager(object):
def _get_removed(self):
"""Manage removed packages by extra options
"""
removed, packages = [], []
if "--tag" in self.extra:
extra = self.extra
removed, packages, pkg = [], [], ""
if "--tag" in extra:
for pkg in find_package("", self.meta.pkg_path):
for tag in self.binary:
if pkg.endswith(tag):
removed.append(split_package(pkg)[0])
packages.append(pkg)
if not removed:
self.msg.pkg_not_found("", "'tag'", "Can't remove", "\n")
raise SystemExit(1)
pkg = ""
extra = ""
elif "--third-party" in extra:
slackware_packages = slackware_repository()
# if "ALL" in self.binary or not self.binary:
slpkg_pkg = self.meta.__all__ + "-" + self.meta.__version__
for pkg in find_package("", self.meta.pkg_path):
if pkg not in slackware_packages and slpkg_pkg not in pkg:
removed.append(split_package(pkg)[0])
packages.append(pkg)
pkg = ""
extra = ""
else:
for pkg in self.binary:
name = GetFromInstalled(pkg).name()
@ -175,7 +185,7 @@ class PackageManager(object):
if pkg and name == pkg:
removed.append(pkg)
packages.append(package[0])
else:
if not removed:
self.msg.pkg_not_found("", pkg, "Can't remove", "\n")
raise SystemExit(1)
return removed, packages
@ -206,6 +216,15 @@ class PackageManager(object):
self._sizes(pkg)
self._calc_sizes()
self._remove_summary()
if "--third-party" in self.extra:
print("\n")
self.msg.template(78)
print("| {0}{1}*** WARNING ***{2}").format(
" " * 27, self.meta.color["RED"], self.meta.color["ENDC"])
print("| Be sure you have update the package lists before. \n| Run"
" the command 'slpkg update' or 'slpkg upgrade "
"--only=slack'")
self.msg.template(78)
return removed
def _calc_sizes(self):