def new(registrant,
         owner,
         name,
         recipe,
         description,
         distroseries=None,
         daily_build_archive=None,
         build_daily=False,
         date_created=DEFAULT):
     """See `ISourcePackageRecipeSource.new`."""
     store = IMasterStore(SourcePackageRecipe)
     sprecipe = SourcePackageRecipe()
     builder_recipe = SourcePackageRecipeData.getParsedRecipe(recipe)
     SourcePackageRecipeData(builder_recipe, sprecipe)
     sprecipe.registrant = registrant
     sprecipe.owner = owner
     sprecipe.name = name
     if distroseries is not None:
         for distroseries_item in distroseries:
             sprecipe.distroseries.add(distroseries_item)
     sprecipe.description = description
     sprecipe.daily_build_archive = daily_build_archive
     sprecipe.build_daily = build_daily
     sprecipe.date_created = date_created
     sprecipe.date_last_modified = date_created
     store.add(sprecipe)
     return sprecipe
 def setManifestText(self, text):
     if text is None:
         if self.manifest is not None:
             IStore(self.manifest).remove(self.manifest)
     elif self.manifest is None:
         SourcePackageRecipeData.createManifestFromText(text, self)
     else:
         from bzrlib.plugins.builder.recipe import RecipeParser
         self.manifest.setRecipe(RecipeParser(text).parse())
Ejemplo n.º 3
0
 def setManifestText(self, text):
     if text is None:
         if self.manifest is not None:
             IStore(self.manifest).remove(self.manifest)
     elif self.manifest is None:
         SourcePackageRecipeData.createManifestFromText(text, self)
     else:
         from bzrlib.plugins.builder.recipe import RecipeParser
         self.manifest.setRecipe(RecipeParser(text).parse())
 def preLoadDataForSourcePackageRecipes(sourcepackagerecipes):
     # Load the referencing SourcePackageRecipeData.
     spr_datas = load_referencing(SourcePackageRecipeData,
                                  sourcepackagerecipes,
                                  ['sourcepackage_recipe_id'])
     # Load the related branches.
     load_related(Branch, spr_datas, ['base_branch_id'])
     # Store the SourcePackageRecipeData in the sourcepackagerecipes
     # objects.
     for spr_data in spr_datas:
         cache = get_property_cache(spr_data.sourcepackage_recipe)
         cache._recipe_data = spr_data
     SourcePackageRecipeData.preLoadReferencedBranches(spr_datas)
 def preLoadDataForSourcePackageRecipes(sourcepackagerecipes):
     # Load the referencing SourcePackageRecipeData.
     spr_datas = load_referencing(
         SourcePackageRecipeData,
         sourcepackagerecipes, ['sourcepackage_recipe_id'])
     # Load the related branches.
     load_related(Branch, spr_datas, ['base_branch_id'])
     # Store the SourcePackageRecipeData in the sourcepackagerecipes
     # objects.
     for spr_data in spr_datas:
         cache = get_property_cache(spr_data.sourcepackage_recipe)
         cache._recipe_data = spr_data
     SourcePackageRecipeData.preLoadReferencedBranches(spr_datas)
Ejemplo n.º 6
0
 def preLoadDataForSourcePackageRecipes(sourcepackagerecipes):
     # Load the referencing SourcePackageRecipeData.
     spr_datas = load_referencing(
         SourcePackageRecipeData,
         sourcepackagerecipes, ['sourcepackage_recipe_id'])
     # Store the SourcePackageRecipeData in the sourcepackagerecipes
     # objects.
     for spr_data in spr_datas:
         cache = get_property_cache(spr_data.sourcepackage_recipe)
         cache._recipe_data = spr_data
     SourcePackageRecipeData.preLoadReferencedBranches(spr_datas)
     owner_ids = set(map(attrgetter('owner_id'), sourcepackagerecipes))
     list(getUtility(IPersonSet).getPrecachedPersonsFromIDs(
         owner_ids, need_validity=True))
Ejemplo n.º 7
0
 def recipes(self):
     """See `IHasRecipes`."""
     from lp.code.model.sourcepackagerecipe import SourcePackageRecipe
     from lp.code.model.sourcepackagerecipedata import (
         SourcePackageRecipeData,
         )
     revspecs = set([self.path, self.name])
     if self.path == self.repository.default_branch:
         revspecs.add(None)
     recipes = SourcePackageRecipeData.findRecipes(
         self.repository, revspecs=list(revspecs))
     hook = SourcePackageRecipe.preLoadDataForSourcePackageRecipes
     return DecoratedResultSet(recipes, pre_iter_hook=hook)
 def new(registrant, owner, name, recipe, description,
         distroseries=None, daily_build_archive=None, build_daily=False,
         date_created=DEFAULT):
     """See `ISourcePackageRecipeSource.new`."""
     store = IMasterStore(SourcePackageRecipe)
     sprecipe = SourcePackageRecipe()
     builder_recipe = SourcePackageRecipeData.getParsedRecipe(recipe)
     SourcePackageRecipeData(builder_recipe, sprecipe)
     sprecipe.registrant = registrant
     sprecipe.owner = owner
     sprecipe.name = name
     if distroseries is not None:
         for distroseries_item in distroseries:
             sprecipe.distroseries.add(distroseries_item)
     sprecipe.description = description
     sprecipe.daily_build_archive = daily_build_archive
     sprecipe.build_daily = build_daily
     sprecipe.date_created = date_created
     sprecipe.date_last_modified = date_created
     store.add(sprecipe)
     return sprecipe
 def setRecipeText(self, recipe_text):
     parsed = SourcePackageRecipeData.getParsedRecipe(recipe_text)
     self._recipe_data.setRecipe(parsed)
 def setRecipeText(self, recipe_text):
     parsed = SourcePackageRecipeData.getParsedRecipe(recipe_text)
     self._recipe_data.setRecipe(parsed)