updated for version 1.2.9

This commit is contained in:
dslackw 2014-05-21 00:52:22 +03:00
parent b6048c720a
commit ffadf9c889
6 changed files with 148 additions and 31 deletions

View file

@ -1,3 +1,8 @@
21-05-2014
Version 1.2.9
Feature] - Added tracking dependencies
20-05-2014
Version 1.2.8

View file

@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: slpkg
Version: 1.2.8
Version: 1.2.9
Author: dslackw
Author-email: d zlatanidis at gmail com
Maintainer: dslackw

View file

@ -50,7 +50,7 @@ Command Line Tool Usage
.. code-block:: bash
usage: slpkg [-h] [-v] [-s script [source ...]] [-l all, sbo [all, sbo ...]]
[-n] [-c] [-i [...]] [-u [...]] [-a [...]] [-r [...]]
[-t] [-n] [-c] [-i [...]] [-u [...]] [-a [...]] [-r [...]]
[-f [...]] [-d [...]]
Utility to help package management in Slackware
@ -62,6 +62,7 @@ Command Line Tool Usage
auto build package
-l all, sbo [all, sbo ...], --list all, sbo [all, sbo ...]
list of installed packages
-t , --tracking tracking dependencies
-n , --network find from SBo repositority
-c , --check check if your package is up to date
-i [ ...], --install [ ...]
@ -81,6 +82,41 @@ Command Line Tool Usage
Slpkg Examples
--------------
Tracking all dependencies of that package:
.. code-block:: bash
$ slpkg -t brasero
+=========================
| `brasero' dependencies :
+=========================
|
|
-- 1 orc
|
-- 1 gstreamer1
|
-- 1 gst1-plugins-base
|
-- 2 libunique gst1-plugins-bad
$ slpkg -t pylint
+========================
| `pylint' dependencies :
+========================
|
|
-- 2 pysetuptools logilab-common
|
-- 1 astroid
Check if your packages is up to date (www.slackbuilds.org):
.. code-block:: bash
@ -128,6 +164,7 @@ Find slackbuild from network (www.slackbuilds.org):
Download this package [y/n]
And try again:

View file

