[node-patches] Change in ovirt-node[master]: edit-node: Identify packages with * in --install
dougsland at redhat.com
dougsland at redhat.com
Wed Aug 13 01:53:48 UTC 2014
Douglas Schilling Landgraf has uploaded a new change for review.
Change subject: edit-node: Identify packages with * in --install
......................................................................
edit-node: Identify packages with * in --install
The --install option accepts packages that will be updated
in the oVirt Node iso. We can accept packages in the below
format:
./edit-node --repo=./myrepo.repp
--install vdsm,ovirt-node-plugin-vdsm* base_iso.iso
--name mynewiso
However, edit-node is not able to generate the plugins
files correctly in /etc/ovirt-plugins.d/<plugin-name>
when the * is used affecting the Plugins option in the TUI.
This patch adds the hability to edit-node to identify
the packages correctly when * is used for similar packages name.
Change-Id: Iee564235caacffe04bafde0a3fb29404d135c2a2
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1119606
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M tools/edit-node
1 file changed, 31 insertions(+), 23 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/28/31428/1
diff --git a/tools/edit-node b/tools/edit-node
index 9287953..845ef64 100755
--- a/tools/edit-node
+++ b/tools/edit-node
@@ -676,30 +676,38 @@
os.system("mkdir -p %s" % plugin_info_dir)
for pkg in pkg.split(","):
pkgfilename = re.sub("\.(rpm)$", "", os.path.basename(pkg))
- # get version-release
- cmd = "rpm -q %s --qf '%%{version}-%%{release}.%%{arch}\n'" \
- % pkgfilename
- f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT,
+
+ # get name#version-release
+ cmd = "rpm -qa %s --qf '%%{name}#%%{version}-" \
+ "%%{release}.%%{arch}\n'" % pkgfilename
+ f = subprocess.Popen(cmd,
+ shell=True,
+ stdout=PIPE,
+ stderr=STDOUT,
preexec_fn=self._chroot)
- vr, err = f.communicate()
- # get install date
- cmd = "LC_ALL=C rpm -q %s --qf '%%{INSTALLTIME:date}\n'" \
- % pkgfilename
- f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT,
- preexec_fn=self._chroot)
- install_date, err = f.communicate()
- if os.path.isfile(pkg):
- #get rpm name
- cmd = "rpm -qp %s --qf '%%{name}'" % pkg
- f = subprocess.Popen(cmd, shell=True, stdout=PIPE,
- stderr=STDOUT)
- pkg, err = f.communicate()
- plugin_file = "%s/%s" % (plugin_info_dir, pkg)
- pfile = open(plugin_file, "w")
- pfile.write("Name:%s\n" % pkg)
- pfile.write("Version:%s-%s" % (pkg, vr))
- pfile.write("Install Date:%s" % install_date)
- pfile.close()
+ namevr, err = f.communicate()
+
+ for nvr in namevr.split("\n"):
+ if not nvr:
+ break
+
+ pkgname, pkgversion = nvr.strip("*").split("#")
+ # get install date
+ cmd = "LC_ALL=C rpm -q %s --qf '%%{INSTALLTIME:date}\n'" \
+ % pkgname
+ f = subprocess.Popen(cmd,
+ shell=True,
+ stdout=PIPE,
+ stderr=STDOUT,
+ preexec_fn=self._chroot)
+ install_date, err = f.communicate()
+
+ plugin_file = "%s/%s" % (plugin_info_dir, pkgname)
+
+ with open(plugin_file, 'w') as f:
+ f.write("Name:%s\n" % pkgname)
+ f.write("Version:%s\n" % pkgversion)
+ f.write("Install Date:%s" % install_date)
update_dir_list = glob.glob(os.path.join(self._ImageCreator__builddir,
"iso", "isolinux", "update*"))
--
To view, visit http://gerrit.ovirt.org/31428
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iee564235caacffe04bafde0a3fb29404d135c2a2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>
More information about the node-patches
mailing list