Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--workspace_status_command doesn't have default as claimed in commit message #964

Closed
guoshimin opened this issue Feb 23, 2016 · 6 comments
Closed
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug untriaged

Comments

@guoshimin
Copy link

In 1314570 it is claimed that --workspace_status_command defaults to tools/buildstamp/get_workspace_status. However, it doesn't look like there's a default set.

To reproduce, create a target:

genrule(
  name = "test",
  outs = ["foo"],
  cmd = """touch $@; for file in bazel-out/*-status.txt; do echo "$$file: "; cat $$file; echo; done""",
  stamp = 1,
)

Basically it prints the content of bazel-out/*-status.txt during the build.

When I don't specify --workspace_status_command, I get

$ bazel clean && bazel build -s :test
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
INFO: Found 1 target...
>>>>> # //tools:test [action 'Executing genrule //tools:test']
(cd /private/var/tmp/_bazel_shimin/3a4c5c5e79ba6f8a3fd88b3eacc43127/universe2 && \
  exec env - \
    PATH=/usr/local/opt/openssl/bin:/opt/local/bin:/opt/local/sbin:/Users/shimin/local/bin:/Users/shimin/Library/Haskell/bin:/Users/shimin/bin:/usr/local/aws/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/go/bin:/usr/local/opt/openssl/bin:/opt/local/bin:/opt/local/sbin:/Users/shimin/local/bin:/Users/shimin/Library/Haskell/bin:/Users/shimin/bin:/usr/local/aws/bin:/Users/shimin/gopath/bin:/Users/shimin/gopath/bin \
    TMPDIR=/var/folders/gz/71h5bskj4x94m63ddqbc3jpw0000gq/T/ \
  /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; touch bazel-out/local_darwin-fastbuild/genfiles/tools/foo; for file in bazel-out/*-status.txt; do echo "$file: "; cat $file; echo; done')
INFO: From Executing genrule //tools:test:
bazel-out/stable-status.txt:
BUILD_EMBED_LABEL
BUILD_HOST canard.local
BUILD_USER shimin
bazel-out/volatile-status.txt:
BUILD_TIMESTAMP 1456166941841

Target //tools:test up-to-date:
  bazel-genfiles/tools/foo
INFO: Elapsed time: 1.815s, Critical Path: 0.02s

No git version info is printed.

When I specify --workspace_status_command manually, it works as expected:

$ bazel clean && bazel build -s :test --workspace_status_command tools/buildstamp/get_workspace_status
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
INFO: Found 1 target...
>>>>> # //tools:test [action 'Executing genrule //tools:test']
(cd /private/var/tmp/_bazel_shimin/3a4c5c5e79ba6f8a3fd88b3eacc43127/universe2 && \
  exec env - \
    PATH=/usr/local/opt/openssl/bin:/opt/local/bin:/opt/local/sbin:/Users/shimin/local/bin:/Users/shimin/Library/Haskell/bin:/Users/shimin/bin:/usr/local/aws/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/go/bin:/usr/local/opt/openssl/bin:/opt/local/bin:/opt/local/sbin:/Users/shimin/local/bin:/Users/shimin/Library/Haskell/bin:/Users/shimin/bin:/usr/local/aws/bin:/Users/shimin/gopath/bin:/Users/shimin/gopath/bin \
    TMPDIR=/var/folders/gz/71h5bskj4x94m63ddqbc3jpw0000gq/T/ \
  /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; touch bazel-out/local_darwin-fastbuild/genfiles/tools/foo; for file in bazel-out/*-status.txt; do echo "$file: "; cat $file; echo; done')
INFO: From Executing genrule //tools:test:
bazel-out/stable-status.txt:
BUILD_EMBED_LABEL
BUILD_HOST canard.local
BUILD_USER shimin
bazel-out/volatile-status.txt:
BUILD_TIMESTAMP 1456167095265
BUILD_SCM_REVISION 74bbe13197c18d8defb74885bf3d6ec3e71ae8c1
BUILD_SCM_STATUS Modified

Target //tools:test up-to-date:
  bazel-genfiles/tools/foo
INFO: Elapsed time: 1.750s, Critical Path: 0.06s

This is my bazel version:

Build label: 0.1.5
Build target: bazel-out/local_darwin-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Feb 9 19:11:16 2016 (1455045076)
Build timestamp: 1455045076
Build timestamp as int: 1455045076
@philwo philwo added type: bug P2 We'll consider working on this in future. (Assignee optional) labels Feb 26, 2016
@philwo
Copy link
Member

philwo commented Feb 26, 2016

@ulfjack Can we safely change the default of workspace_status_command to tools/buildstamp/get_workspace_status? Or should we document instead that people who would like this feature set it manually in their bazelrc?

@ulfjack
Copy link
Contributor

ulfjack commented Feb 26, 2016

Sorta, maybe. Check with Luis on how to do that.

@kchodorow kchodorow assigned lfpino and unassigned ulfjack Mar 1, 2016
@lfpino
Copy link
Contributor

lfpino commented Mar 2, 2016

We could probably set the default value as tools/buildstamp/get_workspace_status in the options in WorkspaceStatusAction.java but I need to do some testing before we can go forward with this. I'll work on it and get back to you with the results

@guoshimin
Copy link
Author

This will only work if the user actually has
tools/buildstamp/get_workspace_status
in her workspace, right?

On Wed, Mar 2, 2016 at 2:01 PM, Luis Pino notifications@github.com wrote:

We could probably set the default value as
tools/buildstamp/get_workspace_status in the options in
WorkspaceStatusAction.java
https://github.com/bazelbuild/bazel/blob/15e9a506118b4067655e5e7f72ff852be5b797ca/src/main/java/com/google/devtools/build/lib/analysis/WorkspaceStatusAction.java
but I need to do some testing before we can go forward with this. I'll work
on it and get back to you with the results


Reply to this email directly or view it on GitHub
#964 (comment).

@damienmg damienmg modified the milestone: 0.7 Jun 14, 2016
@novabyte
Copy link

novabyte commented Jan 3, 2018

@damienmg Any plans to see the default --workspace_status_command to be tools/buildstamp/get_workspace_status and bundle that script with Bazel?

@damienmg
Copy link
Contributor

damienmg commented Jan 3, 2018

@novabyte: I am no longer working on Bazel so I cannot answer your question.

@lfpino lfpino added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed P2 We'll consider working on this in future. (Assignee optional) labels Jan 16, 2019
@lfpino lfpino removed their assignment Feb 7, 2019
@jin jin added team-Front-End untriaged and removed P3 We're not considering working on this, but happy to review a PR. (No assignee) labels Apr 15, 2020
@meisterT meisterT removed this from the 0.7 milestone May 12, 2020
@laurentlb laurentlb added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. and removed team-Front-End labels May 19, 2020
@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
@philwo philwo closed this as completed Feb 8, 2021
@philwo philwo removed the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug untriaged
Projects
None yet
Development

No branches or pull requests

9 participants