Update downloader

This commit is contained in:
Dimitris Zlatanidis 2015-06-17 17:20:42 +03:00
parent 84ef805998
commit 7fec0ab6ba
7 changed files with 19 additions and 16 deletions

View file

@ -88,7 +88,7 @@ class MetaData(object):
__all__ = "slpkg"
__author__ = "dslackw"
__version_info__ = (2, 5, 2)
__version_info__ = (2, 5, 3)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"

View file

@ -120,7 +120,8 @@ class BinaryInstall(object):
print("")
if Msg().answer() in ["y", "Y"]:
self.install.reverse()
Download(self.tmp_path, (self.dep_dwn + self.dwn)).start()
Download(self.tmp_path, self.dep_dwn + self.dwn,
self.repo).start()
self.dep_install = Utils().check_downloaded(
self.tmp_path, self.dep_install)
self.install = Utils().check_downloaded(

View file

@ -32,9 +32,10 @@ from __metadata__ import MetaData as _meta_
class Download(object):
def __init__(self, path, url):
def __init__(self, path, url, repo):
self.path = path
self.url = url
self.repo = repo
self.meta = _meta_
self.wget_options = self.meta.wget_options
@ -46,7 +47,6 @@ class Download(object):
for dwn in self.url:
self.file_name = dwn.split("/")[-1]
self._check_certificate()
print self.wget_options
print("\n[{0}/{1}][ {2}Download{3} ] --> {4}\n".format(
dwn_count, len(self.url), self.meta.color["GREEN"],
self.meta.color["ENDC"],
@ -73,8 +73,8 @@ class Download(object):
sys.exit(0)
def _check_certificate(self):
"""Check sources like jdk for extra options for wget
"""Check for certificates options for wget
"""
if self.file_name.startswith("jdk-"):
if self.file_name.startswith("jdk-") and self.repo == "sbo":
self.wget_options += (" --no-check-certificate --header='Cookie: "
"oraclelicense=accept-securebackup-cookie'")

View file

@ -143,9 +143,11 @@ class QueuePkgs(object):
sources = []
os.chdir(self.meta.build_path)
script = sbo_dwn.split("/")[-1]
Download(self.meta.build_path, sbo_dwn.split()).start()
Download(self.meta.build_path, sbo_dwn.split(),
repo="sbo").start()
for src in source_dwn:
Download(self.meta.build_path, src.split()).start()
Download(self.meta.build_path, src.split(),
repo="sbo").start()
sources.append(src.split("/")[-1])
BuildPackage(script, sources, self.meta.build_path).build()
else:

View file

@ -300,17 +300,16 @@ class SBoInstall(object):
Msg().template(78)
elif self.unst[0] in src_link or self.unst[1] in src_link:
Msg().template(78)
print("| Package {0} {1}{2}{3}".format(sbo,
self.meta.color["RED"],
"".join(src_link),
self.meta.color["ENDC"]))
print("| Package {0} {1}{2}{3}".format(
sbo, self.meta.color["RED"], "".join(src_link),
self.meta.color["ENDC"]))
Msg().template(78)
else:
sbo_url = sbo_search_pkg(pkg)
sbo_link = SBoLink(sbo_url).tar_gz()
script = sbo_link.split("/")[-1]
dwn_srcs = sbo_link.split() + src_link
Download(self.build_folder, dwn_srcs).start()
Download(self.build_folder, dwn_srcs, repo="sbo").start()
sources = self.filenames(src_link)
BuildPackage(script, sources, self.build_folder).build()
binary_list = self.search_in_tmp(prgnam)

View file

@ -76,7 +76,7 @@ class SBoNetwork(object):
while True:
choice = self.read_choice()
if choice in ["D", "d"]:
Download("", self.dwn_srcs).start()
Download("", self.dwn_srcs, repo="sbo").start()
break
elif choice in ["R", "r"]:
README = Read(self.sbo_url).readme("README")
@ -199,7 +199,7 @@ class SBoNetwork(object):
if not os.path.exists(_meta_.build_path):
os.makedirs(_meta_.build_path)
os.chdir(_meta_.build_path)
Download(_meta_.build_path, self.dwn_srcs).start()
Download(_meta_.build_path, self.dwn_srcs, repo="sbo").start()
script = self.sbo_dwn.split("/")[-1]
for src in self.source_dwn:
sources.append(src.split("/")[-1])

View file

@ -111,7 +111,8 @@ class Patches(object):
self.meta.color["ENDC"]))
print("")
if Msg().answer() in ["y", "Y"]:
Download(self.patch_path, self.dwn_links).start()
Download(self.patch_path, self.dwn_links,
repo="slack").start()
self.upgrade_all = self.utils.check_downloaded(
self.patch_path, self.upgrade_all)
self.upgrade()