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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

pre-commit hook for updating deleted packages removes items added by the script that it calls #1858

Open
dougthor42 opened this issue Apr 17, 2024 · 0 comments

Comments

@dougthor42
Copy link
Contributor

馃悶 bug report

Affected Rule

N/A. This isn't a rule-related bug, but rather a bug with the pre-commit hook update-deleted-packages.

Is this a regression?

No.

Description

Running pre-commit run update-deleted-packages --all-files actually removes items that were added by the script that it calls (./tools/update_deleted_packages)

馃敩 Minimal Reproduction

See also #1842 (comment).

  1. Add a new example dir: ./examples/foobar with BUILD.bazel, MODULE.bazel, foo.py files.
  2. run ./tools/update_deleted_packages.sh
  3. Note that examples/foobar is now included in .bazelrc's --deleted_packages arg.
  4. Run pre-commit run update-deleted-packages --all-files

Expected Result:

.bazelrc is unchanged, as it was already updated in (3).

Actual Result:

The examples/foobar value is no longer present in --deleted_packages

馃敟 Exception or Error

$ pre-commit run update-deleted-packages --all-files
Update deleted packages..................................................Failed
- hook id: update-deleted-packages
- files were modified by this hook

INFO: Analyzed target @@rules_bazel_integration_test~0.20.0//tools:update_deleted_packages (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target @@rules_bazel_integration_test~0.20.0//tools:update_deleted_packages up-to-date:
  bazel-bin/external/rules_bazel_integration_test~0.20.0/tools/update_deleted_packages
INFO: Elapsed time: 29.376s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/external/rules_bazel_integration_test~0.20.0/tools/update_deleted_packages
dirname: missing operand
Try 'dirname --help' for more information.

馃實 Your Environment

Operating System:

  
$ # Ubuntu 22.04 on WSL(1) on Windows 10.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy
  

Output of bazel version:

  
$ bazel version
Bazelisk version: v1.19.0
Build label: 7.0.0
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Dec 11 16:51:49 2023 (1702313509)
Build timestamp: 1702313509
Build timestamp as int: 1702313509
  

Rules_python version:

Dirty working tree off commit cdc7f2f

Anything else relevant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant