Commit Graph

584 Commits

Author SHA1 Message Date
Paul Eggleton
291f6bfde7 rrs/tools: use layer index lock
We check out different revisions while we do this processing, and so
does the layer index update script, so we shouldn't be allowing both to
run at once or nasty stuff will happen.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
2afa51b108 rrs_upgrade_history: only look at commits that actually change recipes
Since we're now executing a separate script per commit, we should try
not to do that unless the commit actually touches recipe files in order
to avoid wasting time.

(Whilst it's possible that a change to a bbclass might alter what's in
the recipe, we can ignore that since we are only concerned with actual
upgrades which would always require some sort of change to the recipe or
an include file, so we can safely skip commits that don't do that.)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
000ebf4d59 rrs_upstream_history: use try...finally to ensure tinfoil is shut down
We want tinfoil.shutdown() to be called even if an exception occurs.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
7831eec543 rrs_upgrade_history: use date/commit of last recipe upgrade import
Instead of arbitrarily importing the last 8 days of upgrades, record the
date and commit when we do an import, and then use that information the
next time the script is run.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
c607ba6945 rrs_upgrade_history: handle multiple recipes with same pn per layer
We should expect multiple matches for layerbranch + pn, so use filter()
instead of get() and take the first id that matches.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
fdec9d1d63 rrs_upgrade_history: add a --fullreload option
Add a --fullreload option which deletes all upgrade records for the
layerbranch first.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
add075ae00 rrs/tools/common.py: ensure we pass a string to loadDataFull()
We're calling translate() on the string deep in the bowels of the
parsing code and that doesn't work well if the string is unicode, so
convert it to a plain string first. That won't work well if the filename
is unicode but the chances of that with a recipe is pretty small I would
think.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
acac7d6e9c rrs_upgrade_history.py: ensure we shut down tinfoil safely
Use try...finally to ensure we shut down tinfoil, but since we are
potentially dealing with older bitbake releases when importing older
upgrades, only call shutdown() if it's actually there (and although it's
unlikely, guard against the broken shutdown() in fido as we do in the
main layer index update script).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
ba27f9fee0 rrs_upgrade_history.py: enable to work across python2/3 versions
If you want to go back and get history for the earlier releases (krogoth
and previous) then we need to be able to support both python 2 and 3,
which practically means we need the same split for this script as we
have for the main layer index update script.

The catch here is that since we are going back and following the history
of changes forward, we basically need to use the same version of bitbake
that was current at that time. This works except for around the
transition between python 2 to 3 where the metadata lagged behind a bit,
so we need to take that into account. In order to keep things generic we
have a date field on the maintenance plan layer branch that specifies
the date in the metadata where we should switch over to python 3, and
then link to PythonEnvironment records that should be used for python 2
and 3 respectively.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
59b66d5505 Move run_command_interruptible() to utils
Make this function more easily reusable from the RRS code.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
50aab7c03a rrs/tools: run all tools scripts with python3
These scripts should all now be run under python 3, so update the
shebangs accordingly.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
8a2839b870 rrs: add breadcrumb to recipe detail page
Make it possible to get back to the maintenance plan from the recipe
detail page.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
efc136b1bb rrs: add titles to maintainers/recipes page
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
ea6270f386 rrs: handle dependency field differences
The old RRS branch had its own addition of dependency support, but in the
mean time we added that to the layer index in the master branch using a
different structure. Adapt the RRS recipe detail page to that structure.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
b2a67d718c Add link to maintenance plan in layer detail
If the RRS is enabled, then add a way to get from the layer detail page
to any maintenance plans in which the layer is included.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
88467d1ab9 rrs: use default milestone instead of "All" for release drop-down
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
1733170583 rrs: add maintenance plan selection
Add a drop-down for selecting the maintenance plan from the recipes
page.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
9b7eec7ec8 rrs: replace fixtures with initial data migration
Fixtures aren't supported in current Django versions. Add some code to
the initial migration to add the data instead.

Also add releases/milestones up to and including 2.5.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
e77b652192 rrs/views: fix SQL parameter in get_reup_by_last_updated()
We were passing in a parameter value but not using that in the query.
Add a WHERE clause to fix that.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
8517822d43 rrs/views: fix case in table names
Table names should be lowercase. I'm unsure if the collation settings
have an effect on this, but with the mariadb database I set up here I
needed to make this change or else I got errors about missing tables.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
24db787f68 rrs/models: handle All missing in milestones
If we call objects.get() with no matching record then the result will be
an exception, not a null return, so handle that properly.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
b8f51c7f9e rrs: handle maintenance plans in views
Insert maintenance plan into views, their corresponding URLs and
templates.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
0b6dac83b5 rrs_upstream_email: Adapt to template rendering API change
With Django 1.10+, if you use get_template() to retrieve a template,
then you can't pass a context when calling .render() on it, you need to
pass a dict instead.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
227b9c65af rrs_upstream_email: rework
* Use maintenance plans to get layerbranches
* Use from/to/subject and admin contact from maintenance plan
* Use an actual template to render the email (and drop tabulate
  dependency)
