layerindex-web/layerindex/admin.py
Paul Eggleton e0f8a05423 Handle updating of inc files/classes within same layer
If we aren't doing a full refresh, when changes to an included/required
file or an inherited class occur we need to update all of the files that
depend on them. BitBake records these dependencies, so read them and
record them against each recipe.

At the moment this only handles dependencies within the same layer; that
is probably sufficient to handle most changes for the purposes of
extracting the data this application cares about. A future improved
solution will probably involve making use of BitBake's cache rather than
and parsing all layers and their dependencies rather than individual
recipes.

This change also adds -x/--nofetch and -n/--dry-run options for
debugging as well as some further debug messages.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-02-26 11:05:43 +00:00

67 lines
2.2 KiB
Python

# layerindex-web - admin interface definitions
#
# Copyright (C) 2013 Intel Corporation
#
# Licensed under the MIT license, see COPYING.MIT for details
from layerindex.models import *
from django.contrib import admin
from reversion_compare.admin import CompareVersionAdmin
from django.forms import TextInput
class LayerMaintainerInline(admin.StackedInline):
model = LayerMaintainer
class LayerDependencyInline(admin.StackedInline):
model = LayerDependency
fk_name = 'layer'
class LayerItemAdmin(CompareVersionAdmin):
list_filter = ['status', 'layer_type']
save_as = True
search_fields = ['name', 'summary']
readonly_fields = ['vcs_last_fetch', 'vcs_last_rev', 'vcs_last_commit']
formfield_overrides = {
models.URLField: {'widget': TextInput(attrs={'size':'100'})},
models.CharField: {'widget': TextInput(attrs={'size':'100'})},
}
inlines = [
LayerMaintainerInline,
LayerDependencyInline,
]
class LayerMaintainerAdmin(CompareVersionAdmin):
list_filter = ['status', 'layer__name']
class LayerDependencyAdmin(CompareVersionAdmin):
list_filter = ['layer__name']
class LayerNoteAdmin(CompareVersionAdmin):
list_filter = ['layer__name']
class RecipeAdmin(admin.ModelAdmin):
search_fields = ['filename', 'pn']
list_filter = ['layer__name']
readonly_fields = [fieldname for fieldname in Recipe._meta.get_all_field_names() if fieldname != 'recipefiledependency']
def has_add_permission(self, request, obj=None):
return False
def has_delete_permission(self, request, obj=None):
return False
class MachineAdmin(admin.ModelAdmin):
search_fields = ['name']
list_filter = ['layer__name']
readonly_fields = Machine._meta.get_all_field_names()
def has_add_permission(self, request, obj=None):
return False
def has_delete_permission(self, request, obj=None):
return False
admin.site.register(LayerItem, LayerItemAdmin)
admin.site.register(LayerMaintainer, LayerMaintainerAdmin)
admin.site.register(LayerDependency, LayerDependencyAdmin)
admin.site.register(LayerNote, LayerNoteAdmin)
admin.site.register(Recipe, RecipeAdmin)
admin.site.register(RecipeFileDependency)
admin.site.register(Machine, MachineAdmin)