accept_command: use the value of attribute to set ProductVersion if always_set_productversion_to option presents

This commit is contained in:
Max Lin 2021-02-16 21:31:33 +08:00
parent e68b5e0bce
commit 8bbf34352c
2 changed files with 8 additions and 1 deletions

View File

@ -10,6 +10,7 @@ from osc.core import change_request_state, show_package_meta, wipebinaries
from osc.core import http_GET, http_PUT, http_DELETE, http_POST
from osc.core import delete_package, search, meta_get_packagelist
from osc.core import Request
from osc import conf
from osc.util.helper import decode_it
from osclib.core import attribute_value_save
from osclib.core import attribute_value_load
@ -22,6 +23,7 @@ from datetime import date
class AcceptCommand(object):
def __init__(self, api):
self.api = api
self.config = conf.config[self.api.project]
def find_new_requests(self, project):
match = f"state/@name='new' and action/target/@project='{project}'"
@ -239,6 +241,10 @@ class AcceptCommand(object):
# missleading.
project = self.api.project
pred_productversion = self.config.get('always_set_productversion_to', '')
if pred_productversion:
curr_version = pred_productversion
else:
curr_version = date.today().strftime('%Y%m%d')
self.update_version_attribute(project, curr_version)

View File

@ -46,6 +46,7 @@ DEFAULT = {
'mail-maintainer': 'Dominique Leuenberger <dimstar@suse.de>',
'mail-noreply': 'noreply@opensuse.org',
'mail-release-list': 'opensuse-releaseteam@opensuse.org',
'always_set_productversion_to': '',
},
r'openSUSE:(?P<project>Factory):ARM$': {
'product': 'openSUSE.product',