bug in build after failed build with workspace's

Summary

bug in build after failed build with workspace's

Steps to reproduce

As follows:

  • set up a workspace for a element
  • build element
  • (element fails at configure stage)
  • try to build element again
  • bst craches with a missing artifact bug report

What is the current bug behavior?

Bst thinks there should be a cached artifact even though the last build failed But only for workspaces.

What is the expected correct behavior?

bst should try to rebuild

Relevant logs and/or screenshots

 will  CT-will-S-Deb  ~  projects  …  doc  examples  out-of-source-builds3  willsalmon/outOfSourecBuild  ✎  3?  $  bst workspace reset hello.bst
This will remove all your changes, are you sure? [y/N]: y
[--:--:--][][] START   Loading elements
[00:00:00][][] SUCCESS Loading elements
[--:--:--][][] START   Resolving elements
[00:00:00][][] SUCCESS Resolving elements
[--:--:--][][] START   Resolving cached state
[00:00:00][][] SUCCESS Resolving cached state
[--:--:--][????????][ main:hello.bst                     ] START   Removing workspace directory /home/will/projects/buildstream/buildstream/doc/examples/out-of-source-builds3/hlws
[00:00:00][????????][ main:hello.bst                     ] SUCCESS Removing workspace directory /home/will/projects/buildstream/buildstream/doc/examples/out-of-source-builds3/hlws
[--:--:--][????????][ main:hello.bst                     ] START   Staging sources to /home/will/projects/buildstream/buildstream/doc/examples/out-of-source-builds3/hlws
[--:--:--][        ][ main:hello.bst-0                   ] START   Staging local files at files/hello
[00:00:00][        ][ main:hello.bst-0                   ] SUCCESS Staging local files at files/hello
[00:00:00][????????][ main:hello.bst                     ] SUCCESS Staging sources to /home/will/projects/buildstream/buildstream/doc/examples/out-of-source-builds3/hlws
[--:--:--][][] INFO    Reset workspace for hello.bst at: /home/will/projects/buildstream/buildstream/doc/examples/out-of-source-builds3/hlws
 will  CT-will-S-Deb  ~  projects  …  doc  examples  out-of-source-builds3  willsalmon/outOfSourecBuild  ✎  3?  $  bst build hello.bst
[--:--:--][][] START   Build
[--:--:--][][] START   Loading elements
[00:00:00][][] SUCCESS Loading elements
[--:--:--][][] START   Resolving elements
[00:00:00][][] SUCCESS Resolving elements
[--:--:--][][] START   Resolving cached state
[00:00:00][][] SUCCESS Resolving cached state
[--:--:--][][] START   Checking sources
[00:00:00][][] SUCCESS Checking sources

BuildStream Version 1.3.0+428.gc878ebe9.dirty
  Session Start: Friday, 07-09-2018 at 14:23:14
  Project:       outOfSourceBuilds2 (/home/will/projects/buildstream/buildstream/doc/examples/out-of-source-builds3)
  Targets:       hello.bst

User Configuration
  Configuration File:      Default Configuration
  Log Files:               /home/will/.cache/buildstream/logs
  Source Mirrors:          /home/will/.cache/buildstream/sources
  Build Area:              /home/will/.cache/buildstream/build
  Artifact Cache:          /home/will/.cache/buildstream/artifacts
  Strict Build Plan:       Yes
  Maximum Fetch Tasks:     10
  Maximum Build Tasks:     4
  Maximum Push Tasks:      4
  Maximum Network Retries: 2

Pipeline
      cached 7279b9cc8a468bcc07336479b67b02b8c142b1cfd34d8922c05ff9917942eafc base/alpine.bst 
      cached 3f746703110816af8c43534f3e76dbe61dd5661a9bef0cb1960bff4f53881186 base.bst 
   buildable ???????????????????????????????????????????????????????????????? hello.bst Workspace: /home/will/projects/buildstream/buildstream/doc/examples/out-of-source-builds3/hlws
