Merge lp:~fabien-morin/unifield-wm/fm-us-908 into lp:unifield-wm

Proposed by jftempo
Status: Merged
Merged at revision: 2765
Proposed branch: lp:~fabien-morin/unifield-wm/fm-us-908
Merge into: lp:unifield-wm
Diff against target: 56 lines (+35/-0)
2 files modified
msf_profile/data/patches.xml (+4/-0)
msf_profile/msf_profile.py (+31/-0)
To merge this branch: bzr merge lp:~fabien-morin/unifield-wm/fm-us-908
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+285438@code.launchpad.net
To post a comment you must log in.
2758. By Fabien MORIN

US-908 [FIX] the next unifield version tag is UF2.1-0

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'msf_profile/data/patches.xml'
2--- msf_profile/data/patches.xml 2016-02-03 14:24:11 +0000
3+++ msf_profile/data/patches.xml 2016-02-09 13:11:02 +0000
4@@ -36,6 +36,10 @@
5 <field name="method">us_822_patch</field>
6 </record>
7
8+ <record id="us_908_patch" model="patch.scripts">
9+ <field name="method">us_908_patch</field>
10+ </record>
11+
12 <record id="bar_action_patch" model="patch.scripts">
13 <field name="method">bar_action_patch</field>
14 </record>
15
16=== modified file 'msf_profile/msf_profile.py'
17--- msf_profile/msf_profile.py 2016-02-05 10:13:58 +0000
18+++ msf_profile/msf_profile.py 2016-02-09 13:11:02 +0000
19@@ -242,6 +242,37 @@
20
21 return True
22
23+ def us_908_patch(self, cr, uid, *a, **b):
24+ # add the version to unifield-version.txt as the code which
25+ # automatically add this version name is contained in the patch itself.
26+ from updater import re_version, md5hex_size
27+ import re
28+ from tools import config
29+ file_path = os.path.join(config['root_path'], 'unifield-version.txt')
30+ # get the last known patch line
31+ # 16679c0321623dd7e13fdd5fad6f677c 2015-12-22 14:30:00 UF2.0-0p1
32+ with open(file_path, 'r') as f:
33+ lines = f.readlines()
34+ #if last_version don't have any name
35+ # and the previous is UF2.0-0p1
36+ last_line = lines[-1]
37+ last_line = last_line.rstrip()
38+ if not last_line: # the last is an empty line, no new patch was installed
39+ return True
40+ result = re_version.findall(last_line)
41+ md5sum, date, version_name = result[0]
42+ if not version_name:
43+ # check that the previous patch was UF2.1
44+ previous_line = lines[-2].rstrip() or lines[-3].rstrip() # may be
45+ # there is a blank line between
46+ previous_line_res = re_version.findall(previous_line)
47+ p_md5sum, p_date, p_version_name = previous_line_res[0]
48+ if p_md5sum == '16679c0321623dd7e13fdd5fad6f677c':
49+ last_line = '%s %s %s' % (md5sum, date, 'UF2.1-0') + os.linesep
50+ lines[-1] = last_line
51+ with open(file_path, 'w') as file:
52+ file.writelines(lines)
53+
54 def disable_crondoall(self, cr, uid, *a, **b):
55 cron_obj = self.pool.get('ir.cron')
56 cron_ids = cron_obj.search(cr, uid, [('doall', '=', True), ('active', 'in', ['t', 'f'])])

Subscribers

People subscribed via source and target branches