Commit Graph

296 Commits

Author SHA1 Message Date
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
Liam R. Howlett
e0d163341e layerindex/tools/import_project.py: Code cleanup
Remove ; and spaces when setting variables in calls.

Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com>
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-11-21 15:27:42 -06:00
Liam R. Howlett
a5e2f1e3b5 layerindex/tools/import_project.py: Detect remote name & branch
Don't assume remote name is origin, run `git remote` to get the remote
name.  When checking the remote, detect the branch as well, that way the
layerindex will work if the remote branch name and local branch name do
not match.

Note that this currently only supports one remote.

Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com>
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-11-21 15:27:42 -06:00
Paul Eggleton
a988b6ba08 views: support querying class inheritance
It's a little crude and certainly not optimal performance-wise, but we
can support querying for recipes that inherit a particular class without
too much trouble. This allows you to add "inherits:cmake" to the query
and have it return only recipes that inherit the cmake class. You can
use more than one inherits: item to filter down to recipes that inherit
all of the specified classes.

Note: this does not otherwise change the behaviour of specifying
multiple words - all of the words other than those that start with
"inherits:" are treated as part of a single phrase that will be searched
for - not separate keywords.

Fixes [YOCTO #9879].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-11-16 16:08:37 +13:00
Paul Eggleton
43203c578c Record and display update logs
At the moment it's a bit difficult to get update logs out of the
environment in which the update script is being run. In order to make
the logs more accessible, create a LayerUpdate model to record the
output of update_layer.py separately for each layerbranch and tie the
created LayerUpdates together with a single Update model per session.

We provide two ways to look at this - a Tools->Updates page for
logged-in users, and there's also an "Updates" tab on each layer that is
accessible to anyone; which one is useful depends on whether you are
looking at the index as a whole or an individual layer.

Update records older than 30 days are deleted automatically by default.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-11-16 15:31:46 +13:00
Paul Eggleton
cc1d82f893 utils: fix error in runcmd() if printerr=False
If you specified printerr=False we were referring to the output variable
that hadn't been set. Looks like I broke this back in 2013 in
93ce26f21c.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-11-07 16:53:49 +13:00
Paul Eggleton
002b7c1782 admin: add an action to duplicate a branch
Add an action to duplicate a Branch object, along with all of the
LayerBranches (and LayerMaintainers and LayerDependencies) underneath
it.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-11-07 16:53:49 +13:00
Paul Eggleton
6ff4ed77b4 update.py: fix last_rev handling
update_layer may create the layerbranch record (e.g. for a new branch)
so we should be looking for it after that has been run. Also, we cannot
assume that last_rev will get set because a layer might fail to fetch,
so take that into account as well.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-11-07 16:39:38 +13:00
Paul Eggleton
05f3bccbc6 update_layer: fix regressions in missing layer detection
If a layer is removed by its subdirectory being deleted then we want to
pick up on that and produce an appropriate error message - so let the
layer_update code do the checking out and verifying things are correct
before trying to parse layer.conf.

This also fixes --nocheckout still checking out a branch.

Additionally, drop some code that gets the layerbranch which we just
retrieved a few lines above.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-11-07 16:39:38 +13:00
Paul Eggleton
e547528fd3 update.py: fix regression handling layers that failed to fetch
If the layer failed to fetch, we shouldn't be attempting to update its
contents. (This got broken when we split the update script into two in
c64e4c57a9).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-11-07 16:39:38 +13:00
Paul Eggleton
7ddf8f58d6 recipedetail: don't show homepage as link if not URL
Sometimes people put values that aren't URLs into the HOMEPAGE variable.
If that's the case, then we should not turn that value into a link which
will be invalid.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-10-26 15:41:32 +13:00
Paul Eggleton
d5b0d578a6 about: update contributors list
Ensure recent contributions from Mark and Liam are reflected in the
authors list.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-10-26 15:41:11 +13:00
Paul Eggleton
ac6b563716 editlayer: allow selecting web interface type
For some repo URLs we can automatically determine the values of all of
the other fields - e.g. for github or git.openembedded.org, and we've
been doing that for a while. However if someone submits a URL for some
other site we don't know what type of interface it uses, and usually
the submitter leaves the fields blank so it falls to the layer index
maintainer to set the values, and then you have to remember what the
correct URL format is which is awkward especially for gitweb.

In order to fix this, add a select field to the form which allows
specifying which type of interface is being used. At the moment only
cgit, gitweb, gitlab and "(custom)" (i.e. the current behaviour) are
supported. This is not a real field but activates javascript code
that sets the other fields and enables/disables the controls.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-10-25 20:33:42 +13:00
Paul Eggleton
e6a3008c7e views: ensure exact matches on name are shown first in recipe search
Improves slightly on 3155206e54 by doing
an exact match on name and showing that first - now when you search for
"git" you really do get the git recipe first in the list.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-10-19 16:55:42 +13:00
Paul Eggleton
c6105d69cf views: ensure we only show results once in recipe search
Usage of itertools.chain() that was introduced in
3155206e54 in order to prioritise matches
in the recipe name resulted in recipes showing up twice in the results
if they matched in both the name and the recipe name. Use a custom
chaining function that skips duplicate results in order to fix this.

Fixes [YOCTO #10177].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-10-19 16:55:33 +13:00
Paul Eggleton
7dce7ad681 README: update setup instructions
With Django 1.8 you don't need to use syncdb since migrate does all of
the database structure setup (and in fact in 1.9 it has been removed -
we don't support that version yet but it's good to avoid that issue in
future). The only other thing that syncdb did was to create a superuser,
and there is now a specific command to do that. Since you do need to
actually log in as part of some of the later steps, we now tell the user
explicitly to run that in the first step.

Additionally, add a section about what to do when upgrading - normally
this is straightforward, but if you're upgrading from prior to the
Django 1.8 move then you need to fake the initial migration or it'll
fail (since the structure is already present).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-10-18 16:57:14 +13:00
Mark Hatle
9282cba99f layerindex/update_layer.py: Preserve the recipedependency files
In order to keep primary keys from constantly changing, preserve the
existing keys as much as possible.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com>
2016-10-18 16:42:16 +13:00
Liam R. Howlett
b1375847d9 recipeparse: remove unnecessary else statement
Code clean up.

Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com>
2016-10-18 16:42:16 +13:00
Liam R. Howlett
61845b7465 layerindexer: Add layer recommends support
Parse layer.conf and add dependencies that are not required from
LAYERRECOMMENDS_<name>.  Update the layerindex/template to support
recommends.  Uses bitbake parsing code & checks versions.

Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com>

Added associated migration.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-10-18 16:42:16 +13:00
Liam R. Howlett
65f0b71ade layerindex: Add collection and version to layerbranch
Collection and version will be pulled from the layer.conf if it exists
and dependencies will be resolved by first checking for layers with the
dependency name and then checking for collections.

Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com>

Added associated migration.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-10-18 16:42:16 +13:00
Liam R. Howlett
540336edde layerindex: Detect dependencies from layer.conf files
Read dependencies from layer.conf and try to create the LayerDependency
entry by looking up the correct database object.  Dependencies are found
by layer name only - no collection support.  layer.conf parsing is
handled by the bitbake code.

Once all layers are added, the dependencies have to be rechecked in case
the layers are not added in order.

Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com>
2016-10-18 16:42:16 +13:00
Liam R. Howlett
df492b1277 layerindex/recipeparse.py: refactor setup_tinfoil, checkout_layer_branch, parse_layer_conf to utils.py
Move functions to utils to be used by other classes.

Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com>
2016-10-18 16:42:16 +13:00
Liam R. Howlett
8915465007 layerindex/tools/import_project: Add import_project
import_project will scan through a project and find any layer and add it
to the database by calling import_layer on each layer.  This differs
from import_layer as it tires to figure out the remote url and uses the
subdirectory (if one exists) as the name.

Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com>
2016-10-18 16:42:16 +13:00
Liam R. Howlett
31c85196d0 layerindex: Add distro to web interface and model
Add the distros to the index.  This looks a lot like the machines
and allows users to search for a particular distro.

Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com>

Added associated migration.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-10-18 16:42:15 +13:00
Liam R. Howlett
4f0be8a7d0 layerindex/utils: Update runcmd to decode binary strings to strings
Convert binary strings to strings and strip leading/trailing whitespace
prior to returning errors and output.

Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com>
2016-10-18 16:42:15 +13:00
Liam R. Howlett
752e0152c2 layerindex/tools/import_layer.py: Avoid failing if there is any layer to add
Subdirectories are scanned when adding layers.  If any of the
subdirectories or root directory layers already exist in the database,
then the addition fails.  This changes that behaviour to report the
failure as a warning and remove it from the list.  That way, if a repo
has a new layer added it can be rescanned without issue.  Layers being
rescanned are checked against the vcs_url to ensure there is not a name
collision.  A name collision without the same vcs_url will still produce
a hard failure.

Note that multiple layers with the same vcs_url are supported in the
error reporting even though this should never happen.

Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com>
2016-10-18 16:42:15 +13:00
Liam R. Howlett
4bbc210d34 layerindex/tools/import_layer.py: Sanitize layer name
Django will produce a cryptic error message if layers are added with
invalid names.  Sanitize the layer names when trying to add them.

Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com>
2016-10-18 16:42:15 +13:00
Liam R. Howlett
aaddb1c9a5 import_layer: Add --actual-branch option
Allow users to set actual-branch from the command line import of layers.

Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com>
2016-10-18 16:42:15 +13:00
Mark Hatle
1e2ebe95da layerindex/migrations: Add initial migration
We need to create an initial migration before we create any more
migrations that change the database structure, which we're about to do.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>

Replaced fixture with a function in the initial migration so that we
continue to get a master branch record created with Django 1.8.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-10-18 16:41:24 +13:00
Paul Eggleton
6f8201fe93 Fixes for django-registration 2.x
* Newer django-registration doesn't need the workaround URLs
* We need to rename password_reset_email.html to .txt

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-09-20 20:46:56 +12:00
Paul Eggleton
6513fcf049 update.py: default to python3 without a defined environment
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-09-20 20:37:45 +12:00
Paul Eggleton
78406e520a Fix import script for Django 1.8 & Python 3
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-09-20 20:37:45 +12:00
Paul Eggleton
f268a3cfdb Update to Django 1.8
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-09-20 20:37:45 +12:00
Paul Eggleton
211e2fa3a5 Drop south migrations
These cannot be used with Django 1.8 and thus we need to remove them.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-09-20 20:37:45 +12:00
Paul Eggleton
ae550c5a6c Fix for changes to auth views in Django 1.6
Part of this change is temporary for django-registration 1.0; later
versions probably won't require the workaround URLs.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-09-20 20:11:13 +12:00
Paul Eggleton
00bae9978d update_layer.py: fix up for bitbake API change
The multiconfig changes broke the calls here to loadDataFull(). To avoid
this being an issue in future, make use of tinfoil's new parse_recipe_file()
function (if available) to isolate the code here from any future changes to
bitbake's internal code.

Part of the fix for [YOCTO #10192].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-08-31 08:57:37 +12:00
Paul Eggleton
3cc87cff77 Fix output decoding/reporting for bulk change patch download
With Python 3 we need to take care of decoding the output so we can
treat it as a string. At the same time, it's more useful to see the
output string rather than the exception if there is some output.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-08-01 21:00:39 +12:00