diff --git a/CHANGELOG b/CHANGELOG index 157ff8d9..fbe75b77 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,12 @@ +21-05-2014 +Version 1.3.0 + +[Updated] - Fix argparse view + 21-05-2014 Version 1.2.9 -Feature] - Added tracking dependencies +[Feature] - Added tracking dependencies 20-05-2014 Version 1.2.8 diff --git a/PKG-INFO b/PKG-INFO index 7f3ef4ad..5a28fc6f 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: slpkg -Version: 1.2.9 +Version: 1.3.0 Author: dslackw Author-email: d zlatanidis at gmail com Maintainer: dslackw diff --git a/README.rst b/README.rst index 7294010f..a1b7c49f 100644 --- a/README.rst +++ b/README.rst @@ -51,32 +51,27 @@ Command Line Tool Usage usage: slpkg [-h] [-v] [-s script [source ...]] [-l all, sbo [all, sbo ...]] [-t] [-n] [-c] [-i [...]] [-u [...]] [-a [...]] [-r [...]] - [-f [...]] [-d [...]] + [-f [...]] [-d [...]] Utility to help package management in Slackware optional arguments: - -h, --help show this help message and exit + -h, --help show this help message and exit -v, --verbose print version and exit - -s script [source ...], --slackbuild script [source ...] + -s script [source ...] auto build package - -l all, sbo [all, sbo ...], --list all, sbo [all, sbo ...] + -l 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 [ ...] - install binary packages - -u [ ...], --upgrade [ ...] - install-upgrade package with new - -a [ ...], --reinstall [ ...] - reinstall the same packages - -r [ ...], --remove [ ...] - remove packages - -f [ ...], --find [ ...] - find if packages installed - -d [ ...], --display [ ...] - display the contents of the packages + -t tracking dependencies + -n find from SBo repositority + -c check if your package is up to date + -i [ ...] install binary packages + -u [ ...] install-upgrade packages with new + -a [ ...] reinstall the same packages + -r [ ...] remove packages + -f [ ...] find if packages installed + -d [ ...] display the contents of the packages + Slpkg Examples diff --git a/bin/slpkg b/bin/slpkg index 0fb0273d..cf72b7c9 100755 --- a/bin/slpkg +++ b/bin/slpkg @@ -23,7 +23,7 @@ import subprocess __author__ = "dslackw" -__version__ = "1.2.9" +__version__ = "1.3.0" __license__ = "GNU General Public License v3 (GPLv3)" __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.replace("repository", "slackbuilds") read_info = url_read(sbo_url) + # read lines from .info files grep download line and return source link if arch == "x86_64": for line in read_info.splitlines(): @@ -215,7 +216,7 @@ def sbo_requires_pkg(sbo_url, name): # search for package dependencies def sbo_dependencies_pkg(name): if name == "%README%": # avoid to search %README% as dependency - name = "" + pass else: 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 def pkg_list(name): if "all" in name: @@ -552,94 +579,81 @@ def main(): parser = argparse.ArgumentParser(description=description) parser.add_argument("-v", "--verbose", help="print version and exit", 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')) - 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')) - parser.add_argument("-t", "--tracking", help="tracking dependencies", + parser.add_argument("-t", help="tracking dependencies", 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=('')) - 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=('')) - parser.add_argument("-i", "--install", help="install binary packages", + parser.add_argument("-i", help="install binary packages", 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=('')) - parser.add_argument("-a", "--reinstall", help="reinstall the same packages", + parser.add_argument("-a", help="reinstall the same packages", type=str, nargs="+", metavar=('')) - parser.add_argument("-r", "--remove", help="remove packages", + parser.add_argument("-r", help="remove packages", 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=('')) - 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=('')) args = parser.parse_args() if args.verbose: - print ("Version: {}".format(__version__)) - print ("Licence: {}".format(__license__)) - print ("Email : {}".format(__email__)) + pkg_version() - if args.slackbuild: - if len(args.slackbuild) == 2: - 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.s: + pkg_slackbuild(args.s) - if args.list: - pkg_list(args.list) + if args.l: + pkg_list(args.l) - if args.tracking: - pkg_tracking(args.tracking) - - if args.network: - sbo_network(args.network) + if args.t: + pkg_tracking(args.t) - if args.check: - sbo_check(args.check) + if args.n: + sbo_network(args.n) + + + if args.c: + sbo_check(args.c) - if args.install: - pkg_install(args.install) + if args.i: + pkg_install(args.i) - if args.upgrade: - pkg_upgrade(args.upgrade) + if args.u: + pkg_upgrade(args.u) - if args.reinstall: - pkg_reinstall(args.reinstall) + if args.a: + pkg_reinstall(args.a) - if args.remove: - pkg_remove(args.remove) + if args.r: + pkg_remove(args.r) - if args.find: - pkg_find(args.find) + if args.f: + pkg_find(args.f) - if args.display: - pkg_display(args.display) + if args.d: + pkg_display(args.d) - 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]): + if not any([args.verbose, args.s, args.t, args.c, args.n, args.i, args.u, args.a, + args.r, args.l, args.f, args.d]): os.system("slpkg -h") diff --git a/man/slpkg.8 b/man/slpkg.8 index 092b09da..0b40ceb7 100644 --- a/man/slpkg.8 +++ b/man/slpkg.8 @@ -15,38 +15,29 @@ .SH NAME 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[-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 + \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-f [...]\fP \fB-d [...]\fP .SH DESCRIPTION \fBslpkg\fP is a terminal tool written in Python that allows the build, install, upgrade, remove, find and view Slackware packages contents. .PP 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 \fB-h, --help show this help message and exit\fP \fB-v, --verbose print version and exit\fP - \fB-s script [source ...], --slackbuild script [source ...]\fP - \fB auto build package\fP - \fB-l all, sbo [all, sbo ...], --list all, sbo [all, sbo ...]\fP + \fB-s script [source ...]\fP + \fB auto build package\fP + \fB-l 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 - \fB install binary packages\fP - \fB-u [ ...], --upgrade [ ...]\fP - \fB install-upgrade packages with new\fP - \fB-a [ ...], --reinstall [ ...]\fP - \fB reinstall the same 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 + \fB-t tracking dependencies\fP + \fB-n find from SBo repositority\fP + \fB-c check if your package is up to date\fP + \fB-i [ ...] install binary packages\fP + \fB-u [ ...] install-upgrade packages with new\fP + \fB-a [ ...] reinstall the same packages\fP + \fB-r [ ...] remove packages\fP + \fB-f [ ...] find if packages installed\fP + \fB-d [ ...] display the contents of the packages\fP .SH GLOBAL OPTIONS .TP @@ -55,50 +46,50 @@ Print the version of program and exit. .SH COMMANDS .PP 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> .PP With this argument, build slackware package quickly and easy. 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> .PP Two display options list, one for all packages and another only for packages SBo. -.SS -t , --tracking tracking dependencies +.SS -t , 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 +.SS -n , find from SBo repositority \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 +.SS -c , check if your package is up to date \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 +.SS -i , install binary package \fBslpkg\fP \fB-i\fP <\fIpackages.t?z\fP> .PP Installs single binary packages designed for use with the 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> .PP Normally upgrade only upgrades packages that are already installed on the system, and will skip any packages that do not already have a version installed. 'Requires root privileges' (like slackware command upgradepkg --install-new) -.SS -a --reinstall +.SS -a reinstall binary package \fBslpkg\fP \fB-a\fP <\fIpackages.t?z\fP> .PP Upgradepkg usually skips packages if the exact same package (matching name, version, arch, and build number) is already installed on the system.'Requires root privileges' (like slackware command upgradepkg --reinstall) -.SS -r , --remove package +.SS -r , remove package \fBslpkg\fP \fB-r\fP <\fIname of packages\fP> .PP 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 /var/log/packages/), or by the base package name. 'Requires root privileges' (like slackware command removepkg) -.SS -f --find +.SS -f find packages \fBslpkg\fP \fB-f\fP <\fIname of packages\fP> .PP Find if package allready installed or not. -.SS -d --display +.SS -d display contents \fBslpkg\fP \fB-d\fP <\fIname of packages\fP> .PP Display the contents of the package with all descriptions. diff --git a/setup.py b/setup.py index b6b448f3..a84fb7db 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ from distutils.core import setup setup( name = 'slpkg', - version = "1.2.9", + version = "1.3.0", description = "Python tool to manage Slackware packages", keywords = ["slackware", "slpkg", "upgrade", "install", "remove", "view", "slackpkg", "tool"],