Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
slapos.buildout
Commits
837c540d
Commit
837c540d
authored
Jul 01, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Save installed database in an atomic way"
This reverts commit
54bbe6bf
.
parent
4f679e8d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
26 deletions
+5
-26
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+5
-26
No files found.
src/zc/buildout/buildout.py
View file @
837c540d
...
@@ -839,16 +839,11 @@ class Buildout(UserDict.DictMixin):
...
@@ -839,16 +839,11 @@ class Buildout(UserDict.DictMixin):
def
_update_installed
(
self
,
**
buildout_options
):
def
_update_installed
(
self
,
**
buildout_options
):
installed
=
self
[
'buildout'
][
'installed'
]
installed
=
self
[
'buildout'
][
'installed'
]
# read old installed database
f
=
open
(
installed
,
'a'
)
with
open
(
installed
,
'r'
)
as
f
:
f
.
write
(
'
\
n
[buildout]
\
n
'
)
installed_data
=
f
.
read
()
installed_data
=
'%s
\
n
[buildout]
\
n
'
%
installed_data
f
=
StringIO
()
f
.
write
(
installed_data
)
for
option
,
value
in
buildout_options
.
items
():
for
option
,
value
in
buildout_options
.
items
():
_save_option
(
option
,
value
,
f
)
_save_option
(
option
,
value
,
f
)
self
.
_save_installed_database
(
f
.
getvalue
()
)
f
.
close
(
)
def
_uninstall_part
(
self
,
part
,
installed_part_options
):
def
_uninstall_part
(
self
,
part
,
installed_part_options
):
# uninstall part
# uninstall part
...
@@ -1012,33 +1007,17 @@ class Buildout(UserDict.DictMixin):
...
@@ -1012,33 +1007,17 @@ class Buildout(UserDict.DictMixin):
for
d
in
installed
]
for
d
in
installed
]
return
' '
.
join
(
installed
)
return
' '
.
join
(
installed
)
def
_save_installed_database
(
self
,
text
):
# Saved installed database in an atomic fashion
installed
=
self
[
'buildout'
][
'installed'
]
temp_installed
=
'%s.tmp'
%
installed
try
:
with
open
(
temp_installed
,
'w'
)
as
f
:
f
.
write
(
text
)
f
.
flush
()
os
.
fsync
(
f
.
fileno
())
os
.
rename
(
temp_installed
,
installed
)
finally
:
try
:
os
.
remove
(
temp_installed
)
except
OSError
:
pass
def
_save_installed_options
(
self
,
installed_options
):
def
_save_installed_options
(
self
,
installed_options
):
installed
=
self
[
'buildout'
][
'installed'
]
installed
=
self
[
'buildout'
][
'installed'
]
if
not
installed
:
if
not
installed
:
return
return
f
=
StringIO
(
)
f
=
open
(
installed
,
'w'
)
_save_options
(
'buildout'
,
installed_options
[
'buildout'
],
f
)
_save_options
(
'buildout'
,
installed_options
[
'buildout'
],
f
)
for
part
in
installed_options
[
'buildout'
][
'parts'
].
split
():
for
part
in
installed_options
[
'buildout'
][
'parts'
].
split
():
print
>>
f
print
>>
f
_save_options
(
part
,
installed_options
[
part
],
f
)
_save_options
(
part
,
installed_options
[
part
],
f
)
f
.
close
()
self
.
_save_installed_database
(
f
.
getvalue
())
def
_error
(
self
,
message
,
*
args
):
def
_error
(
self
,
message
,
*
args
):
raise
zc
.
buildout
.
UserError
(
message
%
args
)
raise
zc
.
buildout
.
UserError
(
message
%
args
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment