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

New graph resolution detects build_requires transitive conflicts #4514

Merged
merged 154 commits into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
50fc6c4
WIP
lasote Dec 14, 2018
973f737
Merged develop
lasote Jan 9, 2019
9a66eb0
layout of dev
lasote Jan 9, 2019
2b4d306
Merge remote-tracking branch 'origin/develop' into feature/revisions_…
lasote Jan 10, 2019
386c089
wip
lasote Jan 10, 2019
46acbd6
Removed versions
lasote Jan 10, 2019
d0ab9a3
Merge branch 'feature/fix_server_launcher' into feature/revisions_lis…
lasote Jan 10, 2019
fca987f
working but not tested
lasote Jan 10, 2019
06b1644
local
lasote Jan 10, 2019
94151fb
Merged develop
lasote Jan 10, 2019
5ea2b7a
Local, package failing because of none timestamp in PREV
lasote Jan 10, 2019
e125e76
WIP
lasote Jan 11, 2019
e4c088f
Merged develop
lasote Jan 11, 2019
7d9d2d2
search tests ok
lasote Jan 14, 2019
1e51cac
Fixing tests
lasote Jan 14, 2019
2daab03
Fixing tests and small refactor
lasote Jan 14, 2019
33634ad
renamed module
lasote Jan 14, 2019
fb71f45
review
lasote Jan 18, 2019
b841fe9
ISO in client, reviewed
lasote Jan 21, 2019
c6cd7bd
Fixing tests
lasote Jan 21, 2019
5ee5bc1
Merged develop
lasote Jan 21, 2019
8db4701
Fixing tests
lasote Jan 21, 2019
f42c21b
New tests about metadata being updated
lasote Jan 22, 2019
a2b0d0b
Review
lasote Jan 22, 2019
ca3068f
Time cleared on export/package
lasote Jan 22, 2019
fb21d63
Fix revisions list
lasote Jan 22, 2019
6aa300d
fixed test
lasote Jan 22, 2019
b80b83c
Unused import
lasote Jan 22, 2019
0e6b918
Merge remote-tracking branch 'origin/develop' into feature/remove_com…
lasote Jan 23, 2019
8c302b0
WIP
lasote Jan 24, 2019
c478b72
Merged develop
lasote Jan 24, 2019
e5e663a
Review
lasote Jan 24, 2019
3e704ab
Fixed test message assert
lasote Jan 24, 2019
c7e773e
Merged develop
lasote Jan 24, 2019
ec0609e
Merge changes from previous PR endpoitns
lasote Jan 24, 2019
5e7b212
Use env var instead of test client
lasote Jan 24, 2019
6e5548b
Cool testing framework and a lot of remove with revisions tests
lasote Jan 24, 2019
3f94a21
Remove tests revisions
lasote Jan 24, 2019
399a98d
Drafting tests
lasote Jan 26, 2019
5e7d203
Test passing, a lot missing yet
lasote Jan 28, 2019
3c2cc87
PENDING MANY TESTS
lasote Jan 29, 2019
eb7e76d
some more tests
lasote Jan 30, 2019
c0f0232
Pending many tests
lasote Jan 30, 2019
1e08d30
Added more tests
lasote Jan 31, 2019
cb707af
No revisions tests passing
lasote Jan 31, 2019
1d11242
make BinariesAnalyzer the one responsible for the IDs
memsharded Jan 31, 2019
d6b8726
remove build mode check
memsharded Jan 31, 2019
690d917
Merge branch 'develop' into feature/binary_analyzer_ids
memsharded Jan 31, 2019
82cd60f
Merge branch 'feature/remove_build_mode_check' into feature/binary_an…
memsharded Jan 31, 2019
06c8be5
Tests passing, only about 10 to complete
lasote Jan 31, 2019
2c1ffb8
changing how binary IDs are computed
memsharded Jan 31, 2019
a3543d6
fixing tests
memsharded Jan 31, 2019
39d14f8
refactoring tests
memsharded Jan 31, 2019
b1f5455
binary ID belongs to graph Node
memsharded Feb 1, 2019
0705422
working in graph
memsharded Feb 1, 2019
c1627d7
Finished tests
lasote Feb 1, 2019
9d61726
Merge branch 'develop' into feature/binary_analyzer_ids
memsharded Feb 3, 2019
1379318
Upload package id not reference
lasote Feb 4, 2019
d9e92ef
One more test
lasote Feb 4, 2019
8516124
Merged with develop
lasote Feb 4, 2019
5210a2c
SVN test
lasote Feb 4, 2019
28ba8f6
IOError
lasote Feb 4, 2019
7426d17
Fixing tests
lasote Feb 4, 2019
495a7ea
Merge branch 'develop' into feature/binary_analyzer_ids
memsharded Feb 4, 2019
b7864bd
Merge remote-tracking branch 'origin/develop' into feature/remove_com…
lasote Feb 5, 2019
afb9704
Fixing windows test with export package and package revisions
lasote Feb 5, 2019
27a0030
Fixed test
lasote Feb 5, 2019
a874aea
Merge branch 'feature/remove_compatibility_mode' of github.com:lasote…
lasote Feb 5, 2019
5ae5e0b
Merge branch 'develop' into feature/binary_analyzer_ids
memsharded Feb 5, 2019
122940c
Pending migration
lasote Feb 6, 2019
0d3c46f
Migration OK
lasote Feb 6, 2019
30f1667
working...
memsharded Feb 6, 2019
384df79
renaming conan->recipe
memsharded Feb 6, 2019
4f8e203
Merge branch 'feature/rename' into feature/binary_analyzer_ids
memsharded Feb 6, 2019
8786c7a
Merge remote-tracking branch 'origin/develop' into feature/remove_com…
lasote Feb 8, 2019
c85ac08
Merge branch 'develop' into feature/binary_analyzer_ids
memsharded Feb 8, 2019
34265d6
Revisioning the revisions pull request
lasote Feb 8, 2019
6c34d58
CONAN_REVISIONS_ENABLED
lasote Feb 8, 2019
e82b1cc
WIP
lasote Feb 8, 2019
1a437d3
Safer migration
lasote Feb 8, 2019
c07350f
Merge remote-tracking branch 'lasote/feature/remove_compatibility_mod…
lasote Feb 8, 2019
7383e53
No revisions test
lasote Feb 8, 2019
cafa42e
V2 WIP
lasote Feb 8, 2019
18f08b2
Merge remote-tracking branch 'origin/develop' into feature/remove_com…
lasote Feb 8, 2019
e725c74
WIP
lasote Feb 8, 2019
b4126be
Review
lasote Feb 8, 2019
d4f0c2a
working except full_requires test broken
memsharded Feb 8, 2019
9d8cb71
Merge branch 'feature/remove_compatibility_mode' into feature/simplif…
lasote Feb 8, 2019
1cd3107
WIP
lasote Feb 8, 2019
47a4c4b
Merged develop
lasote Feb 8, 2019
9c71700
Rest routes
lasote Feb 8, 2019
f665841
Refactor routes
lasote Feb 11, 2019
00cbaa2
Passing wihout revisions
lasote Feb 11, 2019
92dc820
working
memsharded Feb 11, 2019
eaa4a1f
Removed time from metadata
lasote Feb 11, 2019
43e0ff8
working but ConanInfo.full_requires test
memsharded Feb 12, 2019
09cfe13
Passing tests
lasote Feb 12, 2019
8a95f46
Fixed more tests
lasote Feb 12, 2019
e4f00c9
Merge branch 'develop' into feature/binary_analyzer_ids
memsharded Feb 12, 2019
7177d24
binary analyzer refactor
memsharded Feb 12, 2019
4b59afa
Self review
lasote Feb 12, 2019
754d52a
Imports
lasote Feb 12, 2019
c81b2f8
Merged develop
lasote Feb 12, 2019
ae99c26
small optimization of set_dirty(package_folder)
memsharded Feb 12, 2019
1fb8240
Fixed rest api test
lasote Feb 12, 2019
9bf107b
Fixed slows
lasote Feb 12, 2019
2eb2536
Fixed py2 issue with exception translation with http codes
lasote Feb 12, 2019
3b67fd3
rest api prepared revisions
lasote Feb 12, 2019
4601592
new graph builder
memsharded Feb 13, 2019
3103a12
working
memsharded Feb 13, 2019
3155053
fixed test
memsharded Feb 13, 2019
d111dd3
Dani and Diego review
lasote Feb 14, 2019
867f91e
tests passing
memsharded Feb 14, 2019
f2a1eae
Fixing tests
lasote Feb 14, 2019
5a4fb06
Merge branch 'develop' into feature/new_graph_builder
memsharded Feb 14, 2019
456e106
working
memsharded Feb 14, 2019
9cc1759
Review
lasote Feb 15, 2019
aec6c8b
Imports
lasote Feb 15, 2019
5383467
working...
memsharded Feb 15, 2019
2b7b658
Merge branch 'develop' into feature/binary_analyzer_refactor
memsharded Feb 15, 2019
d84379b
merged develop
memsharded Feb 15, 2019
67f57a9
merged develop
memsharded Feb 15, 2019
4ee3c79
renamed bid->package_id
memsharded Feb 16, 2019
b41af2a
import and comment
memsharded Feb 16, 2019
1d032d2
renamed test
memsharded Feb 16, 2019
4828d61
Merge branch 'feature/binary_analyzer_refactor' into feature/new_grap…
memsharded Feb 17, 2019
12a6098
merged develop
memsharded Feb 19, 2019
564db10
tests passing
memsharded Feb 19, 2019
c3c200b
changes
memsharded Feb 20, 2019
82a3527
removed prints
memsharded Feb 20, 2019
6f301a3
Merge branch 'develop' into feature/new_graph_builder
memsharded Feb 21, 2019
1a9d28d
moving tests
memsharded Feb 21, 2019
c24acc7
improving tests
memsharded Feb 24, 2019
f63024f
new tests
memsharded Feb 25, 2019
fda23fd
fixed py3
memsharded Feb 25, 2019
654294e
working
memsharded Feb 25, 2019
cfd4b87
Merge branch 'develop' into feature/new_graph_builder
memsharded Feb 25, 2019
f265940
package-ID modes
memsharded Feb 25, 2019
ad602c0
fixing tests
memsharded Feb 25, 2019
339e783
fixing build_id test
memsharded Feb 26, 2019
312425b
merged develop, new checks that build_requires do not change main graph
memsharded Feb 27, 2019
a591079
Merge branch 'develop' into feature/new_graph_builder
memsharded Feb 27, 2019
8bd0044
cleaning
memsharded Feb 27, 2019
0c35e61
Merge branch 'develop' into feature/new_graph_builder
memsharded Feb 27, 2019
523e877
full test of package_id_mode
memsharded Feb 27, 2019
0568baf
removing full_revisions modes
memsharded Feb 28, 2019
ebbc45a
removed test
memsharded Feb 28, 2019
852b81a
Merge branch 'develop' into feature/new_graph_builder
memsharded Mar 1, 2019
12abb6e
remove package_id_mode related changes
memsharded Mar 1, 2019
dcb9251
simplified PR, no using packaeg_id_modes
memsharded Mar 1, 2019
683da6e
Merge branch 'develop' into feature/new_graph_builder
memsharded Mar 4, 2019
cf2f294
fixed migration
memsharded Mar 4, 2019
6b698c0
no_lock=True
memsharded Mar 4, 2019
d49411c
a couple tests more
memsharded Mar 4, 2019
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
75 changes: 24 additions & 51 deletions conans/client/graph/graph.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from collections import OrderedDict

