[Notes] [Git][BuildStream/buildstream][jjardon/use_freedesktop-sdk_18_08] 3 commits: _loader/loader.py: Be more explanatory in CircDep exception



Title: GitLab

Javier Jardón pushed to branch jjardon/use_freedesktop-sdk_18_08 at BuildStream / buildstream

Commits:

11 changed files:

Changes:

  • buildstream/_loader/loader.py
    ... ... @@ -296,12 +296,14 @@ class Loader():
    296 296
         # Raises:
    
    297 297
         #    (LoadError): In case there was a circular dependency error
    
    298 298
         #
    
    299
    -    def _check_circular_deps(self, element_name, check_elements=None, validated=None):
    
    299
    +    def _check_circular_deps(self, element_name, check_elements=None, validated=None, sequence=None):
    
    300 300
     
    
    301 301
             if check_elements is None:
    
    302 302
                 check_elements = {}
    
    303 303
             if validated is None:
    
    304 304
                 validated = {}
    
    305
    +        if sequence is None:
    
    306
    +            sequence = []
    
    305 307
     
    
    306 308
             element = self._elements[element_name]
    
    307 309
     
    
    ... ... @@ -314,16 +316,24 @@ class Loader():
    314 316
                 return
    
    315 317
     
    
    316 318
             if check_elements.get(element_name) is not None:
    
    319
    +            # Create `chain`, the loop of element dependencies from this
    
    320
    +            # element back to itself, by trimming everything before this
    
    321
    +            # element from the sequence under consideration.
    
    322
    +            chain = sequence[sequence.index(element_name):]
    
    323
    +            chain.append(element_name)
    
    317 324
                 raise LoadError(LoadErrorReason.CIRCULAR_DEPENDENCY,
    
    318
    -                            "Circular dependency detected for element: {}"
    
    319
    -                            .format(element.name))
    
    325
    +                            ("Circular dependency detected at element: {}\n" +
    
    326
    +                             "Dependency chain: {}")
    
    327
    +                            .format(element.name, " -> ".join(chain)))
    
    320 328
     
    
    321 329
             # Push / Check each dependency / Pop
    
    322 330
             check_elements[element_name] = True
    
    331
    +        sequence.append(element_name)
    
    323 332
             for dep in element.deps:
    
    324 333
                 loader = self._get_loader_for_dep(dep)
    
    325
    -            loader._check_circular_deps(dep.name, check_elements, validated)
    
    334
    +            loader._check_circular_deps(dep.name, check_elements, validated, sequence)
    
    326 335
             del check_elements[element_name]
    
    336
    +        sequence.pop()
    
    327 337
     
    
    328 338
             # Eliminate duplicate paths
    
    329 339
             validated[element_name] = True
    

  • doc/examples/flatpak-autotools/elements/base/sdk.bst
    ... ... @@ -2,15 +2,15 @@ kind: import
    2 2
     description: Import the base freedesktop SDK
    
    3 3
     sources:
    
    4 4
     - kind: ostree
    
    5
    -  url: gnomesdk:repo/
    
    6
    -  gpg-key: keys/gnome-sdk.gpg
    
    5
    +  url: flathub:repo/
    
    6
    +  gpg-key: keys/flathub.gpg
    
    7 7
       (?):
    
    8 8
       - arch == "x86_64":
    
    9
    -      track: runtime/org.freedesktop.BaseSdk/x86_64/1.4
    
    10
    -      ref: 0d9d255d56b08aeaaffb1c820eef85266eb730cb5667e50681185ccf5cd7c882
    
    9
    +      track: runtime/org.freedesktop.Sdk/x86_64/18.08
    
    10
    +      ref: 266c14050460f4747ffaac89b1050c027dfad51f4fc5742d221b4a5d12e3fb71
    
    11 11
       - arch == "i386":
    
    12
    -      track: runtime/org.freedesktop.BaseSdk/i386/1.4
    
    13
    -      ref: 16036b747c1ec8e7fe291f5b1f667cb942f0267d08fcad962e9b7627d6cf1981
    
    12
    +      track: runtime/org.freedesktop.Sdk/i386/18.08
    
    13
    +      ref: 30230a5eba26b77c334e125493a4b798bd304ab6d5186574f150de5c8cdee350
    
    14 14
     config:
    
    15 15
       source: files
    
    16 16
       target: usr

  • doc/examples/flatpak-autotools/elements/hello.bst
    ... ... @@ -4,6 +4,9 @@ description: Autotools project
    4 4
     depends:
    
    5 5
     - base.bst
    
    6 6
     
    
    7
    +variables:
    
    8
    +  prefix: '/app'
    
    9
    +
    
    7 10
     sources:
    
    8 11
     - kind: local
    
    9 12
       path: files/src

  • doc/examples/flatpak-autotools/files/links/lib64
    1
    +usr/lib64
    \ No newline at end of file

  • doc/examples/flatpak-autotools/keys/flathub.gpg
    No preview for this file type
  • doc/examples/flatpak-autotools/keys/gnome-sdk.gpg deleted
    No preview for this file type
  • doc/examples/flatpak-autotools/project.conf
    1 1
     name: flatpak-autotools
    
    2 2
     
    
    3 3
     aliases:
    
    4
    -  gnomesdk: https://sdk.gnome.org/
    
    4
    +  flathub: https://dl.flathub.org/
    
    5 5
     
    
    6 6
     element-path: elements
    
    7 7
     
    

  • doc/source/examples/flatpak-autotools.rst
    ... ... @@ -31,7 +31,7 @@ architecture. For this example we only support the ``i386`` and ``x86_64``
    31 31
     architectures.
    
    32 32
     
    
    33 33
     Note that we've added a :ref:`source alias <project_source_aliases>` for
    
    34
    -the ``https://sdk.gnome.org/`` repository to download the SDK from.
    
    34
    +the ``https://dl.flathub.org/`` repository to download the SDK from.
    
    35 35
     
    
    36 36
     
    
    37 37
     ``elements/base/sdk.bst``
    
    ... ... @@ -47,7 +47,7 @@ download the Flatpak since these are hosted in OSTree repositories.
    47 47
     While declaring the :mod:`ostree <sources.ostree>` source, we specify a GPG
    
    48 48
     public key to verify the OSTree download. This configuration is optional
    
    49 49
     but recommended for OSTree repositories. The key is stored in the project directory
    
    50
    -at ``keys/gnome-sdk.gpg``, and can be downloaded from https://sdk.gnome.org/keys/.
    
    50
    +at ``keys/flathub.gpg``, and it's included in the file at https://flathub.org/repo/flathub.flatpakrepo.
    
    51 51
     
    
    52 52
     We also use :ref:`conditional statements <format_directives_conditional>` to decide
    
    53 53
     which branch to download.
    

  • tests/examples/flatpak-autotools.py
    ... ... @@ -45,13 +45,13 @@ def test_autotools_build(cli, tmpdir, datafiles):
    45 45
         result = cli.run(project=project, args=['checkout', 'hello.bst', checkout])
    
    46 46
         assert result.exit_code == 0
    
    47 47
     
    
    48
    -    assert_contains(checkout, ['/usr', '/usr/lib', '/usr/bin',
    
    49
    -                               '/usr/share', '/usr/lib/debug',
    
    50
    -                               '/usr/lib/debug/usr', '/usr/lib/debug/usr/bin',
    
    51
    -                               '/usr/lib/debug/usr/bin/hello',
    
    52
    -                               '/usr/bin/hello', '/usr/share/doc',
    
    53
    -                               '/usr/share/doc/amhello',
    
    54
    -                               '/usr/share/doc/amhello/README'])
    
    48
    +    assert_contains(checkout, ['/app', '/app/lib', '/app/bin',
    
    49
    +                               '/app/share', '/app/lib/debug',
    
    50
    +                               '/app/lib/debug/app', '/app/lib/debug/app/bin',
    
    51
    +                               '/app/lib/debug/app/bin/hello',
    
    52
    +                               '/app/bin/hello', '/app/share/doc',
    
    53
    +                               '/app/share/doc/amhello',
    
    54
    +                               '/app/share/doc/amhello/README'])
    
    55 55
     
    
    56 56
     
    
    57 57
     # Test running an executable built with autotools
    
    ... ... @@ -64,6 +64,6 @@ def test_autotools_run(cli, tmpdir, datafiles):
    64 64
         result = cli.run(project=project, args=['build', 'hello.bst'])
    
    65 65
         assert result.exit_code == 0
    
    66 66
     
    
    67
    -    result = cli.run(project=project, args=['shell', 'hello.bst', '/usr/bin/hello'])
    
    67
    +    result = cli.run(project=project, args=['shell', 'hello.bst', '/app/bin/hello'])
    
    68 68
         assert result.exit_code == 0
    
    69 69
         assert result.output == 'Hello World!\nThis is amhello 1.0.\n'

  • tests/integration/project/keys/gnome-sdk.gpg deleted
    No preview for this file type
  • tests/loader/dependencies.py
    ... ... @@ -110,6 +110,7 @@ def test_circular_dependency(datafiles):
    110 110
             element = loader.load(['elements/circulartarget.bst'])[0]
    
    111 111
     
    
    112 112
         assert (exc.value.reason == LoadErrorReason.CIRCULAR_DEPENDENCY)
    
    113
    +    assert ("seconddep" in exc.value.args[0])
    
    113 114
     
    
    114 115
     
    
    115 116
     @pytest.mark.datafiles(DATA_DIR)
    



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