提交 efda8cc4 编写于 作者: L Lukáš Doktor

utils.software_manager: Improve the way src.rpm files are downloaded

Currently it uses "--urls" to list urls to download from and then it
initiates another execution to get the actual file. This is potentially
dangerous as the name can change between those two executions.

Due to yumdownloader bug it's not possible to get the downloaded file
name from python execution (as in non-TTY mode it's not printing it on
<F26) let's use tmpdir and assume the only existing "src.rpm" there is
the freshly downloaded one.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 ecd38f65
......@@ -595,12 +595,15 @@ class YumBackend(RpmBackend):
"could not be installed", pkg)
return ""
try:
src_rpm = process.system_output('yumdownloader --urls --source'
' %s' % name).splitlines()[-1]
src_rpm = src_rpm.split("/")[-1]
process.system_output('yumdownloader --source %s --destdir %s' % (name, path))
src_rpm = os.path.join(path, src_rpm)
if self.rpm_install(src_rpm):
process.run('yumdownloader --verbose --source %s '
'--destdir %s' % (name, path))
src_rpms = [_ for _ in os.walk(path).next()[2]
if _.endswith(".src.rpm")]
if len(src_rpms) != 1:
log.error("Failed to get downloaded src.rpm from %s:\n%s",
path, os.walk(path).next()[2])
return ""
if self.rpm_install(os.path.join(path, src_rpms[-1])):
if self.build_dep(name):
return self.prepare_source(
"%s/rpmbuild/SPECS/%s.spec" % (os.environ['HOME'], name), dest_path)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册