Commit Graph

332 Commits

Author SHA1 Message Date
Amanda Brindle
ffaee423ee templates/layerindex/classes.html: Add bbclass search
Add another tab to search for classes.

Fixes [YOCTO #11207]

Signed-off by: Amanda Brindle <amanda.r.brindle@intel.com>
2017-11-06 14:16:57 -08:00
Paul Eggleton
44386eea41 querysethelper: fix searching
Don't assume that every model will have a "search_allowed_fields"
attribute - if it doesn't, default to all CharFields in the model. This
fixes searching via the REST API.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-10-31 09:58:30 +13:00
Amanda Brindle
be95164aa7 Send email notification on publication
When publishing a layer, send an email notification to all of that
layer's maintainers. Include information on how to edit the layer, plus
contact details for the first active staff user if there are any
problems (we could make this configurable in future, but for now this is
sufficient).

Fixes [YOCTO #11208]

Signed-off-by: Amanda Brindle <amanda.r.brindle@intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-10-31 09:58:30 +13:00
Paul Eggleton
ad1aac4ea5 Show note if layer branch hasn't been indexed
For newly added layers it may not be immediately obvious that you have
to wait for it to be indexed (since the update script is usually run on
a scheduled basis). If the layer branch hasn't been indexed, add a note
mentioning this.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-10-04 13:49:00 +13:00
Paul Eggleton
f7950b885c models: allow LayerBranch.collection to be blank
It's really irritating to be forced to specify a value for this field
especially as it'll get auto-populated by the update script. Set
blank=True to allow that. While we're at it, touch up the description a
bit to make more sense.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-10-04 13:28:24 +13:00
Paul Eggleton
36d315972b update: allow preserving temp directory
If you're diagnosing problems with the bitbake server when running the
update script, then you need to be able to look at
bitbake-cookerdaemon.log, but you couldn't do that after the fact
because the temporary directory it gets written out to was being
unconditionally deleted. Add a --keep-temp option which preserves it and
some debug messages to tell you where it is.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-10-03 11:42:51 +13:00
Amanda Brindle
fdcde00710 Indicate if layer has YP Compatible certification
Allow admin to create Yocto Project versions with the version name,
description, an icon link that represents that version, and a link that
contains more information about the version.

Admins who have the "set_yp_compatibility" permission can then
decide if a layer has Yocto Project compatible certification,
and if it does, admin can choose which version of Yocto Project
the layer is compatible with. If a layer is deemed compatible,
the version's icon will appear next to the layer's name, and
the icon be a clickable link to a page with more information.

Fixes [YOCTO #11452]

Signed-off-by: Amanda Brindle <amanda.r.brindle@intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-09-27 15:26:24 +13:00
Amanda Brindle
e397524791 Don't show "Starting bitbake server" in update log
If a log level is set on the command line with -q/-d,
set tinfoil's log level to the appropriate log level.

Fixes [YOCTO #11931]

Signed-off-by: Amanda Brindle <amanda.r.brindle@intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-09-27 14:48:41 +13:00
Paul Eggleton
e894aabead templates/about: add Diana Thayer to contributors list
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-09-01 17:01:34 +12:00
Diana Thayer
2e671480c7 Asynchronous email notifications, task execution
This patch adds asynchronous task execution using a Celery backend
and RabbitMQ task queue, so that the layer submission process to
proceed even in the event that sending the notification email fails,
and establishing an asynchronous execution mechanism that we can use
in the future e.g. for triggering parse operations from the web UI.
This pertains to bug 11197:

https://bugzilla.yoctoproject.org/show_bug.cgi?id=11197

It updates the README to reflect the installation and configuration
of a basic RabbitMQ setup, adds a 'tasks.py' file to contain task
definitions, updates the 'edit_layer_view' function to send
emails to administrators about new and updated layers asynchronously,
modifies the 'settings.py' to include a default configuration
for a RabbitMQ connection, and updates the Dockerfile to start a Celery
worker alongside the Gunicorn daemon.

Fixes [YOCTO #11197].

Signed-off-by: Diana Thayer <garbados@gmail.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-09-01 16:59:43 +12:00
Paul Eggleton
389971d1dc templates/about: add Jose and Amanda to credits
Patches have been recently merged from both.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-08-22 08:56:08 +12:00
Amanda Brindle
432c9d408e Redirect user to correct url after editing a layer
Before, if a user edited a layer's name, they would be redirected
to a url utilizing the old name and then receive a 404 Page not
found error. Now, the url utilizes the new name.

Fixes [YOCTO #11932]

Signed-off-by: Amanda Brindle <amanda.r.brindle@intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-08-22 08:54:31 +12:00
Paul Eggleton
796722ca77 templates/about: add Robert Yang to credits
Robert's changes just got merged recently.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-08-04 11:20:16 +02:00
Paul Eggleton
07315e0b88 views: add ability to force https URL in layer review emails
At the moment the URL that is presented in the review email will have
http:// or https:// prefix depending on what the user who submitted the
layer was using, but that's irrelevant - we actually want https:// if
the server is capable of it since the reviewer may be redirected to log
in (and Django's login_required decorator will always redirect to the
login page if http is being used as far as I observed, which is a bit
annoying if you are already logged in.) Add a setting which if enabled
will substitute https:// as the prefix.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-07-21 11:40:02 +02:00
Robert Yang
e93eef34bd update_layer.py: delete layerbranch for non-existent branch
The branch is not needed any more when it has been removed from the repo, so we
also need remove its layerbranch, otherwise it still can be got from the web,
which causes confusions.

Note, we have to move the location of tinfoil's code to avoid creating tinfoil
when not needed, otherewise, if tinfoil is created (but not needed), and the
program exists earlier before "try ... finally" block, then tinfoil.shutdown()
doesn't run so that it is not shutdown. Move the code back, right before where
it is needed can fix the problem.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-07-21 08:15:53 +02:00
Robert Yang
f6cb14678b update.py: add -p to git fetch
-p, --prune
    Before fetching, remove any remote-tracking references that no longer exist on the remote.

Fixed:
$ git push origin :test_branch
$ ./update.py

The test_branch was still in fetched local repo which was incorrect, it should
be gone since it has been removed by upstream.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-07-21 08:15:53 +02:00
Robert Yang
b478ff069e update_layer.py: move the location of transaction.atomic()
It doesn't need to be so ahead since we only need it when writing database, and
a following patch will remove layerbranch from database when the branch had
been removed from the repo, it's not easy to do the work in
transaction.atomic() block.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-07-21 08:15:53 +02:00
Robert Yang
de4400674d update_layer.py: remove --update-dependencies
It never works since it is in the middle of transaction.atomic() block, and
update.py doesn't need it any more, so remove it.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-07-21 08:15:53 +02:00
Robert Yang
3ae517091b update.py: update layers in dependency order
* Problems
The update.py couldn't handle new (not only new branch, in fact, but also
existing branches, see below for more info) branch well, for example, there are
3 layers: layer_A, layer_B and layer_C, and create new branch "branch_1" for
them, and they have depends:

layer_A -> layer_B -> layer_C

The "->" means depends on.

Then run "update.py -b branch_1", there would be errors like:

ERROR: Dependency layer_B of layer_A does not have branch record for branch branch_1

Though update.py runs "update_layer.py" twice, but it didn't help since
layerbranch was None when it was failed to create in the first run.

The reason is if update.py updates layer_A firstly, it would fail since it
can't find layer_B:branch_1 in database (not added to database yet), similarly,
if add layer_B before layer_C, it would also fail. Only layer_C can be added
(assume it has no dependencies). So we have to re-run update.py again and again
to make it work, here we may have to run update.py 3 times, and more runs are
needed if the dependency chain is longer.

* Solutions:
Make update.py pass layers orderly to update_layer.py according to dependencies
can fix the problem, we can get intial dependencies from tinfoil, add an option
"-i, --initial" to update_layer.py to get them.

Not only new branch, but also existing branches may have the problem, because
collections and dependencies maybe changed in the coming update, so we can't
trust database when the layer is going to be updated, for example, if there are
10 layers in database, and 3 of them will be updated (-l layer1,layer2,layer3),
then we can not use the 3 layers' collections data from database, we need get
them from tinfoil.

* Performance improvement:
  It should be the same as before in theory, I have tested it with 97 layers:
  - Before: 11m6.472s, but only 75 layers were added, 22 ones were failed, I
    have to re-run update.py again and again (maybe 4 times to make all of
    them added). So:
    (11 * 60 + 6)/75*97/60 = 14m35s

  - Now 12m10.350s, all the layers are added in the first run.

   So about 2 minutes are saved.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-07-21 08:15:53 +02:00
Robert Yang
e5f718182f recipeparse.py: restore cwd when the parsing is done
If we don't restore the current working directory, it may cause trouble
for the calling function.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-07-21 08:15:19 +02:00
Robert Yang
d689b785c4 update_layer.py: set layerbranch's collection before add_dependencies
The _add_dependency() uses:
if layerbranch.collection:
    var_name = layerbranch.collection

The layerbranch.collection is none if it is newly created, thus it can't get
LAYERDEPENDS, because what defined in layer.conf is LAYERDEPENDS_<collection>,
but what it would get is LAYERDEPENDS_<layer_name>, this patch can fix the
problem.

Reproducer:
$ python3 update_layer.py -l mete-xfce -b <newbranch> --fullreload -d

It would get None LAYERDEPENDS.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-07-21 08:14:57 +02:00
Robert Yang
a4d14191f4 utils.py: add REMOVE_LAYER_DEPENDENCIES to remove dependencies
Fixed:
 1) set LAYERDEPENDS_openembedded-layer = "core"
 2) $ "update.py -l meta-oe -b master"
    Check from web, its dependency is "openembedded-core"
 3) Change LAYERDEPENDS_openembedded-layer = "foo"
 4) Run "update.py -l meta-oe -b master"
 5) Check from web, its dependency is "openembedded-core and foo", this might
    be incorrect, now if set REMOVE_LAYER_DEPENDENCIES to true, the old
    dependency openembedded-core will be removed, the default is False which
    prints warnings to notify users.

