From e2328988cf38ace424761a6f880c2fae2ac27f6d Mon Sep 17 00:00:00 2001 From: Ravi Kondamuru Date: Sun, 5 Jan 2014 22:32:15 +0000 Subject: [PATCH] XOP-497:NetScaler suppack install fails for drivers 1. supplementalpack.py setup unconditionally sets the install (-i) option for driver-rpms. 2. When the kernel version is not changed, but a new version of the driver is released, the install script tries to install the new version over the existing files. rpm reports conflicts with file due to this. 3. This commit introduces a new option (-m) for use with kernel modules. This is used for packages that have kernel version in their name (like driver-rpm). (-i) will continue to be used for kernel packages that do not include version in name (like kernel, kernel-dump). 4. During install, if -m in options, choose to upgrade when module with same name is already installed, else install. --- scripts/suppack-install.py | 16 ++++++++++++---- xcp/supplementalpack.py | 5 ++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/scripts/suppack-install.py b/scripts/suppack-install.py index 425bdb1..5bd5608 100644 --- a/scripts/suppack-install.py +++ b/scripts/suppack-install.py @@ -135,14 +135,22 @@ def md5sum_file(fname): pkg_ver, _ = subprocess.Popen(['rpm', '--nosignature', '-q', '--qf', '%{VERSION}-%{RELEASE}', '-p', p.filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() - if 'options' in p.__dict__: - install = '-i' in p.options - else: - install = (pkg_name in ['kernel-xen', 'kernel-kdump']) s = subprocess.Popen(['rpm', '--nosignature', '-q', '--qf', '%{VERSION}-%{RELEASE}', pkg_name], stdout=subprocess.PIPE, stderr=subprocess.PIPE) inst_ver, _ = s.communicate() + + if 'options' in p.__dict__: + install = False + if '-i' in p.options: + install = True + elif '-m' in p.options: + # kernel module, if it exists upgrade, else install + if s.returncode != 0: + install = True + else: + install = (pkg_name in ['kernel-xen', 'kernel-kdump']) + if s.returncode != 0: if install: install_list.append(p) diff --git a/xcp/supplementalpack.py b/xcp/supplementalpack.py index 00f8cc1..45b1bc8 100644 --- a/xcp/supplementalpack.py +++ b/xcp/supplementalpack.py @@ -74,7 +74,10 @@ def __init__(self, fname): if m: self.label = m.group(1) self.kernel = m.group(3) + m.group(2) - self.options = '-i' + # this is a kernel module. Multiple packages of this module + # can be installed for different kernel versions. But for + # the same kernel version, only upgrade should be done. + self.options = '-m' else: self.label = rpmname self.kernel = 'any'