def preloadBuildsData(cls, builds):
     # Circular imports.
     from lp.code.model.sourcepackagerecipe import SourcePackageRecipe
     from lp.services.librarian.model import LibraryFileAlias
     load_related(LibraryFileAlias, builds, ['log_id'])
     archives = load_related(Archive, builds, ['archive_id'])
     load_related(Person, archives, ['ownerID'])
     sprs = load_related(SourcePackageRecipe, builds, ['recipe_id'])
     SourcePackageRecipe.preLoadDataForSourcePackageRecipes(sprs)
Пример #2
0
 def preloadBuildsData(cls, builds):
     # Circular imports.
     from lp.code.model.sourcepackagerecipe import SourcePackageRecipe
     from lp.services.librarian.model import LibraryFileAlias
     load_related(LibraryFileAlias, builds, ['log_id'])
     archives = load_related(Archive, builds, ['archive_id'])
     load_related(Person, archives, ['ownerID'])
     sprs = load_related(SourcePackageRecipe, builds, ['recipe_id'])
     SourcePackageRecipe.preLoadDataForSourcePackageRecipes(sprs)
 def makeDailyBuilds(logger=None):
     from lp.code.model.sourcepackagerecipe import SourcePackageRecipe
     recipes = SourcePackageRecipe.findStaleDailyBuilds()
     if logger is None:
         logger = logging.getLogger()
     builds = []
     for recipe in recipes:
         recipe.is_stale = False
         logger.debug(
             'Recipe %s/%s is stale', recipe.owner.name, recipe.name)
         if recipe.daily_build_archive is None:
             logger.debug(' - No daily build archive specified.')
             continue
         for distroseries in recipe.distroseries:
             series_name = distroseries.named_version
             try:
                 build = recipe.requestBuild(
                     recipe.daily_build_archive, recipe.owner,
                     distroseries, PackagePublishingPocket.RELEASE)
             except BuildAlreadyPending:
                 logger.debug(
                     ' - build already pending for %s', series_name)
                 continue
             except CannotUploadToArchive as e:
                 # This will catch all PPA related issues -
                 # disabled, security, wrong pocket etc
                 logger.debug(
                     ' - daily build failed for %s: %s',
                     series_name, repr(e))
             except BuildNotAllowedForDistro:
                 logger.debug(
                     ' - cannot build against %s.' % series_name)
             except ProgrammingError:
                 raise
             except:
                 logger.exception(' - problem with %s', series_name)
             else:
                 logger.debug(' - build requested for %s', series_name)
                 builds.append(build)
     return builds
 def makeDailyBuilds(logger=None):
     from lp.code.model.sourcepackagerecipe import SourcePackageRecipe
     recipes = SourcePackageRecipe.findStaleDailyBuilds()
     if logger is None:
         logger = logging.getLogger()
     builds = []
     for recipe in recipes:
         recipe.is_stale = False
         logger.debug('Recipe %s/%s is stale', recipe.owner.name,
                      recipe.name)
         if recipe.daily_build_archive is None:
             logger.debug(' - No daily build archive specified.')
             continue
         for distroseries in recipe.distroseries:
             series_name = distroseries.named_version
             try:
                 build = recipe.requestBuild(
                     recipe.daily_build_archive, recipe.owner, distroseries,
                     PackagePublishingPocket.RELEASE)
             except BuildAlreadyPending:
                 logger.debug(' - build already pending for %s',
                              series_name)
                 continue
             except CannotUploadToArchive as e:
                 # This will catch all PPA related issues -
                 # disabled, security, wrong pocket etc
                 logger.debug(' - daily build failed for %s: %s',
                              series_name, repr(e))
             except BuildNotAllowedForDistro:
                 logger.debug(' - cannot build against %s.' % series_name)
             except ProgrammingError:
                 raise
             except:
                 logger.exception(' - problem with %s', series_name)
             else:
                 logger.debug(' - build requested for %s', series_name)
                 builds.append(build)
     return builds