Update the patches to work with bazel 0.9.0 (#7013)

Some code got moved around so the patches needed to be updated
This commit is contained in:
Jimmy Tang 2018-03-18 13:53:57 +00:00 committed by Adam J. Stewart
parent e61b239a8a
commit ba1b3fdc9d
3 changed files with 163 additions and 2 deletions

View file

@ -0,0 +1,126 @@
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java.orig b/home/jtang/spack/var/spack/stage/bazel-0.9.0-xcsfcyrpdn3df755cwpk4sxtfwjdv4ub/spack-expanded-archive/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java
index f1a7a1f..32cd181 100755
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java.orig
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java
@@ -154,6 +154,121 @@ public class BazelConfiguration extends Fragment {
if (tmpdir != null) {
builder.put("TMPDIR", tmpdir);
}
+
+ String spack_prefix = System.getenv("SPACK_PREFIX");
+ if (spack_prefix != null) {
+ builder.put("SPACK_PREFIX", spack_prefix);
+ }
+
+ String spack_env_path = System.getenv("SPACK_ENV_PATH");
+ if (spack_env_path != null) {
+ builder.put("SPACK_ENV_PATH", spack_env_path);
+ }
+
+ String spack_debug_log_id = System.getenv("SPACK_DEBUG_LOG_ID");
+ if (spack_debug_log_id != null) {
+ builder.put("SPACK_DEBUG_LOG_ID", spack_debug_log_id);
+ }
+
+ String spack_debug_log_dir = System.getenv("SPACK_DEBUG_LOG_DIR");
+ if (spack_debug_log_dir != null) {
+ builder.put("SPACK_DEBUG_LOG_DIR", spack_debug_log_dir);
+ }
+
+ String spack_compiler_spec = System.getenv("SPACK_COMPILER_SPEC");
+ if (spack_compiler_spec != null) {
+ builder.put("SPACK_COMPILER_SPEC", spack_compiler_spec);
+ }
+
+ String spack_cc_rpath_arg = System.getenv("SPACK_CC_RPATH_ARG");
+ if (spack_cc_rpath_arg != null) {
+ builder.put("SPACK_CC_RPATH_ARG", spack_cc_rpath_arg);
+ }
+
+ String spack_cxx_rpath_arg = System.getenv("SPACK_CXX_RPATH_ARG");
+ if (spack_cxx_rpath_arg != null) {
+ builder.put("SPACK_CXX_RPATH_ARG", spack_cxx_rpath_arg);
+ }
+
+ String spack_f77_rpath_arg = System.getenv("SPACK_F77_RPATH_ARG");
+ if (spack_f77_rpath_arg != null) {
+ builder.put("SPACK_F77_RPATH_ARG", spack_f77_rpath_arg);
+ }
+
+ String spack_fc_rpath_arg = System.getenv("SPACK_FC_RPATH_ARG");
+ if (spack_fc_rpath_arg != null) {
+ builder.put("SPACK_FC_RPATH_ARG", spack_fc_rpath_arg);
+ }
+
+ String spack_short_spec = System.getenv("SPACK_SHORT_SPEC");
+ if (spack_short_spec != null) {
+ builder.put("SPACK_SHORT_SPEC", spack_short_spec);
+ }
+
+ String spack_cc = System.getenv("SPACK_CC");
+ if (spack_cc != null) {
+ builder.put("SPACK_CC", spack_cc);
+ }
+
+ String spack_cxx = System.getenv("SPACK_CXX");
+ if (spack_cxx != null) {
+ builder.put("SPACK_CXX", spack_cxx);
+ }
+
+ String spack_f77 = System.getenv("SPACK_F77");
+ if (spack_f77 != null) {
+ builder.put("SPACK_F77", spack_f77);
+ }
+
+ String spack_fc = System.getenv("SPACK_FC");
+ if (spack_fc != null) {
+ builder.put("SPACK_FC", spack_fc);
+ }
+
+ String spack_cflags = System.getenv("SPACK_CFLAGS");
+ if (spack_cflags != null) {
+ builder.put("SPACK_CFLAGS", spack_cflags);
+ }
+
+ String spack_cxxflags = System.getenv("SPACK_CXXFLAGS");
+ if (spack_cxxflags != null) {
+ builder.put("SPACK_CXXFLAGS", spack_cxxflags);
+ }
+
+ String spack_fcflags = System.getenv("SPACK_FCFLAGS");
+ if (spack_fcflags != null) {
+ builder.put("SPACK_FCFLAGS", spack_fcflags);
+ }
+
+ String spack_fflags = System.getenv("SPACK_FFLAGS");
+ if (spack_fflags != null) {
+ builder.put("SPACK_FFLAGS", spack_fflags);
+ }
+
+ String spack_ldflags = System.getenv("SPACK_LDFLAGS");
+ if (spack_ldflags != null) {
+ builder.put("SPACK_LDFLAGS", spack_ldflags);
+ }
+
+ String spack_ldlibs = System.getenv("SPACK_LDLIBS");
+ if (spack_ldlibs != null) {
+ builder.put("SPACK_LDLIBS", spack_ldlibs);
+ }
+
+ String spack_debug = System.getenv("SPACK_DEBUG");
+ if (spack_debug != null) {
+ builder.put("SPACK_DEBUG", spack_debug);
+ }
+
+ String spack_test_command = System.getenv("SPACK_TEST_COMMAND");
+ if (spack_test_command != null) {
+ builder.put("SPACK_TEST_COMMAND", spack_test_command);
+ }
+
+ String spack_dependencies = System.getenv("SPACK_DEPENDENCIES");
+ if (spack_dependencies != null) {
+ builder.put("SPACK_DEPENDENCIES", spack_dependencies);
+ }
}
}

