apache / apache/buildstream

Elements with an open workspace cannot be fetched

Open
#846 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
140
Forks
45
Avg merge
1d 3h
Merged PRs (30d)
6

Description

[See original issue on GitLab](https://gitlab.com/BuildStream/buildstream/-/issues/846)
In GitLab by [[Gitlab user @jonathanmaw]](https://gitlab.com/jonathanmaw) on Jan 7, 2019, 16:01

## Summary

It is impossible to fetch a source when its element has its workspace open.

This is a slightly obscure use-case because the normal invocation of `bst workspace open` expects the source to already be fetched, but that is not required if you use `--no-checkout`.

## Steps to reproduce

[//]: # (How one can reproduce the issue - this is very important)
From `doc/examples/autotools`:

1. `bst workspace open --no-checkout --directory hello-workspace hello.bst`
2. `bst source fetch hello.bst`

**NOTE**: If you have already fetched this source, you will need to point buildstream at an empty source cache to see this behaviour.

## What is the current bug behavior?

1. After the workspace is opened, but before `bst source fetch` is called, hello.bst is in state "waiting"
2. In the logs for `bst source fetch`, hello.bst's dependency (base/alpine.bst) is fetched, but not hello.bst.

## What is the expected correct behavior?

* In the logs for `bst source fetch`, hello.bst is fetched as well

## Relevant logs and/or screenshots

```
jonathanmaw[[Gitlab user @fafnir]](https://gitlab.com/fafnir):~/workspace/buildstream/buildstream/doc/examples/autotools$ bst -c buildstream.conf source fetch hello.bst
[--:--:--][][] START Fetch
[--:--:--][][] 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+1163.gc96afb86
Session Start: Monday, 07-01-2019 at 15:45:36
Project: autotools (/home/jonathanmaw/workspace/buildstream/buildstream/doc/examples/autotools)
Targets: hello.bst

User Configuration
Configuration File: /home/jonathanmaw/workspace/buildstream/buildstream/doc/examples/autotools/buildstream.conf
Log Files: /tmp/buildstream/logs
Source Mirrors: /tmp/buildstream/sources
Build Area: /tmp/buildstream/build
Artifact Cache: /tmp/buildstream/artifacts
Strict Build Plan: Yes
Maximum Fetch Tasks: 10
Maximum Build Tasks: 4
Maximum Push Tasks: 4
Maximum Network Retries: 2

Pipeline
fetch needed fc05961cf6dfded6a2818cdbc603ff91e72e18d518a6315a19b106d85f1a42e3 base/alpine.bst
waiting b713a35f5efb5035e0cf7d9968e06aad7cc5b2e1296ed5abd0c776e1d00aa64d base.bst
waiting ???????????????????????????????????????????????????????????????? hello.bst Workspace: /home/jonathanmaw/workspace/buildstream/buildstream/doc/examples/autotools/hello-workspace
===============================================================================
[--:--:--][fc05961c][fetch:base/alpine.bst ] START autotools/base-alpine/fc05961c-fetch.5868.log
[--:--:--][fc05961c][fetch:base/alpine.bst ] START Fetching https://bst-integration-test-images.ams3.cdn.digitaloceanspaces.com/integration-tests-base.v1.x86_64.tar.xz
[00:00:14][fc05961c][fetch:base/alpine.bst ] SUCCESS Fetching https://bst-integration-test-images.ams3.cdn.digitaloceanspaces.com/integration-tests-base.v1.x86_64.tar.xz
[00:00:14][fc05961c][fetch:base/alpine.bst ] SUCCESS autotools/base-alpine/fc05961c-fetch.5868.log
[00:00:15][][] SUCCESS Fetch

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

## Possible fixes

I gather that whether an element's source is fetched depends on whether its state shows up as `fetch needed`. As the element has an open workspace, it is perfectly possible to build without fetching the source.

I can see two possible solutions:
* `bst fetch` will try to fetch even if the state isn't `fetch needed`.
* Elements that do not have a fetched source, but *do* have an open workspace have a new state, and will be fetched by `bst source fetch`, but won't be fetched as part of a normal build.

## Other relevant information

[//]: # (Add the BuildStream version. Substitute below the "x" by "1", "2" or the right version. Add more than one version if necessary)

* BuildStream version affected: /milestone %"BuildStream\_v1.4"

----

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue from doc/examples/autotools with `bst workspace open --no-checkout` followed by `bst source fetch hello.bst`, using an empty source cache. Trace how the open workspace affects the fetch state and queue, then verify that `hello.bst` is fetched while the workspace remains open without changing normal build behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.