Exemplo n.º 1
0
 def get_redirect_url(self, maintplan_name):
     maintplan = get_object_or_404(MaintenancePlan, name=maintplan_name)
     release = Release.get_current(maintplan)
     if not release:
         raise Exception('No releases defined for maintenance plan %s' %
                         maintplan.name)
     milestone = Milestone.get_current(release)
     if not milestone:
         raise Exception('No milestones defined for release %s' %
                         release.name)
     return reverse('rrs_recipes',
                    args=(maintplan.name, release.name, milestone.name))
Exemplo n.º 2
0
 def get_redirect_url(self):
     maintplan = MaintenancePlan.objects.first()
     if not maintplan:
         raise Exception('No maintenance plans defined')
     release = Release.get_current(maintplan)
     if not release:
         raise Exception('No releases defined for maintenance plan %s' %
                         maintplan.name)
     milestone = Milestone.get_current(release)
     if not milestone:
         raise Exception('No milestones defined for release %s' %
                         release.name)
     return reverse('rrs_recipes',
                    args=(maintplan.name, release.name, milestone.name))
Exemplo n.º 3
0
    def get_context_data(self, **kwargs):
        context = super(RecipeDetailView, self).get_context_data(**kwargs)
        recipe = self.get_object()
        if not recipe:
            raise django.http.Http404

        maintplan = get_object_or_404(MaintenancePlan,
                                      name=self.maintplan_name)
        context['maintplan_name'] = maintplan.name
        context['maintplan'] = maintplan
        release = Release.get_current(maintplan)
        context['release_name'] = release.name
        milestone = Milestone.get_current(release)
        context['milestone_name'] = milestone.name

        context['upstream_status'] = ''
        context['upstream_version'] = ''
        context['upstream_no_update_reason'] = ''
        recipe_upstream_history = RecipeUpstreamHistory.get_last_by_date_range(
            recipe.layerbranch, milestone.start_date, milestone.end_date)
        if recipe_upstream_history:
            recipe_upstream = RecipeUpstream.get_by_recipe_and_history(
                recipe, recipe_upstream_history)
            if recipe_upstream:
                if recipe_upstream.status == 'N' and recipe_upstream.no_update_reason:
                    recipe_upstream.status = 'C'
                elif recipe_upstream.status == 'D':
                    recipe_upstream.status = 'U'
                context['upstream_status'] = \
                    RecipeUpstream.RECIPE_UPSTREAM_STATUS_CHOICES_DICT[recipe_upstream.status]
                context['upstream_version'] = recipe_upstream.version
                context[
                    'upstream_no_update_reason'] = recipe_upstream.no_update_reason

        self.recipe_maintainer_history = RecipeMaintainerHistory.get_last(
            recipe.layerbranch)
        recipe_maintainer = RecipeMaintainer.objects.filter(
            recipe=recipe, history=self.recipe_maintainer_history)
        if recipe_maintainer:
            maintainer = recipe_maintainer[0].maintainer
            context['maintainer_name'] = maintainer.name
        else:
            context['maintainer_name'] = 'No maintainer'

        context['recipe_upgrade_details'] = []
        for ru in RecipeUpgrade.objects.filter(
                recipe=recipe).order_by('-commit_date'):
            context['recipe_upgrade_details'].append(
                _get_recipe_upgrade_detail(maintplan, ru))
        context['recipe_upgrade_detail_count'] = len(
            context['recipe_upgrade_details'])

        context['recipe_layer_branch_url'] = _get_layer_branch_url(
            recipe.layerbranch.branch.name, recipe.layerbranch.layer.name)

        context['recipe_provides'] = []
        for p in recipe.provides.split():
            context['recipe_provides'].append(p)

        context['recipe_depends'] = StaticBuildDep.objects.filter(
            recipes__id=recipe.id).values_list('name', flat=True)

        context['recipe_distros'] = RecipeDistro.get_distros_by_recipe(recipe)

        return context