===============================================================================
[--:--:--][????????][build:hello.bst                     ] START   outOfSourceBuilds2/hello/????????-build.7750.log
[--:--:--][????????][build:hello.bst                     ] START   Staging dependencies
[00:00:01][????????][build:hello.bst                     ] SUCCESS Staging dependencies
[--:--:--][????????][build:hello.bst                     ] START   Integrating sandbox
[00:00:00][????????][build:hello.bst                     ] SUCCESS Integrating sandbox
============================================================================= 00:00:01 outOfSourceBuilds2 (1/3) =============================================================================
                                                                                (Fetched:0 1 0)→ (Built:0 0 0)                                                                                
                                                                                   ~~~~~ Active Tasks ~~~~~                                                                                   
[00:00:01][Build:hello.bst]
[--:--:--][????????][build:hello.bst                     ] START   Staging sources
[00:00:00][????????][build:hello.bst                     ] SUCCESS Staging sources
[--:--:--][????????][build:hello.bst                     ] START   Running configure-commands
[--:--:--][????????][build:hello.bst                     ] STATUS  Running configure-commands

    cmake -B_builddir -H"/buildstream/outOfSourceBuilds2/hello.bst/././" -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH="/usr" \
    -DCMAKE_INSTALL_LIBDIR=lib

============================================================================= 00:00:01 outOfSourceBuilds2 (1/3) =============================================================================
[00:00:00][????????][build:hello.bst                     ] FAILURE Running configure-commands
============================================================================= 00:00:02 outOfSourceBuilds2 (1/3) =============================================================================
                                                                                (Fetched:0 1 0)→ (Built:0 0 0)                                                                                
                                                                                   ~~~~~ Active Tasks ~~~~~                                                                                   
[00:00:01][Build:hello.bst]
subdirectory_spec ['outOfSourceBuilds2', 'hello.bst']
subdirectory_spec ['hello.bst']
subdirectory_spec []
subdirectory_spec ['buildstream-install']
subdirectory_spec []
[--:--:--][????????][build:hello.bst                     ] START   Caching artifact
[00:00:00][????????][build:hello.bst                     ] SUCCESS Caching artifact
[00:00:01][????????][build:hello.bst                     ] FAILURE Command 'cmake -B_builddir -H"/buildstream/outOfSourceBuilds2/hello.bst/././" -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH="/usr" \
-DCMAKE_INSTALL_LIBDIR=lib' failed with exitcode 1

    Sandbox directory: /home/will/.cache/buildstream/build/hello-csohbp7s

    Printing the last 20 lines from log file:
    /home/will/.cache/buildstream/logs/outOfSourceBuilds2/hello/????????-build.7750.log
    ======================================================================
    [00:00:01] SUCCESS base/alpine.bst: Staging base/alpine.bst/7279b9cc
    [--:--:--] START   base.bst: Staging base.bst/3f746703
    [00:00:00] SUCCESS base.bst: Staging base.bst/3f746703
    [00:00:01] SUCCESS hello.bst: Staging dependencies
    [--:--:--] START   hello.bst: Integrating sandbox
    [00:00:00] SUCCESS hello.bst: Integrating sandbox
    [--:--:--] START   hello.bst: Staging sources
    [00:00:00] SUCCESS hello.bst: Staging sources
    [--:--:--] START   hello.bst: Running configure-commands
    [--:--:--] STATUS  hello.bst: Running configure-commands

        cmake -B_builddir -H"/buildstream/outOfSourceBuilds2/hello.bst/././" -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH="/usr" \
        -DCMAKE_INSTALL_LIBDIR=lib
    CMake Error: The source directory "/buildstream/outOfSourceBuilds2/hello.bst" does not appear to contain CMakeLists.txt.
    Specify --help for usage, or press the help button on the CMake GUI.
    [00:00:00] FAILURE hello.bst: Running configure-commands
    [--:--:--] START   hello.bst: Caching artifact
    [00:00:00] SUCCESS hello.bst: Caching artifact
    [00:00:01] FAILURE hello.bst: Command 'cmake -B_builddir -H"/buildstream/outOfSourceBuilds2/hello.bst/././" -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH="/usr" \
    -DCMAKE_INSTALL_LIBDIR=lib' failed with exitcode 1
    ======================================================================


