From f96cf7d4bbe74bebb13f684f1bc153005e6f3a27 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Tue, 20 Jan 2015 14:23:25 +0100 Subject: [PATCH] update_product_version: use re instead of importing/exporting the XML (we lose comments in the process) --- osclib/freeze_command.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/osclib/freeze_command.py b/osclib/freeze_command.py index 865ea4e5..e9f8addf 100644 --- a/osclib/freeze_command.py +++ b/osclib/freeze_command.py @@ -131,13 +131,11 @@ class FreezeCommand(object): return None kiwifile = self.api.load_file_content(project, product, 'PRODUCT-x86_64.kiwi') - root = ET.fromstring(kiwifile) - prodvar = root.find(".//productvar[@name='VERSION']") - prodvar.text = version - prodinfoversion = root.find(".//productinfo[@name='VERSION']") - prodinfoversion.text = version - self.api.save_file_content(project, product, 'PRODUCT-x86_64.kiwi', ET.tostring(root)) + tmpkiwifile = re.sub(r'.*', '%s' % version, kiwifile) + newkiwifile = re.sub(r'.*', '%s' % version, tmpkiwifile) + + self.api.save_file_content(project, product, 'PRODUCT-x86_64.kiwi', newkiwifile) def prj_meta_for_bootstrap_copy(self, prj): root = ET.Element('project', {'name': prj})