Commit Graph

38 Commits

Author SHA1 Message Date
Meh Mbeh Ida Delphine
2314fb2811 Add SPDX license headers to layerindex-web source files
Added SPDX identifiers to all .py files except those in migrations directory.

Fixes: [YOCTO #13527]

Signed-off-by: Meh Mbeh Ida Delphine <idadelm@gmail.com>
Signed-off-by: Paul Eggleton <bluelightning@bluelightning.org>
2021-04-21 08:22:51 +12:00
Paul Eggleton
f774a31eb4 RRS: avoid historical parsing bug in bitbake
In bitbake commit 5796ed550d127853808f38257f8dcc8c1cf59342, line
numbering functionality was improved with the starting line number for
python functions being stored in a "lineno" varflag; however, mapped
functions (using EXPORT_FUNCTIONS) did not have a line number set, which
caused parse failures. This bug was not fixed until
547128731e62b36d2271c4390b3fee2b16c535dc so we should be avoiding any
bitbake commit inside that range.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-11-21 02:27:39 +13:00
Paul Eggleton
3deb6f1416 rrs_upgrade_history: add stop commit option
Add an option to stop at a particular commit (so we can then repeat a
specific commit afterwards easily for debugging purposes).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-11-21 02:27:39 +13:00
Paul Eggleton
d8011bc305 rrs_upgrade_history: implement file path filtering
Make it possible to re-collect all the history for a given path.
(Typically this would only be used for debugging, as it saves time if
you are trying to correct an issue with upgrade data collection for a
single recipe.)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-11-21 02:27:39 +13:00
Paul Eggleton
51d7f139f8 RRS: support grouping upgrades by version for multi-version recipes
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-11-21 02:27:39 +13:00
Paul Eggleton
00548d5ab8 rrs_upgrade_history: record start marker in log file
Make it easier to see where each session starts when looking back
through the log.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-11-21 02:27:39 +13:00
Paul Eggleton
c0b8439182 RRS: collect history independent of current recipes
Recipes come and go over time, so when a recipe gets deleted the history
for it goes away, which means that if you look back in time you do not
see an accurate picture - you only see the subset of recipes that are
currently present. Introduce an indirection between recipes and history
that allows for old recipes to persist (mostly in name only).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-11-21 02:27:39 +13:00
Paul Eggleton
303d7ca235 Use shell=False where possible with utils.runcmd()
It's best practice for security reasons to use shell=False and pass
command line arguments as a list; it also avoids some pain with
escaping, so let's use it everywhere we can (in fact we're only left
with one place in layerindex/tasks.py where we now pass shell=True).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-07-17 11:31:01 +12:00
Paul Eggleton
f6f747fb92 Replace use of assert with exceptions
asserts don't really belong in non-test code, let's handle these
situations properly instead.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-02-14 10:05:53 +13:00
Paul Eggleton
c629787630 rrs: show warnings for missing current release/milestone
If there is no release or milestone covering the current date, show an
error message at the top of the recipes list page to alert the user that
they can't view current data (since this is a common cause of not being
able to see that which may not be immediately apparent).

Additionally, show a warning within rrs_upgrade_history when this
happens.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-09-06 11:08:43 +12:00
Paul Eggleton
7ea14221b8 rrs_upgrade_history: skip commits that don't touch the layer
If we're in a repository containing multiple layers, we don't care about
commits that don't affect the layer we are processing, so skip those
commits rather than passing them to upgrade_history_internal.py which
will ignore them (which is significantly slower).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
201c74ca0f rrs/tools: add -p/--plan option
Add an option to specify which maintenance plan to operate on (largely
for debugging purposes).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
4b268a08b8 rrs_upgrade_history: drop final clean
We don't really need to clean up the repository, we'll take care of it
on subsequent runs.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
Paul Eggleton
4eace1a8bc rrs_upgrade_history: Add debug option to process specific commit
Sometimes it's useful to be able to re-try processing a particular
commit (generally in conjunction with --dry-run), so add an option to
enable that.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00
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
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
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
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
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
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
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
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
Aníbal Limón
d94a3524b2 rrs/tools/rrs_upgrade_history.py: Remove mp process related code
The new tinfoil API acts as a client/server so isn't need to work
around creating process to avoid errors in cooker with different
data revisions.

Also add a try/except when create an upgrade display the error.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2018-05-04 23:57:52 +12:00
Aníbal Limón
d13329be1d rrs/tools: Upgrade to use new API of tinfoil
The new client/server API of tinfoil requires explicit call of
shutdown method to send the event for finalize cooker process.

[YOCTO #10863]

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2018-05-04 23:57:52 +12:00
Aníbal Limón
8ed223e13c rrs/tools: Upgrade to use transaction.atomic() in Django 1.6
Django 1.6 provides a context manager for atomic transactions so
update the way for make db transactions.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2018-05-04 23:57:52 +12:00
Aníbal Limón
2c6610ce5d rrs/tools/rrs_upgrade_history.py: Fix import of split_recipe_fn
split_recipe_fn function was moved to update_layer during python3
upgrade in layerindex.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2018-05-04 23:57:52 +12:00
Aníbal Limón
5410eb9ccc rrs/tools/rrs_upgrade_history.py: Don't take into account git recipes
without versioning.

Don't detect upgrade in git recipes that don't have versioning only
PV=git.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2018-05-04 23:57:52 +12:00
Aníbal Limón
d745458018 rrs/tools: Convert unicode strings from Django models to strings.
bb.cache.Cache.loadDatafull() expects an filepath in asciii, if not
is provided it fails with character mapping error.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2018-05-04 23:57:52 +12:00
Aníbal Limón
1f0935240d rrs/tools: Remove call to tinfoil shutdown method.
Tinfoil shutdown was not accepted as patch into bitbake because
this is a simple solution to a big problem.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2018-05-04 23:57:52 +12:00
Aníbal Limón
1b6ba9fb0f rrs/tools/rrs_upgrade_history.py: WORKAROUND Run recipe parse as different proccess.
When runs recipe parse with different revisions in same process it
generates errors due to cooker parser uses global data cache's.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2018-05-04 23:57:52 +12:00
Aníbal Limón
ec0ae0dc29 rrs/tools.py: Create standalone get_recipe_pv_without_srcpv function.
Copied get_recipe_pv_without_srcpv from oe-core/recipeutils library
to avoid import errors caused by have imported twice oe-core from poky
and from tinfoil.

rrs/tools/rrs_upgrade_history.py: Update to use get_recipe_pv_without_srcpv
from common.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2018-05-04 23:57:52 +12:00
Aníbal Limón
45bd164233 rrs/tools: Change to use get_logger from common.
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2018-05-04 23:57:52 +12:00
Aníbal Limón
00045cb6dc rrs/tools/rrs_upgrade_history.py: Only run upgrade detection when detect recipe files in commit.
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2018-05-04 23:57:52 +12:00
Aníbal Limón
5a2ea7713b rrs/tools/rrs_upgrade_history.py: Improve version detection.
Use load_recipes from common instead of parse PV by hand.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2018-05-04 23:57:52 +12:00
Aníbal Limón
bdde6f5c1b rrs/tools/rrs_: Reorder imports.
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2018-05-04 23:57:52 +12:00
Aníbal Limón
dc0fd18ca1 rrs/tools/rrs_upgrade_history.py: Add script for update the recipe upgrades history.
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2018-05-04 23:57:52 +12:00