提交 c84ac6ba 编写于 作者: P Praveen K Pandey

Fixed issue address issue #2873 (kernel library) as when url

not passed while kernel download avocado error out as

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

when url not passed it uses default  else try to use custome url as
base url
Reported-by: Nlolyu <lolyu@redhat.com>
Signed-off-by: NPraveen K Pandey <praveen@linux.vnet.ibm.com>
上级 7d401ce5
......@@ -71,9 +71,15 @@ class KernelBuild(object):
source tarball
:type url: str or None
"""
kernel_file = self.SOURCE.format(version=self.version)
if url is not None:
# if there's no url to override, the default is the one
# specified in the class
if url is None:
base_url = self.URL.format(major=self.version.split('.', 1)[0])
# however, if there's a url informed as a parameter, this one
# should be used as the base url.
else:
base_url = url
full_url = base_url + kernel_file
......@@ -94,7 +100,8 @@ class KernelBuild(object):
Configure/prepare kernel source to build.
"""
self.linux_dir = os.path.join(self.work_dir, 'linux-%s' % self.version)
build.make(self.linux_dir, extra_args='-C %s mrproper' % self.linux_dir)
build.make(self.linux_dir, extra_args='-C %s mrproper' %
self.linux_dir)
if self.config_path is not None:
dotconfig = os.path.join(self.linux_dir, '.config')
shutil.copy(self.config_path, dotconfig)
......@@ -114,10 +121,13 @@ class KernelBuild(object):
if self.distro.name == "Ubuntu":
build_output_format = "deb-pkg"
if self.config_path is None:
build.make(self.linux_dir, extra_args='-C %s defconfig' % self.linux_dir)
build.make(self.linux_dir, extra_args='-C %s defconfig' %
self.linux_dir)
else:
build.make(self.linux_dir, extra_args='-C %s olddefconfig' % self.linux_dir)
build.make(self.linux_dir, extra_args='-C %s %s' % (self.linux_dir, build_output_format))
build.make(self.linux_dir, extra_args='-C %s olddefconfig' %
self.linux_dir)
build.make(self.linux_dir, extra_args='-C %s %s' %
(self.linux_dir, build_output_format))
def install(self):
"""
......@@ -125,7 +135,8 @@ class KernelBuild(object):
"""
log.info("Starting kernel install")
if self.distro.name == "Ubuntu":
process.run('dpkg -i %s/*.deb' % self.work_dir, shell=True, sudo=True)
process.run('dpkg -i %s/*.deb' %
self.work_dir, shell=True, sudo=True)
else:
log.info("Skipping kernel install")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册