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
6f68b305
Commit
6f68b305
authored
6 years ago
by
Lorenz Huedepohl
Browse files
Options
Downloads
Patches
Plain Diff
Automatically set microarchitecture in prjconf in mpcdf_setup_repositories
parent
4457c854
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mpcdf_common.py
+30
-2
30 additions, 2 deletions
mpcdf_common.py
mpcdf_setup_repositories.py
+3
-1
3 additions, 1 deletion
mpcdf_setup_repositories.py
with
33 additions
and
3 deletions
mpcdf_common.py
+
30
−
2
View file @
6f68b305
...
...
@@ -9,6 +9,8 @@ from osc.util.helper import decode_it
from
functools
import
partial
from
xml.etree
import
ElementTree
known_microarchs
=
{
"
sandybridge
"
,
"
haswell
"
,
"
skylake
"
}
package_attributes
=
[
"
MPCDF:enable_repositories
"
]
config_attributes
=
[
"
MPCDF:compiler_modules
"
,
"
MPCDF:cuda_modules
"
,
"
MPCDF:mpi_modules
"
,
"
MPCDF:pgi_modules
"
]
default_attributes
=
[
"
MPCDF:default_compiler
"
,
"
MPCDF:default_cuda
"
,
"
MPCDF:default_mpi
"
,
"
MPCDF:default_python2
"
,
"
MPCDF:default_python3
"
]
...
...
@@ -204,6 +206,19 @@ def remove_attribute(api_url, project, package, attribute_name):
raise
osc
.
oscerr
.
APIError
(
"
Could not remove attribute
"
)
def
get_microarchitecture
(
project
):
if
project
==
"
software
"
:
# Stupid special case
microarch
=
"
sandybridge
"
else
:
microarch
=
project
.
split
(
"
:
"
)[
2
]
if
microarch
in
known_microarchs
:
return
microarch
else
:
raise
Exception
(
"
Unknown micro-architecture
'
{0}
'"
.
format
(
microarch
))
def
mpcdf_enable_repositories
(
api_url
,
project
,
package
,
verbose
=
False
,
filter_repos
=
None
):
from
itertools
import
product
import
sys
...
...
@@ -343,7 +358,8 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False, filter_r
return
True
def
mpcdf_setup_repositories
(
api_url
,
project
,
distribution
=
None
,
parent
=
None
,
packages
=
None
,
dry_run
=
False
,
filter_repos
=
None
,
only_project
=
False
,
remove_old
=
False
):
def
mpcdf_setup_repositories
(
api_url
,
project
,
microarchitecture
=
None
,
distribution
=
None
,
parent
=
None
,
packages
=
None
,
dry_run
=
False
,
filter_repos
=
None
,
only_project
=
False
,
remove_old
=
False
):
import
threading
if
parent
:
...
...
@@ -374,6 +390,9 @@ def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, p
raise
osc
.
oscerr
.
WrongArgs
(
"
No repository
'
{0}
'
is defined in project
'
distributions
'
on the server
"
.
format
(
distribution
))
architectures
=
list
(
arch
.
text
for
arch
in
dist_repo
.
findall
(
"
./arch
"
))
if
microarchitecture
is
None
:
microarchitecture
=
get_microarchitecture
(
project
)
root
=
project_meta
(
api_url
,
project
)
prjconf
=
list
(
map
(
decode_it
,
osc
.
core
.
show_project_conf
(
api_url
,
project
)))
...
...
@@ -391,6 +410,15 @@ def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, p
prjconf_tail
=
""
.
join
(
prjconf
[
end
+
1
:])
prjconf
=
[
start_marker
]
prjconf
.
append
(
"
Constraint: hostlabel {0}
"
.
format
(
microarchitecture
))
prjconf
.
append
(
"""
%if %_repository != System
Macros:
%microarchitecture {0}
:Macros
%endif
"""
.
format
(
microarchitecture
))
prjconf
.
append
(
""
)
prjconf
.
append
(
"
Prefer: mpcdf_python2_
"
+
default_python2
)
prjconf
.
append
(
"
Prefer: mpcdf_python3_
"
+
default_python3
)
prjconf
.
append
(
""
)
...
...
@@ -653,7 +681,7 @@ def sync_projects(api_url, package=None, from_project="software", to_projects=No
distribution
=
sys_repo
.
find
(
'
./path[@project=
"
distributions
"
]
'
).
get
(
"
repository
"
)
print
(
"
Creating repository configuration
"
)
mpcdf_setup_repositories
(
api_url
,
to_project
,
distribution
)
mpcdf_setup_repositories
(
api_url
,
to_project
,
distribution
=
distribution
)
else
:
for
orig_package
in
from_packages
:
if
not
mpcdf_enable_repositories
(
api_url
,
to_project
,
orig_package
):
...
...
This diff is collapsed.
Click to expand it.
mpcdf_setup_repositories.py
+
3
−
1
View file @
6f68b305
...
...
@@ -22,6 +22,8 @@ import osc.cmdln
help
=
"
Only change project metadata
'
prj
'
and
'
prjconf
'
, leave individual packages unchanged
"
)
@osc.cmdln.option
(
'
--remove-old
'
,
action
=
"
store_true
"
,
default
=
False
,
help
=
"
Remove all obsolete repositories instead of only disabling builds for packages there
"
)
@osc.cmdln.option
(
'
--microarchitecture
'
,
metavar
=
"
ARCH
"
,
nargs
=
1
,
help
=
"
Configure project to use ARCH as microarchitecture
"
)
@osc.cmdln.alias
(
"
mpcdf_setup_repos
"
)
def
do_mpcdf_setup_repositories
(
self
,
subcmd
,
opts
,
*
args
):
"""
${cmd_name}: Create all repository combinations for an MPCDF project
...
...
@@ -48,6 +50,6 @@ def do_mpcdf_setup_repositories(self, subcmd, opts, *args):
raise
osc
.
oscerr
.
WrongArgs
(
"
Too many arguments
"
)
mpcdf_setup_repositories
(
self
.
get_api_url
(),
project
,
opts
.
distribution
,
project
,
microarchitecture
=
opts
.
microarchitecture
,
distribution
=
opts
.
distribution
,
parent
=
opts
.
parent
,
dry_run
=
opts
.
dry_run
,
filter_repos
=
opts
.
disable_repo
,
only_project
=
opts
.
only_project
,
remove_old
=
opts
.
remove_old
)
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