OLD | NEW |
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-2014 Eyeo GmbH | 4 # Copyright (C) 2006-2014 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 """ | 66 """ |
67 command = ['hg', 'log', '-R', self.config.repository, '-r', 'default', '--te
mplate', '{rev}'] | 67 command = ['hg', 'log', '-R', self.config.repository, '-r', 'default', '--te
mplate', '{rev}'] |
68 return subprocess.check_output(command) | 68 return subprocess.check_output(command) |
69 | 69 |
70 def getChanges(self): | 70 def getChanges(self): |
71 """ | 71 """ |
72 retrieve changes between the current and previous ("first") revision | 72 retrieve changes between the current and previous ("first") revision |
73 """ | 73 """ |
74 | 74 |
75 command = ['hg', 'log', '-R', self.config.repository, '-r', 'tip:0', | 75 command = ['hg', 'log', '-R', self.config.repository, '-r', 'tip:0', |
76 '-b', 'default', '-l', '50', | 76 '-b', 'default', '-l', '50', '--encoding', 'utf-8', |
77 '--template', '{date|isodate}\\0{author|person}\\0{rev}\\0{desc}\\0\\0'] | 77 '--template', '{date|isodate}\\0{author|person}\\0{rev}\\0{desc}\\0\\0'] |
78 result = subprocess.check_output(command) | 78 result = subprocess.check_output(command).decode('utf-8') |
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 | 89 # We cannot use hg archive here due to |
90 # http://bz.selenic.com/show_bug.cgi?id=3747, have to clone properly :-( | 90 # http://bz.selenic.com/show_bug.cgi?id=3747, have to clone properly :-( |
91 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName) | 91 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName) |
92 command = ['hg', 'clone', '-q', self.config.repository, '-u', 'default', sel
f.tempdir] | 92 command = ['hg', 'clone', '-q', self.config.repository, '-u', 'default', sel
f.tempdir] |
93 subprocess.check_call(command) | 93 subprocess.check_call(command) |
94 | 94 |
95 def writeChangelog(self, changes): | 95 def writeChangelog(self, changes): |
96 """ | 96 """ |
97 write the changelog file into the cloned repository | 97 write the changelog file into the cloned repository |
98 """ | 98 """ |
99 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) | 99 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) |
100 if not os.path.exists(baseDir): | 100 if not os.path.exists(baseDir): |
101 os.makedirs(baseDir) | 101 os.makedirs(baseDir) |
102 changelogFile = "%s-%s.changelog.xhtml" % (self.basename, self.version) | 102 changelogFile = "%s-%s.changelog.xhtml" % (self.basename, self.version) |
103 changelogPath = os.path.join(baseDir, changelogFile) | 103 changelogPath = os.path.join(baseDir, changelogFile) |
104 self.changelogURL = urlparse.urljoin(self.config.nightliesURL, self.basename
+ '/' + changelogFile) | 104 self.changelogURL = urlparse.urljoin(self.config.nightliesURL, self.basename
+ '/' + changelogFile) |
105 | 105 |
106 template = get_template(get_config().get('extensions', 'changelogTemplate')) | 106 template = get_template(get_config().get('extensions', 'changelogTemplate')) |
107 template.stream({'changes': changes}).dump(changelogPath) | 107 template.stream({'changes': changes}).dump(changelogPath, encoding='utf-8') |
108 | 108 |
109 linkPath = os.path.join(baseDir, '00latest.changelog.xhtml') | 109 linkPath = os.path.join(baseDir, '00latest.changelog.xhtml') |
110 if hasattr(os, 'symlink'): | 110 if hasattr(os, 'symlink'): |
111 if os.path.exists(linkPath): | 111 if os.path.exists(linkPath): |
112 os.remove(linkPath) | 112 os.remove(linkPath) |
113 os.symlink(os.path.basename(changelogPath), linkPath) | 113 os.symlink(os.path.basename(changelogPath), linkPath) |
114 else: | 114 else: |
115 shutil.copyfile(changelogPath, linkPath) | 115 shutil.copyfile(changelogPath, linkPath) |
116 | 116 |
117 def readGeckoMetadata(self): | 117 def readGeckoMetadata(self): |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 except Exception, ex: | 505 except Exception, ex: |
506 print >>sys.stderr, "The build for %s failed:" % repo | 506 print >>sys.stderr, "The build for %s failed:" % repo |
507 traceback.print_exc() | 507 traceback.print_exc() |
508 | 508 |
509 file = open(nightlyConfigFile, 'wb') | 509 file = open(nightlyConfigFile, 'wb') |
510 nightlyConfig.write(file) | 510 nightlyConfig.write(file) |
511 | 511 |
512 | 512 |
513 if __name__ == '__main__': | 513 if __name__ == '__main__': |
514 main() | 514 main() |
OLD | NEW |