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

Skip dot folders in local recipe index layouts #16345

Merged
merged 1 commit into from
May 28, 2024
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
3 changes: 3 additions & 0 deletions conans/client/rest_client_local_recipe_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ def get_recipes_references(self, pattern):
ret = []
excluded = set()
for r in recipes:
if r.startswith("."):
# Skip hidden folders, no recipes should start with a dot
continue
if not fnmatch(r, name_pattern):
continue
folder = self._get_base_folder(r)
Expand Down
23 changes: 13 additions & 10 deletions conans/test/integration/remote/test_local_recipes_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,15 @@ def build(self):
"""))
save(os.path.join(recipes_folder, "libcurl", "all", "conanfile.py"),
str(GenConanfile().with_require("openssl/2.0")))

save(os.path.join(recipes_folder, ".DS_Store", "foo"), "")

return folder


class TestSearchList:
def test_basic_search(self, c3i_folder):
client = TestClient()
client = TestClient(light=True)
client.run(f"remote add local '{c3i_folder}' --type=local-recipes-index") # Keep --type test
assert "WARN" not in client.out # Make sure it does not complain about url
client.run("search *")
Expand All @@ -82,7 +85,7 @@ def test_basic_search(self, c3i_folder):
""") in client.out

def test_list_refs(self, c3i_folder):
client = TestClient()
client = TestClient(light=True)
client.run(f"remote add local '{c3i_folder}'")
client.run("list *#* -r=local --format=json")
listjson = json.loads(client.stdout)
Expand All @@ -100,15 +103,15 @@ def test_list_refs(self, c3i_folder):
assert len(revs) == 1 and "6f5c31bb1219e9393743d1fbf2ee1b52" in revs

def test_list_rrevs(self, c3i_folder):
client = TestClient()
client = TestClient(light=True)
client.run(f"remote add local '{c3i_folder}'")
client.run("list libcurl/1.0#* -r=local --format=json")
listjson = json.loads(client.stdout)
revs = listjson["local"]["libcurl/1.0"]["revisions"]
assert len(revs) == 1 and "e468388f0e4e098d5b62ad68979aebd5" in revs

def test_list_binaries(self, c3i_folder):
client = TestClient()
client = TestClient(light=True)
client.run(f"remote add local '{c3i_folder}'")
client.run("list libcurl/1.0:* -r=local --format=json")
listjson = json.loads(client.stdout)
Expand All @@ -118,7 +121,7 @@ def test_list_binaries(self, c3i_folder):

class TestInstall:
def test_install(self, c3i_folder):
c = TestClient()
c = TestClient(light=True)
c.run(f"remote add local '{c3i_folder}'")
c.run("install --requires=libcurl/1.0 --build missing")
assert "zlib/1.2.11: CONANDATA: {}" in c.out
Expand Down Expand Up @@ -178,7 +181,7 @@ def source(self):
{"boost/config.yml": boost_config,
"boost/all/conanfile.py": boost,
"boost/all/dependencies/myfile.json": deps_json})
c = TestClient()
c = TestClient(light=True)
c.run(f"remote add local '{folder}'")
c.run("install --requires=boost/[*] --build missing")
assert 'boost/1.0: {"potato": 42}' in c.out
Expand All @@ -204,7 +207,7 @@ def test_trim_conandata_yaml(self):
{"pkg/config.yml": config,
"pkg/all/conanfile.py": str(GenConanfile("pkg")),
"pkg/all/conandata.yml": conandata})
c = TestClient()
c = TestClient(light=True)
c.run(f"remote add local '{folder}'")
c.run("install --requires=pkg/1.0 --build missing -vvv")
assert "pkg/1.0#86b609916bbdfe63c579f034ad0edfe7" in c.out
Expand Down Expand Up @@ -264,7 +267,7 @@ def source(self):
"zlib/all/conandata.yml": conandata_yml,
"zlib/all/patches/patch1": patch,
"zlib/all/main.cpp": "\n"})
client = TestClient()
client = TestClient(light=True)
client.run(f"remote add local '{folder}'")
client.run("install --requires=zlib/0.1 --build=missing -vv")
assert "zlib/0.1: Copied 1 file: patch1" in client.out
Expand All @@ -276,7 +279,7 @@ def test_upload(self):
folder = temp_folder()
c3i_folder = os.path.join(folder, "recipes")
mkdir(c3i_folder)
c = TestClient()
c = TestClient(light=True)
c.run(f"remote add local '{c3i_folder}'")
c.save({"conanfile.py": GenConanfile("pkg", "0.1")})
c.run("create .")
Expand All @@ -300,7 +303,7 @@ class Zlib(ConanFile):
save_files(recipes_folder,
{"zlib/config.yml": zlib_config,
"zlib/all/conanfile.py": zlib})
c = TestClient()
c = TestClient(light=True)
c.run(f"remote add local '{folder}'")
c.run("install --requires=zlib/[*] --build missing", assert_error=True)
assert "NameError: name 'ConanFile' is not defined" in c.out