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

Copy the executable bit #161

Merged
merged 4 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
queue_rules:
- name: default
conditions:
- check-success=Build & Test - Nixpkgs (*)
- check-success=Build & Test - Examples (*)
- check-success~=Build & Test - Nixpkgs \(.*\)
- check-success~=Build & Test - Examples \(.*\)

pull_request_rules:
- name: merge using the merge queue
conditions:
- base=master
- check-success=Build & Test - Nixpkgs (*)
- check-success=Build & Test - Examples (*)
- check-success~=Build & Test - Nixpkgs \(.*\)
- check-success~=Build & Test - Examples \(.*\)
- "#approved-reviews-by>=1"
actions:
queue:
Expand Down
19 changes: 11 additions & 8 deletions nixpkgs/nixpkgs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1388,21 +1388,24 @@ def _cp(repository_ctx, src, dest = None):
])

# Copy the file
# TODO: auto detect the executable bit of the source file
# It is set to False (i.e. not executable) which was the previous behavior.
# It means that executable files will miss the bit and won't be executable.
# Forcing it to True will fix this behavior, but will impact a lot of file
# (most of the time, files do not have the executable bit) and this may
# lead to other errors if the next process is checking the executable bit.
# One other side effect of this change is that you will have a difference
# in the nix hash computed when nix is run by rules_nixpkgs or directly.
repository_ctx.file(
repository_ctx.path(dest),
repository_ctx.read(repository_ctx.path(src)),
executable = False,
legacy_utf8 = False,
)

# Copy the executable bit of the source
# This is important to ensure that copied binaries are executable.
# Windows may not have chmod in path and doesn't have executable bits anyway.
if get_cpu_value(repository_ctx) != "x64_windows":
repository_ctx.execute([
repository_ctx.which("chmod"),
"--reference",
repository_ctx.path(src),
repository_ctx.path(dest),
])

return dest

def _label_string(label):
Expand Down