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
0bf69658
There was a problem fetching the pipeline summary.
Commit
0bf69658
authored
6 years ago
by
Lorenz Huedepohl
Browse files
Options
Downloads
Patches
Plain Diff
Only add to maintainers if not already maintainer
parent
496f274c
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mpcdf_push.py
+22
-11
22 additions, 11 deletions
mpcdf_push.py
with
22 additions
and
11 deletions
mpcdf_push.py
+
22
−
11
View file @
0bf69658
...
...
@@ -64,26 +64,37 @@ def do_mpcdf_push(self, subcmd, opts, *args):
project_attributes
=
[
"
MPCDF:compiler_modules
"
,
"
MPCDF:cuda_modules
"
,
"
MPCDF:mpi_modules
"
]
package_attributes
=
[
"
MPCDF:enable_repositories
"
]
+
project_attributes
try
:
root
=
ElementTree
.
fromstringlist
(
osc
.
core
.
show_package_meta
(
api_url
,
to_project
,
package
))
existing_maintainers
=
{
e
.
get
(
"
userid
"
)
for
e
in
root
.
findall
(
"
./person[@role=
'
maintainer
'
]
"
)}
except
osc
.
core
.
HTTPError
as
e
:
if
e
.
code
==
404
:
existing_maintainers
=
set
()
else
:
raise
e
req_id
=
osc
.
core
.
create_submit_request
(
api_url
,
from_project
,
package
,
dst_project
=
to_project
,
message
=
"
Update {0} from {1}
"
.
format
(
package
,
from_project
)
if
not
opts
.
message
else
opts
.
message
)
print
(
"
Submitted package {0} to {1} in request {2}
"
.
format
(
package
,
to_project
,
req_id
))
if
not
opts
.
batch
:
print
(
"
PLEASE review the request by
'
osc request show {0} --diff
'
, or in the web interface
"
.
format
(
req_id
))
print
(
"
Do you want to accept the request right away? [y/N]
"
,
end
=
""
)
print
(
"
\n
PLEASE review the request by
'
osc request show {0} --diff
'
, or in the web interface
\n
"
.
format
(
req_id
))
print
(
"
Do you want to accept the request right away? [y/N]
"
,
end
=
""
)
response
=
input
().
lower
()
if
response
==
"
y
"
:
result
=
osc
.
core
.
change_request_state
(
api_url
,
req_id
,
'
accepted
'
,
"
Accepted on the command line via
'
osc mpcdf_push
'"
)
print
(
"
Accepting request {0}:
"
.
format
(
req_id
),
result
)
print
(
"
Accepting request {0}:
"
.
format
(
req_id
),
result
)
print
(
"
Adding you to the list of maintainers for this package (for informational purposes only)
"
)
user
=
osc
.
conf
.
get_apiurl_usr
(
api_url
)
r
=
osc
.
core
.
Request
()
r
.
add_action
(
"
add_role
"
,
tgt_project
=
to_project
,
tgt_package
=
package
,
person_name
=
user
,
person_role
=
"
maintainer
"
)
r
.
description
=
"
Add user {0} as maintainer due to
'
osc mpcdf_push
'"
.
format
(
user
)
r
.
create
(
api_url
)
if
response
==
"
y
"
:
result
=
osc
.
core
.
change_request_state
(
api_url
,
r
.
reqid
,
'
accepted
'
,
"
Accepted on the command line via
'
osc mpcdf_push
'"
)
print
(
"
Accepting request {0}:
"
.
format
(
r
.
reqid
),
result
)
if
user
not
in
existing_maintainers
:
print
(
"
Adding you to the list of maintainers for this package
"
)
r
=
osc
.
core
.
Request
()
r
.
add_action
(
"
add_role
"
,
tgt_project
=
to_project
,
tgt_package
=
package
,
person_name
=
user
,
person_role
=
"
maintainer
"
)
r
.
description
=
"
Add user {0} as maintainer due to
'
osc mpcdf_push
'"
.
format
(
user
)
r
.
create
(
api_url
)
if
response
==
"
y
"
:
result
=
osc
.
core
.
change_request_state
(
api_url
,
r
.
reqid
,
'
accepted
'
,
"
Accepted on the command line via
'
osc mpcdf_push
'"
)
print
(
"
Accepting request {0}:
"
.
format
(
r
.
reqid
),
result
)
print
()
# Give the system some time, sadly there is no transactional guarantee
time
.
sleep
(
2
)
...
...
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