-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
CFE-4051: Added dependencies of modules added by URL through the index now correctly have `"added_by"` keys in `cfbs.json`
- Loading branch information
Showing
2 changed files
with
22 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
from cfbs.utils import read_json, user_error | ||
|
||
|
||
def _construct_provided_module(name, data, url, commit): | ||
def _construct_provided_module(name, data, url, commit, added_by="cfbs add"): | ||
# At this point the @commmit part should be removed from url so: | ||
# either url should not have an @, | ||
# or the @ should be for [email protected] | ||
|
@@ -35,7 +35,7 @@ def _construct_provided_module(name, data, url, commit): | |
"missing required key 'steps' in module definition: %s" % pretty(data) | ||
) | ||
module["steps"] = data["steps"] | ||
module["added_by"] = "cfbs add" | ||
module["added_by"] = added_by | ||
return module | ||
|
||
|
||
|
@@ -123,24 +123,28 @@ def __getitem__(self, key): | |
def __contains__(self, key): | ||
return key in self._data | ||
|
||
def get_provides(self): | ||
def get_provides(self, added_by="cfbs add"): | ||
modules = OrderedDict() | ||
if "provides" not in self._data: | ||
user_error( | ||
"missing required key 'provides' in module definition: %s" | ||
% pretty(self._data) | ||
) | ||
for k, v in self._data["provides"].items(): | ||
module = _construct_provided_module(k, v, self.url, self.url_commit) | ||
module = _construct_provided_module( | ||
k, v, self.url, self.url_commit, added_by | ||
) | ||
modules[k] = module | ||
return modules | ||
|
||
def get_module_for_build(self, name, dependent): | ||
def get_module_for_build(self, name, added_by="cfbs add"): | ||
if "provides" in self._data and name in self._data["provides"]: | ||
module = self._data["provides"][name] | ||
return _construct_provided_module(name, module, self.url, self.url_commit) | ||
return _construct_provided_module( | ||
name, module, self.url, self.url_commit, added_by | ||
) | ||
if name in self.index: | ||
return self.index.get_module_object(name) | ||
return self.index.get_module_object(name, added_by) | ||
return None | ||
|
||
def _module_is_in_build(self, module): | ||
|