OLD | NEW |
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 self.changelogFilename = None | 76 self.changelogFilename = None |
77 | 77 |
78 def hasChanges(self): | 78 def hasChanges(self): |
79 return self.revision != self.previousRevision | 79 return self.revision != self.previousRevision |
80 | 80 |
81 def getCurrentRevision(self): | 81 def getCurrentRevision(self): |
82 """ | 82 """ |
83 retrieves the current revision ID from the repository | 83 retrieves the current revision ID from the repository |
84 """ | 84 """ |
85 command = [ | 85 command = [ |
86 'hg', 'id', '-i', '-r', 'default', '--config', 'defaults.id=', | 86 'hg', 'id', '-i', '-r', self.config.revision, '--config', |
87 self.config.repository | 87 'defaults.id=', self.config.repository |
88 ] | 88 ] |
89 return subprocess.check_output(command).strip() | 89 return subprocess.check_output(command).strip() |
90 | 90 |
91 def getCurrentBuild(self): | 91 def getCurrentBuild(self): |
92 """ | 92 """ |
93 calculates the (typically numerical) build ID for the current build | 93 calculates the (typically numerical) build ID for the current build |
94 """ | 94 """ |
95 command = ['hg', 'id', '-n', '--config', 'defaults.id=', self.tempdir] | 95 command = ['hg', 'id', '-n', '--config', 'defaults.id=', self.tempdir] |
96 build = subprocess.check_output(command).strip() | 96 build = subprocess.check_output(command).strip() |
97 if self.config.type == 'gecko': | 97 if self.config.type == 'gecko': |
98 build += '-beta' | 98 build += '-beta' |
99 return build | 99 return build |
100 | 100 |
101 def getChanges(self): | 101 def getChanges(self): |
102 """ | 102 """ |
103 retrieve changes between the current and previous ("first") revision | 103 retrieve changes between the current and previous ("first") revision |
104 """ | 104 """ |
105 | 105 |
106 command = ['hg', 'log', '-R', self.tempdir, '-r', 'tip:0', | 106 command = [ |
107 '-b', 'default', '-l', '50', '--encoding', 'utf-8', | 107 'hg', 'log', '-R', self.tempdir, '-r', |
108 '--template', '{date|isodate}\\0{author|person}\\0{rev}\\0{de
sc}\\0\\0', | 108 'ancestors({})'.format(self.config.revision), '-l', '50', |
109 '--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 ] |
110 result = subprocess.check_output(command).decode('utf-8') | 113 result = subprocess.check_output(command).decode('utf-8') |
111 | 114 |
112 for change in result.split('\x00\x00'): | 115 for change in result.split('\x00\x00'): |
113 if change: | 116 if change: |
114 date, author, revision, description = change.split('\x00') | 117 date, author, revision, description = change.split('\x00') |
115 yield {'date': date, 'author': author, 'revision': revision, 'de
scription': description} | 118 yield {'date': date, 'author': author, 'revision': revision, 'de
scription': description} |
116 | 119 |
117 def copyRepository(self): | 120 def copyRepository(self): |
118 """ | 121 """ |
119 Create a repository copy in a temporary directory | 122 Create a repository copy in a temporary directory |
120 """ | 123 """ |
121 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName) | 124 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName) |
122 command = ['hg', 'clone', '-q', self.config.repository, '-u', 'default',
self.tempdir] | 125 command = ['hg', 'clone', '-q', self.config.repository, '-u', |
| 126 self.config.revision, self.tempdir] |
123 subprocess.check_call(command) | 127 subprocess.check_call(command) |
124 | 128 |
125 # Make sure to run ensure_dependencies.py if present | 129 # Make sure to run ensure_dependencies.py if present |
126 depscript = os.path.join(self.tempdir, 'ensure_dependencies.py') | 130 depscript = os.path.join(self.tempdir, 'ensure_dependencies.py') |
127 if os.path.isfile(depscript): | 131 if os.path.isfile(depscript): |
128 subprocess.check_call([sys.executable, depscript, '-q']) | 132 subprocess.check_call([sys.executable, depscript, '-q']) |
129 | 133 |
130 def writeChangelog(self, changes): | 134 def writeChangelog(self, changes): |
131 """ | 135 """ |
132 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 Loading... |
581 except Exception as ex: | 585 except Exception as ex: |
582 logging.error('The build for %s failed:', repo) | 586 logging.error('The build for %s failed:', repo) |
583 logging.exception(ex) | 587 logging.exception(ex) |
584 | 588 |
585 file = open(nightlyConfigFile, 'wb') | 589 file = open(nightlyConfigFile, 'wb') |
586 nightlyConfig.write(file) | 590 nightlyConfig.write(file) |
587 | 591 |
588 | 592 |
589 if __name__ == '__main__': | 593 if __name__ == '__main__': |
590 main() | 594 main() |
OLD | NEW |