updated for version 1.3.0

This commit is contained in:
dslackw 2014-05-21 07:16:56 +03:00
parent 0e694cb2ea
commit 0cfe0d371f
6 changed files with 114 additions and 109 deletions

View file

@ -1,7 +1,12 @@
21-05-2014
Version 1.3.0
[Updated] - Fix argparse view
21-05-2014 21-05-2014
Version 1.2.9 Version 1.2.9
Feature] - Added tracking dependencies [Feature] - Added tracking dependencies
20-05-2014 20-05-2014
Version 1.2.8 Version 1.2.8

View file

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

View file

@ -51,32 +51,27 @@ Command Line Tool Usage
usage: slpkg [-h] [-v] [-s script [source ...]] [-l all, sbo [all, sbo ...]] usage: slpkg [-h] [-v] [-s script [source ...]] [-l all, sbo [all, sbo ...]]
[-t] [-n] [-c] [-i [...]] [-u [...]] [-a [...]] [-r [...]] [-t] [-n] [-c] [-i [...]] [-u [...]] [-a [...]] [-r [...]]
[-f [...]] [-d [...]] [-f [...]] [-d [...]]
Utility to help package management in Slackware Utility to help package management in Slackware
optional arguments: optional arguments:
-h, --help show this help message and exit -h, --help show this help message and exit
-v, --verbose print version and exit -v, --verbose print version and exit
-s script [source ...], --slackbuild script [source ...] -s script [source ...]
auto build package auto build package
-l all, sbo [all, sbo ...], --list all, sbo [all, sbo ...] -l all, sbo [all, sbo ...]
list of installed packages list of installed packages
-t , --tracking tracking dependencies -t tracking dependencies
-n , --network find from SBo repositority -n find from SBo repositority
-c , --check check if your package is up to date -c check if your package is up to date
-i [ ...], --install [ ...] -i [ ...] install binary packages
install binary packages -u [ ...] install-upgrade packages with new
-u [ ...], --upgrade [ ...] -a [ ...] reinstall the same packages
install-upgrade package with new -r [ ...] remove packages
-a [ ...], --reinstall [ ...] -f [ ...] find if packages installed
reinstall the same packages -d [ ...] display the contents of the packages
-r [ ...], --remove [ ...]
remove packages
-f [ ...], --find [ ...]
find if packages installed
-d [ ...], --display [ ...]
display the contents of the packages
Slpkg Examples Slpkg Examples

120
bin/slpkg
View file

@ -23,7 +23,7 @@ import subprocess
__author__ = "dslackw" __author__ = "dslackw"
__version__ = "1.2.9" __version__ = "1.3.0"
__license__ = "GNU General Public License v3 (GPLv3)" __license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com" __email__ = "d.zlatanidis@gmail.com"
@ -156,6 +156,7 @@ def sbo_source_dwn(sbo_url, name):
sbo_url = sbo_url + name + ".info" sbo_url = sbo_url + name + ".info"
sbo_url = sbo_url.replace("repository", "slackbuilds") sbo_url = sbo_url.replace("repository", "slackbuilds")
read_info = url_read(sbo_url) read_info = url_read(sbo_url)
# read lines from .info files grep download line and return source link # read lines from .info files grep download line and return source link
if arch == "x86_64": if arch == "x86_64":
for line in read_info.splitlines(): for line in read_info.splitlines():
@ -215,7 +216,7 @@ def sbo_requires_pkg(sbo_url, name):
# search for package dependencies # search for package dependencies
def sbo_dependencies_pkg(name): def sbo_dependencies_pkg(name):
if name == "%README%": # avoid to search %README% as dependency if name == "%README%": # avoid to search %README% as dependency
name = "" pass
else: else:
find_sbo_url = sbo_search_pkg(name) find_sbo_url = sbo_search_pkg(name)
@ -349,6 +350,32 @@ def build_extra2_pkg(script, source, extra, extra2):
# print version
def pkg_version():
print ("Version: {}".format(__version__))
print ("Licence: {}".format(__license__))
print ("Email : {}".format(__email__))
# build packages
def pkg_slackbuild(name):
if len(name) == 2:
build_package(name[0], name[1])
elif len(name) == 3:
build_extra_pkg(name[0],
name[1], name[2])
elif len(name) == 4:
build_extra2_pkg(name[0], name[1],
name[2], name[3])
else:
print
print ("{}Not supported with more than four arguments{}".format(colors.RED,
colors.ENDC))
print
# view list of installed packages # view list of installed packages
def pkg_list(name): def pkg_list(name):
if "all" in name: if "all" in name:
@ -552,94 +579,81 @@ def main():
parser = argparse.ArgumentParser(description=description) parser = argparse.ArgumentParser(description=description)
parser.add_argument("-v", "--verbose", help="print version and exit", parser.add_argument("-v", "--verbose", help="print version and exit",
action="store_true") action="store_true")
parser.add_argument("-s", "--slackbuild", help="auto build package", parser.add_argument("-s", help="auto build package",
type=str, nargs="+", metavar=('script','source')) type=str, nargs="+", metavar=('script','source'))
parser.add_argument("-l", "--list", help="list of installed packages", parser.add_argument("-l", help="list of installed packages",
nargs="+", choices="all sbo".split(), metavar=('all, sbo')) nargs="+", choices="all sbo".split(), metavar=('all, sbo'))
parser.add_argument("-t", "--tracking", help="tracking dependencies", parser.add_argument("-t", help="tracking dependencies",
type=str, metavar=('')) type=str, metavar=(''))
parser.add_argument("-n", "--network", help="find from SBo repositority", parser.add_argument("-n", help="find from SBo repositority",
type=str, metavar=('')) type=str, metavar=(''))
parser.add_argument("-c", "--check", help="check if your package is up to date", parser.add_argument("-c", help="check if your package is up to date",
type=str, metavar=('')) type=str, metavar=(''))
parser.add_argument("-i", "--install", help="install binary packages", parser.add_argument("-i", help="install binary packages",
type=str, nargs="+", metavar=('')) type=str, nargs="+", metavar=(''))
parser.add_argument("-u", "--upgrade", help="install-upgrade packages with new", parser.add_argument("-u", help="install-upgrade packages with new",
type=str, nargs="+", metavar=('')) type=str, nargs="+", metavar=(''))
parser.add_argument("-a", "--reinstall", help="reinstall the same packages", parser.add_argument("-a", help="reinstall the same packages",
type=str, nargs="+", metavar=('')) type=str, nargs="+", metavar=(''))
parser.add_argument("-r", "--remove", help="remove packages", parser.add_argument("-r", help="remove packages",
type=str, nargs="+", metavar=('')) type=str, nargs="+", metavar=(''))
parser.add_argument("-f", "--find", help="find if packages installed", parser.add_argument("-f", help="find if packages installed",
type=str, nargs="+", metavar=('')) type=str, nargs="+", metavar=(''))
parser.add_argument("-d", "--display", help="display the contents of the packages", parser.add_argument("-d", help="display the contents of the packages",
type=str, nargs="+", metavar=('')) type=str, nargs="+", metavar=(''))
args = parser.parse_args() args = parser.parse_args()
if args.verbose: if args.verbose:
print ("Version: {}".format(__version__)) pkg_version()
print ("Licence: {}".format(__license__))
print ("Email : {}".format(__email__))
if args.slackbuild: if args.s:
if len(args.slackbuild) == 2: pkg_slackbuild(args.s)
build_package(args.slackbuild[0], args.slackbuild[1])
elif len(args.slackbuild) == 3:
build_extra_pkg(args.slackbuild[0],
args.slackbuild[1], args.slackbuild[2])
elif len(args.slackbuild) == 4:
build_extra2_pkg(args.slackbuild[0], args.slackbuild[1],
args.slackbuild[2], args.slackbuild[3])
else:
print
print ("{}Not supported with more than four arguments{}".format(colors.RED,
colors.ENDC))
print
if args.list: if args.l:
pkg_list(args.list) pkg_list(args.l)
if args.tracking: if args.t:
pkg_tracking(args.tracking) pkg_tracking(args.t)
if args.network:
sbo_network(args.network)
if args.check: if args.n:
sbo_check(args.check) sbo_network(args.n)
if args.c:
sbo_check(args.c)
if args.install: if args.i:
pkg_install(args.install) pkg_install(args.i)
if args.upgrade: if args.u:
pkg_upgrade(args.upgrade) pkg_upgrade(args.u)
if args.reinstall: if args.a:
pkg_reinstall(args.reinstall) pkg_reinstall(args.a)
if args.remove: if args.r:
pkg_remove(args.remove) pkg_remove(args.r)
if args.find: if args.f:
pkg_find(args.find) pkg_find(args.f)
if args.display: if args.d:
pkg_display(args.display) pkg_display(args.d)
if not any([args.verbose, args.slackbuild, args.tracking, args.check, args.network, args.install, args.upgrade, args.reinstall, if not any([args.verbose, args.s, args.t, args.c, args.n, args.i, args.u, args.a,
args.remove, args.list, args.find, args.display]): args.r, args.l, args.f, args.d]):
os.system("slpkg -h") os.system("slpkg -h")

