 Issue 29589674:
  Issue 5942 - don't create Gecko update manifests  (Closed)
    
  
    Issue 29589674:
  Issue 5942 - don't create Gecko update manifests  (Closed) 
  | Left: | ||
| Right: | 
| 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-present eyeo GmbH | 2 # Copyright (C) 2006-present 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 read Gecko-specific metadata file from a cloned repository | 168 read Gecko-specific metadata file from a cloned repository | 
| 169 and parse id, version, basename and the compat section | 169 and parse id, version, basename and the compat section | 
| 170 out of the file | 170 out of the file | 
| 171 """ | 171 """ | 
| 172 import buildtools.packagerGecko as packager | 172 import buildtools.packagerGecko as packager | 
| 173 metadata = packager.readMetadata(self.tempdir, self.config.type) | 173 metadata = packager.readMetadata(self.tempdir, self.config.type) | 
| 174 self.extensionID = metadata.get('general', 'id') | 174 self.extensionID = metadata.get('general', 'id') | 
| 175 self.version = packager.getBuildVersion(self.tempdir, metadata, False, | 175 self.version = packager.getBuildVersion(self.tempdir, metadata, False, | 
| 176 self.buildNum) | 176 self.buildNum) | 
| 177 self.basename = metadata.get('general', 'basename') | 177 self.basename = metadata.get('general', 'basename') | 
| 178 self.compat = [] | |
| 179 for key, value in packager.KNOWN_APPS.iteritems(): | |
| 180 if metadata.has_option('compat', key): | |
| 181 minVersion, maxVersion = metadata.get('compat', key).split('/') | |
| 182 self.compat.append({'id': value, 'minVersion': minVersion, 'maxV ersion': maxVersion}) | |
| 183 | |
| 184 if metadata.has_option('compat', 'gecko'): | |
| 185 self.compat.append({ | |
| 186 'id': 'gecko', | |
| 187 'minVersion': metadata.get('compat', 'gecko') | |
| 188 }) | |
| 189 | 178 | 
| 190 def readAndroidMetadata(self): | 179 def readAndroidMetadata(self): | 
| 191 """ | 180 """ | 
| 192 Read Android-specific metadata from AndroidManifest.xml file. | 181 Read Android-specific metadata from AndroidManifest.xml file. | 
| 193 """ | 182 """ | 
| 194 manifestFile = open(os.path.join(self.tempdir, 'AndroidManifest.xml'), ' r') | 183 manifestFile = open(os.path.join(self.tempdir, 'AndroidManifest.xml'), ' r') | 
| 195 manifest = parseXml(manifestFile) | 184 manifest = parseXml(manifestFile) | 
| 196 manifestFile.close() | 185 manifestFile.close() | 
| 197 | 186 | 
| 198 root = manifest.documentElement | 187 root = manifest.documentElement | 
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 """ | 251 """ | 
| 263 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) | 252 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) | 
| 264 if self.config.type == 'safari': | 253 if self.config.type == 'safari': | 
| 265 manifestPath = os.path.join(baseDir, 'updates.plist') | 254 manifestPath = os.path.join(baseDir, 'updates.plist') | 
| 266 templateName = 'safariUpdateManifest' | 255 templateName = 'safariUpdateManifest' | 
| 267 autoescape = True | 256 autoescape = True | 
| 268 elif self.config.type == 'android': | 257 elif self.config.type == 'android': | 
| 269 manifestPath = os.path.join(baseDir, 'updates.xml') | 258 manifestPath = os.path.join(baseDir, 'updates.xml') | 
| 270 templateName = 'androidUpdateManifest' | 259 templateName = 'androidUpdateManifest' | 
| 271 autoescape = True | 260 autoescape = True | 
| 272 elif self.config.type == 'gecko-webext': | |
| 273 manifestPath = os.path.join(baseDir, 'updates.json') | |
| 274 templateName = 'geckoUpdateManifest' | |
| 275 autoescape = False | |
| 276 else: | 261 else: | 
| 277 return | 262 return | 
| 278 | 263 | 
| 279 if not os.path.exists(baseDir): | 264 if not os.path.exists(baseDir): | 
| 280 os.makedirs(baseDir) | 265 os.makedirs(baseDir) | 
| 281 | 266 | 
| 282 # ABP for Android used to have its own update manifest format. We need t o | 267 # ABP for Android used to have its own update manifest format. We need t o | 
| 283 # generate both that and the new one in the libadblockplus format as lon g | 268 # generate both that and the new one in the libadblockplus format as lon g | 
| 284 # as a significant amount of users is on an old version. | 269 # as a significant amount of users is on an old version. | 
| 285 if self.config.type == 'android': | 270 if self.config.type == 'android': | 
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 661 self.copyRepository() | 646 self.copyRepository() | 
| 662 self.buildNum = self.getCurrentBuild() | 647 self.buildNum = self.getCurrentBuild() | 
| 663 | 648 | 
| 664 # get meta data from the repository | 649 # get meta data from the repository | 
| 665 if self.config.type == 'android': | 650 if self.config.type == 'android': | 
| 666 self.readAndroidMetadata() | 651 self.readAndroidMetadata() | 
| 667 elif self.config.type == 'chrome': | 652 elif self.config.type == 'chrome': | 
| 668 self.readChromeMetadata() | 653 self.readChromeMetadata() | 
| 669 elif self.config.type == 'safari': | 654 elif self.config.type == 'safari': | 
| 670 self.readSafariMetadata() | 655 self.readSafariMetadata() | 
| 671 elif self.config.type in {'gecko', 'gecko-webext'}: | 656 elif self.config.type in {'gecko', 'gecko-webext'}: | 
| 
Vasily Kuznetsov
2017/10/27 18:47:05
Do we still support both?
 