Exemplo n.º 4
0
    def get_context_data(self, **kwargs):
        context = super(RecipeDetailView, self).get_context_data(**kwargs)
        recipesymbol = self.get_object()
        if not recipesymbol:
            raise django.http.Http404

        recipe = recipesymbol.layerbranch.recipe_set.filter(
            pn=recipesymbol.pn, layerbranch=recipesymbol.layerbranch).last()
        context['recipe'] = recipe

        maintplan = get_object_or_404(MaintenancePlan,
                                      name=self.maintplan_name)
        context['maintplan_name'] = maintplan.name
        context['maintplan'] = maintplan
        release = Release.get_current(maintplan)
        context['release_name'] = release.name
        milestone = Milestone.get_current(release)
        context['milestone_name'] = milestone.name

        context['upstream_status'] = ''
        context['upstream_version'] = ''
        context['upstream_no_update_reason'] = ''
        recipe_upstream_history = RecipeUpstreamHistory.get_last_by_date_range(
            recipesymbol.layerbranch, milestone.start_date, milestone.end_date)
        if recipe_upstream_history:
            recipe_upstream = RecipeUpstream.get_by_recipe_and_history(
                recipesymbol, recipe_upstream_history)
            if recipe_upstream:
                if recipe_upstream.status == 'N' and recipe_upstream.no_update_reason:
                    recipe_upstream.status = 'C'
                elif recipe_upstream.status == 'D':
                    recipe_upstream.status = 'U'
                context['upstream_status'] = \
                    RecipeUpstream.RECIPE_UPSTREAM_STATUS_CHOICES_DICT[recipe_upstream.status]
                context['upstream_version'] = recipe_upstream.version
                context[
                    'upstream_no_update_reason'] = recipe_upstream.no_update_reason

        self.recipe_maintainer_history = RecipeMaintainerHistory.get_last(
            recipesymbol.layerbranch)
        recipe_maintainer = RecipeMaintainer.objects.filter(
            recipesymbol=recipesymbol, history=self.recipe_maintainer_history)
        if recipe_maintainer:
            maintainer = recipe_maintainer[0].maintainer
            context['maintainer_name'] = maintainer.name
        else:
            context['maintainer_name'] = 'No maintainer'

        details = []
        multigroup = False
        lastgroup = ''  # can't use None here
        for ru in RecipeUpgrade.objects.filter(
                recipesymbol=recipesymbol).exclude(upgrade_type='M').order_by(
                    'group', '-commit_date', '-id'):
            details.append(_get_recipe_upgrade_detail(maintplan, ru))
            if not multigroup:
                if lastgroup == '':
                    lastgroup = ru.group
                elif ru.group != lastgroup:
                    multigroup = True
        details.sort(key=lambda s: RecipeUpgradeGroupSortItem(s.group),
                     reverse=True)
        context['multigroup'] = multigroup
        context['recipe_upgrade_details'] = details
        context['recipe_upgrade_detail_count'] = len(details)

        if not recipe:
            ru = RecipeUpgrade.objects.filter(
                recipesymbol=recipesymbol).order_by('-commit_date',
                                                    '-id').first()
            if ru:
                context['last_filepath'] = ru.filepath

        context['recipe_layer_branch_url'] = _get_layer_branch_url(
            recipesymbol.layerbranch.branch.name,
            recipesymbol.layerbranch.layer.name)

        context['recipe_provides'] = []
        if recipe:
            for p in recipe.provides.split():
                context['recipe_provides'].append(p)

            context['recipe_depends'] = StaticBuildDep.objects.filter(
                recipes__id=recipe.id).values_list('name', flat=True)

            context['recipe_distros'] = RecipeDistro.get_distros_by_recipe(
                recipe)
        else:
            context['recipe_depends'] = []
            context['recipe_distros'] = []

        context['otherbranch_recipes'] = Recipe.objects.filter(
            layerbranch__layer=recipesymbol.layerbranch.layer,
            layerbranch__branch__comparison=False,
            pn=recipesymbol.pn).order_by('layerbranch__branch__sort_priority')

        return context