Commit Graph

18 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
f78fd0707c import_layers: tweak debug logging to be a bit more useful
* Drop most "Skipping..." messages
* Use layerbranch name instead of ID

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-10-02 14:13:47 +13:00
Paul Eggleton
16734d7082 import_layers: use vcs_last_rev to check if record is updated
Unfortunately the "updated" date gets changed every time the repo is
fetched (i.e. vcs_last_fetch changes), but that doesn't mean the
layerbranch or anything under it has actually changed. Use vcs_last_rev
instead although unfortunately that won't catch manual edits to the
layerbranch alone.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-10-02 14:13:47 +13:00
Paul Eggleton
b78e498c20 import_layers: fix updating build dependencies
Apparently I forgot that filter() returns a QuerySet and not an actual
object.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-09-17 15:35:44 +12:00
Paul Eggleton
b46de0bfa7 import_layers: fix output when importing layers from scratch
Fixes "Importing None" message since we had not yet initialised the
layerbranch variable.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-09-16 17:15:58 +12:00
Paul Eggleton
cb4bd5e45b import_layers: use recipesExtended viewset
The new viewset has a different URL and uses pagination, so we need to
take that into account.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-09-16 17:15:18 +12:00
Paul Eggleton
7953e7a853 import_layers: show basic progress
Show an info message with a counter when importing layers.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-08-06 11:57:05 +12:00
Paul Eggleton
54e51c26ac import_layers: add reload option
Make it possible to reload the data even if the updated field says it's
up-to-date.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-08-06 11:38:50 +12:00
Paul Eggleton
40aada94e0 import_layers: delete non-matching LayerBranch objects
If a LayerBranch is on a branch that is in the remote layer index (and
that branch is in any branch list specified with -b/--branch) and the
layer for the LayerBranch is not found in the remote layerindex then it
should be deleted, otherwise we could end up with stale data.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-08-06 11:38:50 +12:00
Paul Eggleton
0d62b19a38 import_layers: allow filtering layers
Add an option to import only certain layers - mostly for debugging
(can make testing a lot quicker).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-08-06 11:38:33 +12:00
Paul Eggleton
8501a6da40 import_layers: allow filtering branches
We only work with branches that exist in both the local database and the
remote index, but allow the user to restrict the list further if
desired.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-08-06 11:38:06 +12:00
Paul Eggleton
577e62e62f import_layers: switch to argparse
No functionality changes, just a code upgrade.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-08-06 11:38:01 +12:00
Paul Eggleton
71ff6571c6 import_layers: import other missing items
Import Machine, Distro, BBClass, BBAppend, IncFile objects.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-08-06 09:55:34 +12:00
Paul Eggleton
150b774cce import_layers: import recipes
Import recipe data from the REST API, including sub-recipe objects
(sources, patches, PACKAGE_CONFIGs, dependencies etc.) now that they are
available from the API. Also, with the data being more or less complete,
it's also reasonable to also set the vcs_* fields so that we can tell
how up-to-date it is.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-08-06 09:54:43 +12:00
Paul Eggleton
5352a227ab import_layers: enable incremental LayerItem/LayerBranch import
Don't assume we need to create these objects - check the updated field
value against what the API reports and update the existing object if the
latter is newer.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-08-05 16:18:00 +12:00
Paul Eggleton
8861ccfa19 import_layers: avoid importing duplicate objects
For LayerDependency, LayerMaintainer and LayerNote objects, properly
sync the objects in the database with the objects fetched from the API.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-08-05 16:18:00 +12:00
Paul Eggleton
e033154f4f import_layers: fix URL construction
If you specified only the layer index URL and not the full API URL i.e.
https://layers.openembedded.org then we put an extra slash in the URL
which resulted in the request being redirected to the main page which
breaks the request.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2019-07-17 11:31:04 +12:00
Paul Eggleton
98be24336b Add a script to import layers from an existing layer index
Add a script that uses the REST API to gather information from another
running layer index instance (e.g. layers.openembedded.org) and import
that into the local index. Only information for branches that are
already set up is imported, and only manually entered information -
no recipes, machines, etc.

Partially implements [YOCTO #9760].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-08-06 14:38:40 +02:00