[Notes] [Git][BuildStream/buildstream][issue_640-Build-All] 2 commits: frontend/buildcheckout.py: build default element



Title: GitLab

Phillip Smyth pushed to branch issue_640-Build-All at BuildStream / buildstream

Commits:

20 changed files:

Changes:

  • NEWS
    ... ... @@ -6,6 +6,10 @@ buildstream 1.3.1
    6 6
         specific. Recommendation if you are building in Linux is to use the
    
    7 7
         ones being used in freedesktop-sdk project, for example
    
    8 8
     
    
    9
    +  o Running `bst build` without elements specified will now attempt to build
    
    10
    +    the default element defined in the projcet configuration.
    
    11
    +    If no default element is defined, all elements in the project will be built
    
    12
    +
    
    9 13
       o All elements must now be suffixed with `.bst`
    
    10 14
         Attempting to use an element that does not have the `.bst` extension,
    
    11 15
         will result in a warning.
    

  • tests/frontend/buildcheckout.py
    ... ... @@ -2,6 +2,7 @@ import os
    2 2
     import tarfile
    
    3 3
     import hashlib
    
    4 4
     import pytest
    
    5
    +import subprocess
    
    5 6
     from tests.testutils import cli, create_repo, ALL_REPO_KINDS, generate_junction
    
    6 7
     
    
    7 8
     from buildstream import _yaml
    
    ... ... @@ -60,6 +61,35 @@ def test_build_checkout(datafiles, cli, strict, hardlinks):
    60 61
         assert os.path.exists(filename)
    
    61 62
     
    
    62 63
     
    
    64
    +@pytest.mark.datafiles(DATA_DIR + "_world")
    
    65
    +def test_build_default_all(datafiles, cli):
    
    66
    +    project = os.path.join(datafiles.dirname, datafiles.basename)
    
    67
    +    result = cli.run(project=project, cwd=project, silent=True, args=['build'])
    
    68
    +
    
    69
    +    result.assert_success()
    
    70
    +    target_dir = os.path.join(cli.directory, DATA_DIR + "_world", "elements")
    
    71
    +    output_dir = os.path.join(cli.directory, "logs", "test")
    
    72
    +
    
    73
    +    expected = subprocess.Popen(('ls', target_dir), stdout=subprocess.PIPE)
    
    74
    +    expected = subprocess.check_output(("wc", "-w"), stdin=expected.stdout)
    
    75
    +
    
    76
    +    results = subprocess.Popen(('ls', output_dir), stdout=subprocess.PIPE)
    
    77
    +    results = subprocess.check_output(("wc", "-w"), stdin=results.stdout)
    
    78
    +
    
    79
    +    assert results == expected
    
    80
    +
    
    81
    +
    
    82
    +@pytest.mark.datafiles(DATA_DIR + "_default")
    
    83
    +def test_build_default(cli, datafiles):
    
    84
    +    project = os.path.join(datafiles.dirname, datafiles.basename)
    
    85
    +    result = cli.run(project=project, cwd=project , silent=True, args=['build'])
    
    86
    +
    
    87
    +    result.assert_success()
    
    88
    +    results = cli.get_element_state(project, "target2.bst")
    
    89
    +    expected = "cached"
    
    90
    +    assert results == expected:
    
    91
    +
    
    92
    +
    
    63 93
     @pytest.mark.datafiles(DATA_DIR)
    
    64 94
     @pytest.mark.parametrize("strict,hardlinks", [
    
    65 95
         ("non-strict", "hardlinks"),
    

  • tests/frontend/project_default/elements/target.bst
    1
    +kind: stack
    
    2
    +description: |
    
    3
    +
    
    4
    +  Main stack target for the bst build test

  • tests/frontend/project_default/elements/target2.bst
    1
    +kind: stack
    
    2
    +description: |
    
    3
    +
    
    4
    +  Main stack target for the bst build test

  • tests/frontend/project_default/project.conf
    1
    +# Project config for frontend build test
    
    2
    +name: test
    
    3
    +
    
    4
    +element-path: elements
    
    5
    +
    
    6
    +fatal-warnings:
    
    7
    +- bad-element-suffix
    
    8
    +
    
    9
    +defaults:
    
    10
    +  target-element: target2.bst

  • tests/frontend/project_world/elements/compose-all.bst
    1
    +kind: compose
    
    2
    +
    
    3
    +depends:
    
    4
    +- filename: import-bin.bst
    
    5
    +  type: build
    
    6
    +- filename: import-dev.bst
    
    7
    +  type: build
    
    8
    +
    
    9
    +config:
    
    10
    +  # Dont try running the sandbox, we dont have a
    
    11
    +  # runtime to run anything in this context.
    
    12
    +  integrate: False

  • tests/frontend/project_world/elements/compose-exclude-dev.bst
    1
    +kind: compose
    
    2
    +
    
    3
    +depends:
    
    4
    +- filename: import-bin.bst
    
    5
    +  type: build
    
    6
    +- filename: import-dev.bst
    
    7
    +  type: build
    
    8
    +
    
    9
    +config:
    
    10
    +  # Dont try running the sandbox, we dont have a
    
    11
    +  # runtime to run anything in this context.
    
    12
    +  integrate: False
    
    13
    +
    
    14
    +  # Exclude the dev domain
    
    15
    +  exclude:
    
    16
    +  - devel

  • tests/frontend/project_world/elements/compose-include-bin.bst
    1
    +kind: compose
    
    2
    +
    
    3
    +depends:
    
    4
    +- filename: import-bin.bst
    
    5
    +  type: build
    
    6
    +- filename: import-dev.bst
    
    7
    +  type: build
    
    8
    +
    
    9
    +config:
    
    10
    +  # Dont try running the sandbox, we dont have a
    
    11
    +  # runtime to run anything in this context.
    
    12
    +  integrate: False
    
    13
    +
    
    14
    +  # Only include the runtim
    
    15
    +  include:
    
    16
    +  - runtime

  • tests/frontend/project_world/elements/import-bin.bst
    1
    +kind: import
    
    2
    +sources:
    
    3
    +- kind: local
    
    4
    +  path: files/bin-files

  • tests/frontend/project_world/elements/import-dev.bst
    1
    +kind: import
    
    2
    +sources:
    
    3
    +- kind: local
    
    4
    +  path: files/dev-files

  • tests/frontend/project_world/elements/rebuild-target.bst
    1
    +kind: compose
    
    2
    +
    
    3
    +build-depends:
    
    4
    +- target.bst

  • tests/frontend/project_world/elements/source-bundle/source-bundle-hello.bst
    1
    +kind: import
    
    2
    +description: the kind of this element must implement generate_script() method
    
    3
    +
    
    4
    +sources:
    
    5
    +- kind: local
    
    6
    +  path: files/source-bundle

  • tests/frontend/project_world/elements/target.bst
    1
    +kind: stack
    
    2
    +description: |
    
    3
    +
    
    4
    +  Main stack target for the bst build test
    
    5
    +
    
    6
    +depends:
    
    7
    +- import-bin.bst
    
    8
    +- compose-all.bst

  • tests/frontend/project_world/files/bar

  • tests/frontend/project_world/files/bin-files/usr/bin/hello
    1
    +#!/bin/bash
    
    2
    +
    
    3
    +echo "Hello !"

  • tests/frontend/project_world/files/build-files/buildstream/build/test
    1
    +test

  • tests/frontend/project_world/files/dev-files/usr/include/pony.h
    1
    +#ifndef __PONY_H__
    
    2
    +#define __PONY_H__
    
    3
    +
    
    4
    +#define PONY_BEGIN "Once upon a time, there was a pony."
    
    5
    +#define PONY_END "And they lived happily ever after, the end."
    
    6
    +
    
    7
    +#define MAKE_PONY(story)  \
    
    8
    +  PONY_BEGIN \
    
    9
    +  story \
    
    10
    +  PONY_END
    
    11
    +
    
    12
    +#endif /* __PONY_H__ */

  • tests/frontend/project_world/files/foo

  • tests/frontend/project_world/files/source-bundle/llamas.txt
    1
    +llamas

  • tests/frontend/project_world/project.conf
    1
    +# Project config for frontend build test
    
    2
    +name: test
    
    3
    +
    
    4
    +element-path: elements



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]