Skip to content

Commit

Permalink
bugfix conan 1.x: consider revision for build_requires (#14679)
Browse files Browse the repository at this point in the history
consider revision for build_requires
  • Loading branch information
thorsten-klein authored Sep 7, 2023
1 parent 73a2658 commit bb35ee8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion conans/client/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def load_virtual(self, references, profile_host, scope_options=True,
conanfile.settings = profile_host.processed_settings.copy_values()

if is_build_require:
conanfile.build_requires = [str(r) for r in references]
conanfile.build_requires = [r for r in references]
else:
for reference in references:
conanfile.requires.add_ref(reference)
Expand Down
19 changes: 19 additions & 0 deletions conans/test/functional/revisions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,25 @@ def test_revision_mismatch_packages_remote(self, v1):
client.run(command, assert_error=True)
self.assertIn("Can't find a '{}' package".format(self.ref), client.out)

def test_revision_build_requires(self):
conanfile = GenConanfile()

refs = []
for _ in range(1,4): # create different revisions
conanfile.with_build_msg("any change to get another rrev")
pref = self.c_v2.create(self.ref, conanfile=conanfile)
self.c_v2.upload_all(pref.ref)
refs.append(pref.ref)
assert refs.count(pref.ref) == 1 # make sure that all revisions are different

client = self.c_v2 # revisions enabled
client.remove_all()

for ref in refs:
command = "install --update --build-require {}".format(repr(ref))
client.run(command)
self.assertIn("Downloaded recipe revision {}".format(ref.revision), client.out)

def test_json_output(self):
client = TurboTestClient()
client.save({"conanfile.py": GenConanfile()})
Expand Down

0 comments on commit bb35ee8

Please sign in to comment.