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

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

Issue 29358368: Issue 4540 - Add Platform Specific Branch Support to createNightlies.py (Closed)
Patch Set: Created Oct. 20, 2016, 7:51 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 | « no previous file | 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 # 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
68 self.revision = self.getCurrentRevision() 74 self.revision = self.getCurrentRevision()
69 try: 75 try:
70 self.previousRevision = config.latestRevision 76 self.previousRevision = config.latestRevision
71 except: 77 except:
72 self.previousRevision = '0' 78 self.previousRevision = '0'
73 self.buildNum = None 79 self.buildNum = None
74 self.tempdir = None 80 self.tempdir = None
75 self.outputFilename = None 81 self.outputFilename = None
76 self.changelogFilename = None 82 self.changelogFilename = None
77 83
78 def hasChanges(self): 84 def hasChanges(self):
79 return self.revision != self.previousRevision 85 return self.revision != self.previousRevision
80 86
81 def getCurrentRevision(self): 87 def getCurrentRevision(self):
82 """ 88 """
83 retrieves the current revision ID from the repository 89 retrieves the current revision ID from the repository
84 """ 90 """
85 command = [ 91 command = [
86 'hg', 'id', '-i', '-r', 'default', '--config', 'defaults.id=', 92 'hg', 'id', '-i', '-r', 'default', '-b', self.branch, '--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
87 self.config.repository 93 'defaults.id=', self.config.repository
88 ] 94 ]
89 return subprocess.check_output(command).strip() 95 return subprocess.check_output(command).strip()
90 96
91 def getCurrentBuild(self): 97 def getCurrentBuild(self):
92 """ 98 """
93 calculates the (typically numerical) build ID for the current build 99 calculates the (typically numerical) build ID for the current build
94 """ 100 """
95 command = ['hg', 'id', '-n', '--config', 'defaults.id=', self.tempdir] 101 command = [
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]
96 build = subprocess.check_output(command).strip() 104 build = subprocess.check_output(command).strip()
97 if self.config.type == 'gecko': 105 if self.config.type == 'gecko':
98 build += '-beta' 106 build += '-beta'
99 return build 107 return build
100 108
101 def getChanges(self): 109 def getChanges(self):
102 """ 110 """
103 retrieve changes between the current and previous ("first") revision 111 retrieve changes between the current and previous ("first") revision
104 """ 112 """
105 113
106 command = ['hg', 'log', '-R', self.tempdir, '-r', 'tip:0', 114 command = ['hg', 'log', '-R', self.tempdir, '-r', 'tip:0',
107 '-b', 'default', '-l', '50', '--encoding', 'utf-8', 115 '-b', self.branch, '-l', '50', '--encoding', 'utf-8',
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
108 '--template', '{date|isodate}\\0{author|person}\\0{rev}\\0{de sc}\\0\\0', 116 '--template', '{date|isodate}\\0{author|person}\\0{rev}\\0{de sc}\\0\\0',
109 '--config', 'defaults.log='] 117 '--config', 'defaults.log=']
110 result = subprocess.check_output(command).decode('utf-8') 118 result = subprocess.check_output(command).decode('utf-8')
111 119
112 for change in result.split('\x00\x00'): 120 for change in result.split('\x00\x00'):
113 if change: 121 if change:
114 date, author, revision, description = change.split('\x00') 122 date, author, revision, description = change.split('\x00')
115 yield {'date': date, 'author': author, 'revision': revision, 'de scription': description} 123 yield {'date': date, 'author': author, 'revision': revision, 'de scription': description}
116 124
117 def copyRepository(self): 125 def copyRepository(self):
118 """ 126 """
119 Create a repository copy in a temporary directory 127 Create a repository copy in a temporary directory
120 """ 128 """
121 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName) 129 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName)
122 command = ['hg', 'clone', '-q', self.config.repository, '-u', 'default', self.tempdir] 130 command = ['hg', 'clone', '-q', self.config.repository, '-b',
kzar 2016/10/21 08:17:19 I don't think change is required at all.
131 self.branch, '-u', 'default', self.tempdir]
123 subprocess.check_call(command) 132 subprocess.check_call(command)
124 133
125 # Make sure to run ensure_dependencies.py if present 134 # Make sure to run ensure_dependencies.py if present
126 depscript = os.path.join(self.tempdir, 'ensure_dependencies.py') 135 depscript = os.path.join(self.tempdir, 'ensure_dependencies.py')
127 if os.path.isfile(depscript): 136 if os.path.isfile(depscript):
128 subprocess.check_call([sys.executable, depscript, '-q']) 137 subprocess.check_call([sys.executable, depscript, '-q'])
129 138
130 def writeChangelog(self, changes): 139 def writeChangelog(self, changes):
131 """ 140 """
132 write the changelog file into the cloned repository 141 write the changelog file into the cloned repository
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 except Exception as ex: 590 except Exception as ex:
582 logging.error('The build for %s failed:', repo) 591 logging.error('The build for %s failed:', repo)
583 logging.exception(ex) 592 logging.exception(ex)
584 593
585 file = open(nightlyConfigFile, 'wb') 594 file = open(nightlyConfigFile, 'wb')
586 nightlyConfig.write(file) 595 nightlyConfig.write(file)
587 596
588 597
589 if __name__ == '__main__': 598 if __name__ == '__main__':
590 main() 599 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld