Petr Kubat
2013-08-29 08:21:04 UTC
Signed-off-by: Petr Kubat <pkubat-H+wXaHxf7aLQT0dZR+***@public.gmane.org>
---
src/client-python/debuginfo.py | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/client-python/debuginfo.py b/src/client-python/debuginfo.py
index 035d697..146d2b1 100644
--- a/src/client-python/debuginfo.py
+++ b/src/client-python/debuginfo.py
@@ -7,6 +7,7 @@ import sys
import os
import time
import errno
+import shutil
old_stdout = -1
def mute_stdout():
@@ -335,9 +336,22 @@ class DebugInfoDownload(YumBase):
if retval != RETURN_OK:
return retval
- local = os.path.join(self.tmpdir, local)
- pkg.localpath = local # Hack: to set the localpath we want
- err = self.downloadPkgs(pkglist=[pkg])
+ remote_path = pkg.returnSimple('remote_url')
+ # check if the pkg is in a local repo and copy it if it is
+ err = None
+ if remote_path.startswith('file:///'):
+ pkg_path = remote_path[7:]
+ log2("copying from local repo: %s", remote)
+ try:
+ shutil.copy(pkg_path, self.tmpdir)
+ except OSError, ex:
+ print _("Cannot copy file '{0}': {1}").format(pkg_path, ex)
+ continue
+ else:
+ # pkg is in a remote repo, we need to download it to tmpdir
+ local = os.path.join(self.tmpdir, local)
+ pkg.localpath = local # Hack: to set the localpath we want
+ err = self.downloadPkgs(pkglist=[pkg])
# normalize the name
# just str(pkg) doesn't work because it can have epoch
pkg_nvra = pkg.name + "-" + pkg.version + "-" + pkg.release + "." + pkg.arch
---
src/client-python/debuginfo.py | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/client-python/debuginfo.py b/src/client-python/debuginfo.py
index 035d697..146d2b1 100644
--- a/src/client-python/debuginfo.py
+++ b/src/client-python/debuginfo.py
@@ -7,6 +7,7 @@ import sys
import os
import time
import errno
+import shutil
old_stdout = -1
def mute_stdout():
@@ -335,9 +336,22 @@ class DebugInfoDownload(YumBase):
if retval != RETURN_OK:
return retval
- local = os.path.join(self.tmpdir, local)
- pkg.localpath = local # Hack: to set the localpath we want
- err = self.downloadPkgs(pkglist=[pkg])
+ remote_path = pkg.returnSimple('remote_url')
+ # check if the pkg is in a local repo and copy it if it is
+ err = None
+ if remote_path.startswith('file:///'):
+ pkg_path = remote_path[7:]
+ log2("copying from local repo: %s", remote)
+ try:
+ shutil.copy(pkg_path, self.tmpdir)
+ except OSError, ex:
+ print _("Cannot copy file '{0}': {1}").format(pkg_path, ex)
+ continue
+ else:
+ # pkg is in a remote repo, we need to download it to tmpdir
+ local = os.path.join(self.tmpdir, local)
+ pkg.localpath = local # Hack: to set the localpath we want
+ err = self.downloadPkgs(pkglist=[pkg])
# normalize the name
# just str(pkg) doesn't work because it can have epoch
pkg_nvra = pkg.name + "-" + pkg.version + "-" + pkg.release + "." + pkg.arch
--
1.8.3.1
1.8.3.1