summaryrefslogtreecommitdiff
path: root/tests/frontend/configuredwarning/plugins/corewarn.py
blob: bb744b0ddd0ab6e924568d28477a20a8cecbd5ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import os

from buildstream import Element
from buildstream.plugin import CoreWarnings


class CoreWarn(Element):
    def configure(self, node):
        pass

    def preflight(self):
        pass

    def get_unique_key(self):
        pass

    def configure_sandbox(self, sandbox):
        sandbox.mark_directory(self.get_variable('install-root'))

    def stage(self, sandbox):
        pass

    def assemble(self, sandbox):
        self.warn("Testing: CoreWarning produced during assemble",
                  warning_token=CoreWarnings.OVERLAPS)

        # Return an arbitrary existing directory in the sandbox
        #
        rootdir = sandbox.get_directory()
        install_root = self.get_variable('install-root')
        outputdir = os.path.join(rootdir, install_root.lstrip(os.sep))
        os.makedirs(outputdir, exist_ok=True)
        return install_root


def setup():
    return CoreWarn