Ejemplo n.º 1
0
 def run(self, name, data):
     api = Release(auth=self.auth, api_root=self.api_root)
     current_data, data_version = api.get_data(name)
     data = recursive_update(current_data, data)
     api.update_release(name, data['appVersion'], name.split('-')[0],
                        data['hashFunction'], json.dumps(data), data_version,
                        schemaVersion=current_data['schema_version'])
Ejemplo n.º 2
0
 def run(self,
         appVersion,
         productName,
         version,
         buildNumber,
         updateChannels,
         stagingServer,
         bouncerServer,
         enUSPlatforms,
         hashFunction,
         schemaVersion,
         openURL=None,
         **updateKwargs):
     data = self.generate_data(appVersion, productName, version,
                               buildNumber, updateChannels, stagingServer,
                               bouncerServer, enUSPlatforms, schemaVersion,
                               openURL, **updateKwargs)
     name = get_release_blob_name(productName, version, buildNumber,
                                  self.dummy)
     api = Release(name=name, auth=self.auth, api_root=self.api_root)
     current_data, data_version = api.get_data()
     data = recursive_update(current_data, data)
     api.update_release(version=appVersion,
                        product=productName,
                        hashFunction=hashFunction,
                        releaseData=json.dumps(data),
                        data_version=data_version)
Ejemplo n.º 3
0
 def run(self, name, data):
     api = Release(name=name, auth=self.auth, api_root=self.api_root)
     current_data, data_version = api.get_data()
     data = recursive_update(current_data, data)
     api.update_release(product=name.split('-')[0],
                        hashFunction=data['hashFunction'],
                        releaseData=json.dumps(data),
                        data_version=data_version,
                        schemaVersion=current_data['schema_version'])
Ejemplo n.º 4
0
 def run(self, appVersion, productName, version, buildNumber,
         partialUpdates, updateChannels, stagingServer, bouncerServer,
         enUSPlatforms, hashFunction):
     api = Release(auth=self.auth, api_root=self.api_root)
     data = self.generate_data(appVersion, productName, version,
                               buildNumber, partialUpdates, updateChannels,
                               stagingServer, bouncerServer, enUSPlatforms)
     current_data, data_version = api.get_data(self.name)
     data = recursive_update(current_data, data)
     api = Release(auth=self.auth, api_root=self.api_root)
     api.update_release(name=self.name,
                        version=appVersion,
                        product=productName,
                        hashFunction=hashFunction,
                        releaseData=json.dumps(data),
                        data_version=data_version)
Ejemplo n.º 5
0
 def run(self, appVersion, productName, version, buildNumber,
         updateChannels, ftpServer, bouncerServer,
         enUSPlatforms, hashFunction, schemaVersion, openURL=None,
         **updateKwargs):
     data = self.generate_data(appVersion, productName, version,
                               buildNumber, updateChannels,
                               ftpServer, bouncerServer, enUSPlatforms,
                               schemaVersion, openURL, **updateKwargs)
     name = get_release_blob_name(productName, version, buildNumber,
                                  self.dummy)
     api = Release(name=name, auth=self.auth, api_root=self.api_root)
     current_data, data_version = api.get_data()
     data = recursive_update(current_data, data)
     api.update_release(version=appVersion,
                        product=productName,
                        hashFunction=hashFunction,
                        releaseData=json.dumps(data),
                        data_version=data_version)