from conans.model.ref import PackageReference

RECIPE_DOWNLOADED = "Downloaded"
Expand All @@ -25,7 +23,7 @@
class Node(object):
def __init__(self, ref, conanfile, recipe=None):
self.ref = ref
self.package_id = None
self._package_id = None
self.prev = None
self.conanfile = conanfile
self.dependencies = [] # Ordered Edges
Expand All @@ -36,12 +34,31 @@ def __init__(self, ref, conanfile, recipe=None):
self.binary_remote = None
self.build_require = False
self.revision_pinned = False # The revision has been specified by the user
# all the public deps to which this node belongs
self.public_deps = None # {ref.name: Node}
# all the public deps only in the closure of this node
self.public_closure = None # {ref.name: Node}
self.ancestors = None # set{ref.name}

@property
def package_id(self):
return self._package_id

@package_id.setter
def package_id(self, pkg_id):
assert self._package_id is None, "Trying to override an existing package_id"
self._package_id = pkg_id

@property
def name(self):
return self.ref.name if self.ref else None

@property
def pref(self):
return PackageReference(self.ref, self.package_id, self.prev)

def partial_copy(self):
# Used for collapse_graph
result = Node(self.ref, self.conanfile)
result.dependants = set()
result.dependencies = []
Expand All @@ -62,12 +79,8 @@ def add_edge(self, edge):
def neighbors(self):
return [edge.dst for edge in self.dependencies]