View file

@ -34,6 +34,7 @@ class Bazel(Package):
homepage = "https://www.bazel.io"
url = "https://github.com/bazelbuild/bazel/releases/download/0.5.0/bazel-0.5.0-dist.zip"
version('0.9.0', '7fda74c163108f7c180bbc513bc8123b')
version('0.4.5', '2b737be42678900470ae9e48c975ac5b2296d9ae23c007bf118350dbe7c0552b')
version('0.4.4', '5e7c52b89071efc41277e2f0057d258f')
version('0.3.1', '5c959467484a7fc7dd2e5e4a1e8e866b')
@ -45,9 +46,11 @@ class Bazel(Package):
depends_on('java@8:')
depends_on('zip')
patch('fix_env_handling.patch')
patch('fix_env_handling.patch', when='@:0.4.5')
patch('fix_env_handling-0.9.0.patch', when='@0.9.0:')
patch('link.patch')
patch('cc_configure.patch')
patch('cc_configure.patch', when='@:0.4.5')
patch('unix_cc_configure.patch', when='@0.9.0:')
def url_for_version(self, version):
if version >= Version('0.4.1'):

View file

@ -0,0 +1,32 @@
diff --git a/spack-expanded-archive/tools/cpp/unix_cc_configure.bzl.orig b/spack-expanded-archive/tools/cpp/unix_cc_configure.bzl
old mode 100644
new mode 100755
index aa46f55..ae3c689
--- spack-expanded-archive/tools/cpp/unix_cc_configure.bzl
+++ spack-expanded-archive/tools/cpp/unix_cc_configure.bzl
@@ -117,9 +117,23 @@ def get_escaped_cxx_inc_directories(repository_ctx, cc):
else:
inc_dirs = result.stderr[index1 + 1:index2].strip()
- return [escape_string(repository_ctx.path(_cxx_inc_convert(p)))
- for p in inc_dirs.split("\n")]
+ default_inc_directories = [
+ escape_string(repository_ctx.path(_cxx_inc_convert(p)))
+ for p in inc_dirs.split("\n")
+ ]
+ env = repository_ctx.os.environ
+ if "SPACK_DEPENDENCIES" in env:
+ for dep in env["SPACK_DEPENDENCIES"].split(":"):
+ path = dep + "/include"
+ # path = repository_ctx.os.path.join(dep, "include")
+ # if not repository_ctx.os.path.exists(path):
+ # continue
+ default_inc_directories.append(
+ repository_ctx.path(_cxx_inc_convert(path))
+ )
+
+ return default_inc_directories
def _add_option_if_supported(repository_ctx, cc, option):
"""Checks that `option` is supported by the C compiler. Doesn't %-escape the option."""