View file

@ -15,38 +15,29 @@
.SH NAME .SH NAME
slpkg - Utility to help package management in Slackware slpkg - Utility to help package management in Slackware
.SH SYNOPSIS .SH SYNOPSIS
\fBslpkg\fP \fB[-h]\fP \fB[-v]\fP \fB[-s script [source ...]\fP \fB[-l all, sbo [all, sbo ...]]\fP \fBslpkg\fP \fB-h\fP \fB-v\fP \fB-s script [source ...]\fP \fB-l all, sbo [all, sbo ...]\fP
\fB[-t]\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
\fB[-f [...]]\fP \fB[-d [...]]\fP
.SH DESCRIPTION .SH DESCRIPTION
\fBslpkg\fP is a terminal tool written in Python that allows the build, install, upgrade, \fBslpkg\fP is a terminal tool written in Python that allows the build, install, upgrade,
remove, find and view Slackware packages contents. remove, find and view Slackware packages contents.
.PP .PP
It's a quick and easy way to manage your packages in slackware to a command. It's a quick and easy way to manage your packages in slackware to a command.
.PP
Note : The most definitions needed root privileges.
.SH EXAMPLES .SH EXAMPLES
\fB-h, --help show this help message and exit\fP \fB-h, --help show this help message and exit\fP
\fB-v, --verbose print version and exit\fP \fB-v, --verbose print version and exit\fP
\fB-s script [source ...], --slackbuild script [source ...]\fP \fB-s script [source ...]\fP
\fB auto build package\fP \fB auto build package\fP
\fB-l all, sbo [all, sbo ...], --list all, sbo [all, sbo ...]\fP \fB-l all, sbo [all, sbo ...]\fP
\fB list of installed packages\fP \fB list of installed packages\fP
\fB-t , --tracking tracking dependencies\fP \fB-t tracking dependencies\fP
\fB-n , --network find from SBo repositority\fP \fB-n find from SBo repositority\fP
\fB-c , --check check if your package is up to date\fP \fB-c check if your package is up to date\fP
\fB-i [ ...], --install [ ...]\fP \fB-i [ ...] install binary packages\fP
\fB install binary packages\fP \fB-u [ ...] install-upgrade packages with new\fP
\fB-u [ ...], --upgrade [ ...]\fP \fB-a [ ...] reinstall the same packages\fP
\fB install-upgrade packages with new\fP \fB-r [ ...] remove packages\fP
\fB-a [ ...], --reinstall [ ...]\fP \fB-f [ ...] find if packages installed\fP
\fB reinstall the same packages\fP \fB-d [ ...] display the contents of the packages\fP
\fB-r [ ...], --remove [ ...]\fP
\fB remove packages\fP
\fB-f [ ...], --find [ ...]\fP
\fB find if packages installed\fP
\fB-d [ ...], --display [ ...]\fP
\fB display the contents of the packages\fP
.SH GLOBAL OPTIONS .SH GLOBAL OPTIONS
.TP .TP
@ -55,50 +46,50 @@ Print the version of program and exit.
.SH COMMANDS .SH COMMANDS
.PP .PP
The following commands are available. The following commands are available.
.SS -s script source, --slackbuild script source extra .SS -s script source extra
\fBslpkg\fP \fB-s\fP <\fIscript\fP> <\fIsource\fP> <\fIextra sources\fP> \fBslpkg\fP \fB-s\fP <\fIscript\fP> <\fIsource\fP> <\fIextra sources\fP>
.PP .PP
With this argument, build slackware package quickly and easy. With this argument, build slackware package quickly and easy.
Support .tar.gz and .tar.bz2 slackbuilds archives. Support .tar.gz and .tar.bz2 slackbuilds archives.
.SS -l all, sbo [all, sbo ...], --list all, sbo [all, sbo ...] .SS -l all, sbo [all, sbo ...]
\fBslpkg\fP \fB-l\fP <\fIall\fP> <\fIsbo\fP> \fBslpkg\fP \fB-l\fP <\fIall\fP> <\fIsbo\fP>
.PP .PP
Two display options list, one for all packages and another Two display options list, one for all packages and another
only for packages SBo. only for packages SBo.
.SS -t , --tracking tracking dependencies .SS -t , tracking dependencies
\fBslpkg\fP \fB-t\fP <\fIname of package\fP> \fBslpkg\fP \fB-t\fP <\fIname of package\fP>
.PP .PP
Tracking all dependencies of that package. Tracking all dependencies of that package.
The sequence shown is that you must follow to correctly install package. The sequence shown is that you must follow to correctly install package.
.SS -n , --network find from SBo repositority .SS -n , find from SBo repositority
\fBslpkg\fP \fB-n\fP <\fIname of package\fP> \fBslpkg\fP \fB-n\fP <\fIname of package\fP>
.PP .PP
With this method you can find the SBo script that interests you through With this method you can find the SBo script that interests you through
the network. (www.slackbuilds.org) the network. (www.slackbuilds.org)
.SS -c , --check check if your package is up to date .SS -c , check if your package is up to date
\fBslpkg\fP \fB-c\fP <\fIname of package\fP> \fBslpkg\fP \fB-c\fP <\fIname of package\fP>
.PP .PP
Check if your packages from www.slackbuilds.org is updated. Check if your packages from www.slackbuilds.org is updated.
.SS -i , --install install binary package .SS -i , install binary package
\fBslpkg\fP \fB-i\fP <\fIpackages.t?z\fP> \fBslpkg\fP \fB-i\fP <\fIpackages.t?z\fP>
.PP .PP
Installs single binary packages designed for use with the Installs single binary packages designed for use with the
Slackware Linux distribution into your system. Slackware Linux distribution into your system.
.SS -u , --upgrade install-upgrade package with new .SS -u , install-upgrade package with new
\fBslpkg\fP \fB-u\fP <\fIpackages.t?z\fP> \fBslpkg\fP \fB-u\fP <\fIpackages.t?z\fP>
.PP .PP
Normally upgrade only upgrades packages that are already Normally upgrade only upgrades packages that are already
installed on the system, and will skip any packages that do not installed on the system, and will skip any packages that do not
already have a version installed. 'Requires root privileges' already have a version installed. 'Requires root privileges'
(like slackware command upgradepkg --install-new) (like slackware command upgradepkg --install-new)
.SS -a --reinstall .SS -a reinstall binary package
\fBslpkg\fP \fB-a\fP <\fIpackages.t?z\fP> \fBslpkg\fP \fB-a\fP <\fIpackages.t?z\fP>
.PP .PP
Upgradepkg usually skips packages if the exact same package Upgradepkg usually skips packages if the exact same package
(matching name, version, arch, and build number) is already (matching name, version, arch, and build number) is already
installed on the system.'Requires root privileges' (like installed on the system.'Requires root privileges' (like
slackware command upgradepkg --reinstall) slackware command upgradepkg --reinstall)
.SS -r , --remove package .SS -r , remove package
\fBslpkg\fP \fB-r\fP <\fIname of packages\fP> \fBslpkg\fP \fB-r\fP <\fIname of packages\fP>
.PP .PP
Removes a previously installed Slackware package, while writing Removes a previously installed Slackware package, while writing
@ -106,11 +97,11 @@ a progress report to the standard output. A package may be
specified either by the full package name (as you'd see listed in 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. 'Requires root
privileges' (like slackware command removepkg) privileges' (like slackware command removepkg)
.SS -f --find .SS -f find packages
\fBslpkg\fP \fB-f\fP <\fIname of packages\fP> \fBslpkg\fP \fB-f\fP <\fIname of packages\fP>
.PP .PP
Find if package allready installed or not. Find if package allready installed or not.
.SS -d --display .SS -d display contents
\fBslpkg\fP \fB-d\fP <\fIname of packages\fP> \fBslpkg\fP \fB-d\fP <\fIname of packages\fP>
.PP .PP
Display the contents of the package with all descriptions. Display the contents of the package with all descriptions.

View file

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