Commit Graph

105 Commits

Author SHA1 Message Date
Paul Eggleton
29c6458dca Support (and require) Python 3
We need to be able to support Python 3 so that we can parse master of
OE-Core with bitbake (which now requires it). This now means the
interface itself and the update script require Python 3.4+.

Part of the implementation for [YOCTO #9704].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-06-12 11:33:08 +12:00
Paul Eggleton
bf94b2f7e9 update.py: allow updating all branches with one command
Allow updating multiple branches, and if no branches are specified,
update all branches that have a new "updates_enabled" flag field set to
True. This avoids the need to have a separate shell script which runs
update.py for each branch (and thus has hardcoded knowledge of each
active branch in the index, i.e. it needs to be kept up-to-date in
addition to the database.)

The migration will default updates_enabled to True for all branches so
if you wish to take advantage of this functionality, the flag will need
to be set to False for any branches that shouldn't be updated.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-06-10 06:55:26 +12:00
Paul Eggleton
c64e4c57a9 update.py: refactor into two separate scripts
In order to try to avoid problems with leaking memory, context bleeding
from one layer to another, and lay the groundwork for supporting
updating all branches in one operation, split the updating of a single
layer out to its own internal script. This means that the tinfoil
instantiation and metadata parsing is in a completely separate process
per layer.

Implements [YOCTO #9647].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-05-30 16:05:25 +12:00
Alex Franco
50eef9b55a Display recipe blacklist information
Display blacklist information for recipes in the recipe details,
as well as the recipe search page, and layer page tables. This
information is pulled from the PNBLACKLIST variable. Includes a
hover text containing the reason for blacklist labels.

Changes to Django and Layerindex files:
- models.py, update.py
- migration file
- templates and static content (stylesheet)

[YOCTO #7855]

Signed-off-by: Alex Franco <alejandro.franco@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
2016-05-24 14:22:58 +01:00
Paul Eggleton
0300063abb update.py: fix splitting on _ when getting class inheritance
The code to populate the inherits information was using a function
designed to get the recipe name from a file path, but unlike recipe
filenames, the underscore isn't treated as special in class filenames
and in fact it's quite common to use underscores there; we were ending
up with items in the inherit list such as "populate" and "rootfs". Use
the standard python os.path functions to do the splitting instead and
avoid this.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2015-11-02 16:16:02 +00:00
Alex Franco
fd63761d2a Support for recipe inherits field
To identify image recipes and provide inheritance data for recipes, an
inherits field was added to the recipe model, and then populated using
refactored data from __inherit_cache. Finally the field was also added
to page templates, along with style changes proposed in attachment, and
an additional style change to display the inherits field as a list in
detailed view. The field skips globally inherited data as proposed.

[YOCTO #7575]

Signed-off-by: Alex Franco <alejandro.franco@linux.intel.com>
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2015-10-07 11:34:28 +01:00
Paul Eggleton
40f1d51de6 update.py: minor fixup for last commit
Fix up memory leak fix for bitbake in daisy and earlier which did not
have bb.codeparser.codecache.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2015-06-15 10:24:18 +01:00
Paul Eggleton
f4b4525858 update.py: fix memory leaks
We're kind of abusing some bitbake internals here and the result is that
there are a bunch of global lists and caches that simply grow as we
parse more layers, until available memory is exhausted. We don't care
about the contents of any of these within the layer index update script
so just clear them out between layers.

Should fix [YOCTO #7663].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2015-06-15 00:03:43 +01:00
Paul Eggleton
0ec1909051 update.py: fix not clearing recipe files list on reload
When we did a full reload this list wasn't getting cleared for the next
layer, and we look at the contents of the list unconditionally later to
determine which files need to be added. Given that the list items are
full paths, this is unlikely to have caused any problems; however it
could possibly have been an issue for nested layers with the right
update order, or lead to issues if the usage of the list changes in
future.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2014-06-12 11:21:09 +01:00
Paul Eggleton
ab393b18c6 update.py: ignore layers within layers
Some layers, such as meta-intel, also contain other layers. We don't
want recipes/classes/appends in those child layers to appear in the
parent layer so ignore any that appear within subdirectories that
contain a conf/layer.conf file.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2014-06-12 11:15:14 +01:00
Paul Eggleton
7c4a1c1dab update.py: fix layer exists-on-branch check
There was a logic error here - we were checking to see if the layer
directory existed before actually checking out the branch, which means
we were looking at the state of whatever branch was previously checked
out. Replace this with some validation of the last revision check and an
additional check for the directory after checking out the branch.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2014-05-24 17:29:23 +01:00
Paul Eggleton
f0b517796f update.py: use actual branch when getting last revision
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2014-05-24 17:23:56 +01:00
Paul Eggleton
f7fa15dd36 Allow layers to have no master branch
With BSPs being "retired" e.g. in meta-intel, it is possible for layers
to not exist on the master branch; since this is legitimate we need the
layer index to handle it.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2014-04-06 15:01:24 +01:00
Paul Eggleton
5ce6448a12 update.py: fix subdirectory does not exist error message
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-12-27 00:13:53 +00:00
Paul Eggleton
84eecd7a54 update.py: add --fullreload option
Recently the -r/--reload option was changed to preserve existing recipe
data, so that it could be used to load values into newly added fields;
however we still need an option to load recipe data from scratch for
testing purposes (e.g. in combination with --nocheckout) so add a
 --fullreload option to do this.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-09-20 07:08:22 +01:00
Paul Eggleton
fe717e0ad1 update.py: fix ability to test updating with --nocheckout
In order to test updating we need to be able to check out a previous
revision of the repository and have the update script load from that
without checking out the latest revision, so fix the --nocheckout
option to work properly.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-09-20 07:08:22 +01:00
Paul Eggleton
ce25644664 update.py: fix Ctrl+C handling during layer update
We do not want to continue on to the next layer on Ctrl+C.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-09-20 07:08:09 +01:00
Paul Eggleton
157656cec9 update.py: hide DeprecationWarnings
These are just annoying if the script is called from a cron job.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-09-05 00:31:23 +01:00
Paul Eggleton
c2e36cda11 update.py: handle if deleted recipe can't be found
Show a warning instead of a traceback if a deleted recipe can't be found
in the database.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-09-05 00:31:23 +01:00
Paul Eggleton
93ce26f21c Ensure logger is passed into runcmd function or use sys.stderr.write
Otherwise it might not be defined when an error.needs to be printed.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-09-05 00:31:23 +01:00
Paul Eggleton
1eebd6e525 Implement locking for update/bulkchange process
Avoid the possibility of these two clashing especially when multiple
branches are being used.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-09-05 00:31:23 +01:00
Paul Eggleton
c3a8eb4d82 Add support for importing OE-Classic recipes
Add a script for doing a one-time import of OE-Classic recipe
information, so comparisons against OE-Core can be performed; this
is stored using a new ClassicRecipe model supporting additional fields
for tracking migration status. The migration status fields can be
updated as well as viewed and summarised in graph format.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-09-05 00:31:22 +01:00
Paul Eggleton
e36280922a update.py: preserve recipe id when updating
The recipe detail pages use the recipe record id, so in case users
bookmark links to these pages, try to preserve the id when a recipe
upgrade occurs (which usually shows up as a delete and an add). This
also works when doing a full update with -r so that we can capture the
newly recorded items (bbclasses, bbappends) without having all the
recipe id values change.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-08-11 11:28:14 +01:00
Paul Eggleton
1a9f73d4a7 Split out recipe parsing and utility functions to a separate module
To allow re-use outside of the update script, split out parsing setup
code to a new recipeparse module. Also split out runcmd, get_layer,
get_branch and logger_create functions to a separate utils module.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-07-28 18:43:11 +01:00
Paul Eggleton
8be1adddb6 Add actual_branch field to layerbranch
Some layers don't use the conventional branch name (i.e. the same name
as the core branch). Add a field so we can record the actual branch name
and use this within the update script.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-06-17 21:11:58 +01:00
Paul Eggleton
9af1144928 Collect bbappends and bbclasses for each layer
Collect bbappend/bbclass info during the update process and display it
on the layer detail page.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-06-17 21:11:53 +01:00
Paul Eggleton
38e8791c21 Collect BUGTRACKER, PROVIDES and BBCLASSEXTEND for each recipe
* Show BUGTRACKER in the recipe detail page if set
* Track the other two variables for possible future use

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-06-03 10:59:10 +01:00
Paul Eggleton
5a07f0422d update.py: add --nocheckout option
This allows disabling the checkout of the appropriate branch so that we
can test the update script with fixes to bitbake or the metadata if
needed.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-05-22 17:45:36 +01:00
Paul Eggleton
611ed1dece update.py: handle change to cooker structure in newer BitBake
The cooker module has been refactored in BitBake master and this moved
and renamed the _parse() function; change the update script to handle
that (whilst still handling older versions).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-05-22 17:42:25 +01:00
Paul Eggleton
a490f057d6 update.py: improve fetch failure handling
* Report layer which failed to fetch in error message
* Don't retry fetching a repo if it already failed for another layer
  (where more than one layer is in the same repository)
* Exit immediately if all fetches failed

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-05-08 22:52:09 +01:00
Paul Eggleton
714bc8e39f update.py: error out with unexpected arguments
It's easy to forget you need to use -l to specify the list of layers to
update and previously we just ignored unused arguments, so check for
them and error out if present.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-05-08 22:01:25 +01:00
Paul Eggleton
1c73d63333 update.py: fix scanning for machine files
* Avoid picking up machine files in sub-layers
* Skip scanning of .git directory when doing full refresh

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-03-20 18:01:02 +00:00
Paul Eggleton
e1bbc39237 update.py: improve handling of machine descriptions
Fall back to NAME if DESCRIPTION is not specified and remove more
preamble from the string.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-03-20 17:21:29 +00:00
Paul Eggleton
42d710b640 update.py: set log level earlier
Ensure that we're not printing info messages when the -q option is
specified.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-03-20 17:04:56 +00:00
Paul Eggleton
9cec14c8a9 update.py: make failure to parse a recipe an error
Ensure that these are still printed when the -q option is used.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-03-20 17:04:56 +00:00
Paul Eggleton
af920d10c9 update.py: set PN for recipe even if we fail to parse it
This ensures recipes that failed to parse sort properly instead of all
appearing at the start of the search results.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-03-20 16:21:41 +00:00
Paul Eggleton
98eed250bc update.py: ensure TMPDIR gets created before starting parse
We don't go through the normal code path where this directory would be
created, and if it doesn't exist an error will be thrown in
insane.bbclass when any QA issue is logged; so create it manually.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-03-20 15:41:58 +00:00
Paul Eggleton
65d3f55925 update.py: explicitly check for existence of conf/layer.conf
Rather than letting BitBake error out, just check for existence of this
file and print a single error line if it doesn't exist.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-03-20 15:41:58 +00:00
Paul Eggleton
f17c5cf04f Move fetch dir calculation to model
This makes it easier to get this directory name outside of the update
script.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-03-20 15:41:58 +00:00
Paul Eggleton
3cc0b78935 update.py: create dependency/maintainer records when creating LayerBranch
If we're creating a LayerBranch record, it's helpful to copy the
maintainer and dependency records in from master as they're usually
going to be the same; if they're not the user can always change them
afterwards.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-03-20 15:41:58 +00:00
Paul Eggleton
0a1215e59e Move repo subdirectory to layerbranch
So it turns out that one or two layers have changed in structure between
branches, so we need to be able to specify this on a per-branch basis.
Good times...

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-03-20 15:41:58 +00:00
Paul Eggleton
94ff843006 update.py: ensure script can be run from any directory
Don't assume the current directory contains our conf/local.conf,
explicitly use the directory above where the script is located.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-03-06 18:08:05 +00:00
Paul Eggleton
df76a64d95 update.py: avoid writing bitbake.lock/cache to current directory
Create a temporary directory for these files.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-03-06 18:07:56 +00:00
Paul Eggleton
354e368aa2 Add support for handling multiple branches
Change the data structure to support multiple branches. At the top level
there is a set list of Branch objects, and then a LayerBranch object
between each layer and the maintainers, dependencies, recipes and
machines, so that the set of each can be different per branch. The
branch is a session option, and can be selected via a drop-down that is
shown for all pages.

Additionally, with this change we avoid the need to run the update
script within a build environment set up with oe-init-build-env - since
we need a specific version of BitBake per branch we now use our own copy
of BitBake which is fetched by the script itself. The update script will
need to be called multiple times however - once per branch.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-03-05 20:37:48 +00:00
Paul Eggleton
d56d280be7 Use top commit for subdirectory instead of repository in update script
If there is more than one layer in a repository, we want the latest
commit in the subdirectory not the entire repository (since we use it
to determine the last commit date which should show how "fresh" the
layer is).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-02-26 11:26:00 +00:00
Paul Eggleton
e0f8a05423 Handle updating of inc files/classes within same layer
If we aren't doing a full refresh, when changes to an included/required
file or an inherited class occur we need to update all of the files that
depend on them. BitBake records these dependencies, so read them and
record them against each recipe.

At the moment this only handles dependencies within the same layer; that
is probably sufficient to handle most changes for the purposes of
extracting the data this application cares about. A future improved
solution will probably involve making use of BitBake's cache rather than
and parsing all layers and their dependencies rather than individual
recipes.

This change also adds -x/--nofetch and -n/--dry-run options for
debugging as well as some further debug messages.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-02-26 11:05:43 +00:00
Paul Eggleton
b47400c38d Don't stop parsing layer on fatal error in update script
"Fatal" errors during parsing a single recipe (such as finding legacy
staging) shouldn't stop us from parsing the rest of the layer. To do
this we need to catch BaseException instead of Exception as fatal errors
end up calling sys.exit.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-02-26 11:04:43 +00:00
Paul Eggleton
b3003840e6 Fix update script to handle layers which include/inherit files from other layers
Parse layer.conf files so that BBPATH is set correctly as well as any
other custom variables. This required the repository fetching to be
split out of the update process and done first so that we're sure we
have the data for the other layers.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-02-25 16:14:50 +00:00
Paul Eggleton
e4eb8213cf Collect machine information from layers
Look for conf/machine/*.conf and add a record for each file found. These
are displayed in the layer detail page if any are present.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-02-24 23:14:53 +00:00
Paul Eggleton
3b5c7ad825 Add ability to update specific layers by name
Add a -l / --layers option to the update script.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-02-24 21:22:49 +00:00
Paul Eggleton
f3174e16f6 Fix update script to handle includes from other directories
Set BBPATH so that files from the layer can be found when recipes use
include/require pointing to files with a specific path, or use
inherit to inherit a class in the layer.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-02-24 21:10:37 +00:00
Paul Eggleton
6c12135117 Don't fail with an error due to unset LICENSE
meta-ti has a recipe in it that causes parsing to fail with a fatal
error due to LICENSE not being set; for the purposes of the layer index
just set a default value for LICENSE so that this doesn't break parsing.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-02-24 20:50:52 +00:00
Paul Eggleton
df6a33967e Clear default value of DESCRIPTION before parsing recipes
By default, if DESCRIPTION is not set it takes the value of SUMMARY.
However, within this tool it is useful for us to be able to tell when
DESCRIPTION has not been set so we want it to be blank if that is the
case.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-02-18 16:29:01 +00:00
Paul Eggleton
873093d2e4 Clear default value of HOMEPAGE before parsing recipes
The default value of HOMEPAGE ('unknown', set from bitbake.conf) is not
particularly helpful - we want it to be blank if it's not set, so just
set it to blank before parsing each recipe.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-02-18 16:23:37 +00:00
Paul Eggleton
2eb5f38b21 Initial commit of layerindex-web
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-02-13 12:09:57 +00:00