Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
buildstream
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
6
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
BuildStream
buildstream
Commits
4a38386b
There was an error fetching the commit references. Please try again later.
Commit
4a38386b
authored
7 years ago
by
Tristan Maat
Browse files
Options
Downloads
Patches
Plain Diff
element.py: Encode workspaced dependencies in metadata
parent
7227cd41
No related branches found
No related tags found
1 merge request
!50
Workspaces
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
buildstream/element.py
+28
-5
28 additions, 5 deletions
buildstream/element.py
with
28 additions
and
5 deletions
buildstream/element.py
+
28
−
5
View file @
4a38386b
...
...
@@ -137,6 +137,7 @@ class Element(Plugin):
self
.
__tainted
=
None
self
.
__workspaced_artifact
=
None
self
.
__workspaced_dependencies_artifact
=
None
def
__lt__
(
self
,
other
):
return
self
.
name
<
other
.
name
...
...
@@ -713,12 +714,18 @@ class Element(Plugin):
# _tainted():
#
# Whether this artifact should be pushed to an artifact cache.
#
# Args:
# recalculate (bool) - Whether to force recalculation
#
# Returns:
# (bool) False if this artifact should be excluded from pushing.
#
# Note:
# This method should only be called after the element's
# artifact is present in the local artifact cache.
#
def
_tainted
(
self
,
recalculate
=
False
):
if
recalculate
or
self
.
__tainted
is
None
:
...
...
@@ -726,11 +733,12 @@ class Element(Plugin):
workspaced
=
self
.
_workspaced_artifact
()
# Whether this artifact's dependencies are tainted
dependencies
=
any
(
d
.
_tainted
()
for
d
in
self
.
dependencies
(
Scope
.
BUILD
)
if
d
!=
self
)
workspaced_dependencies
=
any
(
val
for
key
,
val
in
self
.
_workspaced_dependencies_artifact
().
items
()
if
key
!=
_yaml
.
PROVENANCE_KEY
)
# Other conditions should be or-ed
self
.
__tainted
=
workspaced
or
dependencies
self
.
__tainted
=
workspaced
or
workspaced_
dependencies
return
self
.
__tainted
...
...
@@ -1020,13 +1028,17 @@ class Element(Plugin):
dependencies
=
{
e
.
name
:
e
.
_get_cache_key_from_artifact
()
for
e
in
self
.
dependencies
(
Scope
.
BUILD
)
}
workspaced_dependencies
=
{
e
.
name
:
e
.
_workspaced
()
for
e
in
self
.
dependencies
(
Scope
.
BUILD
)
}
meta
=
{
'
workspaced
'
:
self
.
_workspaced
(),
'
keys
'
:
{
'
strong
'
:
self
.
_get_cache_key_for_build
(),
'
weak
'
:
self
.
_get_cache_key
(
_KeyStrength
.
WEAK
),
'
dependencies
'
:
dependencies
}
},
'
workspaced
'
:
self
.
_workspaced
(),
'
workspaced_dependencies
'
:
workspaced_dependencies
}
_yaml
.
dump
(
_yaml
.
node_sanitize
(
meta
),
os
.
path
.
join
(
metadir
,
'
artifact.yaml
'
))
...
...
@@ -1169,6 +1181,17 @@ class Element(Plugin):
return
self
.
__workspaced_artifact
def
_workspaced_dependencies_artifact
(
self
):
if
self
.
__workspaced_dependencies_artifact
is
None
:
self
.
_assert_cached
(
recalculate
=
False
)
metadir
=
os
.
path
.
join
(
self
.
__artifacts
.
extract
(
self
),
'
meta
'
)
meta
=
_yaml
.
load
(
os
.
path
.
join
(
metadir
,
'
artifact.yaml
'
))
self
.
__workspaced_dependencies_artifact
=
meta
[
'
workspaced_dependencies
'
]
return
self
.
__workspaced_dependencies_artifact
# Run some element methods with logging directed to
# a dedicated log file, here we yield the filename
# we decided on for logging
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment