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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpcdf
obs
osc-plugins
Commits
93c6491d
Commit
93c6491d
authored
Mar 21, 2023
by
Lorenz Huedepohl
Browse files
Options
Downloads
Plain Diff
Merge branch 'mpcdf_build_status' into 'master'
Added mpcdf_build_status See merge request
!4
parents
9d2affe5
b7ea61a4
No related branches found
No related tags found
1 merge request
!4
Added mpcdf_build_status
Pipeline
#160474
passed
Mar 21, 2023
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mpcdf_build_status.py
+69
-0
69 additions, 0 deletions
mpcdf_build_status.py
with
69 additions
and
0 deletions
mpcdf_build_status.py
0 → 100644
+
69
−
0
View file @
93c6491d
#!/usr/bin/python3
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
sign in
to comment