Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: sitescripts/extensions/bin/createNightlies.py

Issue 29358368: Issue 4540 - Add Platform Specific Branch Support to createNightlies.py (Closed)
Left Patch Set: Created Oct. 20, 2016, 7:51 a.m.
Right Patch Set: Created Oct. 26, 2016, 5:53 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « .sitescripts.example ('k') | sitescripts/extensions/test/conftest.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-2016 Eyeo GmbH 2 # Copyright (C) 2006-2016 Eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 Performs the build process for an extension, 58 Performs the build process for an extension,
59 generating changelogs and documentation. 59 generating changelogs and documentation.
60 """ 60 """
61 61
62 def __init__(self, config): 62 def __init__(self, config):
63 """ 63 """
64 Creates a NightlyBuild instance; we are simply 64 Creates a NightlyBuild instance; we are simply
65 recording the configuration settings here. 65 recording the configuration settings here.
66 """ 66 """
67 self.config = config 67 self.config = config
68 try:
69 self.branch = self.config.get('extensions', 'abp_{}_branch'.format(
Vasily Kuznetsov 2016/10/20 16:54:39 As we discussed, `xxx_branch` seems nicer than `ab
kzar 2016/10/21 08:17:19 u1. I think bookmark is a better word to use than
70 self.config.type))
Jon Sonesen 2016/10/20 07:55:54 Not sure exactly how you want to implement the con
71 except ConfigParser.NoOptionError:
72 self.branch = 'master'
73
74 self.revision = self.getCurrentRevision() 68 self.revision = self.getCurrentRevision()
75 try: 69 try:
76 self.previousRevision = config.latestRevision 70 self.previousRevision = config.latestRevision
77 except: 71 except:
78 self.previousRevision = '0' 72 self.previousRevision = '0'
79 self.buildNum = None 73 self.buildNum = None
80 self.tempdir = None 74 self.tempdir = None
81 self.outputFilename = None 75 self.outputFilename = None
82 self.changelogFilename = None 76 self.changelogFilename = None
83 77
84 def hasChanges(self): 78 def hasChanges(self):
85 return self.revision != self.previousRevision 79 return self.revision != self.previousRevision
86 80
87 def getCurrentRevision(self): 81 def getCurrentRevision(self):
88 """ 82 """
89 retrieves the current revision ID from the repository 83 retrieves the current revision ID from the repository
90 """ 84 """
91 command = [ 85 command = [
92 'hg', 'id', '-i', '-r', 'default', '-b', self.branch, '--config', 86 'hg', 'id', '-i', '-r', self.config.revision, '--config',
Vasily Kuznetsov 2016/10/20 16:54:39 If I understand correctly it should be '-r', self.
Sebastian Noack 2016/10/20 17:36:16 As far as I understand, if we want to use bookmark
kzar 2016/10/21 08:17:19 I think that's correct, from the issue description
93 'defaults.id=', self.config.repository 87 'defaults.id=', self.config.repository
94 ] 88 ]
95 return subprocess.check_output(command).strip() 89 return subprocess.check_output(command).strip()
96 90
97 def getCurrentBuild(self): 91 def getCurrentBuild(self):
98 """ 92 """
99 calculates the (typically numerical) build ID for the current build 93 calculates the (typically numerical) build ID for the current build
100 """ 94 """
101 command = [ 95 command = ['hg', 'id', '-n', '--config', 'defaults.id=', self.tempdir]
102 'hg', 'id', '-b', self.branch, '-n', '--config', 'defaults.id=',
kzar 2016/10/21 08:17:19 Again this should be `'-r', self.bookmark`, but ac
103 self.tempdir]
104 build = subprocess.check_output(command).strip() 96 build = subprocess.check_output(command).strip()
105 if self.config.type == 'gecko': 97 if self.config.type == 'gecko':
106 build += '-beta' 98 build += '-beta'
107 return build 99 return build
108 100
109 def getChanges(self): 101 def getChanges(self):
110 """ 102 """
111 retrieve changes between the current and previous ("first") revision 103 retrieve changes between the current and previous ("first") revision
112 """ 104 """
113 105
114 command = ['hg', 'log', '-R', self.tempdir, '-r', 'tip:0', 106 command = [
115 '-b', self.branch, '-l', '50', '--encoding', 'utf-8', 107 'hg', 'log', '-R', self.tempdir, '-r',
kzar 2016/10/21 08:17:19 I'm not 100% sure but I think this command is retu
kzar 2016/10/21 08:22:57 Actually I think the second part of my comment was
kzar 2016/10/25 08:13:00 Please could you add the `'-b', 'default'` back ag
116 '--template', '{date|isodate}\\0{author|person}\\0{rev}\\0{de sc}\\0\\0', 108 'ancestors({})'.format(self.config.revision), '-l', '50',
117 '--config', 'defaults.log='] 109 '--encoding', 'utf-8', '--template',
110 '{date|isodate}\\0{author|person}\\0{rev}\\0{desc}\\0\\0',
111 '--config', 'defaults.log='
112 ]
118 result = subprocess.check_output(command).decode('utf-8') 113 result = subprocess.check_output(command).decode('utf-8')
119 114
120 for change in result.split('\x00\x00'): 115 for change in result.split('\x00\x00'):
121 if change: 116 if change:
122 date, author, revision, description = change.split('\x00') 117 date, author, revision, description = change.split('\x00')
123 yield {'date': date, 'author': author, 'revision': revision, 'de scription': description} 118 yield {'date': date, 'author': author, 'revision': revision, 'de scription': description}
124 119
125 def copyRepository(self): 120 def copyRepository(self):
126 """ 121 """
127 Create a repository copy in a temporary directory 122 Create a repository copy in a temporary directory
128 """ 123 """
129 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName) 124 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName)
130 command = ['hg', 'clone', '-q', self.config.repository, '-b', 125 command = ['hg', 'clone', '-q', self.config.repository, '-u',
kzar 2016/10/21 08:17:19 I don't think change is required at all.
131 self.branch, '-u', 'default', self.tempdir] 126 self.config.revision, self.tempdir]
132 subprocess.check_call(command) 127 subprocess.check_call(command)
133 128
134 # Make sure to run ensure_dependencies.py if present 129 # Make sure to run ensure_dependencies.py if present
135 depscript = os.path.join(self.tempdir, 'ensure_dependencies.py') 130 depscript = os.path.join(self.tempdir, 'ensure_dependencies.py')
136 if os.path.isfile(depscript): 131 if os.path.isfile(depscript):
137 subprocess.check_call([sys.executable, depscript, '-q']) 132 subprocess.check_call([sys.executable, depscript, '-q'])
138 133
139 def writeChangelog(self, changes): 134 def writeChangelog(self, changes):
140 """ 135 """
141 write the changelog file into the cloned repository 136 write the changelog file into the cloned repository
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 except Exception as ex: 585 except Exception as ex:
591 logging.error('The build for %s failed:', repo) 586 logging.error('The build for %s failed:', repo)
592 logging.exception(ex) 587 logging.exception(ex)
593 588
594 file = open(nightlyConfigFile, 'wb') 589 file = open(nightlyConfigFile, 'wb')
595 nightlyConfig.write(file) 590 nightlyConfig.write(file)
596 591
597 592
598 if __name__ == '__main__': 593 if __name__ == '__main__':
599 main() 594 main()
LEFTRIGHT

Powered by Google App Engine
This is Rietveld