Ejemplo n.º 6
0
class ReleaseCreatorBase(object):
    def __init__(self, api_root, auth, dummy=False):
        self.api_root = api_root
        self.auth = auth
        self.dummy = dummy

    def generate_data(self,
                      appVersion,
                      productName,
                      version,
                      buildNumber,
                      updateChannels,
                      ftpServer,
                      bouncerServer,
                      enUSPlatforms,
                      schemaVersion,
                      openURL=None,
                      **updateKwargs):
        assert schemaVersion in (
            3, 4), 'Unhandled schema version %s' % schemaVersion
        details_product = productName.lower()
        if details_product == "devedition":
            details_product = "firefox"

        data = {
            'detailsUrl': getProductDetails(details_product, appVersion),
            'platforms': {},
            'fileUrls': {},
            'appVersion': appVersion,
            'platformVersion': appVersion,
            'displayVersion': getPrettyVersion(version)
        }

        actions = []
        if openURL:
            actions.append("showURL")
            data["openURL"] = openURL

        if actions:
            data["actions"] = " ".join(actions)

        fileUrls = self._getFileUrls(productName, version, buildNumber,
                                     updateChannels, ftpServer, bouncerServer,
                                     **updateKwargs)
        if fileUrls:
            data.update(fileUrls)

        updateData = self._get_update_data(productName, version,
                                           **updateKwargs)
        if updateData:
            data.update(updateData)

        for platform in enUSPlatforms:
            updatePlatforms = buildbot2updatePlatforms(platform)
            bouncerPlatform = buildbot2bouncer(platform)
            ftpPlatform = buildbot2ftp(platform)
            data['platforms'][updatePlatforms[0]] = {
                'OS_BOUNCER': bouncerPlatform,
                'OS_FTP': ftpPlatform
            }
            for aliasedPlatform in updatePlatforms[1:]:
                data['platforms'][aliasedPlatform] = {
                    'alias': updatePlatforms[0]
                }

        return data

    def run(self,
            appVersion,
            productName,
            version,
            buildNumber,
            updateChannels,
            ftpServer,
            bouncerServer,
            enUSPlatforms,
            hashFunction,
            schemaVersion,
            openURL=None,
            **updateKwargs):
        data = self.generate_data(appVersion, productName, version,
                                  buildNumber, updateChannels, ftpServer,
                                  bouncerServer, enUSPlatforms, schemaVersion,
                                  openURL, **updateKwargs)
        name = get_release_blob_name(productName, version, buildNumber,
                                     self.dummy)
        api = Release(name=name, auth=self.auth, api_root=self.api_root)
        try:
            current_data, data_version = api.get_data()
        except HTTPError, e:
            if e.response.status_code == 404:
                log.warning("Release blob doesn't exist, using empty data...")
                current_data, data_version = {}, None
            else:
                raise

        data = recursive_update(current_data, data)
        api.update_release(product=productName,
                           hashFunction=hashFunction,
                           releaseData=json.dumps(data),
                           schemaVersion=schemaVersion,
                           data_version=data_version)
Ejemplo n.º 7
0
class ReleaseCreatorV9(ReleaseCreatorFileUrlsMixin):
    schemaVersion = 9

    def __init__(self,
                 api_root,
                 auth,
                 dummy=False,
                 suffix="",
                 from_suffix="",
                 complete_mar_filename_pattern=None,
                 complete_mar_bouncer_product_pattern=None):
        self.api_root = api_root
        self.auth = auth
        self.suffix = suffix
        self.from_suffix = from_suffix
        if dummy and not suffix:
            self.suffix = "-dummy"
        else:
            self.suffix = suffix
        self.complete_mar_filename_pattern = complete_mar_filename_pattern or '%s-%s.complete.mar'
        self.complete_mar_bouncer_product_pattern = complete_mar_bouncer_product_pattern or '%s-%s-complete'

    def generate_data(self, appVersion, productName, version, buildNumber,
                      updateChannels, ftpServer, bouncerServer, enUSPlatforms,
                      **updateKwargs):
        details_product = productName.lower()
        if details_product == "devedition":
            details_product = "firefox"

        data = {
            'platforms': {},
            'fileUrls': {},
            'appVersion':
            appVersion,
            'displayVersion':
            getPrettyVersion(version),
            'updateLine': [
                {
                    'for': {},
                    'fields': {
                        'detailsURL':
                        getProductDetails(details_product, appVersion),
                        'type':
                        'minor',
                    },
                },
            ]
        }

        actions = []

        fileUrls = self._getFileUrls(productName, version, buildNumber,
                                     updateChannels, ftpServer, bouncerServer,
                                     **updateKwargs)
        if fileUrls:
            data.update(fileUrls)

        for platform in enUSPlatforms:
            updatePlatforms = buildbot2updatePlatforms(platform)
            bouncerPlatform = buildbot2bouncer(platform)
            ftpPlatform = buildbot2ftp(platform)
            data['platforms'][updatePlatforms[0]] = {
                'OS_BOUNCER': bouncerPlatform,
                'OS_FTP': ftpPlatform
            }
            for aliasedPlatform in updatePlatforms[1:]:
                data['platforms'][aliasedPlatform] = {
                    'alias': updatePlatforms[0]
                }

        return data

    def run(self, appVersion, productName, version, buildNumber,
            updateChannels, ftpServer, bouncerServer, enUSPlatforms,
            hashFunction, **updateKwargs):
        data = self.generate_data(appVersion, productName, version,
                                  buildNumber, updateChannels, ftpServer,
                                  bouncerServer, enUSPlatforms, **updateKwargs)
        name = get_release_blob_name(productName, version, buildNumber,
                                     self.suffix)
        api = Release(name=name, auth=self.auth, api_root=self.api_root)
        try:
            current_data, data_version = api.get_data()
        except HTTPError, e:
            if e.response.status_code == 404:
                log.warning("Release blob doesn't exist, using empty data...")
                current_data, data_version = {}, None
            else:
                raise

        data = recursive_update(current_data, data)
        api.update_release(product=productName,
                           hashFunction=hashFunction,
                           releaseData=json.dumps(data),
                           schemaVersion=self.schemaVersion,
                           data_version=data_version)