aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/mic/plugin.py23
-rw-r--r--scripts/lib/mic/pluginbase.py55
2 files changed, 75 insertions, 3 deletions
diff --git a/scripts/lib/mic/plugin.py b/scripts/lib/mic/plugin.py
index 7c296e9765..df03c15081 100644
--- a/scripts/lib/mic/plugin.py
+++ b/scripts/lib/mic/plugin.py
@@ -19,13 +19,12 @@ import os, sys
from mic import msger
from mic import pluginbase
-from mic.conf import configmgr
from mic.utils import errors
__ALL__ = ['PluginMgr', 'pluginmgr']
-PLUGIN_TYPES = ["imager", "backend"] # TODO "hook"
+PLUGIN_TYPES = ["imager", "source"] # TODO "hook"
class PluginMgr(object):
@@ -99,4 +98,24 @@ class PluginMgr(object):
return pluginbase.get_plugins(ptype)
+ def get_source_plugin_methods(self, source_name, methods):
+ """
+ The methods param is a dict with the method names to find. On
+ return, the dict values will be filled in with pointers to the
+ corresponding methods. If one or more methods are not found,
+ None is returned.
+ """
+ return_methods = None
+ for _source_name, klass in self.get_plugins('source').iteritems():
+ if _source_name == source_name:
+ for _method_name in methods.keys():
+ if not hasattr(klass, _method_name):
+ msger.warning("Unimplemented %s source interface for: %s"\
+ % (_method_name, _source_name))
+ return None
+ func = getattr(klass, _method_name)
+ methods[_method_name] = func
+ return_methods = methods
+ return return_methods
+
pluginmgr = PluginMgr()
diff --git a/scripts/lib/mic/pluginbase.py b/scripts/lib/mic/pluginbase.py
index 2f9d7209e9..e26b525dc3 100644
--- a/scripts/lib/mic/pluginbase.py
+++ b/scripts/lib/mic/pluginbase.py
@@ -80,6 +80,59 @@ class ImagerPlugin(_Plugin):
def do_chroot(self):
pass
+class SourcePlugin(_Plugin):
+ mic_plugin_type = "source"
+ """
+ The methods that can be implemented by --source plugins.
+
+ Any methods not implemented in a subclass inherit these.
+ """
+
+ @classmethod
+ def do_install_disk(self, disk, disk_name, cr, workdir, oe_builddir,
+ bootimg_dir, kernel_dir, native_sysroot):
+ """
+ Called after all partitions have been prepared and assembled into a
+ disk image. This provides a hook to allow finalization of a
+ disk image e.g. to write an MBR to it.
+ """
+ msger.debug("SourcePlugin: do_install_disk: disk: %s" % disk_name)
+
+ @classmethod
+ def do_stage_partition(self, part, cr, workdir, oe_builddir, bootimg_dir,
+ kernel_dir, native_sysroot):
+ """
+ Special content staging hook called before do_prepare_partition(),
+ normally empty.
+
+ Typically, a partition will just use the passed-in parame e.g
+ straight bootimg_dir, etc, but in some cases, things need to
+ be more tailored e.g. to use a deploy dir + /boot, etc. This
+ hook allows those files to be staged in a customized fashion.
+ Not that get_bitbake_var() allows you to acces non-standard
+ variables that you might want to use for this.
+ """
+ msger.debug("SourcePlugin: do_stage_partition: part: %s" % part)
+
+ @classmethod
+ def do_configure_partition(self, part, cr, cr_workdir, oe_builddir,
+ bootimg_dir, kernel_dir, native_sysroot):
+ """
+ Called before do_prepare_partition(), typically used to create
+ custom configuration files for a partition, for example
+ syslinux or grub config files.
+ """
+ msger.debug("SourcePlugin: do_configure_partition: part: %s" % part)
+
+ @classmethod
+ def do_prepare_partition(self, part, cr, cr_workdir, oe_builddir, bootimg_dir,
+ kernel_dir, native_sysroot):
+ """
+ Called to do the actual content population for a partition i.e. it
+ 'prepares' the partition to be incorporated into the image.
+ """
+ msger.debug("SourcePlugin: do_prepare_partition: part: %s" % part)
+
class BackendPlugin(_Plugin):
mic_plugin_type="backend"
@@ -93,4 +146,4 @@ def get_plugins(typen):
else:
return None
-__all__ = ['ImagerPlugin', 'BackendPlugin', 'get_plugins']
+__all__ = ['ImagerPlugin', 'BackendPlugin', 'SourcePlugin', 'get_plugins']
t.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
{% extends "base_toplevel.html" %}
{% load i18n %}

{% comment %}

  layerindex-web - duplicates page template

  Copyright (C) 2013-2014 Intel Corporation
  Licensed under the MIT license, see COPYING.MIT for details

{% endcomment %}


<!--
{% block title_append %} - duplicates{% endblock %}
-->