Build failure on element: hello.bst

Choose one of the following options:
  (c)ontinue  - Continue queueing jobs as much as possible
  (q)uit      - Exit after all ongoing jobs complete
  (t)erminate - Terminate any ongoing jobs and exit
  (r)etry     - Retry this job
  (l)og       - View the full log file
  (s)hell     - Drop into a shell in the failed build sandbox

Pressing ^C will terminate jobs and exit


Choice: [continue]: t

Terminating all jobs

[00:00:14][][] FAILURE Build


Failure Summary
  hello.bst:
    [00:00:00][????????][build:hello.bst                     ] FAILURE Running configure-commands
    [00:00:01][????????][build:hello.bst                     ] FAILURE Command 'cmake -B_builddir -H"/buildstream/outOfSourceBuilds2/hello.bst/././" -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH="/usr" \
    -DCMAKE_INSTALL_LIBDIR=lib' failed with exitcode 1

        Sandbox directory: /home/will/.cache/buildstream/build/hello-csohbp7s

        Printing the last 20 lines from log file:
        /home/will/.cache/buildstream/logs/outOfSourceBuilds2/hello/????????-build.7750.log
        ======================================================================
        [00:00:01] SUCCESS base/alpine.bst: Staging base/alpine.bst/7279b9cc
        [--:--:--] START   base.bst: Staging base.bst/3f746703
        [00:00:00] SUCCESS base.bst: Staging base.bst/3f746703
        [00:00:01] SUCCESS hello.bst: Staging dependencies
        [--:--:--] START   hello.bst: Integrating sandbox
        [00:00:00] SUCCESS hello.bst: Integrating sandbox
        [--:--:--] START   hello.bst: Staging sources
        [00:00:00] SUCCESS hello.bst: Staging sources
        [--:--:--] START   hello.bst: Running configure-commands
        [--:--:--] STATUS  hello.bst: Running configure-commands

            cmake -B_builddir -H"/buildstream/outOfSourceBuilds2/hello.bst/././" -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH="/usr" \
            -DCMAKE_INSTALL_LIBDIR=lib
        CMake Error: The source directory "/buildstream/outOfSourceBuilds2/hello.bst" does not appear to contain CMakeLists.txt.
        Specify --help for usage, or press the help button on the CMake GUI.
        [00:00:00] FAILURE hello.bst: Running configure-commands
        [--:--:--] START   hello.bst: Caching artifact
        [00:00:00] SUCCESS hello.bst: Caching artifact
        [00:00:01] FAILURE hello.bst: Command 'cmake -B_builddir -H"/buildstream/outOfSourceBuilds2/hello.bst/././" -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH="/usr" \
        -DCMAKE_INSTALL_LIBDIR=lib' failed with exitcode 1
        ======================================================================

Pipeline Summary
  Total:       3
  Session:     1
  Fetch Queue: processed 0, skipped 1, failed 0 
  Build Queue: processed 0, skipped 0, failed 1 


 will  CT-will-S-Deb  ~  projects  …  doc  examples  out-of-source-builds3  willsalmon/outOfSourecBuild  ✎  3?  $  ls
elements  files  hlws  project.conf
 will  CT-will-S-Deb  ~  projects  …  doc  examples  out-of-source-builds3  willsalmon/outOfSourecBuild  ✎  3?  $  ls hlws/
build  Source
 will  CT-will-S-Deb  ~  projects  …  doc  examples  out-of-source-builds3  willsalmon/outOfSourecBuild  ✎  3?  $  ls hlws/Source/
CMakeLists.txt  main.c
 will  CT-will-S-Deb  ~  projects  …  doc  examples  out-of-source-builds3  willsalmon/outOfSourecBuild  ✎  3?  $  ls hlws/build/
 will  CT-will-S-Deb  ~  projects  …  doc  examples  out-of-source-builds3  willsalmon/outOfSourecBuild  ✎  3?  $  bst build hello.bst
