Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
debomatic-webui
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
debomatic-webui-admins
debomatic-webui
Commits
d4429f40
Commit
d4429f40
authored
Jul 10, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
write status package to a package json file
parent
8ce19025
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
debomatic-modules/JSONLogger.py
debomatic-modules/JSONLogger.py
+30
-0
No files found.
debomatic-modules/JSONLogger.py
View file @
d4429f40
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
import
os
import
os
from
time
import
time
from
time
import
time
from
json
import
dumps
as
toJSON
from
json
import
dumps
as
toJSON
from
json
import
load
as
fileToJSON
class
DebomaticModule_JSONLogger
:
class
DebomaticModule_JSONLogger
:
...
@@ -48,6 +49,30 @@ class DebomaticModule_JSONLogger:
...
@@ -48,6 +49,30 @@ class DebomaticModule_JSONLogger:
json
=
toJSON
(
info
)
json
=
toJSON
(
info
)
logfd
.
write
(
json
+
'
\
n
'
)
logfd
.
write
(
json
+
'
\
n
'
)
def
_get_package_json
(
self
,
args
):
return
'%(directory)s/pool/%(package)s/%(package)s.json'
%
args
def
_write_package_json
(
self
,
args
,
status
):
"""Write package status into a JSON file."""
package_json
=
self
.
_get_package_json
(
args
)
if
os
.
path
.
isfile
(
package_json
):
with
open
(
package_json
,
'r'
)
as
infofd
:
try
:
info
=
fileToJSON
(
infofd
)
info
[
'end'
]
=
int
(
time
())
except
:
return
else
:
info
=
{
'start'
:
int
(
time
())}
for
key
in
status
:
if
key
not
in
info
:
info
[
key
]
=
status
[
key
]
with
open
(
package_json
,
'w'
)
as
infofd
:
json
=
toJSON
(
info
,
indent
=
4
)
infofd
.
write
(
json
+
'
\
n
'
)
def
_get_distribution_info
(
self
,
args
):
def
_get_distribution_info
(
self
,
args
):
"""From args to distribution info."""
"""From args to distribution info."""
info
=
{}
info
=
{}
...
@@ -77,6 +102,10 @@ class DebomaticModule_JSONLogger:
...
@@ -77,6 +102,10 @@ class DebomaticModule_JSONLogger:
def
pre_build
(
self
,
args
):
def
pre_build
(
self
,
args
):
package
=
self
.
_get_package_info
(
args
)
package
=
self
.
_get_package_info
(
args
)
package
[
'status'
]
=
'build'
package
[
'status'
]
=
'build'
package_json
=
self
.
_get_package_json
(
args
)
if
os
.
path
.
isfile
(
package_json
):
os
.
remove
(
package_json
)
self
.
_write_package_json
(
args
,
package
)
self
.
_append_info_to_logfile
(
args
,
package
)
self
.
_append_info_to_logfile
(
args
,
package
)
def
post_build
(
self
,
args
):
def
post_build
(
self
,
args
):
...
@@ -88,4 +117,5 @@ class DebomaticModule_JSONLogger:
...
@@ -88,4 +117,5 @@ class DebomaticModule_JSONLogger:
if
filename
.
endswith
(
'.dsc'
):
if
filename
.
endswith
(
'.dsc'
):
package
[
'success'
]
=
True
package
[
'success'
]
=
True
break
break
self
.
_write_package_json
(
args
,
package
)
self
.
_append_info_to_logfile
(
args
,
package
)
self
.
_append_info_to_logfile
(
args
,
package
)
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