And also the existing checking should filter(required=required), otherwise it
can't work well when a layer is in both depends and recommends, this can't
happen in a normal case, but it would surprise the user when this happens.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-07-21 08:14:57 +02:00
Robert Yang
a474dae060 layerconfparse.py: remove unused layerbranch from parse_layer()
The layerbranch is not used in parse_layer(), so remove it.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-07-21 08:14:57 +02:00
Robert Yang
2735d9590a update.py: update actual branch for layer and bitbake
Add an option "-a" to update actual branch for layer and bitbake, it is
useful when there are many layers and need update actual branches
frequently. We only can update them via website without this patch,
which is not fun and easy to make mistakes.

* It works with "-l", and "-l bitbake" means update bitbake branch.
* It requires "-b" to work, and only one branch is supported in a run.

For example:
$ update.py -b master -a branch_20170526
All the layers which have branch master and actual_branch branch_20170526
will be updated to branch_20170526.

$ update.py -b master -l meta-oe -a branch_20170526
Only meta-oe layer will be updated.

$ update.py -b master -l bitbake -a branch_20170526
The bitbake's bitbake_branch will be updated.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-07-21 08:14:34 +02:00
Jose Lamego
b958a991ca layerindex/views: support querying by layer name
This change supports querying recipes that belong to a specific layer
by using the prefix "layer:" + the desired layer name, for example:
"layer: openembedded-core" and this string can be used by itself or
combined with other supported options.

