diff options
author | Hedayat Vatankhah <hedayat.fwd@gmail.com> | 2011-10-08 14:04:09 +0330 |
---|---|---|
committer | Hedayat Vatankhah <hedayat.fwd@gmail.com> | 2011-10-08 14:04:09 +0330 |
commit | 55bd777800620deb6e4642992c03e3b16f99e362 (patch) | |
tree | 13639ecff2aeace10c117e3fe599791c8a178010 | |
parent | d43e89c565ff409b5e564f6b83baad78905569df (diff) | |
parent | baa19078425364bc74fff3301586cbd6133157f5 (diff) | |
download | yum-fast-downloader-55bd777800620deb6e4642992c03e3b16f99e362.tar.gz yum-fast-downloader-55bd777800620deb6e4642992c03e3b16f99e362.tar.xz yum-fast-downloader-55bd777800620deb6e4642992c03e3b16f99e362.zip |
Update to latest version for Fedora 14
-rw-r--r-- | yum-fast-downloader.py | 20 | ||||
-rw-r--r-- | yum-fast-downloader.spec | 11 |
2 files changed, 26 insertions, 5 deletions
diff --git a/yum-fast-downloader.py b/yum-fast-downloader.py index 4fa887a..9f57785 100644 --- a/yum-fast-downloader.py +++ b/yum-fast-downloader.py @@ -28,6 +28,7 @@ import shutil import yum from yum.plugins import TYPE_CORE from yum.yumRepo import YumRepository +from time import sleep requires_api_version = '2.6' plugin_type = (TYPE_CORE,) @@ -44,7 +45,8 @@ downloader_common_args = { # downloader functions def _getAria2CArgs(urls, remote_path, local_path, proxies = None): - args = downloader_common_args['aria2c'] + args = [] + args += downloader_common_args['aria2c'] args.append("--out={0}.yfd".format(os.path.basename(local_path))) args.append("--dir={0}".format(os.path.dirname(local_path))) args.append("--split={0}".format(max(5, len(urls)))) @@ -60,11 +62,22 @@ def _getAria2CArgs(urls, remote_path, local_path, proxies = None): def downloadFile(urls, remote_path, local_path, proxies = None): if urls[0].startswith("http://") or urls[0].startswith("ftp://"): + print "\n============================================================" \ + "====================\nDownloading {0}\n=========="\ + "==================================================================="\ + "===".format(remote_path) args = _getAria2CArgs(urls, remote_path, local_path) ret = os.spawnvp(os.P_WAIT, downloader_app, args) if ret: raise yum.plugins.PluginYumExit( "{0} exited with exit code: {1}".format(downloader_app, ret)) + i=0 + while not os.path.exists(local_path): + sleep(0.1) + i+=1 + if i > 50: + raise yum.plugins.PluginYumExit( + "Error in downloading file: {0}".format(local_path)) def queueDownload(inputFile, urls, remote_path, local_path, proxies = None): if urls[0].startswith("http://") or urls[0].startswith("ftp://"): @@ -81,9 +94,11 @@ def queueDownload(inputFile, urls, remote_path, local_path, proxies = None): inputFile.write(" {0}-proxy={1}\n".format(scheme, proxy)) def downloadQueuedFiles(inputFileName): - args = downloader_common_args['aria2c'] + args = [] + args += downloader_common_args['aria2c'] args.append("--input-file={0}".format(inputFileName)) ret = os.spawnvp(os.P_WAIT, "aria2c", args) + sleep(1) if ret: raise yum.plugins.PluginYumExit( "{0} exited with exit code: {1}".format(downloader_app, ret)) @@ -136,7 +151,6 @@ def postconfig_hook(conduit): downloader_common_args['aria2c'].append( "--max-concurrent-downloads={0}".format(max_concurrent_downloads)) - def prereposetup_hook(conduit): ret_insmethod = type(YumRepository._retrieveMD) YumRepository._retrieveMD = ret_insmethod(myRetrieveMD, None, YumRepository) diff --git a/yum-fast-downloader.spec b/yum-fast-downloader.spec index e5cb0a6..1417119 100644 --- a/yum-fast-downloader.spec +++ b/yum-fast-downloader.spec @@ -1,7 +1,7 @@ Summary: A fast downloader plugin for yum Name: yum-fast-downloader -Version: 0.5.4 -Release: 2 +Version: 0.5.7 +Release: 1 License: GPLv2+ Group: System Environment/Base Source: %{name}-%{version}.tar.bz2 @@ -34,6 +34,13 @@ install -m 755 %{name}-finalize $RPM_BUILD_ROOT/usr/libexec/ /usr/libexec/* %changelog +* Sat Oct 08 2011 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 0.5.7-1 +- Fixed a bug in downloading single files which caused repeated downloading of + metadata files + +* Thu Oct 06 2011 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 0.5.6-1 +- Try to prevent re-downloading after some package downloads + * Mon Jun 20 2011 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 0.5.4-2 - Use the correct source file! |