def testSubstituteBouncerPlatform(self):
     with mock.patch.dict('release.platforms.ftp_bouncer_platform_map',
                          {'abc': 'xxx'}):
         self.assertEquals(
             substitutePath('/%bouncer-platform%/boo', platform='abc'),
             '/xxx/boo')
 def testSubstituteVersion(self):
     self.assertEquals(substitutePath('/abc/def/%version%', version='123'),
                       '/abc/def/123')
 def testNoSubstitutes(self):
     self.assertEquals(substitutePath('/foo/bar/blah', 'aaa', 'bbb'),
                       '/foo/bar/blah')
 def testSubstituteLocale(self):
     self.assertEquals(substitutePath('/foo/%locale%/blah', 'aaa', 'bbb'),
                       '/foo/bbb/blah')
 def testSubstituteVersion(self):
     self.assertEquals(substitutePath(
         '/abc/def/%version%', version='123'), '/abc/def/123')
 def testSubstituteBouncerPlatform(self):
     with mock.patch.dict('release.platforms.ftp_bouncer_platform_map', {'abc': 'xxx'}):
         self.assertEquals(substitutePath(
             '/%bouncer-platform%/boo', platform='abc'), '/xxx/boo')
 def testSubstituteLocale(self):
     self.assertEquals(substitutePath(
         '/foo/%locale%/blah', 'aaa', 'bbb'), '/foo/bbb/blah')
 def testNoSubstitutes(self):
     self.assertEquals(
         substitutePath('/foo/bar/blah', 'aaa', 'bbb'), '/foo/bar/blah')
예제 #9
0
                contents = requests.get(
                    checksumsUrl, config={'danger_mode': True}).content
                log.debug("Using newly downloaded checksums for %s %s" %
                          (platform, locale))
                # Cache the sums in-memory and on-disk.
                cacheChecksums(platform, locale, parseChecksumsFile(contents))
                with open(checksumsFile, 'w') as f:
                    f.write(contents)
        return checksums[platform][locale]

    for fromVersion, platform, locale, channels, updateTypes in pc.getUpdatePaths():
        fromRelease = pc['release'][fromVersion]
        buildid = pc['release'][version]['platforms'][platform]
        fromBuildid = fromRelease['platforms'][platform]
        fromAppVersion = fromRelease['extension-version']
        detailsUrl = substitutePath(
            pc['current-update']['details'], platform, locale, appVersion)
        optionalAttrs = pc.getOptionalAttrs(fromVersion, locale)
        checksumsUrl = substitutePath(
            pc['release'][version]['checksumsurl'], platform, locale)
        checksumsFile = path.join(options.checksumsDir, "%s-%s-%s-%s" %
                                  (appName, platform, locale, version))

        info = getChecksum(platform, locale, checksumsFile)
        # We may have multiple update types to generate a snippet for...
        for type_ in updateTypes:
            # And also multiple channels...
            for channel in channels:
                log.debug("Processing: %s %s %s %s %s" % (
                    fromVersion, platform, locale, channel, type_))
                url = pc.getUrl(fromVersion, platform, locale, type_, channel)
                filename = path.basename(