Home | History | Annotate | Download | only in build_tools

Lines Matching defs:Bundle

27 # Valid values for bundle.stability field
31 # Valid values for bundle-recommended field.
204 class Bundle(dict):
205 """A placeholder for sdk bundle information. We derive Bundle from
209 """ Create a new bundle with the given bundle name."""
215 def MergeWithBundle(self, bundle):
216 """Merge this bundle with |bundle|.
218 Merges dict in |bundle| with this one in such a way that keys are not
219 duplicated: the values of the keys in |bundle| take precedence in the
222 Archives in |bundle| will be appended to archives in self.
225 bundle: The other bundle. Must be a dict.
227 assert self is not bundle
229 for k, v in bundle.iteritems():
240 """Returns the JSON bundle object, pretty-printed"""
244 """Load a JSON bundle string. Raises an exception if json_string
248 json_string: a JSON-formatted string containing the bundle
253 """Update the content of the bundle by copying values from the given
257 source: The dictionary whose values must be copied to the bundle."""
270 """Validate the content of the bundle. Raise an Error if an invalid or
275 found in the bundle.
279 raise Error('Bundle has no name')
281 raise Error('Bundle "%s" is missing a revision number' % self[NAME_KEY])
283 raise Error('Bundle "%s" is missing a version number' % self[NAME_KEY])
285 raise Error('Bundle "%s" is missing a description' % self[NAME_KEY])
287 raise Error('Bundle "%s" is missing stability info' % self[NAME_KEY])
289 raise Error('Bundle "%s" is missing the recommended field' %
293 raise Error('Bundle "%s" has invalid stability field: "%s"' %
297 'Bundle "%s" has invalid recommended field: "%s"' %
303 raise Error('Bundle "%s" has invalid attribute "%s"' %
334 """Returns all the archives in this bundle"""
338 """Add an archive to this bundle."""
342 """Remove all archives from this Bundle."""
346 """Remove an archive from this Bundle."""
377 def __eq__(self, bundle):
384 bundle: The other bundle to compare against.
387 if not isinstance(bundle, Bundle):
389 if len(self.keys()) != len(bundle.keys()):
392 if key not in bundle:
397 if len(self[key]) != len(bundle[key]):
400 if archive != bundle.GetArchive(archive.host_os):
402 elif self[key] != bundle[key]:
406 def __ne__(self, bundle):
410 return not self.__eq__(bundle)
436 # Validate each bundle
437 for bundle in self._manifest_data[BUNDLES_KEY]:
438 bundle.Validate(add_missing_info)
441 """Get a bundle from the array of bundles.
444 name: the name of the bundle to return.
446 The first bundle with the given name, or None if it is not found."""
449 bundles = [bundle for bundle in self._manifest_data[BUNDLES_KEY]
450 if bundle[NAME_KEY] == name]
452 sys.stderr.write("WARNING: More than one bundle with name"
461 """Add or replace a bundle in the manifest.
463 Note: If a bundle in the manifest already exists with this name, it will be
464 overwritten with a copy of this bundle, at the same index as the original.
467 bundle: The bundle.
472 for i, bundle in enumerate(bundles):
473 if bundle[NAME_KEY] == name:
476 # Bundle not already in list, append it.
480 """Remove a bundle by name.
483 name: the name of the bundle to remove.
485 True if the bundle was removed, False if there is no bundle with that
491 for i, bundle in enumerate(bundles):
492 if bundle[NAME_KEY] == name:
497 def BundleNeedsUpdate(self, bundle):
498 """Decides if a bundle needs to be updated.
500 bundle needs to be updated if it is not installed (doesn't exist in this
504 bundle: The Bundle to test.
506 True if Bundle needs to be updated.
508 if NAME_KEY not in bundle:
509 raise KeyError("Bundle must have a 'name' key.")
510 local_bundle = self.GetBundle(bundle[NAME_KEY])
513 (bundle[VERSION_KEY], bundle[REVISION_KEY]))
515 def MergeBundle(self, bundle, allow_existing=True):
516 """Merge a Bundle into this manifest.
518 The new bundle is added if not present, or merged into the existing bundle.
521 bundle: The bundle to merge.
523 if NAME_KEY not in bundle:
524 raise KeyError("Bundle must have a 'name' key.")
525 local_bundle = self.GetBundle(bundle.name)
527 self.SetBundle(bundle)
530 raise Error('cannot merge manifest bundle \'%s\', it already exists'
531 % bundle.name)
532 local_bundle.MergeWithBundle(bundle)
540 for bundle in manifest.GetBundles():
541 self.MergeBundle(bundle, allow_existing=False)
546 For all bundles in this manifest, if predicate(bundle) is False, the bundle
550 predicate: a function that take a bundle and returns whether True to keep
566 # Remap each bundle in |value| to a Bundle instance
569 new_bundle = Bundle(b[NAME_KEY])