From bd4e71e2b0aff5ee2b0b12b5628e1bd249f5469c Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Thu, 6 Jul 2017 12:50:16 +0200 Subject: [PATCH] AcceptCommand: update version of all products found in the project in opeSUSE:Factory, for example, there is also openSUS-Kubic.product and the versions are supposed to stay in sync. We newly find all product definitions inside a project and update all of them, with the same limiation as before: only if version was a 8 digit version it will be updated to the current date stamp Additionally, this is a preparation for the new product builder, as _product is no longer hardcoded, but found. --- osclib/accept_command.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/osclib/accept_command.py b/osclib/accept_command.py index 01dde5f4..884e8e92 100644 --- a/osclib/accept_command.py +++ b/osclib/accept_command.py @@ -191,21 +191,20 @@ class AcceptCommand(object): # XXX TODO - This method have `factory` in the name. Can be # missleading. - # If thereis not product defined for this project, show the - # warning and return. - if not self.api.cproduct: - warnings.warn('There is not product defined in the configuration file.') - return - project = self.api.project - url = self.api.makeurl(['source', project, '_product', self.api.cproduct]) - - product = http_GET(url).read() curr_version = date.today().strftime('%Y%m%d') - new_product = re.sub(r'\d{8}', '%s' % curr_version, product) + url = self.api.makeurl(['source', project], {'view': 'productlist'}) - if product != new_product: - http_PUT(url + '?comment=Update+version', data=new_product) + products = ET.parse(http_GET(url)).getroot() + for product in products.findall('product'): + product_name = product.get('name') + '.product' + product_pkg = product.get('originpackage') + url = self.api.makeurl(['source', project, product_pkg, product_name]) + product_spec = http_GET(url).read() + new_product = re.sub(r'\d{8}', '%s' % curr_version, product_spec) + + if product_spec != new_product: + http_PUT(url + '?comment=Update+version', data=new_product) service = {'cmd': 'runservice'}