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
3bbb90e7
Commit
3bbb90e7
authored
6 years ago
by
Benjamin Schubert
Browse files
Options
Downloads
Patches
Plain Diff
Use sets when checking for existence of an element
parent
8b34e356
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1154
Use sets when checking for existence of an element
Pipeline
#47684316
passed
6 years ago
Stage: test
Stage: post
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
buildstream/_loader/loader.py
+7
-7
7 additions, 7 deletions
buildstream/_loader/loader.py
buildstream/_profile.py
+3
-7
3 additions, 7 deletions
buildstream/_profile.py
buildstream/plugins/sources/tar.py
+2
-2
2 additions, 2 deletions
buildstream/plugins/sources/tar.py
with
12 additions
and
16 deletions
buildstream/_loader/loader.py
+
7
−
7
View file @
3bbb90e7
...
...
@@ -284,17 +284,17 @@ class Loader():
def
_check_circular_deps
(
self
,
element
,
check_elements
=
None
,
validated
=
None
,
sequence
=
None
):
if
check_elements
is
None
:
check_elements
=
{}
check_elements
=
set
()
if
validated
is
None
:
validated
=
{}
validated
=
set
()
if
sequence
is
None
:
sequence
=
[]
# Skip already validated branches
if
validated
.
get
(
element
)
i
s
not
None
:
if
element
i
n
validated
:
return
if
check_
element
s
.
get
(
element
)
is
not
None
:
if
element
in
check_elements
:
# Create `chain`, the loop of element dependencies from this
# element back to itself, by trimming everything before this
# element from the sequence under consideration.
...
...
@@ -306,15 +306,15 @@ class Loader():
.
format
(
element
.
full_name
,
"
->
"
.
join
(
chain
)))
# Push / Check each dependency / Pop
check_elements
[
element
]
=
True
check_elements
.
add
(
element
)
sequence
.
append
(
element
.
full_name
)
for
dep
in
element
.
dependencies
:
dep
.
element
.
_loader
.
_check_circular_deps
(
dep
.
element
,
check_elements
,
validated
,
sequence
)
del
check_elements
[
element
]
check_elements
.
remove
(
element
)
sequence
.
pop
()
# Eliminate duplicate paths
validated
[
element
]
=
True
validated
.
add
(
element
)
# _sort_dependencies():
#
...
...
This diff is collapsed.
Click to expand it.
buildstream/_profile.py
+
3
−
7
View file @
3bbb90e7
...
...
@@ -26,7 +26,7 @@ import datetime
import
time
# Track what profile topics are active
active_topics
=
{}
active_topics
=
set
()
active_profiles
=
{}
initialized
=
False
...
...
@@ -144,14 +144,10 @@ def profile_init():
if
setting
:
topics
=
setting
.
split
(
'
:
'
)
for
topic
in
topics
:
active_topics
[
topic
]
=
True
active_topics
.
add
(
topic
)
initialized
=
True
def
profile_enabled
(
topic
):
profile_init
()
if
active_topics
.
get
(
topic
):
return
True
if
active_topics
.
get
(
Topics
.
ALL
):
return
True
return
False
return
topic
in
active_topics
or
Topics
.
ALL
in
active_topics
This diff is collapsed.
Click to expand it.
buildstream/plugins/sources/tar.py
+
2
−
2
View file @
3bbb90e7
...
...
@@ -154,7 +154,7 @@ class TarSource(DownloadableFileSource):
# directory paths for the archived files.
def
_list_tar_paths
(
self
,
tar
):
visited
=
{}
visited
=
set
()
for
member
in
tar
.
getmembers
():
# Remove any possible leading './', offer more consistent behavior
...
...
@@ -170,7 +170,7 @@ class TarSource(DownloadableFileSource):
for
i
in
range
(
len
(
components
)
-
1
):
dir_component
=
'
/
'
.
join
([
components
[
j
]
for
j
in
range
(
i
+
1
)])
if
dir_component
not
in
visited
:
visited
[
dir_component
]
=
True
visited
.
add
(
dir_component
)
try
:
# Dont yield directory members which actually do
# exist in the archive
...
...
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