A descriptive error message is displayed when the query string has an
unexpected formatting or a non-valid layer name is searched.

[YOCTO #6618]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-06-15 16:04:14 +02:00
Paul Eggleton
8dfe44ed5e TODO: drop implemented items
Drop a couple of items that got implemented recently.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-03-22 14:21:22 +13:00
Paul Eggleton
84fb2b1b29 local.conf: fix HOSTTOOLS blocking parsing
In OE-Core master, HOSTTOOLS specifies a list of host-side tools to be
symlinked into a directory that is placed in a filtered path, so that
binaries used from the host are a controlled subset. This variable is
acted upon at configuration parse time and if any tools are missing,
parsing is terminated.

We're not actually running any tasks, so we won't need to call most of
the tools specified by HOSTTOOLS. There is one we definitely do need to
run (gcc) so keep that one, but the rest can be moved to
HOSTTOOLS_NONFATAL.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-03-20 14:34:08 +13:00
Paul Eggleton
51614fe5a0 layerindex: add "No update" status to LayerItem
Add a status for a layer indicating it should not be updated. I don't
expect this to be widely used (and is only settable from the admin
interface) but would be useful if you have a legacy sub-layer that you
want to prevent from being visible on certain branches - it will prevent
the update script from doing anything with the layer and thus avoid
branch records from being auto-created on branches where you've deleted
it.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-03-14 15:19:53 +13:00
Paul Eggleton
2919424f89 update_layer.py: use DISTRO_NAME as primary distro short description
When reading conf/distro/*.conf to create distro records, attempt to
parse the config file and use DISTRO_NAME (if set) to populate the
description field for the record. If that's not set then fall back to
the less commonly used meta-comment that we supported previously.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-03-14 15:19:53 +13:00
Paul Eggleton
d62b84f593 utils.py: split out parse_conf() from parse_layer_conf()
If we want to parse a configuration file (e.g. a distro conf file) then
we need convenient access to bitbake's conf parsing code, so create a
parse_conf() function to provide that.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-03-14 15:19:53 +13:00
Alex Franco
c8c25fb641 views.py: single result redirect
When the recipe search returns a single result, redirect to it
instead of showing the full result list view.

Part of the fix for [YOCTO #6618].

Signed-off-by: Alex Franco <alejandro.franco@linux.intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-03-14 15:19:53 +13:00
Paul Eggleton
b1c5b15ae8 migrations: add missing migration for branch meta change
The branch meta change made in b91b09a0ae
apparently requires this migration - not entirely sure why, but Django's
manage.py makemigrations wants to create it.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-03-14 15:14:09 +13:00
Paul Eggleton
b91b09a0ae models.py: minor branch tweaks
Make minor (non-structural) improvements to the model, mostly for the
benefit of the admin interface:

* Set default ordering so that branches appear in the same order they do
  in the user-facing drop-down
* Include the description in the default string representation (so you
  know which branch name matches with which Yocto Project version, in
  the OE index).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-03-07 09:22:14 +13:00
Paul Eggleton
128f86adfc utils.py: fix bad indenting
We should always be using four spaces.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-03-07 09:04:17 +13:00
Paul Eggleton
05b8528142 update.py: use reader to decode subprocess output correctly
We can't decode UTF-8 characters byte-by-byte, as soon as we hit a
character that's more than one byte long then we'll fail. Use a reader
object to do it properly. This fixes parsing current meta-angstrom on
master. At the same time, specify errors="surrogateescape" to avoid the
update process dying at this point in case of characters that aren't
valid UTF-8.

Thanks to Jiajie Hu <jiajie.hu@intel.com> who fixed this in devtool's
very similar code.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-03-07 09:02:06 +13:00
Paul Eggleton
19a559cfa6 update_layer: fix tinfoil shutdown check to work for fido branch
The fido branch of OE-Core expects BitBake 1.26.x. Unfortunately that
version had a commit backported which introduced a non-working
tinfoil.shutdown() method, so we can't simply rely on its presence to
determine whether or not it should be called. Use a check on the BitBake
version number instead.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-01-18 11:20:23 +13:00
Paul Eggleton
fd5111a2ac restviews: hide unpublished layers
Layers that aren't published shouldn't be visible via the API. (We don't
need to apply that filter to recipes, machines or distros though since a
layer's content won't automatically be indexed unless it has been
published).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-01-18 10:04:10 +13:00
Paul Eggleton
cb656bdd31 Sort higher preference layers first in layer list
On the main layer index page we want openembedded-core to appear before
meta-oe - naturally openembedded-core is the layer everyone starts from.
We already have an "index_preference" column that we use for search
results, so just sort by that here before sorting by name.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-01-16 14:27:06 +13:00
Paul Eggleton
ef4648db8f detail: show counts on each tab
In the layer detail page, show counts on all but the updates tab (i.e.
for recipes, machines, appends, classes, and distros).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-01-16 14:16:07 +13:00
Paul Eggleton
839bd48c7a layerindex: fix OpenEmbedded cgit URL
Since some recent infrastructure changes, "/cgit.cgi" should no longer
be part of cgit.openembedded.org URLs, apparently.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-01-16 13:57:30 +13:00
Paul Eggleton
ad1d4291ba README: add basic instructions for enabling OE-Classic functionality
This wasn't documented anywhere so I've added it here. I'm not sure
it'll get used outside of the live OE index but it's at least useful for
anyone else who needs to debug it.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-01-16 13:14:07 +13:00
Paul Eggleton
45d307369f tools: fix for Django 1.8
Fix the transaction handling code to work with Django 1.8 in most of the
tools scripts. (Some of these are no longer used, but still serve as
examples of how to import data and update the database.)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-01-16 13:14:01 +13:00
Paul Eggleton
072c7d6656 requirements.txt: update to latest tested Django version
I neglected to update this at the time I updated the README recently.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-01-16 13:08:18 +13:00
Paul Eggleton
3b4fecb217 update: fix logic for updating layer dependencies at the end
* We were passing the incorrect path (to the top of the layer repo) if
  the layer had a subdirectory, so this doesn't seem to have been able
  to work for such layers previously.
* Doing this update in the main update.py script meant that this could
  never work across branches requiring a python version change (using
  PythonEnvironment records) since the code was running within the same
  environment in which update.py was launched - the entire point of the
  separation of the two scripts. Move the checking to update_layer.py
  and call it separately to perform these updates, splitting out some
  common code in order to do so.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-01-16 13:08:18 +13:00
Paul Eggleton
a2dbda9469 update: only get branch object once per branch
A minor optimisation - it's not going to change between layers so get it
in the branch loop.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-01-16 13:08:18 +13:00
Paul Eggleton
a5a3c47b69 Fix layerconfparser lifetime handling
* Setting of the object has to be before the try: or otherwise the
  finally block can get called if that doesn't succeed with the result
  that the layerconfparser object won't have a value, which will
  trigger an exception
* We shouldn't be using the config_data object after shutting down
  tinfoil, so avoid doing that

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-01-16 13:08:18 +13:00
Paul Eggleton
15748efcc1 update_layer: fix tinfoil shutdown
Fix a couple of problems with shutting down tinfoil:

1) tinfoil.shutdown() wasn't being called on error because it wasn't
   inside a finally: section, thus on error the script hung with bitbake
   master (since the tinfoil2 changes) - this is almost certainly a bug
   in bitbake but let's handle it here anyway.
2) We need to check whether the tinfoil object actually has a shutdown
   attribute since we still want to support updating for older branches
   where tinfoil didn't have a shutdown() method.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-01-16 13:07:58 +13:00
Paul Eggleton
9ad2b36469 views: Fix OE-Classic search
You need to use a single = not == when filtering in Django.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-01-13 14:04:46 +13:00
Paul Eggleton
e2d0147a0f README: update latest tested version
We might as well show the latest tested point release.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-01-13 14:04:09 +13:00
Aníbal Limón
f0f61bf574 layerindex: Update tinfoil to call shutdown method
The new client/server API of tinfoil requires explicit call of
shutdown method to send the event for finalize cooker process.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-01-11 21:56:35 +13:00