updated for version 1.4.7

This commit is contained in:
dslackw 2014-06-05 13:25:50 +03:00
parent 8d9ef4965a
commit 0ac8642d9f
6 changed files with 110 additions and 26 deletions

View file

@ -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 05-06-2014
Version 1.4.6 Version 1.4.6

View file

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

View file

@ -174,6 +174,8 @@ Check if your packages is up to date (www.slackbuilds.org):
| flashplayer-plugin 11.2.202.356 | flashplayer-plugin 11.2.202.356
+================================================== +==================================================
Would you like to install ? [Y/y]
$ slpkg -c ranger $ slpkg -c ranger
Searching `ranger` from slackbuilds.org ... Searching `ranger` from slackbuilds.org ...
@ -207,6 +209,7 @@ Find slackbuild from network (www.slackbuilds.org):
Info View the Info file Info View the Info file
Download Download this package Download Download this package
Build Download and build this package Build Download and build this package
Install Download/Build/Install
_ _

120
bin/slpkg
View file

@ -51,7 +51,7 @@ import subprocess
__author__ = "dslackw" __author__ = "dslackw"
__version__ = "1.4.6" __version__ = "1.4.7"
__license__ = "GNU General Public License v3 (GPLv3)" __license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com" __email__ = "d.zlatanidis@gmail.com"
@ -498,6 +498,7 @@ def SBo_network(name):
# call sbo functions # call sbo functions
SBo_req = SBo_requires_pkg(SBo_url, name) SBo_req = SBo_requires_pkg(SBo_url, name)
SBo_dwn = SBo_slackbuild_dwn(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) source_dwn = SBo_source_dwn(SBo_url, name)
extra_dwn = " ".join(SBo_extra_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 ("+" + "=" * SBo_url_len)
print (" {}R{}EADME View the README file".format(colors.RED, colors.ENDC)) 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 (" {}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 (" {}D{}ownload Download this package".format(colors.RED, colors.ENDC))
print (" {}B{}uild Download and build 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 print
while True: while True:
read = raw_input("_ ") read = raw_input("_ ")
if read == "D" or read == "d": if read == "D" or read == "d":
print print
print ("{}Start -->{}\n".format(colors.GREEN, colors.ENDC)) print ("{}Start -->{}\n".format(colors.GREEN, colors.ENDC))
os.system("wget -nc " + SBo_dwn) os.system("wget -nc " + SBo_dwn)
os.system("wget -nc " + source_dwn) os.system("wget -nc " + source_dwn)
@ -538,9 +542,6 @@ def SBo_network(name):
else: else:
os.system("wget " + extra_dwn) os.system("wget " + extra_dwn)
print ("{}Use {}`slpkg -a`{} to build this package{}\n".format(colors.YELLOW,
colors.CYAN, colors.YELLOW, colors.ENDC))
break break
elif read == "R" or read == "r": elif read == "R" or read == "r":
@ -548,7 +549,7 @@ def SBo_network(name):
read_readme(SBo_url, name, site) read_readme(SBo_url, name, site)
os.system("less /tmp/slpkg/readme/" + name + ".{}".format(site)) os.system("less /tmp/slpkg/readme/" + name + ".{}".format(site))
elif read == "I" or read == "i": elif read == "F" or read == "f":
site = ".info" site = ".info"
read_info_slackbuild(SBo_url, name, site) read_info_slackbuild(SBo_url, name, site)
os.system("less /tmp/slpkg/readme/" + name + "{}".format(site)) os.system("less /tmp/slpkg/readme/" + name + "{}".format(site))
@ -568,10 +569,9 @@ def SBo_network(name):
os.system("wget -nc " + source_dwn) os.system("wget -nc " + source_dwn)
extra = [] extra = []
if extra_dwn == "":
pass if extra_dwn != "":
else: os.system("wget -nc " + extra_dwn)
os.system("wget -nc " + extra_dwn)
extra_dwn = extra_dwn.split() # convert str to list extra_dwn = extra_dwn.split() # convert str to list
for ex in extra_dwn: for ex in extra_dwn:
extra.append(get_file(ex, "/")) extra.append(get_file(ex, "/"))
@ -581,8 +581,44 @@ def SBo_network(name):
build_package(script, source) 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: else:
break break
@ -591,6 +627,7 @@ def SBo_network(name):
# check if packages from www.slackbuilds.org is up to date # check if packages from www.slackbuilds.org is up to date
def SBo_check(name): def SBo_check(name):
SBo_file = " ".join(find_package(name, packages)) SBo_file = " ".join(find_package(name, packages))
if SBo_file == "": if SBo_file == "":
print print
print (" {}The package {}`{}`{} not found on your system{}\n".format(colors.RED, print (" {}The package {}`{}`{} not found on your system{}\n".format(colors.RED,
@ -598,26 +635,62 @@ def SBo_check(name):
else: else:
SBo_url = SBo_search_pkg(name) SBo_url = SBo_search_pkg(name)
if SBo_url == None: if SBo_url == None:
print ("\n") print ("\n")
print ("{}The {}`{}`{} not found{}\n".format(colors.RED, print ("{}The {}`{}`{} not found{}\n".format(colors.RED,
colors.CYAN, name, colors.RED, colors.ENDC)) colors.CYAN, name, colors.RED, colors.ENDC))
else: else:
SBo_version = SBo_version_pkg(SBo_url, name) SBo_version = SBo_version_pkg(SBo_url, name)
name_len = len(name) SBo_dwn = SBo_slackbuild_dwn(SBo_url, name)
arch_len = len(arch) source_dwn = SBo_source_dwn(SBo_url, name)
SBo_file = SBo_file[name_len+1:-arch_len-7] extra_dwn = " ".join(SBo_extra_dwn(SBo_url, name))
if SBo_version > SBo_file: name_len = len(name)
print ("\n") 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 ("{} New version is available !!!{}".format(colors.YELLOW, colors.ENDC))
print ("+" + "=" * 50) print ("+" + "=" * 50)
print ("| {} {}".format(name, SBo_version)) print ("| {} {}".format(name, SBo_version))
print ("+" + "=" * 50) 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 print
else: else:
print ("\n") print ("\n")
print ("{}Your package is up to date{}\n".format(colors.GREEN, colors.ENDC)) 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()) s_user(getpass.getuser())
dependencies_links = SBo_dependencies_links_pkg(name) dependencies_links = SBo_dependencies_links_pkg(name)
# crate one list for all # crate one list for all
if dependencies_links == None: if dependencies_links == None:
sys.exit() sys.exit()
@ -808,7 +880,7 @@ def pkg_reinstall(name):
def pkg_remove(name): def pkg_remove(name):
s_user(getpass.getuser()) s_user(getpass.getuser())
print ("{}!!! WARNING !!!{}".format(colors.RED, colors.ENDC)) 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 print
if remove_pkg == "y" or remove_pkg == "Y": if remove_pkg == "y" or remove_pkg == "Y":
for i in range(len(name)): for i in range(len(name)):

View file

@ -169,6 +169,9 @@ $ \fBslpkg -c flashplayer-plugin\fP
+================================================== +==================================================
| flashplayer-plugin 11.2.202.356 | flashplayer-plugin 11.2.202.356
+================================================== +==================================================
Would you like to install ? [Y/y]
$ \fBslpkg -n termcolor\fP $ \fBslpkg -n termcolor\fP
@ -187,6 +190,7 @@ $ \fBslpkg -n termcolor\fP
Info View the Info file Info View the Info file
Download Download this package Download Download this package
Build Download and build this package Build Download and build this package
Install Download/Build/Install
_ _

View file

@ -7,7 +7,7 @@ from distutils.core import setup
setup( setup(
name = 'slpkg', name = 'slpkg',
version = "1.4.6", version = "1.4.7",
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"],