From 0ac8642d9f44e2af2578df0d851c118789203037 Mon Sep 17 00:00:00 2001 From: dslackw Date: Thu, 5 Jun 2014 13:25:50 +0300 Subject: [PATCH] updated for version 1.4.7 --- CHANGELOG | 5 +++ PKG-INFO | 2 +- README.rst | 3 ++ bin/slpkg | 120 +++++++++++++++++++++++++++++++++++++++++----------- man/slpkg.8 | 4 ++ setup.py | 2 +- 6 files changed, 110 insertions(+), 26 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 70800b02..2f2d87b2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +04-06-2014 +Version 1.4.7 + +[Feature] - Added download/build/install in choises (-n) network and (-c) check + 05-06-2014 Version 1.4.6 diff --git a/PKG-INFO b/PKG-INFO index c50ecf64..ab58b0bf 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: slpkg -Version: 1.4.6 +Version: 1.4.7 Author: dslackw Author-email: d zlatanidis at gmail com Maintainer: dslackw diff --git a/README.rst b/README.rst index a72c886a..7bd0fd61 100644 --- a/README.rst +++ b/README.rst @@ -174,6 +174,8 @@ Check if your packages is up to date (www.slackbuilds.org): | flashplayer-plugin 11.2.202.356 +================================================== + Would you like to install ? [Y/y] + $ slpkg -c ranger Searching `ranger` from slackbuilds.org ... @@ -207,6 +209,7 @@ Find slackbuild from network (www.slackbuilds.org): Info View the Info file Download Download this package Build Download and build this package + Install Download/Build/Install _ diff --git a/bin/slpkg b/bin/slpkg index 98f94525..0c1ea9b4 100755 --- a/bin/slpkg +++ b/bin/slpkg @@ -51,7 +51,7 @@ import subprocess __author__ = "dslackw" -__version__ = "1.4.6" +__version__ = "1.4.7" __license__ = "GNU General Public License v3 (GPLv3)" __email__ = "d.zlatanidis@gmail.com" @@ -498,6 +498,7 @@ def SBo_network(name): # call sbo functions SBo_req = SBo_requires_pkg(SBo_url, name) SBo_dwn = SBo_slackbuild_dwn(SBo_url, name) + SBo_version = SBo_version_pkg(SBo_url, name) source_dwn = SBo_source_dwn(SBo_url, name) extra_dwn = " ".join(SBo_extra_dwn(SBo_url, name)) @@ -521,14 +522,17 @@ def SBo_network(name): print ("+" + "=" * SBo_url_len) print (" {}R{}EADME View the README file".format(colors.RED, colors.ENDC)) print (" {}S{}lackBuild View the SlackBuild file".format(colors.RED, colors.ENDC)) - print (" {}I{}nfo View the Info file".format(colors.RED, colors.ENDC)) + print (" In{}f{}o View the Info file".format(colors.RED, colors.ENDC)) print (" {}D{}ownload Download this package".format(colors.RED, colors.ENDC)) print (" {}B{}uild Download and build this package".format(colors.RED, colors.ENDC)) + print (" {}I{}nstall Download/Build/Install".format(colors.RED, colors.ENDC)) print while True: + read = raw_input("_ ") + if read == "D" or read == "d": - print + print print ("{}Start -->{}\n".format(colors.GREEN, colors.ENDC)) os.system("wget -nc " + SBo_dwn) os.system("wget -nc " + source_dwn) @@ -538,9 +542,6 @@ def SBo_network(name): else: os.system("wget " + extra_dwn) - - print ("{}Use {}`slpkg -a`{} to build this package{}\n".format(colors.YELLOW, - colors.CYAN, colors.YELLOW, colors.ENDC)) break elif read == "R" or read == "r": @@ -548,7 +549,7 @@ def SBo_network(name): read_readme(SBo_url, name, site) os.system("less /tmp/slpkg/readme/" + name + ".{}".format(site)) - elif read == "I" or read == "i": + elif read == "F" or read == "f": site = ".info" read_info_slackbuild(SBo_url, name, site) os.system("less /tmp/slpkg/readme/" + name + "{}".format(site)) @@ -568,10 +569,9 @@ def SBo_network(name): os.system("wget -nc " + source_dwn) extra = [] - if extra_dwn == "": - pass - else: - os.system("wget -nc " + extra_dwn) + + if extra_dwn != "": + os.system("wget -nc " + extra_dwn) extra_dwn = extra_dwn.split() # convert str to list for ex in extra_dwn: extra.append(get_file(ex, "/")) @@ -581,8 +581,44 @@ def SBo_network(name): build_package(script, source) - break + elif read == "I" or read == "i": + s_user(getpass.getuser()) + pkg_for_install = name + "-" + SBo_version + if find_package(pkg_for_install, packages) == []: + script = get_file(SBo_dwn, "/") + source = get_file(source_dwn, "/") + print + print ("{}Start -->{}\n".format(colors.GREEN, colors.ENDC)) + os.system("wget -nc " + SBo_dwn) + os.system("wget -nc " + source_dwn) + + extra = [] + + if extra_dwn != "": + os.system("wget -nc " + extra_dwn) + extra_dwn = extra_dwn.split() # convert str to list + for ex in extra_dwn: + extra.append(get_file(ex, "/")) + + build_extra_pkg(script, source, extra) + + install_pkg = tmp + pkg_for_install + SBo_arch + SBo_tag + SBo_filetype + os.system("upgradepkg --install-new {}".format(install_pkg)) + break + + build_package(script, source) + + install_pkg = tmp + pkg_for_install + SBo_arch + SBo_tag + SBo_filetype + os.system("upgradepkg --install-new {}".format(install_pkg)) + break + else: + print + print ("{}The package {}`{}`{} is arlready installed{}".format(colors.YELLOW, + colors.CYAN, pkg_for_install, colors.YELLOW, colors.ENDC)) + print + break + else: break @@ -591,6 +627,7 @@ def SBo_network(name): # check if packages from www.slackbuilds.org is up to date def SBo_check(name): SBo_file = " ".join(find_package(name, packages)) + if SBo_file == "": print print (" {}The package {}`{}`{} not found on your system{}\n".format(colors.RED, @@ -598,26 +635,62 @@ def SBo_check(name): else: SBo_url = SBo_search_pkg(name) + if SBo_url == None: - print ("\n") - print ("{}The {}`{}`{} not found{}\n".format(colors.RED, - colors.CYAN, name, colors.RED, colors.ENDC)) + print ("\n") + print ("{}The {}`{}`{} not found{}\n".format(colors.RED, + colors.CYAN, name, colors.RED, colors.ENDC)) else: - SBo_version = SBo_version_pkg(SBo_url, name) - name_len = len(name) - arch_len = len(arch) - SBo_file = SBo_file[name_len+1:-arch_len-7] + SBo_version = SBo_version_pkg(SBo_url, name) + SBo_dwn = SBo_slackbuild_dwn(SBo_url, name) + source_dwn = SBo_source_dwn(SBo_url, name) + extra_dwn = " ".join(SBo_extra_dwn(SBo_url, name)) - if SBo_version > SBo_file: - print ("\n") + name_len = len(name) + arch_len = len(arch) + SBo_file = SBo_file[name_len+1:-arch_len-7] + + if SBo_version > SBo_file: + print ("\n") print ("{} New version is available !!!{}".format(colors.YELLOW, colors.ENDC)) print ("+" + "=" * 50) print ("| {} {}".format(name, SBo_version)) print ("+" + "=" * 50) + print + + read = raw_input("Would you like to install ? [Y/y] ") + + if read == "Y" or read == "y": + s_user(getpass.getuser()) + pkg_for_install = name + "-" + SBo_version + script = get_file(SBo_dwn, "/") + source = get_file(source_dwn, "/") + print + print ("{}Start -->{}\n".format(colors.GREEN, colors.ENDC)) + os.system("wget -nc " + SBo_dwn) + os.system("wget -nc " + source_dwn) + + extra = [] + if extra_dwn != "": + os.system("wget -nc " + extra_dwn) + extra_dwn = extra_dwn.split() # convert str to list + for ex in extra_dwn: + extra.append(get_file(ex, "/")) + + build_extra_pkg(script, source, extra) + install_pkg = tmp + pkg_for_install + SBo_arch + SBo_tag + SBo_filetype + os.system("upgradepkg --install-new {}".format(install_pkg)) + sys.exit() + + build_package(script, source) + + install_pkg = tmp + pkg_for_install + SBo_arch + SBo_tag + SBo_filetype + os.system("upgradepkg --install-new {}".format(install_pkg)) + print - else: + else: print ("\n") print ("{}Your package is up to date{}\n".format(colors.GREEN, colors.ENDC)) @@ -628,7 +701,6 @@ def SBo_build(name): s_user(getpass.getuser()) dependencies_links = SBo_dependencies_links_pkg(name) - # crate one list for all if dependencies_links == None: sys.exit() @@ -808,7 +880,7 @@ def pkg_reinstall(name): def pkg_remove(name): s_user(getpass.getuser()) print ("{}!!! WARNING !!!{}".format(colors.RED, colors.ENDC)) - remove_pkg = raw_input("Are you sure to remove this package(s) [y/n] ") + remove_pkg = raw_input("Are you sure to remove this package(s) [Y/y] ") print if remove_pkg == "y" or remove_pkg == "Y": for i in range(len(name)): diff --git a/man/slpkg.8 b/man/slpkg.8 index 01a7f3c5..ea014382 100644 --- a/man/slpkg.8 +++ b/man/slpkg.8 @@ -169,6 +169,9 @@ $ \fBslpkg -c flashplayer-plugin\fP +================================================== | flashplayer-plugin 11.2.202.356 +================================================== + + Would you like to install ? [Y/y] + $ \fBslpkg -n termcolor\fP @@ -187,6 +190,7 @@ $ \fBslpkg -n termcolor\fP Info View the Info file Download Download this package Build Download and build this package + Install Download/Build/Install _ diff --git a/setup.py b/setup.py index 033de57b..7e8dc141 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ from distutils.core import setup setup( name = 'slpkg', - version = "1.4.6", + version = "1.4.7", description = "Python tool to manage Slackware packages", keywords = ["slackware", "slpkg", "upgrade", "install", "remove", "view", "slackpkg", "tool"],