Skip to content

Commit

Permalink
Merge pull request #98 from olehermanse/bug
Browse files Browse the repository at this point in the history
Fixed issue when adding modules that were already added
  • Loading branch information
olehermanse authored Feb 8, 2022
2 parents b208a9c + c8889ce commit 706c7de
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cfbs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,10 @@ def _find_dependencies(self, modules, exclude):
return dependencies

def _add_without_dependencies(self, modules):
assert modules and len(modules) > 0 and modules[0]["name"]
assert modules
assert len(modules) > 0
assert modules[0]["name"]

for module in modules:
name = module["name"]
assert name not in (m["name"] for m in self["build"])
Expand Down Expand Up @@ -457,6 +460,8 @@ def _add_modules(

# Filter modules which are already added:
names = self._filter_modules_to_add(names)
if not names:
return 0 # Everything already added

# Convert names to objects:
modules_to_add = [index.get_module_object(m, added_by[m]) for m in names]
Expand Down
16 changes: 16 additions & 0 deletions test/shell/add_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This test is quite slow and makes many API requests,
# so not included in the normal sequence.
# We do something very similar in the index repo.

set -e
set -x
cd test
mkdir -p ./tmp/
cd ./tmp/
touch cfbs.json && rm cfbs.json

cfbs init
cfbs add masterfiles
cfbs search | awk '{print $1}' | xargs -n1 cfbs add

cfbs build

0 comments on commit 706c7de

Please sign in to comment.