diff --git a/cfbs/commands.py b/cfbs/commands.py index 514d4bda..5349c8ed 100644 --- a/cfbs/commands.py +++ b/cfbs/commands.py @@ -623,7 +623,10 @@ def _download_dependencies( if not os.path.exists(module_dir): if url.endswith(SUPPORTED_ARCHIVES): fetch_archive(url, commit) - elif "index" in module or ignore_versions: + # a couple of cases where there will not be an archive available: + # - using an alternate index (index property in module data) + # - added by URL instead of name (no version property in module data) + elif "index" in module or "url" in module or ignore_versions: sh("git clone %s %s" % (url, commit_dir)) sh("(cd %s && git checkout %s)" % (commit_dir, commit)) else: diff --git a/tests/shell/013_add_url_commit.sh b/tests/shell/013_add_url_commit.sh index b3cb911d..00772d0d 100644 --- a/tests/shell/013_add_url_commit.sh +++ b/tests/shell/013_add_url_commit.sh @@ -16,3 +16,25 @@ grep scl cfbs.json cfbs build ls out/masterfiles/lib/scl/ grep scl_dmidecode_example out/masterfiles/scl_example.json + +# Build should be possible to do on another machine +# so let's test that it works after deleting the things which +# will not be on the next machine. +# Notably, cfbs add will download some things which can be reused in +# cfbs build (git clones / zip downloads in ~/.cfengine/cfbs) + +rm -rf out/ +rm -rf ~/.cfengine/cfbs + +cfbs build +ls out/masterfiles/lib/scl/ +grep scl_dmidecode_example out/masterfiles/scl_example.json + +# Finally, let's also test that we can build it again (now with the cached +# files) + +rm -rf out/ + +cfbs build +ls out/masterfiles/lib/scl/ +grep scl_dmidecode_example out/masterfiles/scl_example.json