def public_neighbors(self):
return [edge.dst for edge in self.dependencies
if not edge.private and not edge.build_require]

def private_neighbors(self):
return [edge.dst for edge in self.dependencies if edge.private or edge.build_require]
return [edge.dst for edge in self.dependencies if edge.private]

def inverse_neighbors(self):
return [edge.src for edge in self.dependants]
Expand Down Expand Up @@ -146,18 +159,9 @@ class DepsGraph(object):
def __init__(self):
self.nodes = set()
self.root = None

def add_graph(self, node, graph, build_require=False):
for n in graph.nodes:
if n != graph.root:
n.build_require = build_require
self.add_node(n)

for e in graph.root.dependencies:
e.src = node
e.build_require = build_require

node.dependencies = graph.root.dependencies + node.dependencies
self.aliased = {}
# These are the nodes with pref (not including PREV) that have been evaluated
self.evaluated = {} # {pref: [nodes]}

def add_node(self, node):
if not self.nodes:
Expand All @@ -176,37 +180,6 @@ def ordered_iterate(self):
for node in level:
yield node

def full_closure(self, node, private=False):
# Needed to propagate correctly the cpp_info even with privates
closure = OrderedDict()
current = node.neighbors()
while current:
new_current = []
for n in current:
closure[n] = n
for n in current:
neighbors = n.public_neighbors() if not private else n.neighbors()
for neigh in neighbors:
if neigh not in new_current and neigh not in closure:
new_current.append(neigh)
current = new_current
return closure