* Improve grammar in the email text
* Use a single line to represent the most recent commit

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
735353ebd1 rrs/models: add fields for more flexible email handling
* Add a flag to say whether emails should be sent
* Add fields for from/to/subject (to replace what's currently in
  settings)
* Add user link for administrator to replace the hardcoded values in the
  email template

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
0aa4b93d18 rrs/tools: drop update_repo()
This function is no longer needed - we now rely upon the layer index's
code to do this (update through the update script, and checkout through
setup_layer()).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
d4c400f7bf rrs_distros: support maintenance plans and remove poky hardcoding
Remove hardcoded references to the poky repository, and process
layerbranches for all enabled maintenance plans.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
034d66ab5a rrs/tools: print debug message when parsing recipes
Without this it's not clear what's happening if debug mode is enabled
and you are waiting for the parsing step.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
4ea3834033 rrs_upstream_history: properly handle missing Recipe
If the Recipe object doesn't exist here then an exception will be raised
rather than None being returned, and this will also trigger if multiple
recipes match. This may have never triggered in the past because this
would have been run right after updating all the recipes in the layer and
clearing out duplicates (which we were doing earlier), and thus what is
in the database would match the recipe files in the repository, assuming
no errors occurred during parsing). We can't remove duplicates though so
we need to switch over to using filter() and taking the first recipe.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
97a6b7eaf9 rrs_upgrade_history: drop unused import
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
0c1763bf56 rrs_upstream_history.py: support maintenance plans and remove poky hardcoding
Remove hardcoded references to the poky repository, and process
layerbranches for all enabled maintenance plans.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
0bab50462c rrs_upstream_history.py: drop threading
This is never going to work, the only way we can practically do parallel
execution is to run these things in a task which would basically amount
to distrodata's do_checkpkg; we may move to that in future but for now
just drop the threading code.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
687c2b0051 rrs_maintainer_history.py: support maintenance plans and remove poky hardcoding
Instead of hardcoded references to the poky repository, look for any
maintainers.inc file in layers associated with the layerbranches for all
enabled maintenance plans. At present few layers have this file, but at
least it will now work generically in any layer index instance.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
33e3dee9e7 rrs/tools/common.py: import sys/os at top
These are common enough that they should be imported up front.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
aad000734c utils: decode command output in runcmd() as UTF-8
Sometimes we get back UTF-8 characters (particularly when picking up
names from git commits), and the ascii codec will error out if that
happens, so switch over to utf-8.

We can as a result remove the decode() calls from the bulk change view.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
edb1261d2b rrs: fix model string representations for Python 3
__unicode__ doesn't work anymore, we need to use __str__ for models
instead.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
252578e26d rrs_upgrade_history.py: add maintenance plan handling
Instead of processing all layerbranches, only process those associated
with an enabled maintenance plan. This is one step towards being able to
use the RRS together with a more general layer index database.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
8370c10306 rrs/tools: avoid unnecessary checkouts
We don't need to create branches here, and we don't need to actually
check anything out unless we're going to parse, so we can save a bit of
time by not doing so.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
6f34b7fce7 rrs: show full name in admin
It's neater to show "Recipe Reporting System" instead of "Rrs".

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
24960bb7be rrs: add Release link to MaintenancePlan
If any Releases exist then we create a default MaintenancePlan and then
link all Releases to it - this needs to be done in multiple upgrade
steps since the field needs to be non-null.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
1f49943aee rrs: add maintenance plans
The MaintenancePlan will provide some context for the RRS records so we
can effectively enable RRS functionality only on certain layers where we
want it. You can also consider the maintenance of multiple layers
together under a single plan if desired.

Here we add just the MaintenancePlan and the corresponding migration;
a non-null link from the Release requires a separate migration and thus
that will be done in a separate commit.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
8a9a846d1e rrs: add initial migration
This is of course a new Django migration rather than the previous South
one. This will have to be applied using --fake-initial on a database
that already has the RRS tables.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
cecb5924a8 rrs: drop old migrations
These south migrations aren't useful.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
fd786875c3 rrs/tools: add dry-run option to each script
Add the ability to run the scripts without writing changes back to the
database, for debugging purposes.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
6ca3d6649e Use this layer index's URL for layer branch
If we're integrating the layer index and the RRS, no need to jump off to
the OE index if for example this is an internal index.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
e50c2e6841 Rename RRS URLs to have rrs_ prefix
Make these distinct from the layerindex ones.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
bb20ca4fb0 Drop "load url from future"
This is no longer needed with current Django versions.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
10a639a6b7 rrs/tools/rrs_unique_recipes: drop
We can't just delete arbitrary recipes that do exist in the layer if
we're in a general layer index database. We'll need to handle this in a
different way, or just live with the fact that there will be duplicate
entries.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Paul Eggleton
f58754c998 rrs/models: move Raw class to views.py
This is something that really belongs in with the views, so move it
there.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:52 +12:00
Aníbal Limón
510dec2ee8 rrs/tools/rrs_{distros,upstream_history}: Add path for poky meta lib
Due to bitbake client/server changes now the meta path isn't included
to sys.path when load tinfoil.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2018-05-04 23:57:52 +12:00