Skip to content

Commit

Permalink
qibuild set-host-config: unset previous host config if different (#33…
Browse files Browse the repository at this point in the history
…012)

Change-Id: I5fa8a83577d4c6ddf132b359265fc465793ccc16
Reviewed-on: http://gerrit.aldebaran.lan/65627
Tested-by: gerrit
Reviewed-by: vbarbaresi <[email protected]>
  • Loading branch information
dmerejkowsky committed Dec 2, 2015
1 parent 1ae91db commit 51a06db
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doc/source/changes/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ qibuild
* ``qibuild package``: add ``--breakpad`` option. This generates a
symbols archive to be used with ``breakpad``.

* Using ``qibuild set-host-config`` twice with different configuration names
lead to undefined behavior.

qidoc
-----

Expand Down
8 changes: 7 additions & 1 deletion python/qibuild/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,13 @@ def set_host_config(self, config_name):
""" Set the config used to build host tools """
if not config_name in self.configs:
raise Exception("No such config: %s" % config_name)
self.configs[config_name].host = True
# Make sure that we unset the previous 'host' config when
# called twice with different config names
for name, config in self.configs.iteritems():
if name == config_name:
config.host = True
else:
config.host = False

def get_host_config(self):
""" Get the config to use when looking for host tools """
Expand Down
11 changes: 11 additions & 0 deletions python/qibuild/test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,17 @@ def test_host_config_is_persistent():
qibuild_cfg2.read()
assert qibuild_cfg2.get_host_config() == "foo"

def test_host_config_is_unique():
qibuild.config.add_build_config("foo")
qibuild.config.add_build_config("bar")
qibuild_cfg = qibuild.config.QiBuildConfig()
qibuild_cfg.read()
qibuild_cfg.set_host_config("foo")
assert qibuild_cfg.configs["foo"].host
qibuild_cfg.set_host_config("bar")
assert not qibuild_cfg.configs["foo"].host
assert qibuild_cfg.configs["bar"].host

def test_setting_env_vars(tmpdir):
global_xml = tmpdir.join("global.xml")
global_xml.write("""
Expand Down

0 comments on commit 51a06db

Please sign in to comment.