2013-10-11 12:46:23 +00:00
#
2014-01-14 12:50:32 +00:00
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
2013-10-11 12:46:23 +00:00
# BitBake Toaster Implementation
#
# Copyright (C) 2013 Intel Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2015-08-18 16:28:57 +00:00
2016-08-22 15:42:33 +00:00
import re
2013-12-18 19:50:45 +00:00
2016-08-22 15:42:33 +00:00
from django . db . models import F , Q , Sum
from django . db import IntegrityError
2015-11-04 15:14:06 +00:00
from django . shortcuts import render , redirect , get_object_or_404
2016-08-22 15:42:33 +00:00
from orm . models import Build , Target , Task , Layer , Layer_Version , Recipe
from orm . models import LogMessage , Variable , Package_Dependency , Package
from orm . models import Task_Dependency , Package_File
from orm . models import Target_Installed_Package , Target_File
from orm . models import TargetKernelFile , TargetSDKFile , Target_Image_File
2015-09-29 04:45:22 +00:00
from orm . models import BitbakeVersion , CustomImageRecipe
2016-08-22 15:42:33 +00:00
2015-08-18 16:29:00 +00:00
from django . core . urlresolvers import reverse , resolve
2016-01-18 13:45:10 +00:00
from django . core . exceptions import MultipleObjectsReturned , ObjectDoesNotExist
2013-12-18 19:50:45 +00:00
from django . core . paginator import Paginator , EmptyPage , PageNotAnInteger
2016-08-22 15:42:33 +00:00
from django . http import HttpResponseNotFound
2014-01-07 13:10:42 +00:00
from django . utils import timezone
2015-07-24 15:05:20 +00:00
from datetime import timedelta , datetime
2014-11-11 17:01:09 +00:00
from toastergui . templatetags . projecttags import json as jsonfilter
2016-01-15 11:00:59 +00:00
from decimal import Decimal
2014-03-12 21:54:09 +00:00
import json
2016-04-06 16:46:43 +00:00
import os
2015-05-18 09:03:00 +00:00
from os . path import dirname
2015-10-07 03:05:21 +00:00
import mimetypes
2013-12-18 19:50:45 +00:00
2015-08-18 16:28:52 +00:00
import logging
logger = logging . getLogger ( " toaster " )
2016-08-22 15:42:33 +00:00
2015-09-11 20:57:30 +00:00
class MimeTypeFinder ( object ) :
2015-10-07 03:05:21 +00:00
# setting this to False enables additional non-standard mimetypes
# to be included in the guess
_strict = False
2015-09-11 20:57:30 +00:00
2015-10-07 03:05:21 +00:00
# returns the mimetype for a file path as a string,
# or 'application/octet-stream' if the type couldn't be guessed
2015-09-11 20:57:30 +00:00
@classmethod
def get_mimetype ( self , path ) :
2015-10-07 03:05:21 +00:00
guess = mimetypes . guess_type ( path , self . _strict )
guessed_type = guess [ 0 ]
if guessed_type == None :
guessed_type = ' application/octet-stream '
return guessed_type
2015-09-11 20:57:30 +00:00
2014-10-03 17:03:37 +00:00
# all new sessions should come through the landing page;
# determine in which mode we are running in, and redirect appropriately
def landing ( request ) :
2015-10-17 17:45:53 +00:00
# in build mode, we redirect to the command-line builds page
# if there are any builds for the default (cli builds) project
2015-12-10 03:56:29 +00:00
default_project = Project . objects . get_or_create_default_project ( )
2015-10-17 17:45:53 +00:00
default_project_builds = Build . objects . filter ( project = default_project )
2015-09-03 00:25:09 +00:00
# we only redirect to projects page if there is a user-generated project
2015-10-17 17:45:53 +00:00
num_builds = Build . objects . all ( ) . count ( )
2015-09-03 00:25:09 +00:00
user_projects = Project . objects . filter ( is_default = False )
has_user_project = user_projects . count ( ) > 0
2015-10-17 17:45:53 +00:00
if num_builds == 0 and has_user_project :
2015-06-09 16:25:42 +00:00
return redirect ( reverse ( ' all-projects ' ) , permanent = False )
2014-10-03 17:03:37 +00:00
2015-10-17 17:45:53 +00:00
if num_builds > 0 :
2015-06-09 16:25:42 +00:00
return redirect ( reverse ( ' all-builds ' ) , permanent = False )
2015-02-13 13:08:26 +00:00
2015-06-09 16:25:42 +00:00
context = { ' lvs_nos ' : Layer_Version . objects . all ( ) . count ( ) }
2014-10-03 17:03:37 +00:00
2015-02-13 13:08:26 +00:00
return render ( request , ' landing.html ' , context )
2014-10-03 17:03:37 +00:00
2015-06-08 10:01:43 +00:00
def objtojson ( obj ) :
from django . db . models . query import QuerySet
2015-08-18 16:28:47 +00:00
from django . db . models import Model
2015-06-08 10:01:43 +00:00
if isinstance ( obj , datetime ) :
return obj . isoformat ( )
elif isinstance ( obj , timedelta ) :
return obj . total_seconds ( )
elif isinstance ( obj , QuerySet ) or isinstance ( obj , set ) :
return list ( obj )
2016-01-15 11:00:59 +00:00
elif isinstance ( obj , Decimal ) :
return str ( obj )
2015-06-08 10:01:43 +00:00
elif type ( obj ) . __name__ == " RelatedManager " :
return [ x . pk for x in obj . all ( ) ]
elif hasattr ( obj , ' __dict__ ' ) and isinstance ( obj , Model ) :
d = obj . __dict__
nd = dict ( d )
for di in d . keys ( ) :
if di . startswith ( " _ " ) :
del nd [ di ]
elif isinstance ( d [ di ] , Model ) :
nd [ di ] = d [ di ] . pk
elif isinstance ( d [ di ] , int ) and hasattr ( obj , " get_ %s _display " % di ) :
nd [ di ] = getattr ( obj , " get_ %s _display " % di ) ( )
return nd
2015-06-05 11:30:12 +00:00
elif isinstance ( obj , type ( lambda x : x ) ) :
import inspect
return inspect . getsourcelines ( obj ) [ 0 ]
2015-06-08 10:01:43 +00:00
else :
raise TypeError ( " Unserializable object %s ( %s ) of type %s " % ( obj , dir ( obj ) , type ( obj ) ) )
2015-06-08 12:36:56 +00:00
def _lv_to_dict ( prj , x = None ) :
if x is None :
def wrapper ( x ) :
return _lv_to_dict ( prj , x )
return wrapper
return { " id " : x . pk ,
" name " : x . layer . name ,
2015-06-24 13:53:21 +00:00
" tooltip " : " %s | %s " % ( x . layer . vcs_url , x . get_vcs_reference ( ) ) ,
2016-07-21 13:43:30 +00:00
" detail " : " ( %s " % x . layer . vcs_url + ( " ) " if x . release == None else " | " + x . get_vcs_reference ( ) + " ) " ) ,
2015-06-08 12:36:56 +00:00
" giturl " : x . layer . vcs_url ,
" layerdetailurl " : reverse ( ' layerdetails ' , args = ( prj . id , x . pk ) ) ,
" revision " : x . get_vcs_reference ( ) ,
}
2015-06-02 11:23:12 +00:00
2013-12-18 19:50:45 +00:00
def _build_page_range ( paginator , index = 1 ) :
try :
page = paginator . page ( index )
except PageNotAnInteger :
page = paginator . page ( 1 )
except EmptyPage :
page = paginator . page ( paginator . num_pages )
2013-12-11 16:42:34 +00:00
2013-12-18 19:50:45 +00:00
page . page_range = [ page . number ]
crt_range = 0
for i in range ( 1 , 5 ) :
if ( page . number + i ) < = paginator . num_pages :
page . page_range = page . page_range + [ page . number + i ]
crt_range + = 1
if ( page . number - i ) > 0 :
page . page_range = [ page . number - i ] + page . page_range
crt_range + = 1
if crt_range == 4 :
break
return page
2013-12-11 16:42:34 +00:00
def _verify_parameters ( g , mandatory_parameters ) :
miss = [ ]
for mp in mandatory_parameters :
if not mp in g :
miss . append ( mp )
if len ( miss ) :
return miss
return None
2013-12-13 17:14:34 +00:00
def _redirect_parameters ( view , g , mandatory_parameters , * args , * * kwargs ) :
2016-05-30 13:10:59 +00:00
try :
from urllib import unquote , urlencode
except ImportError :
from urllib . parse import unquote , urlencode
2013-12-13 17:14:34 +00:00
url = reverse ( view , kwargs = kwargs )
2013-12-11 16:42:34 +00:00
params = { }
for i in g :
params [ i ] = g [ i ]
for i in mandatory_parameters :
if not i in params :
2016-05-30 13:10:59 +00:00
params [ i ] = unquote ( str ( mandatory_parameters [ i ] ) )
2013-12-11 16:42:34 +00:00
2016-05-30 13:10:59 +00:00
return redirect ( url + " ? %s " % urlencode ( params ) , permanent = False , * * kwargs )
2015-05-19 15:14:29 +00:00
class RedirectException ( Exception ) :
def __init__ ( self , view , g , mandatory_parameters , * args , * * kwargs ) :
super ( RedirectException , self ) . __init__ ( )
self . view = view
self . g = g
self . mandatory_parameters = mandatory_parameters
self . oargs = args
self . okwargs = kwargs
def get_redirect_response ( self ) :
2015-06-02 11:23:12 +00:00
return _redirect_parameters ( self . view , self . g , self . mandatory_parameters , self . oargs , * * self . okwargs )
2013-12-11 16:42:34 +00:00
2014-01-07 13:10:42 +00:00
FIELD_SEPARATOR = " : "
2015-01-23 17:36:14 +00:00
AND_VALUE_SEPARATOR = " ! "
OR_VALUE_SEPARATOR = " | "
2014-01-07 13:10:42 +00:00
DESCENDING = " - "
def __get_q_for_val ( name , value ) :
2016-05-10 08:39:04 +00:00
if " OR " in value or " AND " in value :
result = None
for x in value . split ( " OR " ) :
x = __get_q_for_val ( name , x )
result = result | x if result else x
return result
2014-01-07 13:10:42 +00:00
if " AND " in value :
2016-05-10 08:39:04 +00:00
result = None
for x in value . split ( " AND " ) :
x = __get_q_for_val ( name , x )
result = result & x if result else x
return result
2014-01-07 13:10:42 +00:00
if value . startswith ( " NOT " ) :
2015-01-23 17:36:14 +00:00
value = value [ 3 : ]
if value == ' None ' :
value = None
kwargs = { name : value }
2014-01-07 13:10:42 +00:00
return ~ Q ( * * kwargs )
else :
2015-01-23 17:36:14 +00:00
if value == ' None ' :
value = None
2014-01-07 13:10:42 +00:00
kwargs = { name : value }
return Q ( * * kwargs )
def _get_filtering_query ( filter_string ) :
search_terms = filter_string . split ( FIELD_SEPARATOR )
2015-01-23 17:36:14 +00:00
and_keys = search_terms [ 0 ] . split ( AND_VALUE_SEPARATOR )
and_values = search_terms [ 1 ] . split ( AND_VALUE_SEPARATOR )
2016-05-10 08:39:04 +00:00
and_query = None
2015-01-23 17:36:14 +00:00
for kv in zip ( and_keys , and_values ) :
or_keys = kv [ 0 ] . split ( OR_VALUE_SEPARATOR )
or_values = kv [ 1 ] . split ( OR_VALUE_SEPARATOR )
2016-05-10 08:39:04 +00:00
query = None
for key , val in zip ( or_keys , or_values ) :
2016-06-07 15:29:35 +00:00
x = __get_q_for_val ( key , val )
2016-05-10 08:39:04 +00:00
query = query | x if query else x
2014-01-07 13:10:42 +00:00
2016-05-10 08:39:04 +00:00
and_query = and_query & query if and_query else query
return and_query
2014-01-07 13:10:42 +00:00
2015-08-18 16:28:47 +00:00
def _get_toggle_order ( request , orderkey , toggle_reverse = False ) :
if toggle_reverse :
2014-01-16 12:22:21 +00:00
return " %s :+ " % orderkey if request . GET . get ( ' orderby ' , " " ) == " %s :- " % orderkey else " %s :- " % orderkey
else :
return " %s :- " % orderkey if request . GET . get ( ' orderby ' , " " ) == " %s :+ " % orderkey else " %s :+ " % orderkey
2014-01-07 13:10:42 +00:00
2014-01-10 21:43:24 +00:00
def _get_toggle_order_icon ( request , orderkey ) :
if request . GET . get ( ' orderby ' , " " ) == " %s :+ " % orderkey :
return " down "
elif request . GET . get ( ' orderby ' , " " ) == " %s :- " % orderkey :
return " up "
else :
return None
2014-01-07 13:10:42 +00:00
# we check that the input comes in a valid form that we can recognize
2015-08-18 16:28:53 +00:00
def _validate_input ( field_input , model ) :
2014-01-07 13:10:42 +00:00
invalid = None
2015-08-18 16:28:53 +00:00
if field_input :
field_input_list = field_input . split ( FIELD_SEPARATOR )
2014-01-07 13:10:42 +00:00
# Check we have only one colon
2015-08-18 16:28:53 +00:00
if len ( field_input_list ) != 2 :
invalid = " We have an invalid number of separators: " + field_input + " -> " + str ( field_input_list )
2014-01-07 13:10:42 +00:00
return None , invalid
# Check we have an equal number of terms both sides of the colon
2015-08-18 16:28:53 +00:00
if len ( field_input_list [ 0 ] . split ( AND_VALUE_SEPARATOR ) ) != len ( field_input_list [ 1 ] . split ( AND_VALUE_SEPARATOR ) ) :
2014-01-07 13:10:42 +00:00
invalid = " Not all arg names got values "
2015-08-18 16:28:53 +00:00
return None , invalid + str ( field_input_list )
2014-01-07 13:10:42 +00:00
# Check we are looking for a valid field
valid_fields = model . _meta . get_all_field_names ( )
2015-08-18 16:28:53 +00:00
for field in field_input_list [ 0 ] . split ( AND_VALUE_SEPARATOR ) :
2016-05-10 08:39:04 +00:00
if True in [ field . startswith ( x ) for x in valid_fields ] :
break
else :
return None , ( field , valid_fields )
2014-01-07 13:10:42 +00:00
2015-08-18 16:28:53 +00:00
return field_input , invalid
2014-01-07 13:10:42 +00:00
# uses search_allowed_fields in orm/models.py to create a search query
# for these fields with the supplied input text
def _get_search_results ( search_term , queryset , model ) :
2016-05-10 08:39:04 +00:00
search_object = None
2014-01-07 13:10:42 +00:00
for st in search_term . split ( " " ) :
2016-05-10 08:39:04 +00:00
queries = None
for field in model . search_allowed_fields :
2016-06-16 14:02:00 +00:00
query = Q ( * * { field + ' __icontains ' : st } )
2016-05-10 08:39:04 +00:00
queries = queries | query if queries else query
2014-01-07 13:10:42 +00:00
2016-05-10 08:39:04 +00:00
search_object = search_object & queries if search_object else queries
2014-01-07 13:10:42 +00:00
queryset = queryset . filter ( search_object )
return queryset
# function to extract the search/filter/ordering parameters from the request
# it uses the request and the model to validate input for the filter and orderby values
def _search_tuple ( request , model ) :
ordering_string , invalid = _validate_input ( request . GET . get ( ' orderby ' , ' ' ) , model )
if invalid :
2014-03-12 21:54:09 +00:00
raise BaseException ( " Invalid ordering model: " + str ( model ) + str ( invalid ) )
2014-01-07 13:10:42 +00:00
filter_string , invalid = _validate_input ( request . GET . get ( ' filter ' , ' ' ) , model )
if invalid :
raise BaseException ( " Invalid filter " + str ( invalid ) )
search_term = request . GET . get ( ' search ' , ' ' )
return ( filter_string , search_term , ordering_string )
# returns a lazy-evaluated queryset for a filter/search/order combination
2014-03-26 23:24:43 +00:00
def _get_queryset ( model , queryset , filter_string , search_term , ordering_string , ordering_secondary = ' ' ) :
2014-01-07 13:10:42 +00:00
if filter_string :
filter_query = _get_filtering_query ( filter_string )
2014-01-16 12:22:21 +00:00
queryset = queryset . filter ( filter_query )
2014-01-07 13:10:42 +00:00
else :
2014-01-16 12:22:21 +00:00
queryset = queryset . all ( )
2014-01-07 13:10:42 +00:00
if search_term :
queryset = _get_search_results ( search_term , queryset , model )
2015-02-02 17:57:36 +00:00
if ordering_string :
2014-01-07 13:10:42 +00:00
column , order = ordering_string . split ( ' : ' )
2014-03-26 23:24:43 +00:00
if column == re . sub ( ' - ' , ' ' , ordering_secondary ) :
ordering_secondary = ' '
2014-01-07 13:10:42 +00:00
if order . lower ( ) == DESCENDING :
2014-03-26 23:24:43 +00:00
column = ' - ' + column
if ordering_secondary :
queryset = queryset . order_by ( column , ordering_secondary )
2014-01-07 13:10:42 +00:00
else :
queryset = queryset . order_by ( column )
2014-03-29 14:47:43 +00:00
# insure only distinct records (e.g. from multiple search hits) are returned
2014-03-25 04:32:08 +00:00
return queryset . distinct ( )
2013-12-18 19:50:45 +00:00
2014-08-29 12:51:01 +00:00
# returns the value of entries per page and the name of the applied sorting field.
# if the value is given explicitly as a GET parameter it will be the first selected,
# otherwise the cookie value will be used.
def _get_parameters_values ( request , default_count , default_order ) :
2015-05-14 13:40:10 +00:00
current_url = resolve ( request . path_info ) . url_name
pagesize = request . GET . get ( ' count ' , request . session . get ( ' %s _count ' % current_url , default_count ) )
orderby = request . GET . get ( ' orderby ' , request . session . get ( ' %s _orderby ' % current_url , default_order ) )
2014-08-29 12:51:01 +00:00
return ( pagesize , orderby )
# set cookies for parameters. this is usefull in case parameters are set
# manually from the GET values of the link
2015-05-19 12:30:05 +00:00
def _set_parameters_values ( pagesize , orderby , request ) :
from django . core . urlresolvers import resolve
current_url = resolve ( request . path_info ) . url_name
request . session [ ' %s _count ' % current_url ] = pagesize
request . session [ ' %s _orderby ' % current_url ] = orderby
2014-03-26 23:24:43 +00:00
2015-03-22 01:01:38 +00:00
# date range: normalize GUI's dd/mm/yyyy to date object
def _normalize_input_date ( date_str , default ) :
date_str = re . sub ( ' / ' , ' - ' , date_str )
# accept dd/mm/yyyy to d/m/yy
try :
date_in = datetime . strptime ( date_str , " %d - % m- % Y " )
except ValueError :
# courtesy try with two digit year
try :
date_in = datetime . strptime ( date_str , " %d - % m- % y " )
except ValueError :
return default
date_in = date_in . replace ( tzinfo = default . tzinfo )
return date_in
# convert and normalize any received date range filter, for example:
# "completed_on__gte!completed_on__lt:01/03/2015!02/03/2015_daterange" to
# "completed_on__gte!completed_on__lt:2015-03-01!2015-03-02"
def _modify_date_range_filter ( filter_string ) :
# was the date range radio button selected?
if 0 > filter_string . find ( ' _daterange ' ) :
return filter_string , ' '
# normalize GUI dates to database format
filter_string = filter_string . replace ( ' _daterange ' , ' ' ) . replace ( ' : ' , ' ! ' ) ;
filter_list = filter_string . split ( ' ! ' ) ;
if 4 != len ( filter_list ) :
return filter_string
today = timezone . localtime ( timezone . now ( ) )
date_id = filter_list [ 1 ]
date_from = _normalize_input_date ( filter_list [ 2 ] , today )
date_to = _normalize_input_date ( filter_list [ 3 ] , today )
# swap dates if manually set dates are out of order
if date_to < date_from :
date_to , date_from = date_from , date_to
# convert to strings, make 'date_to' inclusive by moving to begining of next day
date_from_str = date_from . strftime ( " % Y- % m- %d " )
date_to_str = ( date_to + timedelta ( days = 1 ) ) . strftime ( " % Y- % m- %d " )
filter_string = filter_list [ 0 ] + ' ! ' + filter_list [ 1 ] + ' : ' + date_from_str + ' ! ' + date_to_str
daterange_selected = re . sub ( ' __.* ' , ' ' , date_id )
return filter_string , daterange_selected
def _add_daterange_context ( queryset_all , request , daterange_list ) :
# calculate the exact begining of local today and yesterday
today_begin = timezone . localtime ( timezone . now ( ) )
2015-07-24 15:05:20 +00:00
yesterday_begin = today_begin - timedelta ( days = 1 )
2015-03-22 01:01:38 +00:00
# add daterange persistent
context_date = { }
context_date [ ' last_date_from ' ] = request . GET . get ( ' last_date_from ' , timezone . localtime ( timezone . now ( ) ) . strftime ( " %d / % m/ % Y " ) )
context_date [ ' last_date_to ' ] = request . GET . get ( ' last_date_to ' , context_date [ ' last_date_from ' ] )
# calculate the date ranges, avoid second sort for 'created'
# fetch the respective max range from the database
context_date [ ' daterange_filter ' ] = ' '
for key in daterange_list :
queryset_key = queryset_all . order_by ( key )
2015-03-25 13:34:27 +00:00
try :
context_date [ ' dateMin_ ' + key ] = timezone . localtime ( getattr ( queryset_key . first ( ) , key ) ) . strftime ( " %d / % m/ % Y " )
except AttributeError :
context_date [ ' dateMin_ ' + key ] = timezone . localtime ( timezone . now ( ) )
try :
context_date [ ' dateMax_ ' + key ] = timezone . localtime ( getattr ( queryset_key . last ( ) , key ) ) . strftime ( " %d / % m/ % Y " )
except AttributeError :
context_date [ ' dateMax_ ' + key ] = timezone . localtime ( timezone . now ( ) )
2015-03-22 01:01:38 +00:00
return context_date , today_begin , yesterday_begin
2014-10-03 17:03:37 +00:00
2014-03-21 12:35:50 +00:00
##
2013-12-11 16:42:34 +00:00
# build dashboard for a single build, coming in as argument
2014-03-21 12:35:50 +00:00
# Each build may contain multiple targets and each target
# may generate multiple image files. display them all.
#
2014-04-02 22:04:08 +00:00
def builddashboard ( request , build_id ) :
2013-12-11 16:42:34 +00:00
template = " builddashboard.html "
2014-04-02 22:04:08 +00:00
if Build . objects . filter ( pk = build_id ) . count ( ) == 0 :
return redirect ( builds )
2014-11-25 10:12:46 +00:00
build = Build . objects . get ( pk = build_id ) ;
2014-03-21 12:35:50 +00:00
layerVersionId = Layer_Version . objects . filter ( build = build_id ) ;
recipeCount = Recipe . objects . filter ( layer_version__id__in = layerVersionId ) . count ( ) ;
tgts = Target . objects . filter ( build_id = build_id ) . order_by ( ' target ' ) ;
# set up custom target list with computed package and image data
2016-07-12 22:54:53 +00:00
targets = [ ]
2014-04-02 22:04:08 +00:00
ntargets = 0
2016-07-12 22:54:50 +00:00
2016-07-12 22:54:53 +00:00
# True if at least one target for this build has an SDK artifact
# or image file
has_artifacts = False
2014-03-21 12:35:50 +00:00
for t in tgts :
2016-07-12 22:54:53 +00:00
elem = { }
elem [ ' target ' ] = t
target_has_images = False
image_files = [ ]
2014-04-02 22:04:08 +00:00
npkg = 0
pkgsz = 0
package = None
2014-12-05 15:19:55 +00:00
for package in Package . objects . filter ( id__in = [ x . package_id for x in t . target_installed_package_set . all ( ) ] ) :
2014-04-02 22:04:08 +00:00
pkgsz = pkgsz + package . size
2016-07-12 22:54:53 +00:00
if package . installed_name :
2014-04-02 22:04:08 +00:00
npkg = npkg + 1
2016-07-12 22:54:53 +00:00
elem [ ' npkg ' ] = npkg
elem [ ' pkgsz ' ] = pkgsz
ti = Target_Image_File . objects . filter ( target_id = t . id )
2014-03-21 12:35:50 +00:00
for i in ti :
2016-07-12 22:54:53 +00:00
ndx = i . file_name . rfind ( ' / ' )
if ndx < 0 :
2014-04-02 22:04:08 +00:00
ndx = 0 ;
2016-07-12 22:54:53 +00:00
f = i . file_name [ ndx + 1 : ]
image_files . append ( {
2016-02-23 12:17:04 +00:00
' id ' : i . id ,
' path ' : f ,
' size ' : i . file_size ,
' suffix ' : i . suffix
} )
2016-07-12 22:54:53 +00:00
if len ( image_files ) > 0 :
target_has_images = True
elem [ ' targetHasImages ' ] = target_has_images
elem [ ' imageFiles ' ] = image_files
bitbake: toaster: improve scan for SDK artifacts
SDK artifacts were previously picked up by toaster.bbclass and
notified to buildinfohelper (via toasterui). The artifacts
were then added to the Build object, so that it wasn't clear
which artifact went with which target; we were also unable
to attach SDK artifacts to a Build if they had already been
attached to a previous build.
Now, toaster.bbclass just notifies the TOOLCHAIN_OUTPUTNAME when
a populate_sdk* target completes. The scan is moved to buildinfohelper,
where we search the SDK deploy directory for files matching
TOOLCHAIN_OUTPUTNAME and attach them to targets (not builds).
If an SDK file is not produced by a target, we now look for a
similar, previously-run target which did produce artifacts.
If there is one, we clone the SDK artifacts from that target
onto the current one.
This all means that we can show SDK artifacts by target, and should
always get artifacts associated with a target, regardless of whether
it really build them.
This requires an additional model, TargetSDKFile, which tracks
the size and path of SDK artifact files with respect to Target
objects.
[YOCTO #8556]
(Bitbake rev: 5e650c611605507e1e0d1588cd5eb6535c2d34fc)
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: bavery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-12 22:54:48 +00:00
elem [ ' target_kernel_artifacts ' ] = t . targetkernelfile_set . all ( )
target_sdk_files = t . targetsdkfile_set . all ( )
2016-07-12 22:54:53 +00:00
target_sdk_artifacts_count = target_sdk_files . count ( )
elem [ ' target_sdk_artifacts_count ' ] = target_sdk_artifacts_count
bitbake: toaster: improve scan for SDK artifacts
SDK artifacts were previously picked up by toaster.bbclass and
notified to buildinfohelper (via toasterui). The artifacts
were then added to the Build object, so that it wasn't clear
which artifact went with which target; we were also unable
to attach SDK artifacts to a Build if they had already been
attached to a previous build.
Now, toaster.bbclass just notifies the TOOLCHAIN_OUTPUTNAME when
a populate_sdk* target completes. The scan is moved to buildinfohelper,
where we search the SDK deploy directory for files matching
TOOLCHAIN_OUTPUTNAME and attach them to targets (not builds).
If an SDK file is not produced by a target, we now look for a
similar, previously-run target which did produce artifacts.
If there is one, we clone the SDK artifacts from that target
onto the current one.
This all means that we can show SDK artifacts by target, and should
always get artifacts associated with a target, regardless of whether
it really build them.
This requires an additional model, TargetSDKFile, which tracks
the size and path of SDK artifact files with respect to Target
objects.
[YOCTO #8556]
(Bitbake rev: 5e650c611605507e1e0d1588cd5eb6535c2d34fc)
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: bavery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-12 22:54:48 +00:00
elem [ ' target_sdk_artifacts ' ] = target_sdk_files
2016-07-12 22:54:46 +00:00
2016-07-12 22:54:53 +00:00
if target_has_images or target_sdk_artifacts_count > 0 :
has_artifacts = True
targets . append ( elem )
2014-04-02 22:04:08 +00:00
##
# how many packages in this build - ignore anonymous ones
#
packageCount = 0
packages = Package . objects . filter ( build_id = build_id )
for p in packages :
if ( p . installed_name ) :
packageCount = packageCount + 1
2014-03-21 12:35:50 +00:00
2014-12-05 15:19:55 +00:00
logmessages = list ( LogMessage . objects . filter ( build = build_id ) )
2013-12-11 16:42:34 +00:00
context = {
2014-03-21 12:35:50 +00:00
' build ' : build ,
2016-04-19 16:28:46 +00:00
' project ' : build . project ,
2016-07-12 22:54:53 +00:00
' hasArtifacts ' : has_artifacts ,
2014-03-21 12:35:50 +00:00
' ntargets ' : ntargets ,
' targets ' : targets ,
' recipecount ' : recipeCount ,
2014-04-02 22:04:08 +00:00
' packagecount ' : packageCount ,
2014-12-05 15:19:55 +00:00
' logmessages ' : logmessages ,
2013-12-11 16:42:34 +00:00
}
2014-04-02 22:04:08 +00:00
return render ( request , template , context )
2013-12-11 16:42:34 +00:00
2014-03-21 12:35:50 +00:00
2015-02-24 17:20:58 +00:00
2015-08-17 11:12:16 +00:00
def generateCoveredList2 ( revlist = None ) :
if not revlist :
revlist = [ ]
2015-02-24 17:20:58 +00:00
covered_list = [ x for x in revlist if x . outcome == Task . OUTCOME_COVERED ]
while len ( covered_list ) :
revlist = [ x for x in revlist if x . outcome != Task . OUTCOME_COVERED ]
2015-02-26 21:41:55 +00:00
if len ( revlist ) > 0 :
return revlist
2015-02-24 17:20:58 +00:00
newlist = _find_task_revdep_list ( covered_list )
revlist = list ( set ( revlist + newlist ) )
covered_list = [ x for x in revlist if x . outcome == Task . OUTCOME_COVERED ]
return revlist
2014-02-18 04:30:41 +00:00
2014-04-02 19:10:55 +00:00
def task ( request , build_id , task_id ) :
template = " task.html "
2015-08-18 16:28:53 +00:00
tasks_list = Task . objects . filter ( pk = task_id )
if tasks_list . count ( ) == 0 :
2014-04-02 19:10:55 +00:00
return redirect ( builds )
2015-08-18 16:28:53 +00:00
task_object = tasks_list [ 0 ] ;
2014-04-02 19:10:55 +00:00
dependencies = sorted (
2015-08-18 16:28:53 +00:00
_find_task_dep ( task_object ) ,
2014-04-02 19:10:55 +00:00
key = lambda t : ' %s _ %s %s ' % ( t . recipe . name , t . recipe . version , t . task_name ) )
reverse_dependencies = sorted (
2015-08-18 16:28:53 +00:00
_find_task_revdep ( task_object ) ,
2014-04-02 19:10:55 +00:00
key = lambda t : ' %s _ %s %s ' % ( t . recipe . name , t . recipe . version , t . task_name ) )
coveredBy = ' ' ;
2015-08-18 16:28:53 +00:00
if ( task_object . outcome == Task . OUTCOME_COVERED ) :
2015-02-24 17:20:58 +00:00
# _list = generateCoveredList( task )
2015-08-18 16:28:53 +00:00
coveredBy = sorted ( generateCoveredList2 ( _find_task_revdep ( task_object ) ) , key = lambda x : x . recipe . name )
2014-02-18 04:30:41 +00:00
log_head = ' '
log_body = ' '
2015-08-18 16:28:53 +00:00
if task_object . outcome == task_object . OUTCOME_FAILED :
2014-02-18 04:30:41 +00:00
pass
2014-04-08 03:26:12 +00:00
uri_list = [ ]
variables = Variable . objects . filter ( build = build_id )
v = variables . filter ( variable_name = ' SSTATE_DIR ' )
2015-06-24 13:53:21 +00:00
if v . count ( ) > 0 :
2014-04-08 03:26:12 +00:00
uri_list . append ( v [ 0 ] . variable_value )
v = variables . filter ( variable_name = ' SSTATE_MIRRORS ' )
2015-06-24 13:53:21 +00:00
if ( v . count ( ) > 0 ) :
2014-04-08 03:26:12 +00:00
for mirror in v [ 0 ] . variable_value . split ( ' \\ n ' ) :
s = re . sub ( ' .* ' , ' ' , mirror . strip ( ' \t \n \r ' ) )
2015-08-18 16:28:53 +00:00
if len ( s ) :
uri_list . append ( s )
2014-04-08 03:26:12 +00:00
2013-12-11 16:42:34 +00:00
context = {
2014-04-02 19:10:55 +00:00
' build ' : Build . objects . filter ( pk = build_id ) [ 0 ] ,
2015-08-18 16:28:53 +00:00
' object ' : task_object ,
' task ' : task_object ,
2014-04-02 19:10:55 +00:00
' covered_by ' : coveredBy ,
' deps ' : dependencies ,
' rdeps ' : reverse_dependencies ,
' log_head ' : log_head ,
' log_body ' : log_body ,
' showing_matches ' : False ,
2014-05-21 14:15:08 +00:00
' uri_list ' : uri_list ,
2016-05-26 15:12:22 +00:00
' task_in_tasks_table_pg ' : int ( task_object . order / 25 ) + 1
2013-12-11 16:42:34 +00:00
}
2014-04-02 19:10:55 +00:00
if request . GET . get ( ' show_matches ' , " " ) :
context [ ' showing_matches ' ] = True
2014-06-30 10:16:15 +00:00
context [ ' matching_tasks ' ] = Task . objects . filter (
2015-08-18 16:28:53 +00:00
sstate_checksum = task_object . sstate_checksum ) . filter (
build__completed_on__lt = task_object . build . completed_on ) . exclude (
2014-04-08 01:11:42 +00:00
order__isnull = True ) . exclude ( outcome = Task . OUTCOME_NA ) . order_by ( ' -build__completed_on ' )
2014-02-18 04:30:41 +00:00
2014-04-02 19:10:55 +00:00
return render ( request , template , context )
2014-02-18 04:30:41 +00:00
bitbake: toaster: add sort, search, paging to recipe package page
When selecting the packages tab on a recipe detail page, the page now
includes:
column sort on package name and size columns,
search on the package name, and
pagination.
Column sort is added by splitting the recipe view/html for a recipe's
package list into a new url path, view name and template, so that
the sorting routine, views.reload_params(), interfaces similar to other
views.
Search, sorting, and pagination are implemented for this detail page
using three new templates.
templates/detail_pagination_bottom.html
templates/detail_search_header.html
templates/detail_sorted_header.html
views.recipe() is optimized since the recipe's package list is no
longer needed by the recipe template, only the recipe's package count
is required for the first page.
The recipe view and template also changes to support tabbing to the
right context on the recipe detail page from the recipe-package page.
[YOCTO #6154]
(Bitbake rev: 6cb9e853d05c2c71467af22ef459ffbe6f41de36)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-24 22:14:41 +00:00
def recipe ( request , build_id , recipe_id , active_tab = " 1 " ) :
2013-12-11 16:42:34 +00:00
template = " recipe.html "
if Recipe . objects . filter ( pk = recipe_id ) . count ( ) == 0 :
return redirect ( builds )
2014-01-18 00:58:08 +00:00
2015-08-18 16:28:53 +00:00
recipe_object = Recipe . objects . get ( pk = recipe_id )
layer_version = Layer_Version . objects . get ( pk = recipe_object . layer_version_id )
2014-09-30 12:31:57 +00:00
layer = Layer . objects . get ( pk = layer_version . layer_id )
2015-08-18 16:28:53 +00:00
tasks_list = Task . objects . filter ( recipe_id = recipe_id , build_id = build_id ) . exclude ( order__isnull = True ) . exclude ( task_name__endswith = ' _setscene ' ) . exclude ( outcome = Task . OUTCOME_NA )
bitbake: toaster: add sort, search, paging to recipe package page
When selecting the packages tab on a recipe detail page, the page now
includes:
column sort on package name and size columns,
search on the package name, and
pagination.
Column sort is added by splitting the recipe view/html for a recipe's
package list into a new url path, view name and template, so that
the sorting routine, views.reload_params(), interfaces similar to other
views.
Search, sorting, and pagination are implemented for this detail page
using three new templates.
templates/detail_pagination_bottom.html
templates/detail_search_header.html
templates/detail_sorted_header.html
views.recipe() is optimized since the recipe's package list is no
longer needed by the recipe template, only the recipe's package count
is required for the first page.
The recipe view and template also changes to support tabbing to the
right context on the recipe detail page from the recipe-package page.
[YOCTO #6154]
(Bitbake rev: 6cb9e853d05c2c71467af22ef459ffbe6f41de36)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-24 22:14:41 +00:00
package_count = Package . objects . filter ( recipe_id = recipe_id ) . filter ( build_id = build_id ) . filter ( size__gte = 0 ) . count ( )
if active_tab != ' 1 ' and active_tab != ' 3 ' and active_tab != ' 4 ' :
active_tab = ' 1 '
tab_states = { ' 1 ' : ' ' , ' 3 ' : ' ' , ' 4 ' : ' ' }
tab_states [ active_tab ] = ' active '
2014-01-18 00:58:08 +00:00
2013-12-11 16:42:34 +00:00
context = {
2014-09-30 12:31:57 +00:00
' build ' : Build . objects . get ( pk = build_id ) ,
2015-08-18 16:28:53 +00:00
' object ' : recipe_object ,
2014-01-18 00:58:08 +00:00
' layer_version ' : layer_version ,
' layer ' : layer ,
2015-08-18 16:28:53 +00:00
' tasks ' : tasks_list ,
bitbake: toaster: add sort, search, paging to recipe package page
When selecting the packages tab on a recipe detail page, the page now
includes:
column sort on package name and size columns,
search on the package name, and
pagination.
Column sort is added by splitting the recipe view/html for a recipe's
package list into a new url path, view name and template, so that
the sorting routine, views.reload_params(), interfaces similar to other
views.
Search, sorting, and pagination are implemented for this detail page
using three new templates.
templates/detail_pagination_bottom.html
templates/detail_search_header.html
templates/detail_sorted_header.html
views.recipe() is optimized since the recipe's package list is no
longer needed by the recipe template, only the recipe's package count
is required for the first page.
The recipe view and template also changes to support tabbing to the
right context on the recipe detail page from the recipe-package page.
[YOCTO #6154]
(Bitbake rev: 6cb9e853d05c2c71467af22ef459ffbe6f41de36)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-24 22:14:41 +00:00
' package_count ' : package_count ,
' tab_states ' : tab_states ,
2013-12-11 16:42:34 +00:00
}
return render ( request , template , context )
bitbake: toaster: add sort, search, paging to recipe package page
When selecting the packages tab on a recipe detail page, the page now
includes:
column sort on package name and size columns,
search on the package name, and
pagination.
Column sort is added by splitting the recipe view/html for a recipe's
package list into a new url path, view name and template, so that
the sorting routine, views.reload_params(), interfaces similar to other
views.
Search, sorting, and pagination are implemented for this detail page
using three new templates.
templates/detail_pagination_bottom.html
templates/detail_search_header.html
templates/detail_sorted_header.html
views.recipe() is optimized since the recipe's package list is no
longer needed by the recipe template, only the recipe's package count
is required for the first page.
The recipe view and template also changes to support tabbing to the
right context on the recipe detail page from the recipe-package page.
[YOCTO #6154]
(Bitbake rev: 6cb9e853d05c2c71467af22ef459ffbe6f41de36)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-24 22:14:41 +00:00
def recipe_packages ( request , build_id , recipe_id ) :
template = " recipe_packages.html "
if Recipe . objects . filter ( pk = recipe_id ) . count ( ) == 0 :
return redirect ( builds )
( pagesize , orderby ) = _get_parameters_values ( request , 10 , ' name:+ ' )
mandatory_parameters = { ' count ' : pagesize , ' page ' : 1 , ' orderby ' : orderby }
retval = _verify_parameters ( request . GET , mandatory_parameters )
if retval :
return _redirect_parameters ( ' recipe_packages ' , request . GET , mandatory_parameters , build_id = build_id , recipe_id = recipe_id )
( filter_string , search_term , ordering_string ) = _search_tuple ( request , Package )
2015-08-18 16:28:53 +00:00
recipe_object = Recipe . objects . get ( pk = recipe_id )
bitbake: toaster: add sort, search, paging to recipe package page
When selecting the packages tab on a recipe detail page, the page now
includes:
column sort on package name and size columns,
search on the package name, and
pagination.
Column sort is added by splitting the recipe view/html for a recipe's
package list into a new url path, view name and template, so that
the sorting routine, views.reload_params(), interfaces similar to other
views.
Search, sorting, and pagination are implemented for this detail page
using three new templates.
templates/detail_pagination_bottom.html
templates/detail_search_header.html
templates/detail_sorted_header.html
views.recipe() is optimized since the recipe's package list is no
longer needed by the recipe template, only the recipe's package count
is required for the first page.
The recipe view and template also changes to support tabbing to the
right context on the recipe detail page from the recipe-package page.
[YOCTO #6154]
(Bitbake rev: 6cb9e853d05c2c71467af22ef459ffbe6f41de36)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-24 22:14:41 +00:00
queryset = Package . objects . filter ( recipe_id = recipe_id ) . filter ( build_id = build_id ) . filter ( size__gte = 0 )
package_count = queryset . count ( )
queryset = _get_queryset ( Package , queryset , filter_string , search_term , ordering_string , ' name ' )
packages = _build_page_range ( Paginator ( queryset , pagesize ) , request . GET . get ( ' page ' , 1 ) )
context = {
' build ' : Build . objects . get ( pk = build_id ) ,
2015-08-18 16:28:53 +00:00
' recipe ' : recipe_object ,
bitbake: toaster: add sort, search, paging to recipe package page
When selecting the packages tab on a recipe detail page, the page now
includes:
column sort on package name and size columns,
search on the package name, and
pagination.
Column sort is added by splitting the recipe view/html for a recipe's
package list into a new url path, view name and template, so that
the sorting routine, views.reload_params(), interfaces similar to other
views.
Search, sorting, and pagination are implemented for this detail page
using three new templates.
templates/detail_pagination_bottom.html
templates/detail_search_header.html
templates/detail_sorted_header.html
views.recipe() is optimized since the recipe's package list is no
longer needed by the recipe template, only the recipe's package count
is required for the first page.
The recipe view and template also changes to support tabbing to the
right context on the recipe detail page from the recipe-package page.
[YOCTO #6154]
(Bitbake rev: 6cb9e853d05c2c71467af22ef459ffbe6f41de36)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-24 22:14:41 +00:00
' objects ' : packages ,
' object_count ' : package_count ,
' tablecols ' : [
{
' name ' : ' Package ' ,
' orderfield ' : _get_toggle_order ( request , " name " ) ,
' ordericon ' : _get_toggle_order_icon ( request , " name " ) ,
' orderkey ' : " name " ,
} ,
{
' name ' : ' Version ' ,
} ,
{
' name ' : ' Size ' ,
' orderfield ' : _get_toggle_order ( request , " size " , True ) ,
' ordericon ' : _get_toggle_order_icon ( request , " size " ) ,
' orderkey ' : ' size ' ,
' dclass ' : ' sizecol span2 ' ,
} ,
]
}
response = render ( request , template , context )
2015-05-19 12:30:05 +00:00
_set_parameters_values ( pagesize , orderby , request )
bitbake: toaster: add sort, search, paging to recipe package page
When selecting the packages tab on a recipe detail page, the page now
includes:
column sort on package name and size columns,
search on the package name, and
pagination.
Column sort is added by splitting the recipe view/html for a recipe's
package list into a new url path, view name and template, so that
the sorting routine, views.reload_params(), interfaces similar to other
views.
Search, sorting, and pagination are implemented for this detail page
using three new templates.
templates/detail_pagination_bottom.html
templates/detail_search_header.html
templates/detail_sorted_header.html
views.recipe() is optimized since the recipe's package list is no
longer needed by the recipe template, only the recipe's package count
is required for the first page.
The recipe view and template also changes to support tabbing to the
right context on the recipe detail page from the recipe-package page.
[YOCTO #6154]
(Bitbake rev: 6cb9e853d05c2c71467af22ef459ffbe6f41de36)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-24 22:14:41 +00:00
return response
2014-03-12 21:54:09 +00:00
from django . core . serializers . json import DjangoJSONEncoder
from django . http import HttpResponse
2015-05-11 17:58:25 +00:00
def xhr_dirinfo ( request , build_id , target_id ) :
2014-03-12 21:54:09 +00:00
top = request . GET . get ( ' start ' , ' / ' )
2015-05-11 17:58:25 +00:00
return HttpResponse ( _get_dir_entries ( build_id , target_id , top ) , content_type = " application/json " )
2014-03-12 21:54:09 +00:00
from django . utils . functional import Promise
from django . utils . encoding import force_text
class LazyEncoder ( json . JSONEncoder ) :
def default ( self , obj ) :
if isinstance ( obj , Promise ) :
return force_text ( obj )
return super ( LazyEncoder , self ) . default ( obj )
from toastergui . templatetags . projecttags import filtered_filesizeformat
import os
def _get_dir_entries ( build_id , target_id , start ) :
node_str = {
Target_File . ITYPE_REGULAR : ' - ' ,
Target_File . ITYPE_DIRECTORY : ' d ' ,
Target_File . ITYPE_SYMLINK : ' l ' ,
Target_File . ITYPE_SOCKET : ' s ' ,
Target_File . ITYPE_FIFO : ' p ' ,
Target_File . ITYPE_CHARACTER : ' c ' ,
Target_File . ITYPE_BLOCK : ' b ' ,
}
response = [ ]
objects = Target_File . objects . filter ( target__exact = target_id , directory__path = start )
target_packages = Target_Installed_Package . objects . filter ( target__exact = target_id ) . values_list ( ' package_id ' , flat = True )
for o in objects :
# exclude root inode '/'
if o . path == ' / ' :
continue
try :
entry = { }
entry [ ' parent ' ] = start
entry [ ' name ' ] = os . path . basename ( o . path )
entry [ ' fullpath ' ] = o . path
# set defaults, not all dentries have packages
entry [ ' installed_package ' ] = None
entry [ ' package_id ' ] = None
entry [ ' package ' ] = None
entry [ ' link_to ' ] = None
if o . inodetype == Target_File . ITYPE_DIRECTORY :
entry [ ' isdir ' ] = 1
# is there content in directory
2014-03-25 20:23:53 +00:00
entry [ ' childcount ' ] = Target_File . objects . filter ( target__exact = target_id , directory__path = o . path ) . all ( ) . count ( )
2014-03-12 21:54:09 +00:00
else :
entry [ ' isdir ' ] = 0
# resolve the file to get the package from the resolved file
resolved_id = o . sym_target_id
resolved_path = o . path
if target_packages . count ( ) :
while resolved_id != " " and resolved_id != None :
tf = Target_File . objects . get ( pk = resolved_id )
resolved_path = tf . path
resolved_id = tf . sym_target_id
thisfile = Package_File . objects . all ( ) . filter ( path__exact = resolved_path , package_id__in = target_packages )
if thisfile . count ( ) :
p = Package . objects . get ( pk = thisfile [ 0 ] . package_id )
entry [ ' installed_package ' ] = p . installed_name
entry [ ' package_id ' ] = str ( p . id )
entry [ ' package ' ] = p . name
# don't use resolved path from above, show immediate link-to
if o . sym_target_id != " " and o . sym_target_id != None :
entry [ ' link_to ' ] = Target_File . objects . get ( pk = o . sym_target_id ) . path
2014-09-25 15:10:33 +00:00
entry [ ' size ' ] = filtered_filesizeformat ( o . size )
2014-03-12 21:54:09 +00:00
if entry [ ' link_to ' ] != None :
entry [ ' permission ' ] = node_str [ o . inodetype ] + o . permission
else :
entry [ ' permission ' ] = node_str [ o . inodetype ] + o . permission
entry [ ' owner ' ] = o . owner
entry [ ' group ' ] = o . group
response . append ( entry )
2014-09-25 15:10:33 +00:00
except Exception as e :
2016-05-09 13:05:09 +00:00
print ( " Exception " , e )
2016-06-10 09:34:12 +00:00
traceback . print_exc ( )
2014-03-12 21:54:09 +00:00
# sort by directories first, then by name
rsorted = sorted ( response , key = lambda entry : entry [ ' name ' ] )
rsorted = sorted ( rsorted , key = lambda entry : entry [ ' isdir ' ] , reverse = True )
2014-11-11 17:01:09 +00:00
return json . dumps ( rsorted , cls = LazyEncoder ) . replace ( ' </ ' , ' < \\ / ' )
2014-03-12 21:54:09 +00:00
def dirinfo ( request , build_id , target_id , file_path = None ) :
template = " dirinfo.html "
objects = _get_dir_entries ( build_id , target_id , ' / ' )
packages_sum = Package . objects . filter ( id__in = Target_Installed_Package . objects . filter ( target_id = target_id ) . values ( ' package_id ' ) ) . aggregate ( Sum ( ' installed_size ' ) )
dir_list = None
if file_path != None :
"""
Link from the included package detail file list page and is
requesting opening the dir info to a specific file path .
Provide the list of directories to expand and the full path to
highlight in the page .
"""
# Aassume target's path separator matches host's, that is, os.sep
sep = os . sep
dir_list = [ ]
head = file_path
while head != sep :
2015-08-18 16:28:47 +00:00
( head , tail ) = os . path . split ( head )
2014-03-12 21:54:09 +00:00
if head != sep :
dir_list . insert ( 0 , head )
2016-04-19 16:28:46 +00:00
build = Build . objects . get ( pk = build_id )
context = { ' build ' : build ,
' project ' : build . project ,
2014-09-30 12:31:57 +00:00
' target ' : Target . objects . get ( pk = target_id ) ,
2014-03-12 21:54:09 +00:00
' packages_sum ' : packages_sum [ ' installed_size__sum ' ] ,
' objects ' : objects ,
' dir_list ' : dir_list ,
' file_path ' : file_path ,
}
return render ( request , template , context )
2013-12-11 16:42:34 +00:00
2015-08-18 16:28:53 +00:00
def _find_task_dep ( task_object ) :
2016-05-10 13:18:02 +00:00
tdeps = Task_Dependency . objects . filter ( task = task_object ) . filter ( depends_on__order__gt = 0 )
tdeps = tdeps . exclude ( depends_on__outcome = Task . OUTCOME_NA ) . select_related ( " depends_on " )
return [ x . depends_on for x in tdeps ]
2013-12-11 16:42:34 +00:00
2015-08-18 16:28:53 +00:00
def _find_task_revdep ( task_object ) :
2016-05-10 13:18:02 +00:00
tdeps = Task_Dependency . objects . filter ( depends_on = task_object ) . filter ( task__order__gt = 0 )
tdeps = tdeps . exclude ( task__outcome = Task . OUTCOME_NA ) . select_related ( " task " , " task__recipe " , " task__build " )
2016-07-29 11:25:46 +00:00
# exclude self-dependencies to prevent infinite dependency loop
# in generateCoveredList2()
tdeps = tdeps . exclude ( task = task_object )
2016-05-10 13:18:02 +00:00
return [ tdep . task for tdep in tdeps ]
2015-02-24 17:20:58 +00:00
def _find_task_revdep_list ( tasklist ) :
2016-05-10 13:18:02 +00:00
tdeps = Task_Dependency . objects . filter ( depends_on__in = tasklist ) . filter ( task__order__gt = 0 )
tdeps = tdeps . exclude ( task__outcome = Task . OUTCOME_NA ) . select_related ( " task " , " task__recipe " , " task__build " )
2016-07-29 11:25:46 +00:00
# exclude self-dependencies to prevent infinite dependency loop
# in generateCoveredList2()
tdeps = tdeps . exclude ( task = F ( ' depends_on ' ) )
2016-05-10 13:18:02 +00:00
return [ tdep . task for tdep in tdeps ]
2013-12-18 19:50:45 +00:00
2015-08-18 16:28:53 +00:00
def _find_task_provider ( task_object ) :
task_revdeps = _find_task_revdep ( task_object )
2013-12-18 19:50:45 +00:00
for tr in task_revdeps :
if tr . outcome != Task . OUTCOME_COVERED :
return tr
for tr in task_revdeps :
trc = _find_task_provider ( tr )
if trc is not None :
return trc
return None
def configuration ( request , build_id ) :
template = ' configuration.html '
2014-02-28 13:55:46 +00:00
2015-05-02 15:50:34 +00:00
var_names = ( ' BB_VERSION ' , ' BUILD_SYS ' , ' NATIVELSBSTRING ' , ' TARGET_SYS ' ,
' MACHINE ' , ' DISTRO ' , ' DISTRO_VERSION ' , ' TUNE_FEATURES ' , ' TARGET_FPU ' )
context = dict ( Variable . objects . filter ( build = build_id , variable_name__in = var_names ) \
. values_list ( ' variable_name ' , ' variable_value ' ) )
2016-04-19 16:28:46 +00:00
build = Build . objects . get ( pk = build_id )
2015-05-02 15:50:34 +00:00
context . update ( { ' objectname ' : ' configuration ' ,
' object_search_display ' : ' variables ' ,
' filter_search_display ' : ' variables ' ,
2016-04-19 16:28:46 +00:00
' build ' : build ,
' project ' : build . project ,
2015-05-02 15:50:34 +00:00
' targets ' : Target . objects . filter ( build = build_id ) } )
2014-01-07 13:10:42 +00:00
return render ( request , template , context )
def configvars ( request , build_id ) :
template = ' configvars.html '
2014-08-29 12:51:01 +00:00
( pagesize , orderby ) = _get_parameters_values ( request , 100 , ' variable_name:+ ' )
mandatory_parameters = { ' count ' : pagesize , ' page ' : 1 , ' orderby ' : orderby , ' filter ' : ' description__regex:.+ ' }
2013-12-13 17:14:34 +00:00
retval = _verify_parameters ( request . GET , mandatory_parameters )
2014-03-15 22:10:27 +00:00
( filter_string , search_term , ordering_string ) = _search_tuple ( request , Variable )
2013-12-13 17:14:34 +00:00
if retval :
2014-03-15 22:10:27 +00:00
# if new search, clear the default filter
if search_term and len ( search_term ) :
mandatory_parameters [ ' filter ' ] = ' '
2014-01-07 13:10:42 +00:00
return _redirect_parameters ( ' configvars ' , request . GET , mandatory_parameters , build_id = build_id )
2014-02-28 13:55:46 +00:00
queryset = Variable . objects . filter ( build = build_id ) . exclude ( variable_name__istartswith = ' B_ ' ) . exclude ( variable_name__istartswith = ' do_ ' )
2014-03-26 23:24:43 +00:00
queryset_with_search = _get_queryset ( Variable , queryset , None , search_term , ordering_string , ' variable_name ' ) . exclude ( variable_value = ' ' , vhistory__file_name__isnull = True )
queryset = _get_queryset ( Variable , queryset , filter_string , search_term , ordering_string , ' variable_name ' )
2014-02-28 13:55:46 +00:00
# remove records where the value is empty AND there are no history files
2014-03-12 21:54:09 +00:00
queryset = queryset . exclude ( variable_value = ' ' , vhistory__file_name__isnull = True )
2014-01-07 13:10:42 +00:00
2014-08-29 12:51:01 +00:00
variables = _build_page_range ( Paginator ( queryset , pagesize ) , request . GET . get ( ' page ' , 1 ) )
2014-01-07 13:10:42 +00:00
2014-04-08 16:25:44 +00:00
# show all matching files (not just the last one)
2014-02-28 13:55:46 +00:00
file_filter = search_term + " : "
2014-04-08 16:25:44 +00:00
if filter_string . find ( ' /conf/ ' ) > 0 :
file_filter + = ' conf/(local|bblayers).conf '
2014-02-28 13:55:46 +00:00
if filter_string . find ( ' conf/machine/ ' ) > 0 :
file_filter + = ' conf/machine/ '
if filter_string . find ( ' conf/distro/ ' ) > 0 :
file_filter + = ' conf/distro/ '
if filter_string . find ( ' /bitbake.conf ' ) > 0 :
file_filter + = ' /bitbake.conf '
2014-09-30 12:31:57 +00:00
build_dir = re . sub ( " /tmp/log/.* " , " " , Build . objects . get ( pk = build_id ) . cooker_log_path )
2014-03-12 21:54:09 +00:00
2016-04-19 16:28:46 +00:00
build = Build . objects . get ( pk = build_id )
2014-01-07 13:10:42 +00:00
context = {
2014-02-28 13:55:46 +00:00
' objectname ' : ' configvars ' ,
2014-03-15 13:41:58 +00:00
' object_search_display ' : ' BitBake variables ' ,
2014-02-28 13:55:46 +00:00
' filter_search_display ' : ' variables ' ,
' file_filter ' : file_filter ,
2016-04-19 16:28:46 +00:00
' build ' : build ,
' project ' : build . project ,
2014-01-07 13:10:42 +00:00
' objects ' : variables ,
2014-03-12 18:47:41 +00:00
' total_count ' : queryset_with_search . count ( ) ,
2014-05-21 14:15:08 +00:00
' default_orderby ' : ' variable_name:+ ' ,
2014-03-12 18:47:41 +00:00
' search_term ' : search_term ,
2014-01-07 13:10:42 +00:00
# Specifies the display of columns for the table, appearance in "Edit columns" box, toggling default show/hide, and specifying filters for columns
' tablecols ' : [
2014-03-16 14:21:55 +00:00
{ ' name ' : ' Variable ' ,
2014-02-28 13:55:46 +00:00
' qhelp ' : " BitBake is a generic task executor that considers a list of tasks with dependencies and handles metadata that consists of variables in a certain format that get passed to the tasks " ,
2014-01-07 13:10:42 +00:00
' orderfield ' : _get_toggle_order ( request , " variable_name " ) ,
2014-02-28 13:55:46 +00:00
' ordericon ' : _get_toggle_order_icon ( request , " variable_name " ) ,
2014-01-07 13:10:42 +00:00
} ,
2014-03-16 14:21:55 +00:00
{ ' name ' : ' Value ' ,
2014-01-07 13:10:42 +00:00
' qhelp ' : " The value assigned to the variable " ,
} ,
2014-02-28 13:55:46 +00:00
{ ' name ' : ' Set in file ' ,
' qhelp ' : " The last configuration file that touched the variable value " ,
' clclass ' : ' file ' , ' hidden ' : 0 ,
2014-05-21 14:15:08 +00:00
' orderkey ' : ' vhistory__file_name ' ,
2014-02-28 13:55:46 +00:00
' filter ' : {
' class ' : ' vhistory__file_name ' ,
' label ' : ' Show: ' ,
' options ' : [
2014-04-08 16:25:44 +00:00
( ' Local configuration variables ' , ' vhistory__file_name__contains: ' + build_dir + ' /conf/ ' , queryset_with_search . filter ( vhistory__file_name__contains = build_dir + ' /conf/ ' ) . count ( ) , ' Select this filter to see variables set by the <code>local.conf</code> and <code>bblayers.conf</code> configuration files inside the <code>/build/conf/</code> directory ' ) ,
2014-03-15 00:13:06 +00:00
( ' Machine configuration variables ' , ' vhistory__file_name__contains:conf/machine/ ' , queryset_with_search . filter ( vhistory__file_name__contains = ' conf/machine ' ) . count ( ) , ' Select this filter to see variables set by the configuration file(s) inside your layers <code>/conf/machine/</code> directory ' ) ,
( ' Distro configuration variables ' , ' vhistory__file_name__contains:conf/distro/ ' , queryset_with_search . filter ( vhistory__file_name__contains = ' conf/distro ' ) . count ( ) , ' Select this filter to see variables set by the configuration file(s) inside your layers <code>/conf/distro/</code> directory ' ) ,
( ' Layer configuration variables ' , ' vhistory__file_name__contains:conf/layer.conf ' , queryset_with_search . filter ( vhistory__file_name__contains = ' conf/layer.conf ' ) . count ( ) , ' Select this filter to see variables set by the <code>layer.conf</code> configuration file inside your layers ' ) ,
( ' bitbake.conf variables ' , ' vhistory__file_name__contains:/bitbake.conf ' , queryset_with_search . filter ( vhistory__file_name__contains = ' /bitbake.conf ' ) . count ( ) , ' Select this filter to see variables set by the <code>bitbake.conf</code> configuration file ' ) ,
2014-02-28 13:55:46 +00:00
]
} ,
2014-01-07 13:10:42 +00:00
} ,
2014-03-16 14:21:55 +00:00
{ ' name ' : ' Description ' ,
2014-02-28 13:55:46 +00:00
' qhelp ' : " A brief explanation of the variable " ,
' clclass ' : ' description ' , ' hidden ' : 0 ,
2014-04-01 00:56:44 +00:00
' dclass ' : " span4 " ,
2014-02-28 13:55:46 +00:00
' filter ' : {
' class ' : ' description ' ,
' label ' : ' Show: ' ,
' options ' : [
2014-03-16 13:09:34 +00:00
( ' Variables with description ' , ' description__regex:.+ ' , queryset_with_search . filter ( description__regex = ' .+ ' ) . count ( ) , ' We provide descriptions for the most common BitBake variables. The list of descriptions lives in <code>meta/conf/documentation.conf</code> ' ) ,
2014-02-28 13:55:46 +00:00
]
} ,
} ,
] ,
2014-01-07 13:10:42 +00:00
}
2013-12-13 17:14:34 +00:00
2014-08-29 12:51:01 +00:00
response = render ( request , template , context )
2015-05-19 12:30:05 +00:00
_set_parameters_values ( pagesize , orderby , request )
2014-08-29 12:51:01 +00:00
return response
2014-01-07 13:10:42 +00:00
2013-12-18 19:50:45 +00:00
def bfile ( request , build_id , package_id ) :
template = ' bfile.html '
files = Package_File . objects . filter ( package = package_id )
2016-04-19 16:28:46 +00:00
build = Build . objects . get ( pk = build_id )
context = {
' build ' : build ,
' project ' : build . project ,
' objects ' : files
}
2013-12-18 19:50:45 +00:00
return render ( request , template , context )
2014-01-23 17:47:41 +00:00
# A set of dependency types valid for both included and built package views
OTHER_DEPENDS_BASE = [
Package_Dependency . TYPE_RSUGGESTS ,
Package_Dependency . TYPE_RPROVIDES ,
Package_Dependency . TYPE_RREPLACES ,
Package_Dependency . TYPE_RCONFLICTS ,
]
# value for invalid row id
INVALID_KEY = - 1
"""
Given a package id , target_id retrieves two sets of this image and package ' s
dependencies . The return value is a dictionary consisting of two other
lists : a list of ' runtime ' dependencies , that is , having RDEPENDS
values in source package ' s recipe, and a list of other dependencies, that is
the list of possible recipe variables as found in OTHER_DEPENDS_BASE plus
2015-04-16 23:03:50 +00:00
the RRECOMMENDS or TRECOMMENDS value .
2014-01-23 17:47:41 +00:00
The lists are built in the sort order specified for the package runtime
dependency views .
"""
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
def _get_package_dependencies ( package_id , target_id = INVALID_KEY ) :
2014-01-23 17:47:41 +00:00
runtime_deps = [ ]
other_deps = [ ]
other_depends_types = OTHER_DEPENDS_BASE
if target_id != INVALID_KEY :
rdepends_type = Package_Dependency . TYPE_TRDEPENDS
other_depends_types + = [ Package_Dependency . TYPE_TRECOMMENDS ]
else :
rdepends_type = Package_Dependency . TYPE_RDEPENDS
other_depends_types + = [ Package_Dependency . TYPE_RRECOMMENDS ]
package = Package . objects . get ( pk = package_id )
if target_id != INVALID_KEY :
alldeps = package . package_dependencies_source . filter ( target_id__exact = target_id )
else :
alldeps = package . package_dependencies_source . all ( )
for idep in alldeps :
dep_package = Package . objects . get ( pk = idep . depends_on_id )
dep_entry = Package_Dependency . DEPENDS_DICT [ idep . dep_type ]
if dep_package . version == ' ' :
version = ' '
else :
version = dep_package . version + " - " + dep_package . revision
installed = False
if target_id != INVALID_KEY :
if Target_Installed_Package . objects . filter ( target_id__exact = target_id , package_id__exact = dep_package . id ) . count ( ) > 0 :
installed = True
dep = {
' name ' : dep_package . name ,
' version ' : version ,
' size ' : dep_package . size ,
' dep_type ' : idep . dep_type ,
' dep_type_display ' : dep_entry [ 0 ] . capitalize ( ) ,
' dep_type_help ' : dep_entry [ 1 ] % ( dep_package . name , package . name ) ,
' depends_on_id ' : dep_package . id ,
' installed ' : installed ,
}
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
if target_id != INVALID_KEY :
dep [ ' alias ' ] = _get_package_alias ( dep_package )
2014-01-23 17:47:41 +00:00
if idep . dep_type == rdepends_type :
runtime_deps . append ( dep )
elif idep . dep_type in other_depends_types :
other_deps . append ( dep )
rdep_sorted = sorted ( runtime_deps , key = lambda k : k [ ' name ' ] )
odep_sorted = sorted (
sorted ( other_deps , key = lambda k : k [ ' name ' ] ) ,
key = lambda k : k [ ' dep_type ' ] )
retvalues = { ' runtime_deps ' : rdep_sorted , ' other_deps ' : odep_sorted }
return retvalues
# Return the count of packages dependent on package for this target_id image
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
def _get_package_reverse_dep_count ( package , target_id ) :
2014-01-23 17:47:41 +00:00
return package . package_dependencies_target . filter ( target_id__exact = target_id , dep_type__exact = Package_Dependency . TYPE_TRDEPENDS ) . count ( )
# Return the count of the packages that this package_id is dependent on.
# Use one of the two RDEPENDS types, either TRDEPENDS if the package was
# installed, or else RDEPENDS if only built.
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
def _get_package_dependency_count ( package , target_id , is_installed ) :
2014-01-23 17:47:41 +00:00
if is_installed :
return package . package_dependencies_source . filter ( target_id__exact = target_id ,
dep_type__exact = Package_Dependency . TYPE_TRDEPENDS ) . count ( )
else :
return package . package_dependencies_source . filter ( dep_type__exact = Package_Dependency . TYPE_RDEPENDS ) . count ( )
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
def _get_package_alias ( package ) :
alias = package . installed_name
if alias != None and alias != ' ' and alias != package . name :
return alias
else :
return ' '
def _get_fullpackagespec ( package ) :
r = package . name
version_good = package . version != None and package . version != ' '
revision_good = package . revision != None and package . revision != ' '
if version_good or revision_good :
r + = ' _ '
if version_good :
r + = package . version
if revision_good :
r + = ' - '
if revision_good :
r + = package . revision
return r
2014-01-23 17:47:41 +00:00
def package_built_detail ( request , build_id , package_id ) :
template = " package_built_detail.html "
if Build . objects . filter ( pk = build_id ) . count ( ) == 0 :
return redirect ( builds )
bitbake: toaster: sort on size in detail pages
[YOCTO 5778]
Implements the features described in the attachment to bugzilla 5778
- new global changes to the format of size data, and
- adding sorts by selected columns to specific detail pages.
Although new pagination and row search capabilities are shown on the
screen shots for the 5778 attachment, those features are specified in
a different bugzilla entry 5777 and are not implemented in this commit.
Also, the 5778 spec includes table sorting for the recipe package
detail page, but sorting for that page was not implemented in this
commit due to complications with sorting then returning to a page that
is only one URL fragment in a template.
The scope of file changes are described below.
Changes to support new 'size' field column formats...
default.css - added sizecol class style (right justified)
projecttags.py - changed filtered_filesizeformat to allow
".0" suffixes
Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or
<td> size columns were made to...
dirinfo.py,
package_built_dependencies.html,
package_included_dependencies.html,
recipe.html,
bpackage.html, and
target.html
More significant changes to support detail page table sorting
are:
- tablesort.html: New created to implement the sort icons,
directions, and table headings, and
suppress sort handling if 'disable_sort' in context,
without search or pagination elements ingrained
in basetable_top. Confining the changes to this small file
reduces the impact (testing and risk) on the larger set of
files that arleady include basetable_top/bottom files.
- view.py: Modified the following view functions with
- trivial changes for size formatting to the views: target,
- changes to package_built_detail, package_included_detail,
package_included_reverse_dependencies to handle the sorting
implementation as well as moving headings and size
formatting for size columns from templates to the views.
- Implementation of the detail sorting using above in:
package_built_detail.html,
package_included_detail.html, and
package_included_reverse_dependencies.html
to include the tablesort heading setup, format the size column,
and iterate over the new sorted objects, suppressing sorts if
table row count less than 2.
(Bitbake rev: d16126e9abfffde66ab70865a81997322847d44e)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08 16:32:21 +00:00
# follow convention for pagination w/ search although not used for this view
queryset = Package_File . objects . filter ( package_id__exact = package_id )
2014-08-29 12:51:01 +00:00
( pagesize , orderby ) = _get_parameters_values ( request , 25 , ' path:+ ' )
mandatory_parameters = { ' count ' : pagesize , ' page ' : 1 , ' orderby ' : orderby }
bitbake: toaster: sort on size in detail pages
[YOCTO 5778]
Implements the features described in the attachment to bugzilla 5778
- new global changes to the format of size data, and
- adding sorts by selected columns to specific detail pages.
Although new pagination and row search capabilities are shown on the
screen shots for the 5778 attachment, those features are specified in
a different bugzilla entry 5777 and are not implemented in this commit.
Also, the 5778 spec includes table sorting for the recipe package
detail page, but sorting for that page was not implemented in this
commit due to complications with sorting then returning to a page that
is only one URL fragment in a template.
The scope of file changes are described below.
Changes to support new 'size' field column formats...
default.css - added sizecol class style (right justified)
projecttags.py - changed filtered_filesizeformat to allow
".0" suffixes
Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or
<td> size columns were made to...
dirinfo.py,
package_built_dependencies.html,
package_included_dependencies.html,
recipe.html,
bpackage.html, and
target.html
More significant changes to support detail page table sorting
are:
- tablesort.html: New created to implement the sort icons,
directions, and table headings, and
suppress sort handling if 'disable_sort' in context,
without search or pagination elements ingrained
in basetable_top. Confining the changes to this small file
reduces the impact (testing and risk) on the larger set of
files that arleady include basetable_top/bottom files.
- view.py: Modified the following view functions with
- trivial changes for size formatting to the views: target,
- changes to package_built_detail, package_included_detail,
package_included_reverse_dependencies to handle the sorting
implementation as well as moving headings and size
formatting for size columns from templates to the views.
- Implementation of the detail sorting using above in:
package_built_detail.html,
package_included_detail.html, and
package_included_reverse_dependencies.html
to include the tablesort heading setup, format the size column,
and iterate over the new sorted objects, suppressing sorts if
table row count less than 2.
(Bitbake rev: d16126e9abfffde66ab70865a81997322847d44e)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08 16:32:21 +00:00
retval = _verify_parameters ( request . GET , mandatory_parameters )
if retval :
return _redirect_parameters ( ' package_built_detail ' , request . GET , mandatory_parameters , build_id = build_id , package_id = package_id )
( filter_string , search_term , ordering_string ) = _search_tuple ( request , Package_File )
paths = _get_queryset ( Package_File , queryset , filter_string , search_term , ordering_string , ' path ' )
2014-09-30 12:31:57 +00:00
package = Package . objects . get ( pk = package_id )
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
package . fullpackagespec = _get_fullpackagespec ( package )
2014-01-23 17:47:41 +00:00
context = {
2014-09-30 12:31:57 +00:00
' build ' : Build . objects . get ( pk = build_id ) ,
2014-01-23 17:47:41 +00:00
' package ' : package ,
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
' dependency_count ' : _get_package_dependency_count ( package , - 1 , False ) ,
bitbake: toaster: sort on size in detail pages
[YOCTO 5778]
Implements the features described in the attachment to bugzilla 5778
- new global changes to the format of size data, and
- adding sorts by selected columns to specific detail pages.
Although new pagination and row search capabilities are shown on the
screen shots for the 5778 attachment, those features are specified in
a different bugzilla entry 5777 and are not implemented in this commit.
Also, the 5778 spec includes table sorting for the recipe package
detail page, but sorting for that page was not implemented in this
commit due to complications with sorting then returning to a page that
is only one URL fragment in a template.
The scope of file changes are described below.
Changes to support new 'size' field column formats...
default.css - added sizecol class style (right justified)
projecttags.py - changed filtered_filesizeformat to allow
".0" suffixes
Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or
<td> size columns were made to...
dirinfo.py,
package_built_dependencies.html,
package_included_dependencies.html,
recipe.html,
bpackage.html, and
target.html
More significant changes to support detail page table sorting
are:
- tablesort.html: New created to implement the sort icons,
directions, and table headings, and
suppress sort handling if 'disable_sort' in context,
without search or pagination elements ingrained
in basetable_top. Confining the changes to this small file
reduces the impact (testing and risk) on the larger set of
files that arleady include basetable_top/bottom files.
- view.py: Modified the following view functions with
- trivial changes for size formatting to the views: target,
- changes to package_built_detail, package_included_detail,
package_included_reverse_dependencies to handle the sorting
implementation as well as moving headings and size
formatting for size columns from templates to the views.
- Implementation of the detail sorting using above in:
package_built_detail.html,
package_included_detail.html, and
package_included_reverse_dependencies.html
to include the tablesort heading setup, format the size column,
and iterate over the new sorted objects, suppressing sorts if
table row count less than 2.
(Bitbake rev: d16126e9abfffde66ab70865a81997322847d44e)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08 16:32:21 +00:00
' objects ' : paths ,
' tablecols ' : [
{
' name ' : ' File ' ,
' orderfield ' : _get_toggle_order ( request , " path " ) ,
' ordericon ' : _get_toggle_order_icon ( request , " path " ) ,
} ,
{
' name ' : ' Size ' ,
' orderfield ' : _get_toggle_order ( request , " size " , True ) ,
' ordericon ' : _get_toggle_order_icon ( request , " size " ) ,
' dclass ' : ' sizecol span2 ' ,
} ,
]
2014-01-23 17:47:41 +00:00
}
bitbake: toaster: sort on size in detail pages
[YOCTO 5778]
Implements the features described in the attachment to bugzilla 5778
- new global changes to the format of size data, and
- adding sorts by selected columns to specific detail pages.
Although new pagination and row search capabilities are shown on the
screen shots for the 5778 attachment, those features are specified in
a different bugzilla entry 5777 and are not implemented in this commit.
Also, the 5778 spec includes table sorting for the recipe package
detail page, but sorting for that page was not implemented in this
commit due to complications with sorting then returning to a page that
is only one URL fragment in a template.
The scope of file changes are described below.
Changes to support new 'size' field column formats...
default.css - added sizecol class style (right justified)
projecttags.py - changed filtered_filesizeformat to allow
".0" suffixes
Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or
<td> size columns were made to...
dirinfo.py,
package_built_dependencies.html,
package_included_dependencies.html,
recipe.html,
bpackage.html, and
target.html
More significant changes to support detail page table sorting
are:
- tablesort.html: New created to implement the sort icons,
directions, and table headings, and
suppress sort handling if 'disable_sort' in context,
without search or pagination elements ingrained
in basetable_top. Confining the changes to this small file
reduces the impact (testing and risk) on the larger set of
files that arleady include basetable_top/bottom files.
- view.py: Modified the following view functions with
- trivial changes for size formatting to the views: target,
- changes to package_built_detail, package_included_detail,
package_included_reverse_dependencies to handle the sorting
implementation as well as moving headings and size
formatting for size columns from templates to the views.
- Implementation of the detail sorting using above in:
package_built_detail.html,
package_included_detail.html, and
package_included_reverse_dependencies.html
to include the tablesort heading setup, format the size column,
and iterate over the new sorted objects, suppressing sorts if
table row count less than 2.
(Bitbake rev: d16126e9abfffde66ab70865a81997322847d44e)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08 16:32:21 +00:00
if paths . all ( ) . count ( ) < 2 :
context [ ' disable_sort ' ] = True ;
2014-08-29 12:51:01 +00:00
response = render ( request , template , context )
2015-05-19 12:30:05 +00:00
_set_parameters_values ( pagesize , orderby , request )
2014-08-29 12:51:01 +00:00
return response
2014-01-23 17:47:41 +00:00
def package_built_dependencies ( request , build_id , package_id ) :
template = " package_built_dependencies.html "
if Build . objects . filter ( pk = build_id ) . count ( ) == 0 :
return redirect ( builds )
2014-09-30 12:31:57 +00:00
package = Package . objects . get ( pk = package_id )
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
package . fullpackagespec = _get_fullpackagespec ( package )
dependencies = _get_package_dependencies ( package_id )
2014-01-23 17:47:41 +00:00
context = {
2014-09-30 12:31:57 +00:00
' build ' : Build . objects . get ( pk = build_id ) ,
2014-01-23 17:47:41 +00:00
' package ' : package ,
' runtime_deps ' : dependencies [ ' runtime_deps ' ] ,
' other_deps ' : dependencies [ ' other_deps ' ] ,
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
' dependency_count ' : _get_package_dependency_count ( package , - 1 , False )
2014-01-23 17:47:41 +00:00
}
return render ( request , template , context )
def package_included_detail ( request , build_id , target_id , package_id ) :
template = " package_included_detail.html "
if Build . objects . filter ( pk = build_id ) . count ( ) == 0 :
return redirect ( builds )
bitbake: toaster: sort on size in detail pages
[YOCTO 5778]
Implements the features described in the attachment to bugzilla 5778
- new global changes to the format of size data, and
- adding sorts by selected columns to specific detail pages.
Although new pagination and row search capabilities are shown on the
screen shots for the 5778 attachment, those features are specified in
a different bugzilla entry 5777 and are not implemented in this commit.
Also, the 5778 spec includes table sorting for the recipe package
detail page, but sorting for that page was not implemented in this
commit due to complications with sorting then returning to a page that
is only one URL fragment in a template.
The scope of file changes are described below.
Changes to support new 'size' field column formats...
default.css - added sizecol class style (right justified)
projecttags.py - changed filtered_filesizeformat to allow
".0" suffixes
Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or
<td> size columns were made to...
dirinfo.py,
package_built_dependencies.html,
package_included_dependencies.html,
recipe.html,
bpackage.html, and
target.html
More significant changes to support detail page table sorting
are:
- tablesort.html: New created to implement the sort icons,
directions, and table headings, and
suppress sort handling if 'disable_sort' in context,
without search or pagination elements ingrained
in basetable_top. Confining the changes to this small file
reduces the impact (testing and risk) on the larger set of
files that arleady include basetable_top/bottom files.
- view.py: Modified the following view functions with
- trivial changes for size formatting to the views: target,
- changes to package_built_detail, package_included_detail,
package_included_reverse_dependencies to handle the sorting
implementation as well as moving headings and size
formatting for size columns from templates to the views.
- Implementation of the detail sorting using above in:
package_built_detail.html,
package_included_detail.html, and
package_included_reverse_dependencies.html
to include the tablesort heading setup, format the size column,
and iterate over the new sorted objects, suppressing sorts if
table row count less than 2.
(Bitbake rev: d16126e9abfffde66ab70865a81997322847d44e)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08 16:32:21 +00:00
# follow convention for pagination w/ search although not used for this view
2014-08-29 12:51:01 +00:00
( pagesize , orderby ) = _get_parameters_values ( request , 25 , ' path:+ ' )
mandatory_parameters = { ' count ' : pagesize , ' page ' : 1 , ' orderby ' : orderby }
bitbake: toaster: sort on size in detail pages
[YOCTO 5778]
Implements the features described in the attachment to bugzilla 5778
- new global changes to the format of size data, and
- adding sorts by selected columns to specific detail pages.
Although new pagination and row search capabilities are shown on the
screen shots for the 5778 attachment, those features are specified in
a different bugzilla entry 5777 and are not implemented in this commit.
Also, the 5778 spec includes table sorting for the recipe package
detail page, but sorting for that page was not implemented in this
commit due to complications with sorting then returning to a page that
is only one URL fragment in a template.
The scope of file changes are described below.
Changes to support new 'size' field column formats...
default.css - added sizecol class style (right justified)
projecttags.py - changed filtered_filesizeformat to allow
".0" suffixes
Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or
<td> size columns were made to...
dirinfo.py,
package_built_dependencies.html,
package_included_dependencies.html,
recipe.html,
bpackage.html, and
target.html
More significant changes to support detail page table sorting
are:
- tablesort.html: New created to implement the sort icons,
directions, and table headings, and
suppress sort handling if 'disable_sort' in context,
without search or pagination elements ingrained
in basetable_top. Confining the changes to this small file
reduces the impact (testing and risk) on the larger set of
files that arleady include basetable_top/bottom files.
- view.py: Modified the following view functions with
- trivial changes for size formatting to the views: target,
- changes to package_built_detail, package_included_detail,
package_included_reverse_dependencies to handle the sorting
implementation as well as moving headings and size
formatting for size columns from templates to the views.
- Implementation of the detail sorting using above in:
package_built_detail.html,
package_included_detail.html, and
package_included_reverse_dependencies.html
to include the tablesort heading setup, format the size column,
and iterate over the new sorted objects, suppressing sorts if
table row count less than 2.
(Bitbake rev: d16126e9abfffde66ab70865a81997322847d44e)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08 16:32:21 +00:00
retval = _verify_parameters ( request . GET , mandatory_parameters )
if retval :
return _redirect_parameters ( ' package_included_detail ' , request . GET , mandatory_parameters , build_id = build_id , target_id = target_id , package_id = package_id )
( filter_string , search_term , ordering_string ) = _search_tuple ( request , Package_File )
queryset = Package_File . objects . filter ( package_id__exact = package_id )
paths = _get_queryset ( Package_File , queryset , filter_string , search_term , ordering_string , ' path ' )
2014-09-30 12:31:57 +00:00
package = Package . objects . get ( pk = package_id )
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
package . fullpackagespec = _get_fullpackagespec ( package )
package . alias = _get_package_alias ( package )
2014-09-30 12:31:57 +00:00
target = Target . objects . get ( pk = target_id )
2014-01-23 17:47:41 +00:00
context = {
2014-09-30 12:31:57 +00:00
' build ' : Build . objects . get ( pk = build_id ) ,
2014-01-23 17:47:41 +00:00
' target ' : target ,
' package ' : package ,
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
' reverse_count ' : _get_package_reverse_dep_count ( package , target_id ) ,
bitbake: toaster: sort on size in detail pages
[YOCTO 5778]
Implements the features described in the attachment to bugzilla 5778
- new global changes to the format of size data, and
- adding sorts by selected columns to specific detail pages.
Although new pagination and row search capabilities are shown on the
screen shots for the 5778 attachment, those features are specified in
a different bugzilla entry 5777 and are not implemented in this commit.
Also, the 5778 spec includes table sorting for the recipe package
detail page, but sorting for that page was not implemented in this
commit due to complications with sorting then returning to a page that
is only one URL fragment in a template.
The scope of file changes are described below.
Changes to support new 'size' field column formats...
default.css - added sizecol class style (right justified)
projecttags.py - changed filtered_filesizeformat to allow
".0" suffixes
Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or
<td> size columns were made to...
dirinfo.py,
package_built_dependencies.html,
package_included_dependencies.html,
recipe.html,
bpackage.html, and
target.html
More significant changes to support detail page table sorting
are:
- tablesort.html: New created to implement the sort icons,
directions, and table headings, and
suppress sort handling if 'disable_sort' in context,
without search or pagination elements ingrained
in basetable_top. Confining the changes to this small file
reduces the impact (testing and risk) on the larger set of
files that arleady include basetable_top/bottom files.
- view.py: Modified the following view functions with
- trivial changes for size formatting to the views: target,
- changes to package_built_detail, package_included_detail,
package_included_reverse_dependencies to handle the sorting
implementation as well as moving headings and size
formatting for size columns from templates to the views.
- Implementation of the detail sorting using above in:
package_built_detail.html,
package_included_detail.html, and
package_included_reverse_dependencies.html
to include the tablesort heading setup, format the size column,
and iterate over the new sorted objects, suppressing sorts if
table row count less than 2.
(Bitbake rev: d16126e9abfffde66ab70865a81997322847d44e)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08 16:32:21 +00:00
' dependency_count ' : _get_package_dependency_count ( package , target_id , True ) ,
' objects ' : paths ,
' tablecols ' : [
{
' name ' : ' File ' ,
' orderfield ' : _get_toggle_order ( request , " path " ) ,
' ordericon ' : _get_toggle_order_icon ( request , " path " ) ,
} ,
{
' name ' : ' Size ' ,
' orderfield ' : _get_toggle_order ( request , " size " , True ) ,
' ordericon ' : _get_toggle_order_icon ( request , " size " ) ,
' dclass ' : ' sizecol span2 ' ,
} ,
]
2014-01-23 17:47:41 +00:00
}
bitbake: toaster: sort on size in detail pages
[YOCTO 5778]
Implements the features described in the attachment to bugzilla 5778
- new global changes to the format of size data, and
- adding sorts by selected columns to specific detail pages.
Although new pagination and row search capabilities are shown on the
screen shots for the 5778 attachment, those features are specified in
a different bugzilla entry 5777 and are not implemented in this commit.
Also, the 5778 spec includes table sorting for the recipe package
detail page, but sorting for that page was not implemented in this
commit due to complications with sorting then returning to a page that
is only one URL fragment in a template.
The scope of file changes are described below.
Changes to support new 'size' field column formats...
default.css - added sizecol class style (right justified)
projecttags.py - changed filtered_filesizeformat to allow
".0" suffixes
Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or
<td> size columns were made to...
dirinfo.py,
package_built_dependencies.html,
package_included_dependencies.html,
recipe.html,
bpackage.html, and
target.html
More significant changes to support detail page table sorting
are:
- tablesort.html: New created to implement the sort icons,
directions, and table headings, and
suppress sort handling if 'disable_sort' in context,
without search or pagination elements ingrained
in basetable_top. Confining the changes to this small file
reduces the impact (testing and risk) on the larger set of
files that arleady include basetable_top/bottom files.
- view.py: Modified the following view functions with
- trivial changes for size formatting to the views: target,
- changes to package_built_detail, package_included_detail,
package_included_reverse_dependencies to handle the sorting
implementation as well as moving headings and size
formatting for size columns from templates to the views.
- Implementation of the detail sorting using above in:
package_built_detail.html,
package_included_detail.html, and
package_included_reverse_dependencies.html
to include the tablesort heading setup, format the size column,
and iterate over the new sorted objects, suppressing sorts if
table row count less than 2.
(Bitbake rev: d16126e9abfffde66ab70865a81997322847d44e)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08 16:32:21 +00:00
if paths . all ( ) . count ( ) < 2 :
2014-08-29 12:51:01 +00:00
context [ ' disable_sort ' ] = True
response = render ( request , template , context )
2015-05-19 12:30:05 +00:00
_set_parameters_values ( pagesize , orderby , request )
2014-08-29 12:51:01 +00:00
return response
2014-01-23 17:47:41 +00:00
def package_included_dependencies ( request , build_id , target_id , package_id ) :
template = " package_included_dependencies.html "
if Build . objects . filter ( pk = build_id ) . count ( ) == 0 :
return redirect ( builds )
2014-09-30 12:31:57 +00:00
package = Package . objects . get ( pk = package_id )
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
package . fullpackagespec = _get_fullpackagespec ( package )
package . alias = _get_package_alias ( package )
2014-09-30 12:31:57 +00:00
target = Target . objects . get ( pk = target_id )
2014-01-23 17:47:41 +00:00
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
dependencies = _get_package_dependencies ( package_id , target_id )
2014-01-23 17:47:41 +00:00
context = {
2014-09-30 12:31:57 +00:00
' build ' : Build . objects . get ( pk = build_id ) ,
2014-01-23 17:47:41 +00:00
' package ' : package ,
' target ' : target ,
' runtime_deps ' : dependencies [ ' runtime_deps ' ] ,
' other_deps ' : dependencies [ ' other_deps ' ] ,
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
' reverse_count ' : _get_package_reverse_dep_count ( package , target_id ) ,
' dependency_count ' : _get_package_dependency_count ( package , target_id , True )
2014-01-23 17:47:41 +00:00
}
return render ( request , template , context )
def package_included_reverse_dependencies ( request , build_id , target_id , package_id ) :
template = " package_included_reverse_dependencies.html "
if Build . objects . filter ( pk = build_id ) . count ( ) == 0 :
return redirect ( builds )
2014-08-29 12:51:01 +00:00
( pagesize , orderby ) = _get_parameters_values ( request , 25 , ' package__name:+ ' )
mandatory_parameters = { ' count ' : pagesize , ' page ' : 1 , ' orderby ' : orderby }
bitbake: toaster: sort on size in detail pages
[YOCTO 5778]
Implements the features described in the attachment to bugzilla 5778
- new global changes to the format of size data, and
- adding sorts by selected columns to specific detail pages.
Although new pagination and row search capabilities are shown on the
screen shots for the 5778 attachment, those features are specified in
a different bugzilla entry 5777 and are not implemented in this commit.
Also, the 5778 spec includes table sorting for the recipe package
detail page, but sorting for that page was not implemented in this
commit due to complications with sorting then returning to a page that
is only one URL fragment in a template.
The scope of file changes are described below.
Changes to support new 'size' field column formats...
default.css - added sizecol class style (right justified)
projecttags.py - changed filtered_filesizeformat to allow
".0" suffixes
Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or
<td> size columns were made to...
dirinfo.py,
package_built_dependencies.html,
package_included_dependencies.html,
recipe.html,
bpackage.html, and
target.html
More significant changes to support detail page table sorting
are:
- tablesort.html: New created to implement the sort icons,
directions, and table headings, and
suppress sort handling if 'disable_sort' in context,
without search or pagination elements ingrained
in basetable_top. Confining the changes to this small file
reduces the impact (testing and risk) on the larger set of
files that arleady include basetable_top/bottom files.
- view.py: Modified the following view functions with
- trivial changes for size formatting to the views: target,
- changes to package_built_detail, package_included_detail,
package_included_reverse_dependencies to handle the sorting
implementation as well as moving headings and size
formatting for size columns from templates to the views.
- Implementation of the detail sorting using above in:
package_built_detail.html,
package_included_detail.html, and
package_included_reverse_dependencies.html
to include the tablesort heading setup, format the size column,
and iterate over the new sorted objects, suppressing sorts if
table row count less than 2.
(Bitbake rev: d16126e9abfffde66ab70865a81997322847d44e)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08 16:32:21 +00:00
retval = _verify_parameters ( request . GET , mandatory_parameters )
if retval :
return _redirect_parameters ( ' package_included_reverse_dependencies ' , request . GET , mandatory_parameters , build_id = build_id , target_id = target_id , package_id = package_id )
( filter_string , search_term , ordering_string ) = _search_tuple ( request , Package_File )
queryset = Package_Dependency . objects . select_related ( ' depends_on__name ' , ' depends_on__size ' ) . filter ( depends_on = package_id , target_id = target_id , dep_type = Package_Dependency . TYPE_TRDEPENDS )
objects = _get_queryset ( Package_Dependency , queryset , filter_string , search_term , ordering_string , ' package__name ' )
2014-09-30 12:31:57 +00:00
package = Package . objects . get ( pk = package_id )
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
package . fullpackagespec = _get_fullpackagespec ( package )
package . alias = _get_package_alias ( package )
2014-09-30 12:31:57 +00:00
target = Target . objects . get ( pk = target_id )
bitbake: toaster: sort on size in detail pages
[YOCTO 5778]
Implements the features described in the attachment to bugzilla 5778
- new global changes to the format of size data, and
- adding sorts by selected columns to specific detail pages.
Although new pagination and row search capabilities are shown on the
screen shots for the 5778 attachment, those features are specified in
a different bugzilla entry 5777 and are not implemented in this commit.
Also, the 5778 spec includes table sorting for the recipe package
detail page, but sorting for that page was not implemented in this
commit due to complications with sorting then returning to a page that
is only one URL fragment in a template.
The scope of file changes are described below.
Changes to support new 'size' field column formats...
default.css - added sizecol class style (right justified)
projecttags.py - changed filtered_filesizeformat to allow
".0" suffixes
Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or
<td> size columns were made to...
dirinfo.py,
package_built_dependencies.html,
package_included_dependencies.html,
recipe.html,
bpackage.html, and
target.html
More significant changes to support detail page table sorting
are:
- tablesort.html: New created to implement the sort icons,
directions, and table headings, and
suppress sort handling if 'disable_sort' in context,
without search or pagination elements ingrained
in basetable_top. Confining the changes to this small file
reduces the impact (testing and risk) on the larger set of
files that arleady include basetable_top/bottom files.
- view.py: Modified the following view functions with
- trivial changes for size formatting to the views: target,
- changes to package_built_detail, package_included_detail,
package_included_reverse_dependencies to handle the sorting
implementation as well as moving headings and size
formatting for size columns from templates to the views.
- Implementation of the detail sorting using above in:
package_built_detail.html,
package_included_detail.html, and
package_included_reverse_dependencies.html
to include the tablesort heading setup, format the size column,
and iterate over the new sorted objects, suppressing sorts if
table row count less than 2.
(Bitbake rev: d16126e9abfffde66ab70865a81997322847d44e)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08 16:32:21 +00:00
for o in objects :
if o . package . version != ' ' :
o . package . version + = ' - ' + o . package . revision
o . alias = _get_package_alias ( o . package )
2014-01-23 17:47:41 +00:00
context = {
2014-09-30 12:31:57 +00:00
' build ' : Build . objects . get ( pk = build_id ) ,
2014-01-23 17:47:41 +00:00
' package ' : package ,
' target ' : target ,
bitbake: toaster: sort on size in detail pages
[YOCTO 5778]
Implements the features described in the attachment to bugzilla 5778
- new global changes to the format of size data, and
- adding sorts by selected columns to specific detail pages.
Although new pagination and row search capabilities are shown on the
screen shots for the 5778 attachment, those features are specified in
a different bugzilla entry 5777 and are not implemented in this commit.
Also, the 5778 spec includes table sorting for the recipe package
detail page, but sorting for that page was not implemented in this
commit due to complications with sorting then returning to a page that
is only one URL fragment in a template.
The scope of file changes are described below.
Changes to support new 'size' field column formats...
default.css - added sizecol class style (right justified)
projecttags.py - changed filtered_filesizeformat to allow
".0" suffixes
Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or
<td> size columns were made to...
dirinfo.py,
package_built_dependencies.html,
package_included_dependencies.html,
recipe.html,
bpackage.html, and
target.html
More significant changes to support detail page table sorting
are:
- tablesort.html: New created to implement the sort icons,
directions, and table headings, and
suppress sort handling if 'disable_sort' in context,
without search or pagination elements ingrained
in basetable_top. Confining the changes to this small file
reduces the impact (testing and risk) on the larger set of
files that arleady include basetable_top/bottom files.
- view.py: Modified the following view functions with
- trivial changes for size formatting to the views: target,
- changes to package_built_detail, package_included_detail,
package_included_reverse_dependencies to handle the sorting
implementation as well as moving headings and size
formatting for size columns from templates to the views.
- Implementation of the detail sorting using above in:
package_built_detail.html,
package_included_detail.html, and
package_included_reverse_dependencies.html
to include the tablesort heading setup, format the size column,
and iterate over the new sorted objects, suppressing sorts if
table row count less than 2.
(Bitbake rev: d16126e9abfffde66ab70865a81997322847d44e)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08 16:32:21 +00:00
' objects ' : objects ,
bitbake: toaster: show installed package name
[YOCTO #5922]
Implement changes that show the installed package name after the
official 'recipe-named' package name. If the alias exists and
is different than the package name, then the alias is shown as a
'muted' string after the package name in the form 'as some-alias-name'.
This formatting appears in the included package pages in the elements:
* local breadcrumbs at the top of package included pages,
* <h1> title headings along with a help bubble that is not hovering,
and
* package lists where the help bubble appears when the mouse hovers
over the row.
The changes in detail in this patch per file are:
views.py
- added function that tests whether the package object's installed_name
should be shown,
- added function that appends package name with version and revision to
encapsulate package name formatting in one place and referred to as
package.fullpackagespec,
- changed package_built* and package_included* functions to use both
of the above new formatting functions, passing the formatted values to
templates, and
- adhered to django coding styles by renaming module local
'get_package*' functions with "_" prefix.
package_detail_base.html
- added display of package aliases for included package page,
- refactored to use package.fullpackagespec, formatted by view function,
- added javascript function to format package alias with help, and
- removed trailing whitespace.
package_included_detail.html
- used javascript function above to format package alias, and
- refactored to use package.fullpackagespec.
package_included_dependencies.html
- used javascript function above to format package alias,
- refactored to use package.fullpackagespec,
- forced empty data cells following hover-help to draw borders
by appending space, and
- removed trailing whitespace.
package_included_reverse_dependencies.html
- use javascript function above to format package alias,
- refactor to use views fullpackagespe, and
- force empty data cells following hover-help to draw borders
by appending space.
package_built_detail.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
package_built_dependencies.html
- refactored to use package.fullpackagespec, and
- removed trailing whitespace.
projecttags.py
- removed unused filter to handle installed name
- removed extra spaces around "title = " in format_vpackage_namehelp
(Bitbake rev: c604e14df8cdb1f47535f093d7044955d4c2057d)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24 21:37:17 +00:00
' reverse_count ' : _get_package_reverse_dep_count ( package , target_id ) ,
bitbake: toaster: sort on size in detail pages
[YOCTO 5778]
Implements the features described in the attachment to bugzilla 5778
- new global changes to the format of size data, and
- adding sorts by selected columns to specific detail pages.
Although new pagination and row search capabilities are shown on the
screen shots for the 5778 attachment, those features are specified in
a different bugzilla entry 5777 and are not implemented in this commit.
Also, the 5778 spec includes table sorting for the recipe package
detail page, but sorting for that page was not implemented in this
commit due to complications with sorting then returning to a page that
is only one URL fragment in a template.
The scope of file changes are described below.
Changes to support new 'size' field column formats...
default.css - added sizecol class style (right justified)
projecttags.py - changed filtered_filesizeformat to allow
".0" suffixes
Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or
<td> size columns were made to...
dirinfo.py,
package_built_dependencies.html,
package_included_dependencies.html,
recipe.html,
bpackage.html, and
target.html
More significant changes to support detail page table sorting
are:
- tablesort.html: New created to implement the sort icons,
directions, and table headings, and
suppress sort handling if 'disable_sort' in context,
without search or pagination elements ingrained
in basetable_top. Confining the changes to this small file
reduces the impact (testing and risk) on the larger set of
files that arleady include basetable_top/bottom files.
- view.py: Modified the following view functions with
- trivial changes for size formatting to the views: target,
- changes to package_built_detail, package_included_detail,
package_included_reverse_dependencies to handle the sorting
implementation as well as moving headings and size
formatting for size columns from templates to the views.
- Implementation of the detail sorting using above in:
package_built_detail.html,
package_included_detail.html, and
package_included_reverse_dependencies.html
to include the tablesort heading setup, format the size column,
and iterate over the new sorted objects, suppressing sorts if
table row count less than 2.
(Bitbake rev: d16126e9abfffde66ab70865a81997322847d44e)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08 16:32:21 +00:00
' dependency_count ' : _get_package_dependency_count ( package , target_id , True ) ,
' tablecols ' : [
{
' name ' : ' Package ' ,
' orderfield ' : _get_toggle_order ( request , " package__name " ) ,
' ordericon ' : _get_toggle_order_icon ( request , " package__name " ) ,
} ,
{
' name ' : ' Version ' ,
} ,
{
' name ' : ' Size ' ,
' orderfield ' : _get_toggle_order ( request , " package__size " , True ) ,
' ordericon ' : _get_toggle_order_icon ( request , " package__size " ) ,
' dclass ' : ' sizecol span2 ' ,
} ,
]
2014-01-23 17:47:41 +00:00
}
bitbake: toaster: sort on size in detail pages
[YOCTO 5778]
Implements the features described in the attachment to bugzilla 5778
- new global changes to the format of size data, and
- adding sorts by selected columns to specific detail pages.
Although new pagination and row search capabilities are shown on the
screen shots for the 5778 attachment, those features are specified in
a different bugzilla entry 5777 and are not implemented in this commit.
Also, the 5778 spec includes table sorting for the recipe package
detail page, but sorting for that page was not implemented in this
commit due to complications with sorting then returning to a page that
is only one URL fragment in a template.
The scope of file changes are described below.
Changes to support new 'size' field column formats...
default.css - added sizecol class style (right justified)
projecttags.py - changed filtered_filesizeformat to allow
".0" suffixes
Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or
<td> size columns were made to...
dirinfo.py,
package_built_dependencies.html,
package_included_dependencies.html,
recipe.html,
bpackage.html, and
target.html
More significant changes to support detail page table sorting
are:
- tablesort.html: New created to implement the sort icons,
directions, and table headings, and
suppress sort handling if 'disable_sort' in context,
without search or pagination elements ingrained
in basetable_top. Confining the changes to this small file
reduces the impact (testing and risk) on the larger set of
files that arleady include basetable_top/bottom files.
- view.py: Modified the following view functions with
- trivial changes for size formatting to the views: target,
- changes to package_built_detail, package_included_detail,
package_included_reverse_dependencies to handle the sorting
implementation as well as moving headings and size
formatting for size columns from templates to the views.
- Implementation of the detail sorting using above in:
package_built_detail.html,
package_included_detail.html, and
package_included_reverse_dependencies.html
to include the tablesort heading setup, format the size column,
and iterate over the new sorted objects, suppressing sorts if
table row count less than 2.
(Bitbake rev: d16126e9abfffde66ab70865a81997322847d44e)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08 16:32:21 +00:00
if objects . all ( ) . count ( ) < 2 :
2014-08-29 12:51:01 +00:00
context [ ' disable_sort ' ] = True
response = render ( request , template , context )
2015-05-19 12:30:05 +00:00
_set_parameters_values ( pagesize , orderby , request )
2014-08-29 12:51:01 +00:00
return response
2014-01-23 17:47:41 +00:00
def image_information_dir ( request , build_id , target_id , packagefile_id ) :
# stubbed for now
return redirect ( builds )
2015-05-07 17:09:09 +00:00
# the context processor that supplies data used across all the pages
2015-10-05 15:39:36 +00:00
# a context processor which runs on every request; this provides the
# projects and non_cli_projects (i.e. projects created by the user)
# variables referred to in templates, which used to determine the
# visibility of UI elements like the "New build" button
2015-05-07 17:09:09 +00:00
def managedcontextprocessor ( request ) :
2015-10-05 15:39:36 +00:00
projects = Project . objects . all ( )
2015-05-07 17:09:09 +00:00
ret = {
2015-10-05 15:39:36 +00:00
" projects " : projects ,
" non_cli_projects " : projects . exclude ( is_default = True ) ,
2015-05-07 17:09:09 +00:00
" DEBUG " : toastermain . settings . DEBUG ,
" TOASTER_BRANCH " : toastermain . settings . TOASTER_BRANCH ,
" TOASTER_REVISION " : toastermain . settings . TOASTER_REVISION ,
}
return ret
2013-12-18 19:50:45 +00:00
2014-06-26 14:21:42 +00:00
import toastermain . settings
2015-05-12 14:34:45 +00:00
from orm . models import Project , ProjectLayer , ProjectTarget , ProjectVariable
2016-04-06 16:46:43 +00:00
from bldcontrol . models import BuildEnvironment
2014-06-26 14:21:42 +00:00
# we have a set of functions if we're in managed mode, or
# a default "page not available" simple functions for interactive mode
2015-06-09 15:03:36 +00:00
if True :
2014-06-27 14:09:04 +00:00
from django . contrib . auth . models import User
from django . contrib . auth import authenticate , login
from django . contrib . auth . decorators import login_required
2016-07-21 13:43:30 +00:00
from orm . models import LayerSource , ToasterSetting , Release , Machine , LayerVersionDependency
2014-06-30 17:33:04 +00:00
from bldcontrol . models import BuildRequest
2014-07-15 12:01:56 +00:00
2014-06-30 14:58:36 +00:00
import traceback
2015-08-18 16:28:47 +00:00
class BadParameterException ( Exception ) :
''' The exception raised on invalid POST requests '''
pass
2015-01-16 16:42:40 +00:00
2014-06-26 14:21:42 +00:00
# new project
def newproject ( request ) :
template = " newproject.html "
2014-06-27 14:09:04 +00:00
context = {
' email ' : request . user . email if request . user . is_authenticated ( ) else ' ' ,
' username ' : request . user . username if request . user . is_authenticated ( ) else ' ' ,
2014-11-27 12:18:25 +00:00
' releases ' : Release . objects . order_by ( " description " ) ,
2014-06-27 14:09:04 +00:00
}
2014-11-26 12:18:55 +00:00
try :
context [ ' defaultbranch ' ] = ToasterSetting . objects . get ( name = " DEFAULT_RELEASE " ) . value
except ToasterSetting . DoesNotExist :
pass
2014-06-27 14:09:04 +00:00
2014-06-26 14:21:42 +00:00
if request . method == " GET " :
# render new project page
return render ( request , template , context )
elif request . method == " POST " :
2015-06-22 13:48:53 +00:00
mandatory_fields = [ ' projectname ' , ' ptype ' ]
2014-06-30 14:58:36 +00:00
try :
2015-06-22 13:48:53 +00:00
ptype = request . POST . get ( ' ptype ' )
if ptype == " build " :
mandatory_fields . append ( ' projectversion ' )
2014-06-30 14:58:36 +00:00
# make sure we have values for all mandatory_fields
2016-05-10 08:39:04 +00:00
missing = [ field for field in mandatory_fields if len ( request . POST . get ( field , ' ' ) ) == 0 ]
if missing :
# set alert for missing fields
raise BadParameterException ( " Fields missing: %s " % " , " . join ( missing ) )
2014-06-30 14:58:36 +00:00
2014-06-27 14:09:04 +00:00
if not request . user . is_authenticated ( ) :
2014-09-09 10:47:13 +00:00
user = authenticate ( username = request . POST . get ( ' username ' , ' _anonuser ' ) , password = ' nopass ' )
2014-06-27 14:09:04 +00:00
if user is None :
2014-09-09 10:47:13 +00:00
user = User . objects . create_user ( username = request . POST . get ( ' username ' , ' _anonuser ' ) , email = request . POST . get ( ' email ' , ' ' ) , password = " nopass " )
2014-06-30 14:58:36 +00:00
user = authenticate ( username = user . username , password = ' nopass ' )
2014-06-27 14:09:04 +00:00
login ( request , user )
2014-06-30 14:58:36 +00:00
# save the project
2015-06-22 13:48:53 +00:00
if ptype == " analysis " :
release = None
2015-06-24 13:53:21 +00:00
else :
release = Release . objects . get ( pk = request . POST . get ( ' projectversion ' , None ) )
2015-06-22 13:48:53 +00:00
prj = Project . objects . create_project ( name = request . POST [ ' projectname ' ] , release = release )
2014-06-30 14:58:36 +00:00
prj . user_id = request . user . pk
prj . save ( )
2015-07-31 12:09:12 +00:00
return redirect ( reverse ( project , args = ( prj . pk , ) ) + " ?notify=new-project " )
2014-06-30 14:58:36 +00:00
except ( IntegrityError , BadParameterException ) as e :
# fill in page with previously submitted values
2016-05-10 13:18:02 +00:00
for field in mandatory_fields :
context . __setitem__ ( field , request . POST . get ( field , " -- missing " ) )
2014-06-30 14:58:36 +00:00
if isinstance ( e , IntegrityError ) and " username " in str ( e ) :
context [ ' alert ' ] = " Your chosen username is already used "
else :
context [ ' alert ' ] = str ( e )
2014-06-26 14:21:42 +00:00
return render ( request , template , context )
2014-06-30 17:33:04 +00:00
2014-06-26 14:21:42 +00:00
raise Exception ( " Invalid HTTP method for this page " )
# Shows the edit project page
2014-06-30 14:58:36 +00:00
def project ( request , pid ) :
2016-09-26 10:59:28 +00:00
project = Project . objects . get ( pk = pid )
context = { " project " : project }
return render ( request , " project.html " , context )
2014-06-30 17:33:04 +00:00
2015-08-17 16:47:47 +00:00
def jsunittests ( request ) :
2015-09-29 04:45:21 +00:00
""" Provides a page for the js unit tests """
bbv = BitbakeVersion . objects . filter ( branch = " master " ) . first ( )
release = Release . objects . filter ( bitbake_version = bbv ) . first ( )
2015-08-17 16:47:47 +00:00
2015-09-29 04:45:21 +00:00
name = " _js_unit_test_prj_ "
2015-08-17 16:47:47 +00:00
2016-04-04 10:47:31 +00:00
# If there is an existing project by this name delete it.
# We don't want Lots of duplicates cluttering up the projects.
2015-09-29 04:45:21 +00:00
Project . objects . filter ( name = name ) . delete ( )
2015-08-17 16:47:47 +00:00
2016-04-04 10:47:31 +00:00
new_project = Project . objects . create_project ( name = name ,
release = release )
# Add a layer
layer = new_project . get_all_compatible_layer_versions ( ) . first ( )
2015-08-17 16:47:47 +00:00
2016-04-04 10:47:31 +00:00
ProjectLayer . objects . get_or_create ( layercommit = layer ,
project = new_project )
# make sure we have a machine set for this project
ProjectVariable . objects . get_or_create ( project = new_project ,
name = " MACHINE " ,
value = " qemux86 " )
context = { ' project ' : new_project }
2015-09-29 04:45:21 +00:00
return render ( request , " js-unit-tests.html " , context )
2014-11-11 16:30:22 +00:00
2014-09-09 10:47:13 +00:00
from django . views . decorators . csrf import csrf_exempt
@csrf_exempt
2015-08-04 19:46:36 +00:00
def xhr_testreleasechange ( request , pid ) :
def response ( data ) :
return HttpResponse ( jsonfilter ( data ) ,
content_type = " application/json " )
""" returns layer versions that would be deleted on the new
release__pk """
2014-09-09 10:47:13 +00:00
try :
2015-05-11 17:58:25 +00:00
prj = Project . objects . get ( pk = pid )
2015-08-04 19:46:36 +00:00
new_release_id = request . GET [ ' new_release_id ' ]
2014-11-24 12:52:49 +00:00
2015-08-04 19:46:36 +00:00
# If we're already on this project do nothing
if prj . release . pk == int ( new_release_id ) :
return reponse ( { " error " : " ok " , " rows " : [ ] } )
2014-11-14 17:07:06 +00:00
2015-08-04 19:46:36 +00:00
retval = [ ]
2014-09-09 10:47:13 +00:00
2015-12-10 03:56:36 +00:00
for project in prj . projectlayer_set . all ( ) :
release = Release . objects . get ( pk = new_release_id )
layer_versions = prj . get_all_compatible_layer_versions ( )
layer_versions = layer_versions . filter ( release = release )
layer_versions = layer_versions . filter ( layer__name = project . layercommit . layer . name )
2015-08-04 19:46:36 +00:00
# there is no layer_version with the new release id,
# and the same name
2015-12-10 03:56:36 +00:00
if layer_versions . count ( ) < 1 :
retval . append ( project )
2014-11-14 17:07:06 +00:00
2015-08-04 19:46:36 +00:00
return response ( { " error " : " ok " ,
2016-05-10 13:18:02 +00:00
" rows " : [ _lv_to_dict ( prj ) for y in [ x . layercommit for x in retval ] ]
2015-08-04 19:46:36 +00:00
} )
2015-01-08 13:15:14 +00:00
2014-09-09 10:47:13 +00:00
except Exception as e :
2015-08-04 19:46:36 +00:00
return response ( { " error " : str ( e ) } )
2014-09-09 10:47:13 +00:00
2015-01-16 16:42:41 +00:00
def xhr_configvaredit ( request , pid ) :
try :
prj = Project . objects . get ( id = pid )
2016-06-24 15:25:53 +00:00
# There are cases where user can add variables which hold values
# like http://, file:/// etc. In such case a simple split(":")
# would fail. One example is SSTATE_MIRRORS variable. So we use
# max_split var to handle them.
max_split = 1
2015-01-16 16:42:41 +00:00
# add conf variables
if ' configvarAdd ' in request . POST :
t = request . POST [ ' configvarAdd ' ] . strip ( )
if " : " in t :
2016-06-24 15:25:53 +00:00
variable , value = t . split ( " : " , max_split )
2015-01-16 16:42:41 +00:00
else :
variable = t
value = " "
pt , created = ProjectVariable . objects . get_or_create ( project = prj , name = variable , value = value )
# change conf variables
if ' configvarChange ' in request . POST :
t = request . POST [ ' configvarChange ' ] . strip ( )
if " : " in t :
2016-06-24 15:25:53 +00:00
variable , value = t . split ( " : " , max_split )
2015-01-16 16:42:41 +00:00
else :
variable = t
value = " "
2015-02-12 11:40:53 +00:00
pt , created = ProjectVariable . objects . get_or_create ( project = prj , name = variable )
pt . value = value
pt . save ( )
2015-01-16 16:42:41 +00:00
# remove conf variables
if ' configvarDel ' in request . POST :
t = request . POST [ ' configvarDel ' ] . strip ( )
pt = ProjectVariable . objects . get ( pk = int ( t ) ) . delete ( )
2015-02-27 03:46:23 +00:00
# return all project settings, filter out blacklist and elsewhere-managed variables
2015-01-16 16:42:41 +00:00
vars_managed , vars_fstypes , vars_blacklist = get_project_configvars_context ( )
2015-02-27 03:46:23 +00:00
configvars_query = ProjectVariable . objects . filter ( project_id = pid ) . all ( )
for var in vars_managed :
configvars_query = configvars_query . exclude ( name = var )
for var in vars_blacklist :
configvars_query = configvars_query . exclude ( name = var )
2015-02-12 11:40:53 +00:00
return_data = {
2015-01-16 16:42:41 +00:00
" error " : " ok " ,
2016-05-10 13:18:02 +00:00
' configvars ' : [ ( x . name , x . value , x . pk ) for x in configvars_query ]
2015-02-12 11:40:53 +00:00
}
try :
return_data [ ' distro ' ] = ProjectVariable . objects . get ( project = prj , name = " DISTRO " ) . value ,
except ProjectVariable . DoesNotExist :
pass
2016-04-06 16:46:43 +00:00
try :
return_data [ ' dl_dir ' ] = ProjectVariable . objects . get ( project = prj , name = " DL_DIR " ) . value ,
except ProjectVariable . DoesNotExist :
pass
2015-02-12 11:40:53 +00:00
try :
return_data [ ' fstypes ' ] = ProjectVariable . objects . get ( project = prj , name = " IMAGE_FSTYPES " ) . value ,
except ProjectVariable . DoesNotExist :
pass
try :
return_data [ ' image_install_append ' ] = ProjectVariable . objects . get ( project = prj , name = " IMAGE_INSTALL_append " ) . value ,
except ProjectVariable . DoesNotExist :
pass
try :
return_data [ ' package_classes ' ] = ProjectVariable . objects . get ( project = prj , name = " PACKAGE_CLASSES " ) . value ,
except ProjectVariable . DoesNotExist :
pass
2016-04-06 16:46:43 +00:00
try :
return_data [ ' sstate_dir ' ] = ProjectVariable . objects . get ( project = prj , name = " SSTATE_DIR " ) . value ,
except ProjectVariable . DoesNotExist :
pass
2015-02-12 11:40:53 +00:00
return HttpResponse ( json . dumps ( return_data ) , content_type = " application/json " )
2015-01-16 16:42:41 +00:00
except Exception as e :
return HttpResponse ( json . dumps ( { " error " : str ( e ) + " \n " + traceback . format_exc ( ) } ) , content_type = " application/json " )
2015-11-04 15:14:06 +00:00
def customrecipe_download ( request , pid , recipe_id ) :
recipe = get_object_or_404 ( CustomImageRecipe , pk = recipe_id )
file_data = recipe . generate_recipe_file_contents ( )
response = HttpResponse ( file_data , content_type = ' text/plain ' )
response [ ' Content-Disposition ' ] = \
' attachment; filename= " %s _ %s .bb " ' % ( recipe . name ,
recipe . version )
return response
2015-05-07 17:09:09 +00:00
def importlayer ( request , pid ) :
2014-08-29 15:42:00 +00:00
template = " importlayer.html "
context = {
2015-05-07 17:09:09 +00:00
' project ' : Project . objects . get ( id = pid ) ,
2014-08-29 15:42:00 +00:00
}
return render ( request , template , context )
2014-08-08 16:50:02 +00:00
2015-08-06 16:01:35 +00:00
def layerdetails ( request , pid , layerid ) :
project = Project . objects . get ( pk = pid )
layer_version = Layer_Version . objects . get ( pk = layerid )
2016-07-21 13:43:27 +00:00
project_layers = ProjectLayer . objects . filter (
project = project ) . values_list ( " layercommit_id " ,
flat = True )
context = {
' project ' : project ,
' layer_source ' : LayerSource . types_dict ( ) ,
' layerversion ' : layer_version ,
' layerdeps ' : {
" list " : [
{
" id " : dep . id ,
" name " : dep . layer . name ,
" layerdetailurl " : reverse ( ' layerdetails ' ,
args = ( pid , dep . pk ) ) ,
" vcs_url " : dep . layer . vcs_url ,
" vcs_reference " : dep . get_vcs_reference ( )
}
for dep in layer_version . get_alldeps ( project . id ) ]
} ,
' projectlayers ' : list ( project_layers )
2015-10-13 08:58:49 +00:00
}
2015-08-06 16:01:35 +00:00
2016-12-09 16:52:55 +00:00
return render ( request , ' layerdetails.html ' , context )
2015-08-06 16:01:35 +00:00
2015-01-16 16:42:41 +00:00
def get_project_configvars_context ( ) :
# Vars managed outside of this view
vars_managed = {
2015-02-27 03:46:23 +00:00
' MACHINE ' , ' BBLAYERS '
2015-01-16 16:42:41 +00:00
}
vars_blacklist = {
2016-04-06 16:46:43 +00:00
' PARALLEL_MAKE ' , ' BB_NUMBER_THREADS ' ,
2015-01-23 17:36:14 +00:00
' BB_DISKMON_DIRS ' , ' BB_NUMBER_THREADS ' , ' CVS_PROXY_HOST ' , ' CVS_PROXY_PORT ' ,
2016-06-24 15:25:53 +00:00
' PARALLEL_MAKE ' , ' TMPDIR ' ,
2015-01-23 17:36:14 +00:00
' all_proxy ' , ' ftp_proxy ' , ' http_proxy ' , ' https_proxy '
}
2015-01-16 16:42:41 +00:00
2016-01-15 11:00:45 +00:00
vars_fstypes = Target_Image_File . SUFFIXES
2015-01-16 16:42:41 +00:00
return ( vars_managed , sorted ( vars_fstypes ) , vars_blacklist )
2014-08-08 16:50:02 +00:00
def projectconf ( request , pid ) :
2015-01-16 16:42:41 +00:00
try :
prj = Project . objects . get ( id = pid )
except Project . DoesNotExist :
return HttpResponseNotFound ( " <h1>Project id " + pid + " is unavailable</h1> " )
2015-02-27 03:46:23 +00:00
# remove blacklist and externally managed varaibles from this list
2015-01-16 16:42:41 +00:00
vars_managed , vars_fstypes , vars_blacklist = get_project_configvars_context ( )
2015-02-27 03:46:23 +00:00
configvars = ProjectVariable . objects . filter ( project_id = pid ) . all ( )
for var in vars_managed :
configvars = configvars . exclude ( name = var )
for var in vars_blacklist :
configvars = configvars . exclude ( name = var )
2014-08-29 15:42:00 +00:00
context = {
2015-05-07 17:09:09 +00:00
' project ' : prj ,
2015-02-27 03:46:23 +00:00
' configvars ' : configvars ,
2015-01-16 16:42:41 +00:00
' vars_managed ' : vars_managed ,
' vars_fstypes ' : vars_fstypes ,
' vars_blacklist ' : vars_blacklist ,
2014-08-29 15:42:00 +00:00
}
2015-01-16 16:42:41 +00:00
try :
context [ ' distro ' ] = ProjectVariable . objects . get ( project = prj , name = " DISTRO " ) . value
2015-02-27 03:46:23 +00:00
context [ ' distro_defined ' ] = " 1 "
2015-01-16 16:42:41 +00:00
except ProjectVariable . DoesNotExist :
pass
2016-04-06 16:46:43 +00:00
try :
if ProjectVariable . objects . get ( project = prj , name = " DL_DIR " ) . value == " $ {TOPDIR} /../downloads " :
be = BuildEnvironment . objects . get ( pk = str ( 1 ) )
dl_dir = os . path . join ( dirname ( be . builddir ) , " downloads " )
context [ ' dl_dir ' ] = dl_dir
pv , created = ProjectVariable . objects . get_or_create ( project = prj , name = " DL_DIR " )
pv . value = dl_dir
pv . save ( )
else :
context [ ' dl_dir ' ] = ProjectVariable . objects . get ( project = prj , name = " DL_DIR " ) . value
context [ ' dl_dir_defined ' ] = " 1 "
2016-05-10 14:10:30 +00:00
except ( ProjectVariable . DoesNotExist , BuildEnvironment . DoesNotExist ) :
2016-04-06 16:46:43 +00:00
pass
2015-01-16 16:42:41 +00:00
try :
context [ ' fstypes ' ] = ProjectVariable . objects . get ( project = prj , name = " IMAGE_FSTYPES " ) . value
2015-02-27 03:46:23 +00:00
context [ ' fstypes_defined ' ] = " 1 "
2015-01-16 16:42:41 +00:00
except ProjectVariable . DoesNotExist :
pass
try :
context [ ' image_install_append ' ] = ProjectVariable . objects . get ( project = prj , name = " IMAGE_INSTALL_append " ) . value
2015-02-27 03:46:23 +00:00
context [ ' image_install_append_defined ' ] = " 1 "
2015-01-16 16:42:41 +00:00
except ProjectVariable . DoesNotExist :
pass
try :
context [ ' package_classes ' ] = ProjectVariable . objects . get ( project = prj , name = " PACKAGE_CLASSES " ) . value
2015-02-27 03:46:23 +00:00
context [ ' package_classes_defined ' ] = " 1 "
2015-01-16 16:42:41 +00:00
except ProjectVariable . DoesNotExist :
pass
2016-04-06 16:46:43 +00:00
try :
if ProjectVariable . objects . get ( project = prj , name = " SSTATE_DIR " ) . value == " $ {TOPDIR} /../sstate-cache " :
be = BuildEnvironment . objects . get ( pk = str ( 1 ) )
sstate_dir = os . path . join ( dirname ( be . builddir ) , " sstate-cache " )
context [ ' sstate_dir ' ] = sstate_dir
pv , created = ProjectVariable . objects . get_or_create ( project = prj , name = " SSTATE_DIR " )
pv . value = sstate_dir
pv . save ( )
else :
context [ ' sstate_dir ' ] = ProjectVariable . objects . get ( project = prj , name = " SSTATE_DIR " ) . value
context [ ' sstate_dir_defined ' ] = " 1 "
2016-05-10 14:10:30 +00:00
except ( ProjectVariable . DoesNotExist , BuildEnvironment . DoesNotExist ) :
2016-04-06 16:46:43 +00:00
pass
2015-01-16 16:42:41 +00:00
2016-12-09 16:52:55 +00:00
return render ( request , " projectconf.html " , context )
2014-08-08 16:50:02 +00:00
2016-01-18 13:45:10 +00:00
def _file_names_for_artifact ( build , artifact_type , artifact_id ) :
"""
Return a tuple ( file path , file name for the download response ) for an
artifact of type artifact_type with ID artifact_id for build ; if
artifact type is not supported , returns ( None , None )
"""
2014-12-05 15:19:55 +00:00
file_name = None
2016-01-18 13:45:10 +00:00
response_file_name = None
if artifact_type == " cookerlog " :
file_name = build . cooker_log_path
response_file_name = " cooker.log "
elif artifact_type == " imagefile " :
file_name = Target_Image_File . objects . get ( target__build = build , pk = artifact_id ) . file_name
2014-10-03 17:03:37 +00:00
bitbake: toaster: improve scan for SDK artifacts
SDK artifacts were previously picked up by toaster.bbclass and
notified to buildinfohelper (via toasterui). The artifacts
were then added to the Build object, so that it wasn't clear
which artifact went with which target; we were also unable
to attach SDK artifacts to a Build if they had already been
attached to a previous build.
Now, toaster.bbclass just notifies the TOOLCHAIN_OUTPUTNAME when
a populate_sdk* target completes. The scan is moved to buildinfohelper,
where we search the SDK deploy directory for files matching
TOOLCHAIN_OUTPUTNAME and attach them to targets (not builds).
If an SDK file is not produced by a target, we now look for a
similar, previously-run target which did produce artifacts.
If there is one, we clone the SDK artifacts from that target
onto the current one.
This all means that we can show SDK artifacts by target, and should
always get artifacts associated with a target, regardless of whether
it really build them.
This requires an additional model, TargetSDKFile, which tracks
the size and path of SDK artifact files with respect to Target
objects.
[YOCTO #8556]
(Bitbake rev: 5e650c611605507e1e0d1588cd5eb6535c2d34fc)
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: bavery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-12 22:54:48 +00:00
elif artifact_type == " targetkernelartifact " :
target = TargetKernelFile . objects . get ( pk = artifact_id )
file_name = target . file_name
2014-10-14 12:57:33 +00:00
bitbake: toaster: improve scan for SDK artifacts
SDK artifacts were previously picked up by toaster.bbclass and
notified to buildinfohelper (via toasterui). The artifacts
were then added to the Build object, so that it wasn't clear
which artifact went with which target; we were also unable
to attach SDK artifacts to a Build if they had already been
attached to a previous build.
Now, toaster.bbclass just notifies the TOOLCHAIN_OUTPUTNAME when
a populate_sdk* target completes. The scan is moved to buildinfohelper,
where we search the SDK deploy directory for files matching
TOOLCHAIN_OUTPUTNAME and attach them to targets (not builds).
If an SDK file is not produced by a target, we now look for a
similar, previously-run target which did produce artifacts.
If there is one, we clone the SDK artifacts from that target
onto the current one.
This all means that we can show SDK artifacts by target, and should
always get artifacts associated with a target, regardless of whether
it really build them.
This requires an additional model, TargetSDKFile, which tracks
the size and path of SDK artifact files with respect to Target
objects.
[YOCTO #8556]
(Bitbake rev: 5e650c611605507e1e0d1588cd5eb6535c2d34fc)
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: bavery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-12 22:54:48 +00:00
elif artifact_type == " targetsdkartifact " :
target = TargetSDKFile . objects . get ( pk = artifact_id )
2016-07-12 22:54:46 +00:00
file_name = target . file_name
2016-01-18 13:45:10 +00:00
elif artifact_type == " licensemanifest " :
file_name = Target . objects . get ( build = build , pk = artifact_id ) . license_manifest_path
2014-10-14 12:57:33 +00:00
2016-07-12 22:54:54 +00:00
elif artifact_type == " packagemanifest " :
file_name = Target . objects . get ( build = build , pk = artifact_id ) . package_manifest_path
2014-12-05 15:19:55 +00:00
elif artifact_type == " tasklogfile " :
2016-01-18 13:45:10 +00:00
file_name = Task . objects . get ( build = build , pk = artifact_id ) . logfile
2014-10-14 12:57:33 +00:00
2014-12-05 15:19:55 +00:00
elif artifact_type == " logmessagefile " :
2016-01-18 13:45:10 +00:00
file_name = LogMessage . objects . get ( build = build , pk = artifact_id ) . pathname
2014-10-14 12:57:33 +00:00
2016-01-18 13:45:10 +00:00
if file_name and not response_file_name :
response_file_name = os . path . basename ( file_name )
2014-10-14 12:57:33 +00:00
2016-01-18 13:45:10 +00:00
return ( file_name , response_file_name )
2014-12-05 15:19:55 +00:00
def build_artifact ( request , build_id , artifact_type , artifact_id ) :
2016-01-18 13:45:10 +00:00
"""
View which returns a build artifact file as a response
"""
file_name = None
response_file_name = None
try :
build = Build . objects . get ( pk = build_id )
file_name , response_file_name = _file_names_for_artifact (
build , artifact_type , artifact_id
)
if file_name and response_file_name :
2016-06-07 15:37:29 +00:00
fsock = open ( file_name , " rb " )
2015-09-11 20:57:30 +00:00
content_type = MimeTypeFinder . get_mimetype ( file_name )
2014-12-05 15:19:55 +00:00
2015-02-16 17:47:07 +00:00
response = HttpResponse ( fsock , content_type = content_type )
2016-01-18 13:45:10 +00:00
disposition = " attachment; filename= " + response_file_name
response [ " Content-Disposition " ] = disposition
bitbake: toaster: Avoid unnecessary local to local copy of cooker log
The cooker log is copied from its original (bitbake) location
to an artifact directory chosen by the user (chosen when
checksettings.py runs as part of the managed mode;
it's one of the annoying questions you're asked at startup).
The copy happens as part of the runbuilds script run, which
is started in a loop from the toaster startup script
in managed mode.
When a user requests the log for a build via toaster, they
are getting the log which has been copied to the artifact
directory, not the original bitbake log.
This works for the managed case, where the runbuilds command is
running in a loop and copying log files for completed builds to
the artifact directory. However, in analysis mode, there are two
problems:
1. checksettings isn't run, so the artifacts directory isn't
set. toaster is then unable to figure out where the log files
should have been copied to.
2. The log files aren't copied to the artifacts directory
anyway, as runbuilds isn't running in analysis mode.
To fix this, just point the user to the local bitbake log file
in its original location. This avoids the copy step, and means
we can remove a whole question from the toaster startup sequence,
as we no longer need an artifact directory.
The only downside to this is that it's not appropriate for
remote bitbake servers. We will need to revisit this and
possibly reinstate the copy step once we have to reconcile
local and remote builds and make their logs available in
the same way.
[YOCTO #8209]
(Bitbake rev: 5697bbcc88edad85891f66d28b8803a9c9d27ff2)
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-11 20:57:29 +00:00
2015-02-16 17:47:07 +00:00
return response
else :
2016-01-18 13:45:10 +00:00
return render ( request , " unavailable_artifact.html " )
2016-05-10 14:10:30 +00:00
except ( ObjectDoesNotExist , IOError ) :
2016-01-18 13:45:10 +00:00
return render ( request , " unavailable_artifact.html " )