Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue when adding modules that were already added #98

Merged
merged 2 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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