def closure(self, node):
closure = OrderedDict()
current = node.neighbors()
while current:
new_current = []
for n in current:
closure[n.ref.name] = n
for n in current:
neighs = n.public_neighbors()
for neigh in neighs:
if neigh not in new_current and neigh.ref.name not in closure:
new_current.append(neigh)
current = new_current
return closure

def _inverse_closure(self, references):
closure = set()
current = [n for n in self.nodes if str(n.ref) in references or "ALL" in references]
Expand Down
44 changes: 26 additions & 18 deletions conans/client/graph/graph_binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,27 @@ def _evaluate_node(self, node, build_mode, update, evaluated_nodes, remote_name)
pref = PackageReference(ref, node.package_id)

# Check that this same reference hasn't already been checked
previous_node = evaluated_nodes.get(pref)
if previous_node:
previous_nodes = evaluated_nodes.get(pref)
if previous_nodes:
previous_nodes.append(node)
previous_node = previous_nodes[0]
node.binary = previous_node.binary
node.binary_remote = previous_node.binary_remote
node.prev = previous_node.prev
return
evaluated_nodes[pref] = node
evaluated_nodes[pref] = [node]

output = conanfile.output

if node.recipe == RECIPE_EDITABLE:
node.binary = BINARY_EDITABLE
# TODO: PREV?
return

