Record configure options

Record the configure script options when importing recipe / package
information so we can display them.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2019-04-14 21:34:21 +12:00
parent 49bb85c944
commit 6deed03a1c
5 changed files with 68 additions and 2 deletions

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-04-15 00:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('layerindex', '0038_patch_striplevel'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='configopts',
field=models.CharField(blank=True, max_length=4096),
),
]

View File

@ -472,6 +472,7 @@ class Recipe(models.Model):
inherits = models.CharField(max_length=255, blank=True)
updated = models.DateTimeField(auto_now=True)
blacklisted = models.CharField(max_length=255, blank=True)
configopts = models.CharField(max_length=4096, blank=True)
def vcs_web_url(self):
url = self.layerbranch.file_url(os.path.join(self.filepath, self.filename))

View File

@ -50,6 +50,7 @@ def update_recipe_file(path, recipe, repodir, raiseexceptions=False):
# At the end of the day we are scraping the spec file, we aren't trying to build it
pnum_re = re.compile('-p[\s]*([0-9]+)')
configure_re = re.compile('[/%]configure\s')
try:
logger.debug('Updating recipe %s' % path)
@ -199,9 +200,17 @@ def update_recipe_file(path, recipe, repodir, raiseexceptions=False):
reading = True
inprep = False
applyextra = []
configopts = ''
inconf = False
for line in f:
if line.startswith('%build'):
# Assume it's OK to stop when we hit %build
if inconf:
line = line.rstrip()
configopts += line.rstrip('\\')
if not line.endswith('\\'):
inconf = False
continue
if line.startswith('%install'):
# Assume it's OK to stop when we hit %install
break
if line.startswith('%autopatch') or line.startswith('%autosetup'):
pnum = pnum_re.search(line)
@ -266,6 +275,21 @@ def update_recipe_file(path, recipe, repodir, raiseexceptions=False):
else:
patchid = int(patchsplit[0][6:])
applypatches[patchid] = ' '.join(patchsplit[1:])
elif line.startswith('%cmake'):
if line.rstrip().endswith('\\'):
inconf = True
configopts = line[7:].rstrip().rstrip('\\')
continue
elif configure_re.search(line):
if line.rstrip().endswith('\\'):
inconf = True
configopts = line.split('configure', 1)[1].rstrip().rstrip('\\')
continue
elif line.startswith('meson'):
if line.rstrip().endswith('\\'):
inconf = True
configopts = line[6:].rstrip().rstrip('\\')
continue
elif line.startswith('%prep'):
inprep = True
continue
@ -311,6 +335,8 @@ def update_recipe_file(path, recipe, repodir, raiseexceptions=False):
elif key.startswith('source'):
sources.append(expand(value))
recipe.configopts = utils.squashspaces(configopts)
if desc and desc[0][0] in string.printable:
recipe.description = expand(' '.join(desc).rstrip())
else:

View File

@ -121,6 +121,12 @@ def update_recipe_file(tinfoil, data, path, recipe, layerdir_start, repodir, sto
lr = set(envdata.getVar("__inherit_cache", True) or [])
recipe.inherits = ' '.join(sorted({os.path.splitext(os.path.basename(r))[0] for r in lr if r not in gr}))
recipe.blacklisted = envdata.getVarFlag('PNBLACKLIST', recipe.pn, True) or ""
for confvar in ['EXTRA_OEMESON', 'EXTRA_OECMAKE', 'EXTRA_OESCONS', 'EXTRA_OECONF']:
recipe.configopts = envdata.getVar(confvar, True) or ""
if recipe.configopts:
break
else:
recipe.configopts = ''
recipe.save()
# Handle sources

View File

@ -206,6 +206,19 @@
{% endfor %}
</tr></tbody>
</table>
<h2>configure options</h2>
<table width="100%" class="table table-bordered">
<thead>
<th width="50%">{{ layerbranch_desc }}{{ layerbranch_addtext }}</th>
<th width="50%">{{ to_desc }}</th>
</thead>
<tbody><tr>
{% for rcp in recipes %}
<td><code>{{ rcp.configopts }}</code></td>
{% endfor %}
</tr></tbody>
</table>
</div>
</div>