Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions kernelci/legacy/config/build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2018, 2019 Collabora Limited

Check warning on line 1 in kernelci/legacy/config/build.py

View workflow job for this annotation

GitHub Actions / Lint

Missing module docstring
# Author: Guillaume Tucker <guillaume.tucker@collabora.com>
#
# This module is free software; you can redistribute it and/or modify it under
Expand All @@ -23,7 +23,7 @@
class Tree(YAMLConfigObject):
"""Kernel git tree model."""

yaml_tag = u'!Tree'

Check warning on line 26 in kernelci/legacy/config/build.py

View workflow job for this annotation

GitHub Actions / Lint

The u prefix for strings is no longer necessary in Python >=3.0

def __init__(self, name, url):
"""A kernel git tree is essentially a repository with kernel branches.
Expand All @@ -35,11 +35,11 @@
self._url = url

@property
def name(self):

Check warning on line 38 in kernelci/legacy/config/build.py

View workflow job for this annotation

GitHub Actions / Lint

Missing function or method docstring
return self._name

@property
def url(self):

Check warning on line 42 in kernelci/legacy/config/build.py

View workflow job for this annotation

GitHub Actions / Lint

Missing function or method docstring
return self._url

@classmethod
Expand All @@ -52,7 +52,7 @@
class Reference(YAMLConfigObject):
"""Kernel reference tree and branch model."""

yaml_tag = u'!Reference'

Check warning on line 55 in kernelci/legacy/config/build.py

View workflow job for this annotation

GitHub Actions / Lint

The u prefix for strings is no longer necessary in Python >=3.0

def __init__(self, tree, branch):
"""Reference is a tree and branch used for bisections
Expand All @@ -64,23 +64,23 @@
self._branch = branch

@classmethod
def load_from_yaml(cls, reference, trees):

Check warning on line 67 in kernelci/legacy/config/build.py

View workflow job for this annotation

GitHub Actions / Lint

Variadics removed in overriding 'Reference.load_from_yaml' method

Check warning on line 67 in kernelci/legacy/config/build.py

View workflow job for this annotation

GitHub Actions / Lint

Number of parameters was 3 in 'YAMLConfigObject.load_from_yaml' and is now 3 in overriding 'Reference.load_from_yaml' method
kw = cls._kw_from_yaml(reference, ['tree', 'branch'])
kw['tree'] = trees[kw['tree']]
return cls(**kw)

@property
def tree(self):

Check warning on line 73 in kernelci/legacy/config/build.py

View workflow job for this annotation

GitHub Actions / Lint

Missing function or method docstring
return self._tree

@property
def branch(self):

Check warning on line 77 in kernelci/legacy/config/build.py

View workflow job for this annotation

GitHub Actions / Lint

Missing function or method docstring
return self._branch

@classmethod
def to_yaml(cls, dumper, data):
return dumper.represent_mapping(
u'tag:yaml.org,2002:map', {

Check warning on line 83 in kernelci/legacy/config/build.py

View workflow job for this annotation

GitHub Actions / Lint

The u prefix for strings is no longer necessary in Python >=3.0
'tree': data.tree.name,
'branch': data.branch,
}
Expand Down Expand Up @@ -359,7 +359,8 @@

yaml_tag = u'!BuildConfig'

def __init__(self, name, tree, branch, variants, reference=None, architectures=None):
def __init__(self, name, tree, branch, variants, reference=None,
architectures=None, frequency=None):
"""A build configuration defines the actual kernels to be built.

*name* is the name of the build configuration. It is arbitrary and
Expand All @@ -378,13 +379,18 @@
bisections when no base commit is found for the good and
bad revisions. It can also be None if no reference branch
can be used with this build configuration.

*frequency* is an optional string that limits how often a checkout node
can be created for this tree/branch. Format: [Nd][Nh][Nm]
e.g. "1d" for once per day, "12h" for twice per day.
"""
self._name = name
self._tree = tree
self._branch = branch
self._variants = variants
self._reference = reference
self._architectures = architectures
self._frequency = frequency

@classmethod
def load_from_yaml(cls, config, name, trees, fragments, b_envs, defaults):
Expand All @@ -406,6 +412,7 @@
if reference:
kw['reference'] = Reference.load_from_yaml(reference, trees)
kw['architectures'] = config.get('architectures', None)
kw['frequency'] = config.get('frequency', None)
return cls(**kw)

@property
Expand Down Expand Up @@ -435,16 +442,21 @@
def reference(self):
return self._reference

@property
def frequency(self):
return self._frequency

@classmethod
def to_yaml(cls, dumper, data):
return dumper.represent_mapping(
u'tag:yaml.org,2002:map', {
'tree': data.tree.name,
'branch': data.branch,
'variants': {var.name: var for var in data.variants},
'reference': data.reference,
}
)
result = {
'tree': data.tree.name,
'branch': data.branch,
'variants': {var.name: var for var in data.variants},
'reference': data.reference,
}
if data.frequency:
result['frequency'] = data.frequency
return dumper.represent_mapping(u'tag:yaml.org,2002:map', result)


def from_yaml(data, filters):
Expand Down