plainbox:session:state: add JobState.effective_category_id

This patch adds a new, writable property to the JobState class. As the
name suggests, this property holds the effective category identifier of
a given job within a given session. This allows anyone that needs to
know the effective identifier to simply look it up without any
additional lookaside tables.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:unit:testplan: fix category overrides

This patch fixes swapped arguments on re.match() that made category
overrides either fail silently (most of the time) or perhaps cras as a
bad regular expression (possibly)

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:unit:testplan: add get_effective_category()

This patch adds a new method, TestPlan.get_effective_category() that is
similar to get_effective_category_map() but works for a single job a
little bit faster.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:providers:stubbox: add stub override test plan

This patch adds a new test plan to stubbox (the test provider) which is
using category overrides. Using this test plan one can test how category
overrides are applied in practice. For example:

        stubbox run -T 2013.com.canonical.plainbox::category-override-test

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:exporter: use effective category_id

This patch changes the base exporter class to put the effective,
category identifier into the 'category_id' field of the per-test-result
export meta-data. Previously this field only held the so-called
"partial" category identifier (and only natural identifiers) which was
insufficient to look up the corresponding category unit.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:exporter: add OPTION_WITH_CATEGORY_MAP

This patch adds a new option to the base exporter class. The
OPTION_WITH_CATEGORY_MAP (aka with-category-map) controls the new
category_map attribute in the computed JSON representation. The
attribute contains a mapping from category identifier to a translated
category name for each category that was used by at least one job.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:exporter: add support for uncategorized jobs

This patch makes the base exporter class generate information for the
special, built-in 'uncategorized' job category. This category is
implicitly assigned to each job that doesn't have a better category
available.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:exporter: use translatable job summary

This patch changes the base exporter data transformation code to use
JobDefinition.tr_summary() instead of .summary. This makes the test
summary translated in various reports.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:exporter: fix PEP-8 issue

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:exporter: fix PEP-8 issue (2)

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:exporter: fix PEP-8 issue (3)

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:exporter: fix PEP-8 issue (4)

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:exporter: fix PEP-8 issue (5)

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:exporter:xlsx: require OPTION_WITH_CATEGORY_MAP

This patch makes the xlsx exported depend on the
OPTION_WITH_CATEGORY_MAP option.

This is required for the new-style category headers.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:exporter:xlsx: pass category_map to _tree()

This patch makes the _tree() method (internal to xlsx exporter class)
get both the result and category map.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:exporter:xlsx: use category names instead of ids

This patch makes the _tree() method use the now-available translated
category names instead of the raw category identifiers.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:exporter:xslx: sprinkle missing gettext calls

This patch adds a few missing calls to gettext around constants like
"FAIL", "PASS" and "skip". Later on all such values will come from the
outcome meta-data API but for now that's just better.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:command:run: set effective category id

This patch makes 'plainbox run' and 'checkbox ...' set the effective
category identifier (only when using test plans where such values may be
different than the natural identifiers). This allows reports to see the
category identifier transformations that can be performed by a test
plan.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:commands:run: display effective category

This patch changes 'plainbox run' user interface to display the
effective category identifier instead of the natural category identifier
associated with each executed job.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
checkbox-touch: set effective category identifiers

This pach mirros the previous patch to plainbox and makes checkbox touch
set the effective category identifier every time a test plan is
selected. This patch is not fully correct as it doesn't handle generated
jobs (and doesn't keep the effective category id updated for jobs that
got added during testing) but so far those are not supported by checkbox
touch much.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>