Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
osc-plugins
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
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpcdf
obs
osc-plugins
Commits
7134f518
Commit
7134f518
authored
2 years ago
by
Tobias Melson
Browse files
Options
Downloads
Patches
Plain Diff
Added mpcdf_build_status
parent
9d2affe5
No related branches found
No related tags found
1 merge request
!4
Added mpcdf_build_status
Pipeline
#159827
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mpcdf_build_status.py
+70
-0
70 additions, 0 deletions
mpcdf_build_status.py
with
70 additions
and
0 deletions
mpcdf_build_status.py
0 → 100644
+
70
−
0
View file @
7134f518
#!/usr/bin/python2
from
__future__
import
print_function
import
os
import
osc
import
osc.conf
import
osc.core
from
xml.etree
import
ElementTree
def
do_mpcdf_build_status
(
self
,
subcmd
,
opts
,
*
args
):
"""
${cmd_name}: List build statuses of a package for all software projects
For a given package or the one from the current directory, iterate over all
projects in
"
software
"
and the user
'
s
"
home
"
project and display the build
statuses of that package. Lines will be skipped if the status is
"
succeeded
"
,
"
excluded
"
, or
"
disabled
"
.
Usage:
osc ${cmd_name} [PACKAGE]
${cmd_option_list}
"""
api_url
=
self
.
get_api_url
()
if
len
(
args
)
==
0
:
if
osc
.
core
.
is_package_dir
(
os
.
curdir
):
project
=
osc
.
core
.
store_read_project
(
os
.
curdir
)
package
=
osc
.
core
.
store_read_package
(
os
.
curdir
)
else
:
raise
osc
.
oscerr
.
WrongArgs
(
"
Specify PACKAGE or run command in an osc package checkout directory
"
)
elif
len
(
args
)
==
1
:
project
=
osc
.
core
.
store_read_project
(
os
.
curdir
)
package
,
=
args
else
:
raise
osc
.
oscerr
.
WrongArgs
(
"
Too many arguments
"
)
url
=
osc
.
core
.
makeurl
(
api_url
,
[
"
source
"
])
entries
=
ElementTree
.
fromstringlist
(
osc
.
core
.
streamfile
(
url
,
osc
.
core
.
http_GET
))
user
=
osc
.
conf
.
get_apiurl_usr
(
api_url
)
for
entry
in
entries
.
findall
(
"
./entry
"
):
project
=
entry
.
get
(
"
name
"
)
if
project
.
startswith
(
"
software:
"
)
or
project
==
"
home:{0}
"
.
format
(
user
):
print
(
project
)
project_url
=
osc
.
core
.
makeurl
(
api_url
,
[
"
build
"
,
project
,
"
_result?view=status&multibuild=1&package={0}
"
.
format
(
package
)])
resultlist
=
ElementTree
.
fromstringlist
(
osc
.
core
.
streamfile
(
project_url
,
osc
.
core
.
http_GET
))
actualPackages
=
set
()
for
result
in
resultlist
.
findall
(
"
./result
"
):
for
status
in
result
.
findall
(
"
./status
"
):
actualPackages
.
add
(
status
.
get
(
"
package
"
))
for
pack
in
actualPackages
:
print
(
"
{0} (https://obs-api.mpcdf.mpg.de/package/show/{1}/{2}):
"
.
format
(
pack
,
project
,
pack
))
cnt
=
0
for
result
in
resultlist
.
findall
(
"
./result
"
):
for
status
in
result
.
findall
(
"
./status
"
):
if
status
.
get
(
"
package
"
)
==
pack
:
if
status
.
get
(
"
code
"
)
not
in
[
"
disabled
"
,
"
excluded
"
,
"
succeeded
"
]:
print
(
"
{0}: {1}
"
.
format
(
result
.
get
(
"
repository
"
),
status
.
get
(
"
code
"
)))
cnt
=
cnt
+
1
if
cnt
==
0
:
print
(
"
all succeeded
"
)
print
()
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