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

Environment variable from default overrides not propagated #435

Open
matthiasrichter opened this issue Mar 29, 2017 · 5 comments
Open

Environment variable from default overrides not propagated #435

matthiasrichter opened this issue Mar 29, 2017 · 5 comments

Comments

@matthiasrichter
Copy link

I'm testing how to set the cmake build type from the defaults file, I want to have RELEASE for all packages but the ones I'm doing development on. Here is what I'm trying in the defaults file:

diff --git a/defaults-o2.sh b/defaults-o2.sh
index 618e1b6..7605cb8 100644
--- a/defaults-o2.sh
+++ b/defaults-o2.sh
@@ -1,9 +1,9 @@
 package: defaults-o2
 version: v1
 env:
-  CXXFLAGS: "-fPIC -g -O2 -std=c++11"
-  CFLAGS: "-fPIC -g -O2"
-  CMAKE_BUILD_TYPE: "RELWITHDEBINFO"
+  CXXFLAGS: "-fPIC -O2 -std=c++11"
+  CFLAGS: "-fPIC -O2"
+  CMAKE_BUILD_TYPE: "RELEASE"
 disable:
   - AliEn-Runtime
   - AliRoot
@@ -27,6 +27,9 @@ overrides:
   libpng:
   Python-modules:
   Python:
+  FairRoot:
+    env:
+      CMAKE_BUILD_TYPE: "RELWITHDEBINFO"
 ---

However, FairRoot build uses the common build type "RELEASE". It looks like the variable I want to set in the FairRoot environment from the overrides section is not propagated.

Using branch IB/v5-08/prod

matthiasrichter added a commit to matthiasrichter/alidist that referenced this issue Apr 12, 2017
Doesn't seem to work out of the box
alisw/alibuild#435
@matthiasrichter
Copy link
Author

Just to be sure, I have tested again with updated master branches of both alibuild and alidist, the variables from the override section doesn't seem to be propagated.

@ktf can you have a quick look whether I'm doing something wrong.

@dberzano
Copy link
Contributor

Hi @matthiasrichter, aliBuild does propagate the environment variable CMAKE_BUILD_TYPE, but then it's up to the recipes to pick it up correctly.

For instance, in AliRoot we have:

cmake ... ${CMAKE_BUILD_TYPE:+-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE"}

whereas in FairRoot we hardcoded:

-DCMAKE_BUILD_TYPE=RelWithDebInfo

I have tested the variables propagation and aliBuild works correctly, I would say this is an alidist problem of the fairroot.sh recipe instead. Do you mind opening a PR if you still have the problem, and closing this one? Thanks!

@matthiasrichter
Copy link
Author

Hi @dberzano let me check again. I had updated the FairRoot recipe in exactly the way you mention and it did not work
matthiasrichter/alidist@ed0a8da

@matthiasrichter
Copy link
Author

I have checked the case, it's still valid.

My user story: As a developer I want to build all packages with build type RELEASE, except some packages I'm working on. For those I want to write a custom build type in the defaults file, like e.g.

diff --git a/defaults-o2.sh b/defaults-o2.sh
index 2027e5e..1cf9042 100644
--- a/defaults-o2.sh
+++ b/defaults-o2.sh
@@ -43,6 +43,9 @@ overrides:
       - GEANT4_VMC
       - Vc
       - ZeroMQ
+  FairRoot:
+    env:
+      CMAKE_BUILD_TYPE: "RELWITHDEBINFO"
   GSL:

expecting now that the environment from the overrides section is propagated to the build of my package. This does not happen.

Note: For the recipes I'm using a patch which replace the hardcoded build type in the recipe
matthiasrichter/alidist@ed0a8da

@dberzano
Copy link
Contributor

I can reproduce it with a simple "reproducer".

testme.sh package:

package: TestMe
version: v1
---
#!/bin/sh
echo $CMAKE_BUILD_TYPE
false

defaults-o2.sh:

package: defaults-o2
version: v1
env:
  CMAKE_BUILD_TYPE: "global"
overrides:
  TestMe:
    env:
      CMAKE_BUILD_TYPE: "overridden"

Expected result is overridden but I get global, meaning that the global defaults environment has precedence over the package override, which is - indeed - wrong. I am looking into it.

Thanks for spotting!

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

2 participants