@ -23,12 +23,11 @@ import subprocess
__author__ = "dslackw"
__version__ = "1.2.8"
__version__ = "1.2.9"
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"
# grep computer architecture
uname = os.uname()
arch = (uname[4])
@ -38,7 +37,7 @@ arch = (uname[4])
# path file record
packages = "/var/log/packages/"
tmp = "/tmp/"
results = []
# SlackBuilds Repository
@ -66,11 +65,13 @@ class colors:
# check if user is root
def s_user(user):
print
if user == "root":
pass
else:
print ("{}Must have {}`root`{} privileges ...{}".format(colors.RED,
colors.GREEN, colors.RED, colors.ENDC))
print
sys.exit()
@ -206,10 +207,35 @@ def sbo_requires_pkg(sbo_url, name):
if line.startswith('REQUIRES="'):
line = line[10:-1]
return line
# search for package dependencies
def sbo_dependencies_pkg(name):
if name == "%README%": # avoid to search %README% as dependency
name = ""
else:
find_sbo_url = sbo_search_pkg(name)
find_sbo_req = sbo_requires_pkg(find_sbo_url, name)
dependencies = find_sbo_req.split() # convert string to list
if dependencies == []:
pass
else:
results.append(dependencies)
for line in dependencies:
print
sbo_dependencies_pkg(line)
return results
# find from www.slackbuilds.org the version of the package
def sbo_version_pkg(sbo_url, name):
sbo_url = sbo_url + name + ".info"
@ -323,6 +349,44 @@ def build_extra2_pkg(script, source, extra, extra2):
# view list of installed packages
def pkg_list(name):
if "all" in name:
print
os.chdir(packages)
os.system("ls * | more")
print
if "sbo" in name:
print
os.chdir(packages)
os.system("ls * | grep 'SBo' | more")
print
# find all dependencies
def pkg_tracking(name):
find_dependencies = sbo_dependencies_pkg(name)
print ("\n")
pkg_len = len(name) + 18
print ("+" + "=" * pkg_len)
print ("| {}`{}' {}dependencies :{}".format(colors.CYAN, name,
colors.YELLOW, colors.ENDC))
print ("+" + "=" * pkg_len)
find_dependencies.reverse()
if find_dependencies == []:
pass
else:
print (" |")
for i in range(len(find_dependencies)):
found = " --", str(len(find_dependencies[i])), " ".join(find_dependencies[i])
print (" |")
print " ".join(found)
print
# find from SBo repositority www.slackbuild.org
def sbo_network(name):
find_sbo_url = sbo_search_pkg(name)
@ -377,22 +441,6 @@ def sbo_network(name):
# view list of installed packages
def pkg_list(name):
if "all" in name:
print
os.chdir(packages)
os.system("ls * | more")
print
if "sbo" in name:
print
os.chdir(packages)
os.system("ls * | grep 'SBo' | more")
print
# check if packages from www.slackbuilds.org is up to date
def sbo_check(name):
sbo_file = " ".join(find_package(name, packages))
@ -508,6 +556,8 @@ def main():
type=str, nargs="+", metavar=('script','source'))
parser.add_argument("-l", "--list", help="list of installed packages",
nargs="+", choices="all sbo".split(), metavar=('all, sbo'))
parser.add_argument("-t", "--tracking", help="tracking dependencies",
type=str, metavar=(''))
parser.add_argument("-n", "--network", help="find from SBo repositority",
type=str, metavar=(''))
parser.add_argument("-c", "--check", help="check if your package is up to date",
@ -553,6 +603,9 @@ def main():
pkg_list(args.list)
if args.tracking:
pkg_tracking(args.tracking)
if args.network:
sbo_network(args.network)
@ -585,7 +638,7 @@ def main():
pkg_display(args.display)
if not any([args.verbose, args.slackbuild, args.check, args.network, args.install, args.upgrade, args.reinstall,
if not any([args.verbose, args.slackbuild, args.tracking, args.check, args.network, args.install, args.upgrade, args.reinstall,
args.remove, args.list, args.find, args.display]):
os.system("slpkg -h")

View file

@ -16,7 +16,7 @@
slpkg - Utility to help package management in Slackware
.SH SYNOPSIS
\fBslpkg\fP \fB[-h]\fP \fB[-v]\fP \fB[-s script [source ...]\fP \fB[-l all, sbo [all, sbo ...]]\fP
\fB[-n]\fP \fB[-c]\fP \fB[-i [...]]\fP \fB[-u [...]]\fP \fB[-a [...]]\fP \fB[-r[...]]\fP
\fB[-t]\fP \fB[-n]\fP \fB[-c]\fP \fB[-i [...]]\fP \fB[-u [...]]\fP \fB[-a [...]]\fP \fB[-r[...]]\fP
\fB[-f [...]]\fP \fB[-d [...]]\fP
.SH DESCRIPTION
\fBslpkg\fP is a terminal tool written in Python that allows the build, install, upgrade,
@ -32,6 +32,7 @@ Note : The most definitions needed root privileges.
\fB auto build package\fP
\fB-l all, sbo [all, sbo ...], --list all, sbo [all, sbo ...]\fP
\fB list of installed packages\fP
\fB-t , --tracking tracking dependencies\fP
\fB-n , --network find from SBo repositority\fP
\fB-c , --check check if your package is up to date\fP
\fB-i [ ...], --install [ ...]\fP
@ -54,8 +55,8 @@ Print the version of program and exit.
.SH COMMANDS
.PP
The following commands are available.
.SS -s script source, --slackbuild script source
\fBslpkg\fP \fB-s\fP <\fIscript\fP> <\fIsource\fP>
.SS -s script source, --slackbuild script source extra
\fBslpkg\fP \fB-s\fP <\fIscript\fP> <\fIsource\fP> <\fIextra sources\fP>
.PP
With this argument, build slackware package quickly and easy.
Support .tar.gz and .tar.bz2 slackbuilds archives.
@ -64,13 +65,18 @@ Support .tar.gz and .tar.bz2 slackbuilds archives.
.PP
Two display options list, one for all packages and another
only for packages SBo.
.SS -t , --tracking tracking dependencies
\fBslpkg\fP \fB-t\fP <\fIname of package\fP>
.PP
Tracking all dependencies of that package.
The sequence shown is that you must follow to correctly install package.
.SS -n , --network find from SBo repositority
\fBslpkg\fP \fB-n\fP <\fIname\fP>
\fBslpkg\fP \fB-n\fP <\fIname of package\fP>
.PP
With this method you can find the SBo script that interests you through
the network. (www.slackbuilds.org)
.SS -c , --check check if your package is up to date
\fBslpkg\fP \fB-c\fP <\fIname\fP>
\fBslpkg\fP \fB-c\fP <\fIname of package\fP>
.PP
Check if your packages from www.slackbuilds.org is updated.
.SS -i , --install install binary package
@ -101,7 +107,7 @@ specified either by the full package name (as you'd see listed in
/var/log/packages/), or by the base package name. 'Requires root
privileges' (like slackware command removepkg)
.SS -f --find
\fBslpkg\fP \fB-f\fP <\fIname of package\fP>
\fBslpkg\fP \fB-f\fP <\fIname of packages\fP>
.PP
Find if package allready installed or not.
.SS -d --display
@ -116,6 +122,22 @@ For example:
\fBslpkg \-\-help\fP - display help for slpkg
.SH EXAMPLES
$ \fBslpkg -t brasero\fP
+=========================
| `brasero' dependencies :
+=========================
|
|
-- 1 orc
|
-- 1 gstreamer1
|
-- 1 gst1-plugins-base
|
-- 2 libunique gst1-plugins-bad
$ \fBslpkg -c flashplayer-plugin\fP
Searching for `flashplayer-plugin` from www.slackbuilds.org Please wait ...
@ -128,9 +150,9 @@ $ \fBslpkg -n termcolor\fP
Searching for termcolor from www.slackbuilds.org Please wait ...
+=====================================================================================
+======================================================================================
| The `termcolor` found in --> http://slackbuilds.org/repository/14.1/python/termcolor/
+=====================================================================================
+======================================================================================
Download SlackBuild : http://slackbuilds.org/slackbuilds/14.1/python/termcolor.tar.gz
Source Downloads : https://pypi.python.org/packages/source/t/termcolor/termcolor-1.1.0.tar.gz

View file

@ -7,7 +7,7 @@ from distutils.core import setup
setup(
name = 'slpkg',
version = "1.2.8",
version = "1.2.9",
description = "Python tool to manage Slackware packages",
keywords = ["slackware", "slpkg", "upgrade", "install", "remove",
"view", "slackpkg", "tool"],