[Notes] [Git][BuildStream/buildstream][jjardon/aarch64] 5 commits: element.py: Use _force_rmtree instead of custom code.



Title: GitLab

Javier Jardón pushed to branch jjardon/aarch64 at BuildStream / buildstream

Commits:

8 changed files:

Changes:

  • .gitlab-ci.yml
    ... ... @@ -89,18 +89,36 @@ tests-debian-9:
    89 89
       image: buildstream/testsuite-debian:9-master-119-552f5fc6
    
    90 90
       <<: *linux-tests
    
    91 91
     
    
    92
    +tests-debian-9-aarch64:
    
    93
    +  image: buildstream/testsuite-debian:aarch64-9-master-123-8931e42c
    
    94
    +  tags:
    
    95
    +  - aarch64
    
    96
    +  <<: *linux-tests
    
    97
    +
    
    92 98
     tests-fedora-27:
    
    93
    -  image: buildstream/testsuite-fedora:27-master-119-552f5fc6
    
    99
    +  image: buildstream/testsuite-fedora:aarch64-27-master-123-8931e42c
    
    94 100
       <<: *linux-tests
    
    95 101
     
    
    96 102
     tests-fedora-28:
    
    97 103
       image: buildstream/testsuite-fedora:28-master-119-552f5fc6
    
    98 104
       <<: *linux-tests
    
    99 105
     
    
    106
    +tests-fedora-28-aarch64:
    
    107
    +  image: buildstream/testsuite-fedora:aarch64-27-master-123-8931e42c
    
    108
    +  tags:
    
    109
    +  - aarch64
    
    110
    +  <<: *linux-tests
    
    111
    +
    
    100 112
     tests-ubuntu-18.04:
    
    101 113
       image: buildstream/testsuite-ubuntu:18.04-master-119-552f5fc6
    
    102 114
       <<: *linux-tests
    
    103 115
     
    
    116
    +tests-ubuntu-18.04--aarch64:
    
    117
    +  image: buildstream/testsuite-ubuntu:
    
    118
    +  tags:
    
    119
    +  - aarch64
    
    120
    +  <<: *linux-tests
    
    121
    +
    
    104 122
     tests-unix:
    
    105 123
       # Use fedora here, to a) run a test on fedora and b) ensure that we
    
    106 124
       # can get rid of ostree - this is not possible with debian-8
    

  • buildstream/element.py
    ... ... @@ -1410,16 +1410,9 @@ class Element(Plugin):
    1410 1410
     
    
    1411 1411
                 finally:
    
    1412 1412
                     # Staging may produce directories with less than 'rwx' permissions
    
    1413
    -                # for the owner, which will break tempfile, so we need to use chmod
    
    1414
    -                # occasionally.
    
    1415
    -                def make_dir_writable(fn, path, excinfo):
    
    1416
    -                    os.chmod(os.path.dirname(path), 0o777)
    
    1417
    -                    if os.path.isdir(path):
    
    1418
    -                        os.rmdir(path)
    
    1419
    -                    else:
    
    1420
    -                        os.remove(path)
    
    1421
    -                shutil.rmtree(temp_staging_directory, onerror=make_dir_writable)
    
    1422
    -
    
    1413
    +                # for the owner, which breaks tempfile. _force_rmtree will deal
    
    1414
    +                # with these.
    
    1415
    +                utils._force_rmtree(temp_staging_directory)
    
    1423 1416
             # Ensure deterministic mtime of sources at build time
    
    1424 1417
             vdirectory.set_deterministic_mtime()
    
    1425 1418
             # Ensure deterministic owners of sources at build time
    

  • buildstream/scriptelement.py
    ... ... @@ -201,16 +201,17 @@ class ScriptElement(Element):
    201 201
             # Setup environment
    
    202 202
             sandbox.set_environment(self.get_environment())
    
    203 203
     
    
    204
    +        # Tell the sandbox to mount the install root
    
    205
    +        directories = {'/': False}
    
    206
    +
    
    204 207
             # Mark the artifact directories in the layout
    
    205 208
             for item in self.__layout:
    
    206
    -            if item['destination'] != '/':
    
    207
    -                if item['element']:
    
    208
    -                    sandbox.mark_directory(item['destination'], artifact=True)
    
    209
    -                else:
    
    210
    -                    sandbox.mark_directory(item['destination'])
    
    209
    +            destination = item['destination']
    
    210
    +            was_artifact = directories.get(destination, False)
    
    211
    +            directories[destination] = item['element'] or was_artifact
    
    211 212
     
    
    212
    -        # Tell the sandbox to mount the install root
    
    213
    -        sandbox.mark_directory(self.__install_root)
    
    213
    +        for directory, artifact in directories.items():
    
    214
    +            sandbox.mark_directory(directory, artifact=artifact)
    
    214 215
     
    
    215 216
         def stage(self, sandbox):
    
    216 217
     
    

  • tests/integration/project/elements/script/corruption-image.bst
    1
    +kind: import
    
    2
    +sources:
    
    3
    +- kind: local
    
    4
    +  path: files/canary

  • tests/integration/project/elements/script/corruption-integration.bst
    1
    +kind: stack
    
    2
    +
    
    3
    +public:
    
    4
    +  bst:
    
    5
    +    integration-commands:
    
    6
    +      - echo smashed >>/canary
    
    7
    +

  • tests/integration/project/elements/script/corruption.bst
    1
    +kind: script
    
    2
    +
    
    3
    +depends:
    
    4
    +- filename: base.bst
    
    5
    +  type: build
    
    6
    +- filename: script/corruption-image.bst
    
    7
    +  type: build
    
    8
    +- filename: script/corruption-integration.bst
    
    9
    +  type: build
    
    10
    +
    
    11
    +variables:
    
    12
    +  install-root: "/"
    
    13
    +
    
    14
    +config:
    
    15
    +  layout:
    
    16
    +  - element: base.bst
    
    17
    +    destination: "/"
    
    18
    +  - element: script/corruption-image.bst
    
    19
    +    destination: "/"
    
    20
    +  - element: script/corruption-integration.bst
    
    21
    +    destination: "/"

  • tests/integration/project/files/canary
    1
    +alive

  • tests/integration/script.py
    ... ... @@ -155,3 +155,32 @@ def test_script_layout(cli, tmpdir, datafiles):
    155 155
             text = f.read()
    
    156 156
     
    
    157 157
         assert text == "Hi\n"
    
    158
    +
    
    159
    +
    
    160
    +@pytest.mark.datafiles(DATA_DIR)
    
    161
    +def test_regression_cache_corruption(cli, tmpdir, datafiles):
    
    162
    +    project = str(datafiles)
    
    163
    +    checkout_original = os.path.join(cli.directory, 'checkout-original')
    
    164
    +    checkout_after = os.path.join(cli.directory, 'checkout-after')
    
    165
    +    element_name = 'script/corruption.bst'
    
    166
    +    canary_element_name = 'script/corruption-image.bst'
    
    167
    +
    
    168
    +    res = cli.run(project=project, args=['build', canary_element_name])
    
    169
    +    assert res.exit_code == 0
    
    170
    +
    
    171
    +    res = cli.run(project=project, args=['checkout', canary_element_name,
    
    172
    +                                         checkout_original])
    
    173
    +    assert res.exit_code == 0
    
    174
    +
    
    175
    +    with open(os.path.join(checkout_original, 'canary')) as f:
    
    176
    +        assert f.read() == 'alive\n'
    
    177
    +
    
    178
    +    res = cli.run(project=project, args=['build', element_name])
    
    179
    +    assert res.exit_code == 0
    
    180
    +
    
    181
    +    res = cli.run(project=project, args=['checkout', canary_element_name,
    
    182
    +                                         checkout_after])
    
    183
    +    assert res.exit_code == 0
    
    184
    +
    
    185
    +    with open(os.path.join(checkout_after, 'canary')) as f:
    
    186
    +        assert f.read() == 'alive\n'



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