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

Side by Side Diff: sitescripts/extensions/bin/createNightlies.py

Issue 9044061: Nightly builds: prepared for the change in the Chrome build process (Closed)
Patch Set: Replaced hg archive by hg clone Created Jan. 2, 2013, 7:36 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « .hgsubstate ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2012 Eyeo GmbH 4 # Copyright (C) 2006-2012 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 for change in result.split('\0\0'): 80 for change in result.split('\0\0'):
81 if change: 81 if change:
82 date, author, revision, description = change.split('\0') 82 date, author, revision, description = change.split('\0')
83 yield {'date': date, 'author': author, 'revision': revision, 'descriptio n': description} 83 yield {'date': date, 'author': author, 'revision': revision, 'descriptio n': description}
84 84
85 def copyRepository(self): 85 def copyRepository(self):
86 ''' 86 '''
87 Create a repository copy in a temporary directory 87 Create a repository copy in a temporary directory
88 ''' 88 '''
89 # We cannot use hg archive here due to
90 # http://bz.selenic.com/show_bug.cgi?id=3747, have to clone properly :-(
89 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName) 91 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName)
90 command = ['hg', 'archive', '-R', self.config.repository, '-r', 'default', s elf.tempdir] 92 command = ['hg', 'clone', '-q', self.config.repository, '-u', 'default', sel f.tempdir]
Felix Dahlke 2013/01/02 07:47:33 Are you sure "-u default" is necessary? Don't thin
Wladimir Palant 2013/01/02 08:13:04 Yes, it is absolutely necessary - otherwise Mercur
91 subprocess.Popen(command).communicate() 93 subprocess.Popen(command).communicate()
92 94
93 def writeChangelog(self, changes): 95 def writeChangelog(self, changes):
94 """ 96 """
95 write the changelog file into the cloned repository 97 write the changelog file into the cloned repository
96 """ 98 """
97 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) 99 baseDir = os.path.join(self.config.nightliesDirectory, self.basename)
98 if not os.path.exists(baseDir): 100 if not os.path.exists(baseDir):
99 os.makedirs(baseDir) 101 os.makedirs(baseDir)
100 changelogFile = "%s-%s.changelog.xhtml" % (self.basename, self.version) 102 changelogFile = "%s-%s.changelog.xhtml" % (self.basename, self.version)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 while self.version.count('.') < 2: 144 while self.version.count('.') < 2:
143 self.version += '.0' 145 self.version += '.0'
144 self.version = '%s.%s' % (self.version, self.revision) 146 self.version = '%s.%s' % (self.version, self.revision)
145 147
146 usesSdk = manifest.getElementsByTagName('uses-sdk')[0] 148 usesSdk = manifest.getElementsByTagName('uses-sdk')[0]
147 self.minSdkVersion = usesSdk.attributes["android:minSdkVersion"].value 149 self.minSdkVersion = usesSdk.attributes["android:minSdkVersion"].value
148 self.basename = os.path.basename(self.config.repository) 150 self.basename = os.path.basename(self.config.repository)
149 151
150 def readChromeMetadata(self): 152 def readChromeMetadata(self):
151 """ 153 """
152 Read Chrome-specific metadata from manifest.json file. It will also 154 Read Chrome-specific metadata from metadata file. This will also
153 calculate extension ID from the private key. 155 calculate extension ID from the private key.
154 """ 156 """
155 157
156 # Calculate extension ID from public key 158 # Calculate extension ID from public key
157 # (see http://supercollider.dk/2010/01/calculating-chrome-extension-id-from- your-private-key-233) 159 # (see http://supercollider.dk/2010/01/calculating-chrome-extension-id-from- your-private-key-233)
158 import buildtools.packagerChrome as packager 160 import buildtools.packagerChrome as packager
Felix Dahlke 2013/01/02 07:47:33 Shouldn't this be "buildtools.packagerPorts" or so
Wladimir Palant 2013/01/02 08:13:04 No, not really. I doubt that we will ever have the
159 publicKey = packager.getPublicKey(self.config.keyFile) 161 publicKey = packager.getPublicKey(self.config.keyFile)
160 hash = hashlib.sha256() 162 hash = hashlib.sha256()
161 hash.update(publicKey) 163 hash.update(publicKey)
162 self.extensionID = hash.hexdigest()[0:32] 164 self.extensionID = hash.hexdigest()[0:32]
163 self.extensionID = ''.join(map(lambda c: chr(97 + int(c, 16)), self.extensio nID)) 165 self.extensionID = ''.join(map(lambda c: chr(97 + int(c, 16)), self.extensio nID))
164 166
165 # Now read manifest.json 167 # Now read metadata file
166 manifestFile = open(os.path.join(self.tempdir, 'manifest.json'), 'rb') 168 metadata = packager.readMetadata(self.tempdir)
167 manifest = json.load(manifestFile) 169 self.version = metadata.get("general", "version")
168 manifestFile.close()
169
170 self.version = manifest['version']
171 while self.version.count('.') < 2: 170 while self.version.count('.') < 2:
172 self.version += '.0' 171 self.version += '.0'
173 self.version = '%s.%s' % (self.version, self.revision) 172 self.version = '%s.%s' % (self.version, self.revision)
174 self.basename = os.path.basename(self.config.repository) 173 self.basename = metadata.get("general", "basename")
175 if self.config.experimental: 174 if self.config.experimental:
176 self.basename += '-experimental' 175 self.basename += '-experimental'
177 176
178 self.compat = [] 177 self.compat = []
179 if 'minimum_chrome_version' in manifest: 178 if metadata.has_section('compat') and metadata.has_option('compat', 'chrome' ):
180 self.compat.append({'id': 'chrome', 'minVersion': manifest['minimum_chrome _version']}) 179 self.compat.append({'id': 'chrome', 'minVersion': metadata.get('compat', ' chrome')})
181 180
182 def writeUpdateManifest(self): 181 def writeUpdateManifest(self):
183 """ 182 """
184 Writes update.rdf file for the current build 183 Writes update.rdf file for the current build
185 """ 184 """
186 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) 185 baseDir = os.path.join(self.config.nightliesDirectory, self.basename)
187 if not os.path.exists(baseDir): 186 if not os.path.exists(baseDir):
188 os.makedirs(baseDir) 187 os.makedirs(baseDir)
189 if self.config.type == 'chrome': 188 if self.config.type == 'chrome':
190 manifestPath = os.path.join(baseDir, "updates.xml") 189 manifestPath = os.path.join(baseDir, "updates.xml")
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 except Exception, ex: 389 except Exception, ex:
391 print >>sys.stderr, "The build for %s failed:" % repo 390 print >>sys.stderr, "The build for %s failed:" % repo
392 traceback.print_exc() 391 traceback.print_exc()
393 392
394 file = open(nightlyConfigFile, 'wb') 393 file = open(nightlyConfigFile, 'wb')
395 nightlyConfig.write(file) 394 nightlyConfig.write(file)
396 395
397 396
398 if __name__ == '__main__': 397 if __name__ == '__main__':
399 main() 398 main()
OLDNEW
« no previous file with comments | « .hgsubstate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld