diff --git a/CHANGELOG b/CHANGELOG
index 8d5cb77b..1aaa1e96 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+09-08-2014
+Version 1.7.0
+
+[Feature] - Added removes packages with all dependencies
04-08-2014
Version 1.6.9
diff --git a/PKG-INFO b/PKG-INFO
index 7ce9653f..05f75e83 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: slpkg
-Version: 1.6.9
+Version: 1.7.0
Author: dslackw
Author-email: d zlatanidis at gmail com
Maintainer: dslackw
diff --git a/README.rst b/README.rst
index bb827d03..f09f6025 100644
--- a/README.rst
+++ b/README.rst
@@ -19,6 +19,7 @@ Features
- Grabs packages from slackbuilds.org in real time
- Automatic tool build and install packages
- Check if your distribution is up to date
+- Remove packages with all dependencies
- Display the contents of the packages
- Install-upgrade Slackware packages
- Build and install all in a command
@@ -27,7 +28,6 @@ Features
- Find installed package
- Read SlackBuilds files
- Ī¤racking dependencies
-- Remove packages
- No dependencies
It's a quick and easy way to manage your packages in `Slackware `_
@@ -233,7 +233,7 @@ Check if your distribution is up to date from `Slackware official mirrors
Would you like to upgrade ? [Y/y]
-Find slackbuild from slackbuilds.org:
+Find packages from slackbuilds.org:
.. code-block:: bash
@@ -337,7 +337,7 @@ Auto tool to build package:
Slackware package /tmp/termcolor-1.1.0-x86_64-1_SBo.tgz created.
-Upgrade install package:
+Upgrade, install package:
.. code-block:: bash
@@ -358,7 +358,7 @@ Upgrade install package:
#
Package termcolor-1.1.0-x86_64-1_SBo.tgz installed.
-Of course you can install mass-packages:
+Install mass-packages:
.. code-block:: bash
@@ -368,7 +368,7 @@ Of course you can install mass-packages:
$ slpkg -i *.t?z
-Find if your packages installed:
+Find installed packages:
.. code-block:: bash
@@ -383,7 +383,7 @@ Find if your packages installed:
[ installed ] - rar-5.0.1-x86_64-1_SBo
[ installed ] - pip-1.5.4-x86_64-1_SBo
-Display the contents of the package:
+Display the contents of the packages:
.. code-block:: bash
@@ -431,7 +431,7 @@ Display the contents of the package:
No such package lua: Cant find
-Remove package:
+Remove packages:
.. code-block:: bash
@@ -476,10 +476,42 @@ Remove package:
No such package lua: Cant find
[ installed ] - rar-5.0.1-x86_64-1_SBo
- $ slpkg -v
- Version: x.x.x
- Licence: GNU General Public License v3 (GPLv3)
- Email: d.zlatanidis@gmail.com
+Remove packages with all dependencies:
+(presupposes facility with the option 'slpkg -s sbo )
+
+.. code-block:: bash
+
+ $ slpkg -r Flask
+
+ Packages with name matching [ Flask ]
+
+ [ delete ] --> Flask-0.10.1-x86_64-1_SBo
+
+ Are you sure to remove 1 package [Y/y]
+
+ +==============================================================================
+ | Found dependencies for package Flask:
+ +==============================================================================
+ | pysetuptools
+ | MarkupSafe
+ | itsdangerous
+ | Jinja2
+ | werkzeug
+ +==============================================================================
+
+ Remove dependencies [Y/y]
+
+ .
+ .
+ .
+ +==============================================================================
+ | Package Flask removed
+ | Package pysetuptools removed
+ | Package MarkupSafe removed
+ | Package itsdangerous removed
+ | Package Jinja2 removed
+ | Package werkzeug removed
+ +==============================================================================
Man page it is available for full support:
diff --git a/man/slpkg.8 b/man/slpkg.8
index 56250434..f41a3338 100644
--- a/man/slpkg.8
+++ b/man/slpkg.8
@@ -107,7 +107,10 @@ slackware command upgradepkg --reinstall)
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 you'd see listed in
-/var/log/packages/), or by the base package name. 'Requires root
+/var/log/packages/), or by the base package name. If installed
+packages with command 'slpkg -s sbo ' then write a file
+in /var/log/slpkg/dep/ with all dependencies and it allows you
+can remove them all together. 'Requires root
privileges' (like slackware command removepkg)
.SS -f find packages
\fBslpkg\fP \fB-f\fP <\fIname of packages\fP>
diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py
index 8289d356..0328398e 100644
--- a/slpkg/__metadata__.py
+++ b/slpkg/__metadata__.py
@@ -6,7 +6,7 @@ import subprocess
__all__ = "slpkg"
__author__ = "dslackw"
-__version_info__ = (1, 6, 9)
+__version_info__ = (1, 7, 0)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"
@@ -18,7 +18,10 @@ sp = "-"
path = subprocess.check_output(["pwd"], shell=True).replace("\n", "/")
''' build path '''
-build_path = path + "Slpkg_Build/"
+build_path = path + "slpkg_Build/"
+
+''' log path '''
+log_path = "/var/log/slpkg/"
''' temponary path '''
tmp = "/tmp/"
diff --git a/slpkg/main.py b/slpkg/main.py
index 3fbe057c..34238b6c 100755
--- a/slpkg/main.py
+++ b/slpkg/main.py
@@ -34,8 +34,8 @@ optional arguments:
-i [ ...] install binary packages
-u [ ...] upgrade binary packages
-o [ ...] reinstall binary packages
- -r [ ...] remove packages
- -f [ ...] view packages installed
+ -r [ ...] remove binary packages
+ -f [ ...] view installed packages
-d [ ...] display the contents of the packages
'''
diff --git a/slpkg/pkg/build.py b/slpkg/pkg/build.py
index 94729c01..48a9c680 100755
--- a/slpkg/pkg/build.py
+++ b/slpkg/pkg/build.py
@@ -11,7 +11,7 @@ from slpkg.messages import pkg_not_found, s_user
def build_package(script, source, extra, path):
'''
- Build package with source
+ Build package from source
'''
s_user(getpass.getuser())
pkg_name = script.replace(".tar.gz", "")
diff --git a/slpkg/pkg/find.py b/slpkg/pkg/find.py
index 1b1e8c26..6a4f3413 100755
--- a/slpkg/pkg/find.py
+++ b/slpkg/pkg/find.py
@@ -5,8 +5,7 @@ import os
def find_package(find_pkg, directory):
'''
- Find installed packages from
- /var/log/packages/
+ Find packages
'''
pkgs = []
for pkg in os.listdir(directory):
diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py
index 2ac4a442..e4adc837 100755
--- a/slpkg/pkg/manager.py
+++ b/slpkg/pkg/manager.py
@@ -5,9 +5,12 @@ import os
import sys
import getpass
import subprocess
+
+from collections import OrderedDict
+
from slpkg.colors import colors
-from slpkg.__metadata__ import pkg_path, uname, arch, sp
from slpkg.messages import pkg_not_found, s_user, template
+from slpkg.__metadata__ import pkg_path, uname, arch, sp, log_path
from find import find_package
@@ -66,8 +69,7 @@ def pkg_remove(binary):
Remove Slackware binary packages
'''
s_user(getpass.getuser())
- removed = []
- not_found = []
+ removed, not_found, dependencies, rmv_dependencies = [], [], [], []
print ("\nPackages with name matching [ {0}{1}{2} ]\n".format(
colors.CYAN, ', '.join(binary), colors.ENDC))
for pkg in binary:
@@ -82,24 +84,69 @@ def pkg_remove(binary):
pkg_not_found(bol, pkg, message, eol)
if removed == []:
print # new line at end
- sys.exit()
- try:
- remove_pkg = raw_input("\nAre you sure to remove " + str(len(removed)) + \
- " package(s) [Y/y] ")
- except KeyboardInterrupt:
- print # new line at exit
- sys.exit()
- if remove_pkg == "y" or remove_pkg == "Y":
- for rmv in removed:
- print subprocess.check_output('removepkg {0}'.format(rmv), shell=True)
- template(78)
- for pkg in removed:
- if find_package(pkg + sp, pkg_path) == []:
- print ("| Package: {0} removed".format(pkg))
- for pkg in not_found:
- print ("| Package: {0} not found".format(pkg))
- template(78)
- print # new line at end
+ else:
+ msg = "package"
+ if len(removed) > 1:
+ msg = msg + "s"
+ try:
+ remove_pkg = raw_input("\nAre you sure to remove {0} {1} [Y/y] ".format(
+ str(len(removed)), msg))
+ except KeyboardInterrupt:
+ print # new line at exit
+ sys.exit()
+ if remove_pkg == "y" or remove_pkg == "Y":
+ for rmv in removed:
+ '''
+ If package build and install with 'slpkg -s sbo '
+ then look log file for dependencies in /var/log/slpkg/dep,
+ read and remove all else remove only the package.
+ '''
+ if find_package(rmv, log_path + "dep/"):
+ f = open("{0}dep/{1}".format(log_path, rmv), "r")
+ dependencies = f.read().split()
+ print # new line at start
+ template(78)
+ print ("| Found dependencies for package {0}:".format(rmv))
+ template(78)
+ '''
+ Prints dependecies before removed except master package
+ because referred as master package
+ '''
+ for dep in dependencies[:-1]:
+ print ("| " + dep)
+ template(78)
+ try:
+ remove_dep = raw_input("\nRemove dependencies [Y/y] ")
+ except KeyboardInterrupt:
+ print # new line at exit
+ sys.exit()
+ if remove_dep == "y" or remove_dep == "Y":
+ for dep in dependencies:
+ if find_package(dep + sp, pkg_path):
+ print subprocess.check_output('removepkg {0}'.format(dep), shell=True)
+ f.close()
+ os.remove("{0}dep/{1}".format(log_path, rmv))
+ rmv_dependencies += dependencies[:-1]
+ else:
+ if find_package(rmv + sp, pkg_path):
+ print subprocess.check_output('removepkg {0}'.format(rmv), shell=True)
+ f.close()
+ os.remove("{0}dep/{1}".format(log_path, rmv))
+ else:
+ if find_package(rmv + sp, pkg_path):
+ print subprocess.check_output('removepkg {0}'.format(rmv), shell=True)
+ '''
+ Prints all removed packages
+ '''
+ removed = removed + rmv_dependencies
+ template(78)
+ for pkg in list(OrderedDict.fromkeys(removed)):
+ if find_package(pkg + sp, pkg_path) == []:
+ print ("| Package {0} removed".format(pkg))
+ for pkg in not_found:
+ print ("| Package {0} not found".format(pkg))
+ template(78)
+ print # new line at end
def pkg_find(binary):
'''
@@ -145,7 +192,8 @@ def pkg_list(binary):
index += 1
print ("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg))
if index == page:
- key = raw_input('\nPress [ Enter ] >> Next page ')
+ key = raw_input('\nPress [ {0}Enter{1} ] >> Next page '.format(
+ colors.CYAN, colors.ENDC))
page += 50
if "sbo" in binary:
for pkg in os.listdir(pkg_path):
@@ -153,7 +201,8 @@ def pkg_list(binary):
index += 1
print ("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg))
if index == page:
- key = raw_input('\nPress [ Enter ] >> Next page ')
+ key = raw_input('\nPress [ {0}Enter{1} ] >> Next page '.format(
+ colors.CYAN, colors.ENDC))
page += 50
if "slack" in binary:
for pkg in os.listdir(pkg_path):
@@ -161,7 +210,8 @@ def pkg_list(binary):
index += 1
print ("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg))
if index == page:
- key = raw_input('\nPress [ Enter ] >> Next page ')
+ key = raw_input('\nPress [ {0}Enter{1} ] >> Next page '.format(
+ colors.CYAN, colors.ENDC))
page += 50
if "noarch" in binary:
for pkg in os.listdir(pkg_path):
@@ -169,7 +219,8 @@ def pkg_list(binary):
index += 1
print ("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg))
if index == page:
- key = raw_input('\nPress [ Enter ] >> Next page ')
+ key = raw_input('\nPress [ {0}Enter{1} ] >> Next page '.format(
+ colors.CYAN, colors.ENDC))
page += 50
if "other" in binary:
for pkg in os.listdir(pkg_path):
@@ -179,10 +230,10 @@ def pkg_list(binary):
index += 1
print ("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg))
if index == page:
- key = raw_input('\nPress [ Enter ] >> Next page ')
+ key = raw_input('\nPress [ {0}Enter{1} ] >> Next page '.format(
+ colors.CYAN, colors.ENDC))
page += 50
print # new line at end
except KeyboardInterrupt:
print # new line at exit
sys.exit()
-
diff --git a/slpkg/sbo/download.py b/slpkg/sbo/download.py
index 1be84a9f..5112a9eb 100755
--- a/slpkg/sbo/download.py
+++ b/slpkg/sbo/download.py
@@ -7,4 +7,4 @@ def sbo_slackbuild_dwn(sbo_url, name):
slackbuild download link
'''
sbo_url = sbo_url.replace(name + "/", name + ".tar.gz")
- return sbo_url.replace("repository", "slackbuilds")
+ return sbo_url
diff --git a/slpkg/sbo/greps.py b/slpkg/sbo/greps.py
index e972dc5c..d5b82eaa 100755
--- a/slpkg/sbo/greps.py
+++ b/slpkg/sbo/greps.py
@@ -7,10 +7,9 @@ from slpkg.__metadata__ import uname, arch
def sbo_source_dwn(sbo_url, name):
'''
- Grep source code download link
+ Grep source downloads links
'''
- read_info = url_read((sbo_url + name + ".info").replace(
- "repository", "slackbuilds"))
+ read_info = url_read(sbo_url + name + ".info")
if arch == "x86_64":
for line in read_info.splitlines():
if line.startswith('DOWNLOAD_x86_64='):
@@ -22,10 +21,9 @@ def sbo_source_dwn(sbo_url, name):
def sbo_extra_dwn(sbo_url, name):
'''
- Grep extra source code download link
+ Grep extra source downloads links
'''
- read_info = url_read((sbo_url + name + ".info").replace(
- "repository", "slackbuilds"))
+ read_info = url_read(sbo_url + name + ".info")
extra = []
for line in read_info.split():
if line.endswith('"'):
@@ -40,8 +38,7 @@ def sbo_requires_pkg(sbo_url, name):
'''
Grep package requirements
'''
- read_info = url_read((sbo_url + name + ".info").replace(
- "repository", "slackbuilds"))
+ read_info = url_read(sbo_url + name + ".info")
for line in read_info.splitlines():
if line.startswith('REQUIRES="'):
return line[10:-1]
@@ -50,8 +47,7 @@ def sbo_prgnam_pkg(sbo_url, name):
'''
Grep program name
'''
- read_info = url_read((sbo_url + name + ".info").replace(
- "repository", "slackbuilds"))
+ read_info = url_read(sbo_url + name + ".info")
for line in read_info.splitlines():
if line.startswith('PRGNAM="'):
return line[8:-1]
@@ -60,8 +56,7 @@ def sbo_version_pkg(sbo_url, name):
'''
Grep package version
'''
- read_info = url_read((sbo_url + name + ".info").replace(
- "repository", "slackbuilds"))
+ read_info = url_read(sbo_url + name + ".info")
for line in read_info.splitlines():
if line.startswith('VERSION="'):
return line[9:-1]
diff --git a/slpkg/sbo/read.py b/slpkg/sbo/read.py
index 83b9b0ad..73ecd522 100755
--- a/slpkg/sbo/read.py
+++ b/slpkg/sbo/read.py
@@ -15,17 +15,17 @@ def read_readme(sbo_url, name, site):
Read SlackBuild README file
'''
s_user(getpass.getuser())
- readme = url_read((sbo_url + site).replace("repository", "slackbuilds"))
- file = open("{0}readme/{1}.{2}".format(slpkg_path, name, site), "w")
- file.write(readme)
- file.close()
+ readme = url_read(sbo_url + site)
+ f = open("{0}readme/{1}.{2}".format(slpkg_path, name, site), "w")
+ f.write(readme)
+ f.close()
def read_info_slackbuild(sbo_url, name, site):
'''
Read info SlackBuild file
'''
s_user(getpass.getuser())
- info = url_read((sbo_url + name + site).replace("repository", "slackbuilds"))
- file = open("{0}readme/{1}{2}".format(slpkg_path, name, site), "w")
- file.write(info)
- file.close()
+ info = url_read(sbo_url + name + site)
+ f = open("{0}readme/{1}{2}".format(slpkg_path, name, site), "w")
+ f.write(info)
+ f.close()
diff --git a/slpkg/sbo/search.py b/slpkg/sbo/search.py
index 9b766ee5..e59b9a00 100755
--- a/slpkg/sbo/search.py
+++ b/slpkg/sbo/search.py
@@ -15,7 +15,7 @@ def sbo_search_pkg(name):
'''
try:
sbo_location = []
- sbo_url = ("http://slackbuilds.org/repository/{0}/".format(slack_ver()))
+ sbo_url = ("http://slackbuilds.org/slackbuilds/{0}/".format(slack_ver()))
SLACKBUILDS_TXT = url_read((
"http://slackbuilds.org/slackbuilds/{0}/SLACKBUILDS.TXT".format(slack_ver())))
for line in SLACKBUILDS_TXT.splitlines():
diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py
index de734ab5..8b5a7d83 100755
--- a/slpkg/sbo/slackbuild.py
+++ b/slpkg/sbo/slackbuild.py
@@ -7,8 +7,8 @@ import getpass
from slpkg.colors import colors
from slpkg.functions import get_file
from slpkg.__metadata__ import tmp, pkg_path, build_path, sp
-from slpkg.__metadata__ import sbo_arch, sbo_tag, sbo_filetype, arch
from slpkg.messages import pkg_not_found, pkg_found, template, s_user
+from slpkg.__metadata__ import sbo_arch, sbo_tag, sbo_filetype, arch, log_path
from slpkg.pkg.find import find_package
from slpkg.pkg.build import build_package
@@ -37,7 +37,7 @@ def sbo_build(name):
try:
os.system("mkdir -p {0}".format(build_path))
os.chdir(build_path)
- requires, dependencies, extra = [], [], []
+ requires, dependencies, extra, = [], [], []
requires.append(name)
for pkg in dependencies_list:
requires += pkg
@@ -75,6 +75,17 @@ def sbo_build(name):
template(78)
pkg_found(pkg)
template(78)
+ '''
+ Write dependencies in a log file into directory '/var/log/slpkg/dep/'
+ '''
+ os.system("mkdir -p {0}dep/".format(log_path))
+ if find_package(name, log_path + "dep/"):
+ os.remove("{0}dep/{1}".format(log_path, name))
+ if len(dependencies) > 1:
+ f = open("{0}dep/{1}".format(log_path, name), "w")
+ for dep in dependencies:
+ f.write(dep + "\n")
+ f.close()
print # new line at end
except KeyboardInterrupt:
print # new line at exit