tlucas
2017/10/27 19:14:48
No, but the removal of "gecko-webext" is handled i
 | |
| 672 self.readGeckoMetadata() | 657 self.readGeckoMetadata() | 
| 673 elif self.config.type == 'edge': | 658 elif self.config.type == 'edge': | 
| 674 self.read_edge_metadata() | 659 self.read_edge_metadata() | 
| 675 else: | 660 else: | 
| 676 raise Exception('Unknown build type {}' % self.config.type) | 661 raise Exception('Unknown build type {}' % self.config.type) | 
| 677 | 662 | 
| 678 # create development build | 663 # create development build | 
| 679 self.build() | 664 self.build() | 
| 680 | 665 | 
| 681 # write out changelog | 666 # write out changelog | 
| 682 self.writeChangelog(self.getChanges()) | 667 self.writeChangelog(self.getChanges()) | 
| 683 | 668 | 
| 684 # write update manifest | 669 # write update manifest | 
| 685 if self.config.type != 'gecko': | 670 self.writeUpdateManifest() | 
| 686 self.writeUpdateManifest() | |
| 687 | 671 | 
| 688 # retire old builds | 672 # retire old builds | 
| 689 versions = self.retireBuilds() | 673 versions = self.retireBuilds() | 
| 690 | 674 | 
| 691 if self.config.type == 'ie': | 675 if self.config.type == 'ie': | 
| 692 self.writeIEUpdateManifest(versions) | 676 self.writeIEUpdateManifest(versions) | 
| 693 | 677 | 
| 694 # update index page | 678 # update index page | 
| 695 self.updateIndex(versions) | 679 self.updateIndex(versions) | 
| 696 | 680 | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 733 except Exception as ex: | 717 except Exception as ex: | 
| 734 logging.error('The build for %s failed:', repo) | 718 logging.error('The build for %s failed:', repo) | 
| 735 logging.exception(ex) | 719 logging.exception(ex) | 
| 736 | 720 | 
| 737 file = open(nightlyConfigFile, 'wb') | 721 file = open(nightlyConfigFile, 'wb') | 
| 738 nightlyConfig.write(file) | 722 nightlyConfig.write(file) | 
| 739 | 723 | 
| 740 | 724 | 
| 741 if __name__ == '__main__': | 725 if __name__ == '__main__': | 
| 742 main() | 726 main() | 
| OLD | NEW |