| 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-2015 Eyeo GmbH | 4 # Copyright (C) 2006-2015 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, |
| 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 # GNU General Public License for more details. | 13 # GNU General Public License for more details. |
| 14 # | 14 # |
| 15 # You should have received a copy of the GNU General Public License | 15 # You should have received a copy of the GNU General Public License |
| 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 17 | 17 |
| 18 """ | 18 """ |
| 19 Generate update manifests | 19 Generate update manifests |
| 20 ========================= | 20 ========================= |
| 21 | 21 |
| 22 This script generates update manifests for all extensions and apps | 22 This script generates update manifests for all extensions and apps |
| 23 """ | 23 """ |
| 24 | 24 |
| 25 import os | 25 import os |
| 26 import re | 26 import re |
| 27 import subprocess | 27 import subprocess |
| 28 from ConfigParser import SafeConfigParser |
| 29 |
| 28 from buildtools.packagerGecko import KNOWN_APPS | 30 from buildtools.packagerGecko import KNOWN_APPS |
| 29 from ConfigParser import SafeConfigParser | 31 from buildtools.packagerSafari import (get_developer_identifier, |
| 32 get_certificates_and_key) |
| 33 |
| 30 from sitescripts.utils import get_config, get_template | 34 from sitescripts.utils import get_config, get_template |
| 31 from sitescripts.extensions.utils import ( | 35 from sitescripts.extensions.utils import ( |
| 32 Configuration, getDownloadLinks, getSafariCertificateID, | 36 Configuration, getDownloadLinks, |
| 33 writeIEUpdateManifest, writeAndroidUpdateManifest) | 37 writeIEUpdateManifest, writeAndroidUpdateManifest) |
| 34 from sitescripts.extensions.android import get_min_sdk_version | 38 from sitescripts.extensions.android import get_min_sdk_version |
| 35 | 39 |
| 36 def readMetadata(repo, version): | 40 def readMetadata(repo, version): |
| 37 """ | 41 """ |
| 38 reads extension ID and compatibility information from metadata file in the | 42 reads extension ID and compatibility information from metadata file in the |
| 39 extension's repository | 43 extension's repository |
| 40 """ | 44 """ |
| 41 if repo.type == 'android': | 45 if repo.type == 'android': |
| 42 command = ['hg', '-R', repo.repository, 'id', '-r', version, '-n'] | 46 command = ['hg', '-R', repo.repository, 'id', '-r', version, '-n'] |
| 43 result = subprocess.check_output(command) | 47 result = subprocess.check_output(command) |
| 44 revision = re.sub(r'\D', '', result) | 48 revision = re.sub(r'\D', '', result) |
| 45 | 49 |
| 46 return { | 50 return { |
| 47 'revision': revision, | 51 'revision': revision, |
| 48 'version': version, | 52 'version': version, |
| 49 'minSdkVersion': get_min_sdk_version(repo, version), | 53 'minSdkVersion': get_min_sdk_version(repo, version), |
| 50 'basename': os.path.basename(repo.repository) | 54 'basename': os.path.basename(repo.repository) |
| 51 } | 55 } |
| 52 elif repo.type == 'safari': | 56 elif repo.type == 'safari': |
| 53 metadata = repo.readMetadata(version) | 57 metadata = repo.readMetadata(version) |
| 58 certs = get_certificates_and_key(repo.keyFile)[0] |
| 59 |
| 54 return { | 60 return { |
| 55 'certificateID': getSafariCertificateID(repo.keyFile), | 61 'certificateID': get_developer_identifier(certs), |
| 56 'version': version, | 62 'version': version, |
| 57 'shortVersion': version, | 63 'shortVersion': version, |
| 58 'basename': metadata.get('general', 'basename'), | 64 'basename': metadata.get('general', 'basename'), |
| 59 } | 65 } |
| 60 elif repo.type == 'gecko': | 66 elif repo.type == 'gecko': |
| 61 metadata = repo.readMetadata(version) | 67 metadata = repo.readMetadata(version) |
| 62 result = { | 68 result = { |
| 63 'extensionID': metadata.get('general', 'id'), | 69 'extensionID': metadata.get('general', 'id'), |
| 64 'version': version, | 70 'version': version, |
| 65 'compat': [] | 71 'compat': [] |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 """ | 120 """ |
| 115 updates all update manifests with the current versions | 121 updates all update manifests with the current versions |
| 116 """ | 122 """ |
| 117 | 123 |
| 118 parser = SafeConfigParser() | 124 parser = SafeConfigParser() |
| 119 getDownloadLinks(parser) | 125 getDownloadLinks(parser) |
| 120 writeUpdateManifest(parser) | 126 writeUpdateManifest(parser) |
| 121 | 127 |
| 122 if __name__ == "__main__": | 128 if __name__ == "__main__": |
| 123 updateUpdateManifests() | 129 updateUpdateManifests() |
| OLD | NEW |