From e59b620b392a8ebbcf25879fc3fde52b4dc77535 Mon Sep 17 00:00:00 2001 From: aiuto Date: Wed, 9 Oct 2019 12:43:21 -0400 Subject: [PATCH] Fix execute bit on empty_test.sh (#206) * make the tarball 555 * Split the bins out from the rest of the package and combine the packages. This solution is horrible. The better solution is - We need something like pkgfilegroup in rules_pkg, so we can specify exectuable mode next to the file. - But we do not want rules_pkg to appear in the rules/BUILD file because that would make a runtime dependency. So we need to - rewrite rules/BUILD when going into the package. - or provide magic mapping of files names to mode bits - or something entirely different. --- BUILD | 7 +++++++ distribution/BUILD | 40 +++++++++++++++++++++++++++++----------- rules/BUILD | 12 +++++++++++- 3 files changed, 47 insertions(+), 12 deletions(-) diff --git a/BUILD b/BUILD index 8ae601d..191752b 100644 --- a/BUILD +++ b/BUILD @@ -65,3 +65,10 @@ filegroup( "//toolchains/unittest:distribution", ] + glob(["*.bzl"]), ) + +filegroup( + name = "bins", + srcs = [ + "//rules:bins", + ], +) diff --git a/distribution/BUILD b/distribution/BUILD index f349779..ddebb1c 100644 --- a/distribution/BUILD +++ b/distribution/BUILD @@ -6,26 +6,44 @@ load("@bazel_skylib//:version.bzl", "version") load("@rules_pkg//:pkg.bzl", "pkg_tar") load("@rules_pkg//releasing:defs.bzl", "print_rel_notes") -# Build the artifact to put on the github release page. pkg_tar( - name = "bazel-skylib-%s" % version, - srcs = [ - "//:distribution", - ], - extension = "tar.gz", - # It is all source code, so make it read-only. + name = "srcs", + srcs = ["//:distribution"], mode = "0444", # Make it owned by root so it does not have the uid of the CI robot. owner = "0.0", - package_dir = ".", + package_dir = "", strip_prefix = ".", ) +pkg_tar( + name = "bins", + srcs = ["//:bins"], + mode = "0555", + # Make it owned by root so it does not have the uid of the CI robot. + owner = "0.0", + package_dir = "", + strip_prefix = ".", +) + +# Build the artifact to put on the github release page. +pkg_tar( + name = "bazel-skylib-%s" % version, + extension = "tar.gz", + # Make it owned by root so it does not have the uid of the CI robot. + owner = "0.0", + strip_prefix = ".", + deps = [ + ":bins.tar", + ":srcs.tar", + ], +) + print_rel_notes( name = "relnotes", outs = ["relnotes.txt"], - repo = "bazel-skylib", - version = version, - setup_file = ":workspace.bzl", deps_method = "bazel_skylib_workspace", + repo = "bazel-skylib", + setup_file = ":workspace.bzl", + version = version, ) diff --git a/rules/BUILD b/rules/BUILD index fac17b0..f3cfe6c 100644 --- a/rules/BUILD +++ b/rules/BUILD @@ -60,7 +60,17 @@ filegroup( # The files needed for distribution filegroup( name = "distribution", - srcs = glob(["*"]), + srcs = [ + "BUILD", + ] + glob(["*.bzl"]), + visibility = [ + "//:__pkg__", + ], +) + +filegroup( + name = "bins", + srcs = glob(["*.sh"]), visibility = [ "//:__pkg__", ],