summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHedayat Vatankhah <hedayat.fwd@gmail.com>2011-06-12 01:39:28 +0430
committerHedayat Vatankhah <hedayat.fwd@gmail.com>2011-06-12 01:39:28 +0430
commit9f092a36cfacc335e7cda3eff1e073397d65e7ae (patch)
treec7adf3cb5d224a6a2e612f0dc8b9c63a2572c3fd
parent8b9f59673067cfa9ac52fbead70d37d8e5b2aa77 (diff)
downloadyum-fast-downloader-9f092a36cfacc335e7cda3eff1e073397d65e7ae.tar.gz
yum-fast-downloader-9f092a36cfacc335e7cda3eff1e073397d65e7ae.tar.xz
yum-fast-downloader-9f092a36cfacc335e7cda3eff1e073397d65e7ae.zip
Save intermediate files with a unique name
-rwxr-xr-xyum-fast-downloader-finalize2
-rw-r--r--yum-fast-downloader.py7
-rw-r--r--yum-fast-downloader.spec11
3 files changed, 15 insertions, 5 deletions
diff --git a/yum-fast-downloader-finalize b/yum-fast-downloader-finalize
new file mode 100755
index 0000000..75ebeb3
--- /dev/null
+++ b/yum-fast-downloader-finalize
@@ -0,0 +1,2 @@
+#!/bin/sh
+mv $3 ${3%.yfd}
diff --git a/yum-fast-downloader.py b/yum-fast-downloader.py
index 682c43c..4fa887a 100644
--- a/yum-fast-downloader.py
+++ b/yum-fast-downloader.py
@@ -37,14 +37,15 @@ originalRetrieveMD = YumRepository._retrieveMD
downloader_app = ''
global_cache_dir=''
downloader_common_args = {
- 'aria2c' : ["aria2c", "--continue", "--check-certificate=false"]
+ 'aria2c' : ["aria2c", "--continue", "--check-certificate=false",
+ "--on-download-complete=/usr/libexec/yum-fast-downloader-finalize"]
}
# downloader functions
def _getAria2CArgs(urls, remote_path, local_path, proxies = None):
args = downloader_common_args['aria2c']
- args.append("--out={0}".format(os.path.basename(local_path)))
+ 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))))
if proxies:
@@ -70,7 +71,7 @@ def queueDownload(inputFile, urls, remote_path, local_path, proxies = None):
for url in urls:
inputFile.write(url + remote_path + "\t")
inputFile.write("\n")
- inputFile.write(" out={0}\n".format(os.path.basename(local_path)))
+ inputFile.write(" out={0}.yfd\n".format(os.path.basename(local_path)))
inputFile.write(" dir={0}\n".format(os.path.dirname(local_path)))
inputFile.write(" split={0}\n".format(max(5, len(urls))))
diff --git a/yum-fast-downloader.spec b/yum-fast-downloader.spec
index 02f64a0..afd417f 100644
--- a/yum-fast-downloader.spec
+++ b/yum-fast-downloader.spec
@@ -1,6 +1,6 @@
Summary: A fast downloader plugin for yum
Name: yum-fast-downloader
-Version: 0.5.2
+Version: 0.5.4
Release: 1
License: GPLv2+
Group: System Environment/Base
@@ -21,16 +21,23 @@ Currently, it provides the following features:
%setup -q
%install
-install -d -m 755 $RPM_BUILD_ROOT/usr/lib/yum-plugins $RPM_BUILD_ROOT/etc/yum/pluginconf.d/
+install -d -m 755 $RPM_BUILD_ROOT/usr/lib/yum-plugins \
+ $RPM_BUILD_ROOT/etc/yum/pluginconf.d/ $RPM_BUILD_ROOT/usr/libexec/
install -m 644 %{name}.py $RPM_BUILD_ROOT/usr/lib/yum-plugins/
install -m 644 %{name}.conf $RPM_BUILD_ROOT/etc/yum/pluginconf.d/
+install -m 755 %{name}-finalize $RPM_BUILD_ROOT/usr/libexec/
%files
%config(noreplace) /etc/yum/pluginconf.d/%{name}.conf
%doc README COPYING
/usr/lib/yum-plugins/*
+/usr/libexec/*
%changelog
+* Sun Jun 12 2011 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 0.5.4-1
+- Save intermediate download files with a different name, so that presto
+ will not remove aria2c incompletely downloaded files
+
* Thu May 12 2011 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 0.5.2-1
- Fixed a small bug and add a new config option in 0.5.2