if build_mode.forced(conanfile, ref):
output.warn('Forced build from source')
node.binary = BINARY_BUILD
node.prev = None
return

package_folder = self._cache.package(pref, short_paths=conanfile.short_paths)
Expand Down Expand Up @@ -105,6 +110,8 @@ def _evaluate_node(self, node, build_mode, update, evaluated_nodes, remote_name)
output.warn("Can't update, no remote defined")
if not node.binary:
node.binary = BINARY_CACHE
metadata = self._cache.package_layout(pref.ref).load_metadata()
node.prev = metadata.packages[pref.id].revision
package_hash = ConanInfo.load_from_package(package_folder).recipe_hash

else: # Binary does NOT exist locally
Expand Down Expand Up @@ -138,13 +145,15 @@ def _evaluate_node(self, node, build_mode, update, evaluated_nodes, remote_name)
node.binary = BINARY_BUILD
else:
node.binary = BINARY_MISSING
node.prev = None

if build_mode.outdated:
if node.binary in (BINARY_CACHE, BINARY_DOWNLOAD, BINARY_UPDATE):
local_recipe_hash = self._cache.package_layout(ref).recipe_manifest().summary_hash
if local_recipe_hash != package_hash:
output.info("Outdated package!")
node.binary = BINARY_BUILD
node.prev = None
else:
output.info("Package is up to date")

Expand All @@ -158,8 +167,7 @@ def _compute_package_id(node):
indirect_reqs = set() # of PackageReference, avoid duplicates
for neighbor in neighbors:
ref, nconan = neighbor.ref, neighbor.conanfile
pref = PackageReference(ref, neighbor.package_id)
direct_reqs.append(pref)
direct_reqs.append(neighbor.pref)
indirect_reqs.update(nconan.info.requires.refs())
conanfile.options.propagate_downstream(ref, nconan.info.full_options)
# Might be never used, but update original requirement, just in case
Expand All @@ -171,6 +179,7 @@ def _compute_package_id(node):
# for build-requires
conanfile.build_requires_options = conanfile.options.values
conanfile.options.clear_unused(indirect_reqs.union(direct_reqs))
conanfile.options.freeze()

conanfile.info = ConanInfo.create(conanfile.settings.values,
conanfile.options.values,
Expand All @@ -181,24 +190,23 @@ def _compute_package_id(node):
with conanfile_exception_formatter(str(conanfile), "package_id"):
conanfile.package_id()

info = node.conanfile.info
info = conanfile.info
node.package_id = info.package_id()

def _handle_private(self, node, deps_graph):
private_neighbours = node.private_neighbors()
if private_neighbours:
if node.binary in (BINARY_CACHE, BINARY_DOWNLOAD, BINARY_UPDATE):
for neigh in private_neighbours:
neigh.binary = BINARY_SKIP
closure = deps_graph.full_closure(neigh, private=True)
for n in closure:
n.binary = BINARY_SKIP
def _handle_private(self, node):
if node.binary in (BINARY_CACHE, BINARY_DOWNLOAD, BINARY_UPDATE, BINARY_SKIP):
private_neighbours = node.private_neighbors()
for neigh in private_neighbours:
# Current closure contains own node to be skipped
for n in neigh.public_closure.values():
n.binary = BINARY_SKIP
self._handle_private(n)

def evaluate_graph(self, deps_graph, build_mode, update, remote_name):
evaluated_nodes = {}
evaluated = deps_graph.evaluated
for node in deps_graph.ordered_iterate():
self._compute_package_id(node)
if node.recipe in (RECIPE_CONSUMER, RECIPE_VIRTUAL):
continue
self._evaluate_node(node, build_mode, update, evaluated_nodes, remote_name)
self._handle_private(node, deps_graph)
self._evaluate_node(node, build_mode, update, evaluated, remote_name)
self._handle_private(node)
Loading