[--:--:--][][] START   Build
[--:--:--][][] START   Loading elements
[00:00:00][][] SUCCESS Loading elements
[--:--:--][][] START   Resolving elements
[00:00:00][][] SUCCESS Resolving elements
[--:--:--][][] START   Resolving cached state
[00:00:00][][] SUCCESS Resolving cached state
[--:--:--][][] BUG     cmake element at hello.bst [line 1 column 0]: Missing artifact ????????

    Traceback (most recent call last):
      File "/home/will/.local/bin/bst", line 8, in <module>
        sys.exit(cli())
      File "/home/will/.local/lib/python3.5/site-packages/click/core.py", line 722, in __call__
        return self.main(*args, **kwargs)
      File "/home/will/projects/buildstream/buildstream/buildstream/_frontend/cli.py", line 162, in override_main
        standalone_mode=standalone_mode, **extra)
      File "/home/will/.local/lib/python3.5/site-packages/click/core.py", line 697, in main
        rv = self.invoke(ctx)
      File "/home/will/.local/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/will/.local/lib/python3.5/site-packages/click/core.py", line 895, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/home/will/.local/lib/python3.5/site-packages/click/core.py", line 535, in invoke
        return callback(*args, **kwargs)
      File "/home/will/.local/lib/python3.5/site-packages/click/decorators.py", line 27, in new_func
        return f(get_current_context().obj, *args, **kwargs)
      File "/home/will/projects/buildstream/buildstream/buildstream/_frontend/cli.py", line 330, in build
        build_all=all_)
      File "/home/will/projects/buildstream/buildstream/buildstream/_stream.py", line 184, in build
        dynamic_plan=True)
      File "/home/will/projects/buildstream/buildstream/buildstream/_stream.py", line 933, in _load
        selected = self._pipeline.get_selection(elements, selection, silent=False)
      File "/home/will/projects/buildstream/buildstream/buildstream/_pipeline.py", line 209, in get_selection
        elements = self.plan(targets)
      File "/home/will/projects/buildstream/buildstream/buildstream/_pipeline.py", line 178, in plan
        return _Planner().plan(elements, plan_cached)
      File "/home/will/projects/buildstream/buildstream/buildstream/_pipeline.py", line 485, in plan
        self.plan_element(root, 0)
      File "/home/will/projects/buildstream/buildstream/buildstream/_pipeline.py", line 476, in plan_element
        if not element._cached_success():
      File "/home/will/projects/buildstream/buildstream/buildstream/element.py", line 967, in _cached_success
        return self.__cached_success(keystrength=None)
      File "/home/will/projects/buildstream/buildstream/buildstream/element.py", line 2626, in __cached_success
        success, _, _ = self.__get_build_result(keystrength=keystrength)
      File "/home/will/projects/buildstream/buildstream/buildstream/element.py", line 2618, in __get_build_result
        self.__load_build_result(keystrength)
      File "/home/will/projects/buildstream/buildstream/buildstream/element.py", line 2598, in __load_build_result
        self.__assert_cached(keystrength=keystrength)
      File "/home/will/projects/buildstream/buildstream/buildstream/element.py", line 2108, in __assert_cached
        self, self._get_brief_display_key())
    AssertionError: cmake element at hello.bst [line 1 column 0]: Missing artifact ????????

 will  CT-will-S-Deb  ~  projects  …  doc  examples  out-of-source-builds3  willsalmon/outOfSourecBuild  ✎  3?  $  

Possible fixes

It only happens when there is a workspace so the fix is probs already in the non workspace code.

Other relevant information

Normally this would not happen becasue you would change something between trying to build but if you are hacking on bst then this is a use case, ehter way it should not crash like this

Current master: 7b32e1ec

I am actually in a branch but i think i have seen this before but not under stood.

  • BuildStream version affected: /milestone %BuildStream_v1.x

Edited by William Salmon
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information