diff options
| author | Michael Wood <michael.g.wood@intel.com> | 2015-11-04 14:56:36 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-10 13:29:17 +0000 |
| commit | c402ac2654cafb2c594c091a5a0a0f340af19a05 (patch) | |
| tree | d13c137428a3b8a46c5f9b4761c21546c24cac5b /bitbake | |
| parent | a6e4f94b0164434ebdd3bdad2ea7f69f6ba53ff0 (diff) | |
| download | poky-c402ac2654cafb2c594c091a5a0a0f340af19a05.tar.gz | |
bitbake: toaster: orm add CustomImageRecipe generate contents function
Add function generate_recipe_file_contents to dump the custom image
recipe instance to a string for use either to push to the user as a
downloaded version of their custom image recipe or to use to generate
the recipe that we build.
(Bitbake rev: 6863343c3434ce19aa4b609c83f48a06e6943366)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
| -rw-r--r-- | bitbake/lib/toaster/orm/models.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 20557abfc7..f826bcea34 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
| @@ -1400,6 +1400,55 @@ class CustomImageRecipe(Recipe): | |||
| 1400 | base_recipe = models.ForeignKey(Recipe, related_name='based_on_recipe') | 1400 | base_recipe = models.ForeignKey(Recipe, related_name='based_on_recipe') |
| 1401 | project = models.ForeignKey(Project) | 1401 | project = models.ForeignKey(Project) |
| 1402 | 1402 | ||
| 1403 | def generate_recipe_file_contents(self): | ||
| 1404 | """Generate the contents for the recipe file.""" | ||
| 1405 | # If we have no excluded packages we only need to _append | ||
| 1406 | if self.excludes_set.count() == 0: | ||
| 1407 | packages_conf = "IMAGE_INSTALL_append = \" " | ||
| 1408 | |||
| 1409 | for pkg in self.appends_set.all(): | ||
| 1410 | packages_conf += pkg.name+' ' | ||
| 1411 | else: | ||
| 1412 | packages_conf = "IMAGE_INSTALL = \"" | ||
| 1413 | # We add all the known packages to be built by this recipe apart | ||
| 1414 | # from the packagegroups, which would bring the excluded package | ||
| 1415 | # back in and locale packages which are dynamic packages which | ||
| 1416 | # bitbake will not know about. | ||
| 1417 | for pkg in \ | ||
| 1418 | self.includes_set.exclude( | ||
| 1419 | Q(pk__in=self.excludes_set.values_list('pk', flat=True)) | | ||
| 1420 | Q(name__icontains="packagegroup") | | ||
| 1421 | Q(name__icontains="locale")): | ||
| 1422 | print pkg.name | ||
| 1423 | packages_conf += pkg.name+' ' | ||
| 1424 | |||
| 1425 | packages_conf += "\"" | ||
| 1426 | |||
| 1427 | base_recipe = open("%s/%s" % | ||
| 1428 | (self.base_recipe.layer_version.dirpath, | ||
| 1429 | self.base_recipe.file_path), 'r').read() | ||
| 1430 | |||
| 1431 | info = {"date" : timezone.now().strftime("%Y-%m-%d %H:%M:%S"), | ||
| 1432 | "base_recipe" : base_recipe, | ||
| 1433 | "recipe_name" : self.name, | ||
| 1434 | "base_recipe_name" : self.base_recipe.name, | ||
| 1435 | "license" : self.license, | ||
| 1436 | "summary" : self.summary, | ||
| 1437 | "description" : self.description, | ||
| 1438 | "packages_conf" : packages_conf.strip(), | ||
| 1439 | } | ||
| 1440 | |||
| 1441 | recipe_contents = ("# Original recipe %(base_recipe_name)s \n" | ||
| 1442 | "%(base_recipe)s\n\n" | ||
| 1443 | "# Recipe %(recipe_name)s \n" | ||
| 1444 | "# Customisation Generated by Toaster on %(date)s\n" | ||
| 1445 | "SUMMARY = \"%(summary)s\"\n" | ||
| 1446 | "DESCRIPTION = \"%(description)s\"\n" | ||
| 1447 | "LICENSE = \"%(license)s\"\n" | ||
| 1448 | "%(packages_conf)s") % info | ||
| 1449 | |||
| 1450 | return recipe_contents | ||
| 1451 | |||
| 1403 | class ProjectVariable(models.Model): | 1452 | class ProjectVariable(models.Model): |
| 1404 | project = models.ForeignKey(Project) | 1453 | project = models.ForeignKey(Project) |
| 1405 | name = models.CharField(max_length=100) | 1454 | name = models.CharField(max_length=100) |
