diff options
| -rwxr-xr-x | bitbake/bin/bitbake-setup | 20 | ||||
| -rw-r--r-- | bitbake/lib/bb/tests/setup.py | 17 |
2 files changed, 32 insertions, 5 deletions
diff --git a/bitbake/bin/bitbake-setup b/bitbake/bin/bitbake-setup index 36a1bbd91a..de83d780bf 100755 --- a/bitbake/bin/bitbake-setup +++ b/bitbake/bin/bitbake-setup | |||
| @@ -114,10 +114,23 @@ def checkout_layers(layers, layerdir, d): | |||
| 114 | os.remove(symlink) | 114 | os.remove(symlink) |
| 115 | os.symlink(os.path.relpath(t,layerdir),symlink) | 115 | os.symlink(os.path.relpath(t,layerdir),symlink) |
| 116 | 116 | ||
| 117 | def setup_bitbake_build(bitbake_config, layerdir, builddir): | 117 | def setup_bitbake_build(bitbake_config, layerdir, builddir, thisdir): |
| 118 | def _setup_build_conf(layers, build_conf_dir): | 118 | def _setup_build_conf(layers, build_conf_dir): |
| 119 | os.makedirs(build_conf_dir) | 119 | os.makedirs(build_conf_dir) |
| 120 | layers_s = "\n".join([" {} \\".format(os.path.join(layerdir,l)) for l in layers]) | 120 | layers_s = [] |
| 121 | for l in layers: | ||
| 122 | if l.startswith("{THISDIR}/"): | ||
| 123 | if thisdir: | ||
| 124 | l = l.format(THISDIR=thisdir) | ||
| 125 | else: | ||
| 126 | raise Exception("Configuration is using {THISDIR} to specify " \ | ||
| 127 | "a layer path relative to itself. This can be done only " \ | ||
| 128 | "when the configuration is specified by its path on local " \ | ||
| 129 | "disk, not when it's in a registry or is fetched over http.") | ||
| 130 | if not os.path.isabs(l): | ||
| 131 | l = os.path.join(layerdir, l) | ||
| 132 | layers_s.append(" {} \\".format(l)) | ||
| 133 | layers_s = "\n".join(layers_s) | ||
| 121 | bblayers_conf = """BBLAYERS ?= " \\ | 134 | bblayers_conf = """BBLAYERS ?= " \\ |
| 122 | {} | 135 | {} |
| 123 | " | 136 | " |
| @@ -237,7 +250,8 @@ def update_build(config, confdir, builddir, layerdir, d): | |||
| 237 | layer_config[k]["git-remote"] = v["git-remote"] | 250 | layer_config[k]["git-remote"] = v["git-remote"] |
| 238 | checkout_layers(layer_config, layerdir, d) | 251 | checkout_layers(layer_config, layerdir, d) |
| 239 | bitbake_config = config["bitbake-config"] | 252 | bitbake_config = config["bitbake-config"] |
| 240 | setup_bitbake_build(bitbake_config, layerdir, builddir) | 253 | thisdir = os.path.dirname(config["path"]) if config["type"] == 'local' else None |
| 254 | setup_bitbake_build(bitbake_config, layerdir, builddir, thisdir) | ||
| 241 | 255 | ||
| 242 | def int_input(allowed_values): | 256 | def int_input(allowed_values): |
| 243 | n = None | 257 | n = None |
diff --git a/bitbake/lib/bb/tests/setup.py b/bitbake/lib/bb/tests/setup.py index 2076613d9b..747a9b733f 100644 --- a/bitbake/lib/bb/tests/setup.py +++ b/bitbake/lib/bb/tests/setup.py | |||
| @@ -130,6 +130,12 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) | |||
| 130 | "description": "Gizmo notemplate build configuration", | 130 | "description": "Gizmo notemplate build configuration", |
| 131 | "bb-layers": ["layerC","layerD/meta-layer"], | 131 | "bb-layers": ["layerC","layerD/meta-layer"], |
| 132 | "oe-fragments": ["test-fragment-2"] | 132 | "oe-fragments": ["test-fragment-2"] |
| 133 | }, | ||
| 134 | { | ||
| 135 | "name": "gizmo-notemplate-with-thisdir", | ||
| 136 | "description": "Gizmo notemplate build configuration using THISDIR", | ||
| 137 | "bb-layers": ["layerC","layerD/meta-layer","{THISDIR}/layerE/meta-layer"], | ||
| 138 | "oe-fragments": ["test-fragment-2"] | ||
| 133 | } | 139 | } |
| 134 | ] | 140 | ] |
| 135 | }, | 141 | }, |
| @@ -174,7 +180,14 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) | |||
| 174 | with open(os.path.join(bb_conf_path, 'bblayers.conf')) as f: | 180 | with open(os.path.join(bb_conf_path, 'bblayers.conf')) as f: |
| 175 | bblayers = f.read() | 181 | bblayers = f.read() |
| 176 | for l in bitbake_config["bb-layers"]: | 182 | for l in bitbake_config["bb-layers"]: |
| 177 | self.assertIn(os.path.join(buildpath, 'layers', l), bblayers) | 183 | if l.startswith('{THISDIR}/'): |
| 184 | thisdir_layer = os.path.join( | ||
| 185 | os.path.dirname(json_config["path"]), | ||
| 186 | l.removeprefix("{THISDIR}/"), | ||
| 187 | ) | ||
| 188 | self.assertIn(thisdir_layer, bblayers) | ||
| 189 | else: | ||
| 190 | self.assertIn(os.path.join(buildpath, "layers", l), bblayers) | ||
| 178 | 191 | ||
| 179 | for f in bitbake_config["oe-fragments"]: | 192 | for f in bitbake_config["oe-fragments"]: |
| 180 | self.assertTrue(os.path.exists(os.path.join(bb_conf_path, f))) | 193 | self.assertTrue(os.path.exists(os.path.join(bb_conf_path, f))) |
| @@ -235,7 +248,7 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) | |||
| 235 | 248 | ||
| 236 | # test-config-1 is tested as a registry config, test-config-2 as a local file | 249 | # test-config-1 is tested as a registry config, test-config-2 as a local file |
| 237 | test_configurations = {'test-config-1': {'cmdline': 'test-config-1', 'buildconfigs':('gadget','gizmo','gadget-notemplate','gizmo-notemplate')}, | 250 | test_configurations = {'test-config-1': {'cmdline': 'test-config-1', 'buildconfigs':('gadget','gizmo','gadget-notemplate','gizmo-notemplate')}, |
| 238 | 'test-config-2': {'cmdline': os.path.join(self.registrypath,'config-2/test-config-2.conf.json'), 'buildconfigs': ('gadget','gizmo','gadget-notemplate','gizmo-notemplate') } } | 251 | 'test-config-2': {'cmdline': os.path.join(self.registrypath,'config-2/test-config-2.conf.json'), 'buildconfigs': ('gadget','gizmo','gadget-notemplate','gizmo-notemplate', 'gizmo-notemplate-with-thisdir') } } |
| 239 | for cf, v in test_configurations.items(): | 252 | for cf, v in test_configurations.items(): |
| 240 | for c in v['buildconfigs']: | 253 | for c in v['buildconfigs']: |
| 241 | out = self.runbbsetup("init --non-interactive {} {}".format(v['cmdline'], c)) | 254 | out = self.runbbsetup("init --non-interactive {} {}".format(v['cmdline'], c)) |