{% block content %}
{% autoescape on %}

        <div class="row-fluid">
            <div class="span12">

    <div class="btn-group pull-right">
        <a href="#" class="btn dropdown-toggle" data-toggle="dropdown">
        Branch: <b>{{ url_branch }}</b>
        <b class="caret"></b>
        </a>
        <ul class="dropdown-menu">
            {% for branch in all_branches %}
                <li><a href="{% url this_url_name branch.name %}">
                    {% if branch.name == url_branch %}<b>{% endif %}
                    {{ branch.name }}
                    {% if branch.short_description %}
                    ({{ branch.short_description }})
                    {% endif %}
                    {% if branch.name == url_branch %}</b>{% endif %}
                </a></li>
            {% endfor %}
        </ul>

        <div id="layerDialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="layerDialogLabel" aria-hidden="true">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="layerDialogLabel">Select layers to include</h3>
            </div>
            <form action="" method="get">
                <div class="modal-body">
                    <div class="scrolling">
                        <table><tbody>
                            {% for layerbranch in layers %}
                                <tr>
                                    <td class="checkboxtd"><input
                                        type="checkbox"
                                        class="filterlayercheckbox"
                                        name="l"
                                        value="{{ layerbranch.layer.id }}" id="id_layer_{{layerbranch.layer.id}}"
                                        {% if showlayers and layerbranch.layer.id in showlayers %}
                                            checked
                                        {% endif %}
                                        />
                                    </td>
                                    <td><label for="id_layer_{{layerbranch.layer.id}}">{{ layerbranch.layer.name }}</label></td>
                                </tr>
                            {% endfor %}
                        </tbody></table>
                    </div>
                    <div class="buttonblock">
                    <button type="button" class="btn" id="id_select_all">Select all</button>
                    <button type="button" class="btn buttonblock-btn" id="id_select_none">Select none</button>
                    </div>
                </div>
                <div class="modal-footer">
                    <input type="submit" value="Filter" class='btn btn-primary' />
                    <button class="btn" id="id_cancel" data-dismiss="modal" aria-hidden="true">Cancel</button>
                </div>
            </form>
        </div>

        <a href="#layerDialog" role="button" class="btn nav-spacer" data-toggle="modal">Filter layers {% if showlayers %}<span class="badge badge-success">{{ showlayers|length }}</span>{% endif %}</a>

    </div>

                <h2>Duplicate recipes</h2>
{% if recipes %}
                <p>Recipes with the same name in different layers:</p>
                <table class="table table-striped table-bordered recipestable">
                    <thead>
                        <tr>
                            <th>Recipe name</th>
                            <th>Version</th>
                            <th class="span9">Description</th>
                            <th>Layer</th>
                        </tr>
                    </thead>

                    <tbody>
                        {% for recipe in recipes %}
                            <tr {% if recipe.preferred_count > 0 %}class="muted"{% endif %}>
                                <td><a href="{% url 'recipe' recipe.id %}">{{ recipe.name }}</a></td>
                                <td>{{ recipe.pv }}</td>
                                <td>{{ recipe.short_desc }}</td>
                                <td><a href="{% url 'layer_item' url_branch recipe.layerbranch.layer.name %}">{{ recipe.layerbranch.layer.name }}</a></td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
{% else %}
    <p>No duplicate recipes in database.</p>
{% endif %}
            </div>
        </div>


        <div class="row-fluid">
            <div class="span12">
                <h2>Duplicate classes</h2>
{% if classes %}
                <p>Classes with the same name in different layers:</p>
                <table class="table table-striped table-bordered recipestable">
                    <thead>
                        <tr>
                            <th>Class name</th>
                            <th>Layer</th>
                        </tr>
                    </thead>

                    <tbody>
                        {% for class in classes %}
                            <tr>
                                <td><a href="{{ class.vcs_web_url }}">{{ class.name }}</a></td>
                                <td><a href="{% url 'layer_item' 'master' class.layerbranch.layer.name %}">{{ class.layerbranch.layer.name }}</a></td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
{% else %}
    <p>No duplicate classes in database.</p>
{% endif %}
            </div>
        </div>


{% endautoescape %}

{% endblock %}


{% block scripts %}
<script>
    $(document).ready(function() {
        firstfield = $("#filter-form input:text").first()
        if( ! firstfield.val() )
            firstfield.focus()
    });
    $('#id_select_all').click(function (e) {
        $('.filterlayercheckbox').attr('checked', true);
    });
    $('#id_select_none').click(function (e) {
        $('.filterlayercheckbox').attr('checked', false);
    });
    $('#id_cancel').click(function (e) {
        $('.filterlayercheckbox').attr('checked', false);
        showlayers = {{ showlayers }}
        for(i in showlayers) {
            $('#id_layer_' + showlayers[i]).attr('checked', true);
        }
    });
</script>
{% endblock %}