-
Notifications
You must be signed in to change notification settings - Fork 418
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
Fix #7256: Linux sh installer is broken in 9.1.0 #7313
Fix #7256: Linux sh installer is broken in 9.1.0 #7313
Conversation
…ECTORY globally Mac should default to the same as currently harcoded.
@Myoldmopar there might be a good reason I'm not seeing though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General comments right now. Honestly the actual fix for the Linux installer is fine, it's the extra stuff that worries me.
cmake/CPack.STGZ_Header.sh.in
Outdated
|
||
# Reset | ||
Color_Off='\033[0m' # Text Reset | ||
URed='\033[4;31m' # Red |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these valid for non-bash shells? This script's shebang line is attempting to run sh
not bash
. I have been searching for non-bash color output codes and literally everything is focusing on bash terminals. This could be because most people think of bash as the only terminal on Linux, so the answers are confusing online, or it's because the color codes really are specific to bash. Anyway, please verify. If we aren't sure, then I'm inclined to turn the color back off to avoid breaking other shells.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After doing some research, it looks like we are on the up and up. According to Debian policy, any script that includes a shebang line with sh
must simply be POSIX-compliant, and the color codes are POSIX-fine. So that's good. If anything were to change, I'd consider making the red code not underlined because it looks like it is a hyperlink. I'd go with bold red (1;31m).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, replaced with
BRed='\033[1;31m' # Bold Red
Will push after testing on mac.
(FYI I have a handy colors.sh
that you can find on OpenStudio-resources here)
exit 1;; | ||
esac | ||
|
||
default_install_directory="/usr/local/${package_name}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this is the actual fix, OK.
rm -f "${link_directory}/BasementGHT.idd" | ||
rm -f "${link_directory}/convertESOMTR" | ||
rm -f "${link_directory}/EnergyPlus" | ||
rm -f "${link_directory}/energyplus" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
cmake/Install.cmake
Outdated
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") | ||
set(CPACK_IFW_TARGET_DIRECTORY "/Applications/${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}-${CPACK_PACKAGE_VERSION_MINOR}-${CPACK_PACKAGE_VERSION_PATCH}") | ||
# CPACK_IFW_TARGET_DIRECTORY defaults to “@ApplicationsDir@/CPACK_PACKAGE_INSTALL_DIRECTORY” | ||
#set(CPACK_IFW_TARGET_DIRECTORY "/Applications/${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}-${CPACK_PACKAGE_VERSION_MINOR}-${CPACK_PACKAGE_VERSION_PATCH}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Windows is working, and we had to add code in here for IFW to work, I was hoping to see Linux-only changes in this PR. It was really annoying to get IFW working with the CMake logic we have in here. I'm curious what this and the CPACK_PACKAGE_INSTALL_DIRECTORY line above are effectively changing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When doing CPack stuff, there are variables that are defined for all Cpack generators, this being one. I think it makes more sense to use these instead of harcoding generator-specific variables, because it would help with consistency, and be more future proof.
That being said in our case it's actually a change that should have no effect as best as I can tell:
- On mac: The CPACK_IFW_TARGET_DIRECTORY will be set based on this on mac, which will match the current explicit setting. (cf the block on which you commented above)
- On Windows NSIS will override it anyways (https://github.com/jmarrec/EnergyPlus/blob/develop/cmake/CMakeCPackOptions.cmake.in#L6:L9).
- On Linux it will not be used because we use the STGZ header script. It would be used if we used the .deb package (and would be correct...)
If that makes you uneasy I can just revert it, or least harcode the CPACK_IFW_TARGET_DIRECTORY
for mac. Let me know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cf "Variables common to all CPack generators": specifically https://cmake.org/cmake/help/v3.2/module/CPack.html#variable:CPACK_PACKAGE_INSTALL_DIRECTORY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tested building a package on a Mac? If not, I can try from this branch to see what happens. As long as it works, I'm OK with the cleanup, I'm just nervous from trying to get it to work with IFW in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just kicked one on mac a minute ago (after needed to install QtIFW and stuff) to test it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted back to harcoded CPACK_IFW_TARGET_DIRECTORY
because it would default to “@ApplicationsDir@/CPACK_PACKAGE_INSTALL_DIRECTORY”
which ends up being /Users/julien/Applications/EnergyPlus-9-2-0
and not /Applications/EnergyPlus-9-2-0
like I had expected.
…to PR_opened/Fix_7256_Installer
cmake/Install.cmake
Outdated
@@ -241,7 +244,6 @@ endif() | |||
|
|||
if( APPLE ) | |||
set(CPACK_PACKAGE_DEFAULT_LOCATION "/Applications") | |||
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this variable not picked up by anyone else later in the IFW build? It looks to be unused, but I'm still really nervous about touching this since it works perfectly fine right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's already defined on line 10: https://github.com/NREL/EnergyPlus/pull/7313/files/cfbb86e3d7fd51e3c80dcf5102a1ab6937fd8121#diff-41362486261ba172ec8a6127c1785ccfR10
Only difference is that it's defined with the build sha too:
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${CPACK_PACKAGE_VERSION_BUILD}")
I'll revert that too.
cmake/CompilerFlags.cmake
Outdated
# On Mac with Ninja (kitware binary for fortran support) and brew gfortran, I get build errors due to this flag. | ||
if (NOT BUILD_FORTRAN) | ||
AddFlagIfSupported(-fcolor-diagnostics COMPILER_SUPPORTS_fdiagnostics_color) | ||
endif() | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, I've never had any issues. Is there any chance we should protect this more specifically for your corner case so that it still works OK for other builds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've never had any issues with it either until today, and I think I had built fortran on mac with ninja before. I don't think it matters that much if no one bumps into this anyways, but there should be a way here to use add_compile_options
with generator expressions to limit to everything BUT fortran instead of disabling for everyone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah add_compile_options($<$<NOT:$<COMPILE_LANGUAGE:Fortran>>:${flag}>)
works
rm -f "${link_directory}/SlabGHT.idd" | ||
rm -f "${link_directory}/Transition-V8-2-0-to-V8-3-0" | ||
rm -f "${link_directory}/V8-2-0-Energy+.idd" | ||
rm -f "${link_directory}/V8-3-0-Energy+.idd" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah good call.
This reverts commit cff2c95.
Everything looks to be in great shape now. I think that diff should be unrelated to the work here. I'll build an installer and test it out and this will drop in if everything is good. Thanks @jmarrec |
Fetched latest develop just now and merged it in and built an installer. Verified that the latest develop build is wonky and that this new one provides a proper install. We should add an install note that the install path now accepts the full path to the E+ install folder, not the parent folder. I'm building on Mac now and will verify that the install package over there is fine. |
My IFW package build using this branch on Mac seemed to have trouble. I'm verifying my develop build works OK before any further commentary. |
OK, my develop build is funny too. @jmarrec can you confirm your package build is OK on Mac? Like the actual artifact is a full package? If it looks OK to you then I'll probably merge this in and immediately try a CI package build. If CI can also build it OK then I'll just figure out what's up with my personal build sometime later. If CI can't build it either then we'll need to address it right away. |
…d/Fix_7256_Installer * commit '2eb3f96cc3cbfdcd2da70adc3be6f740ae1a297c': (35 commits) Encode degree signs properly as UTF-8 Convert DataStringGlobals.in.cc to UTF-8 Fix check_non_utf8.py script Make E+ fixture use DataStringGlobals::clear_state Add a clear_state function to DataStringGlobals.in.cc Revert "Merge pull request NREL#7317 from NREL/HotFixFiniteDiffTestDisable" Fix IDD unit and validation script Make sure file key is in json output for decent CI Fix licensetext for Python 3 support Fixup change_version script for Python 3 Remove unused 179D script, clean up validate_idd_units and add to custom_check Fix license text python 3 support Fix non-utf8 character check for Python 3, remove unused script Temporarily disable finite diff tests to clean up unit test issue Remove unneeded old python scripts, continuing to test others Minor tidying up in fluid properties code - should be no functional change; Move transition support files to PreProcess subdir and add all recent older versions of support files - fixes NREL#7248 Add protection and clarification for check_pr_labels Change to code and unit test Update to test files. Zone is now fully controlled by single reference point. Remove commented out "using" directive in test ...
@Myoldmopar merged develop in, and rebuilt on mac. Definitely a full package, same exact size (59.7MB) as regular develop, installs just fine. |
Sounds good, thanks @jmarrec. I'll merge this in shortly and trigger a CI package build. |
Pull request overview
Fix #7256: Linux sh installer is broken in 9.1.0
The linux installer was broken in 9.1.0 and until now since the tar.gz (which is also embedded in the .sh script) has one level less, that top level
EnergyPlus-X.Y.Z
one (cf https://github.com/NREL/EnergyPlus/pull/7148/files#diff-41362486261ba172ec8a6127c1785ccf).I modified the
CPack.SGTZ_Header.sh.in
to ask for the full install directory - as opposed to the parent dir and appending EnergyPlus-X.Y.Z - as I think it make a lot more sense anyways. To illustrate:Before:
input_dir
is asked to user, defaults to/usr/local
input_dir/EnergyPlus-X.Y.Z
(because the embedded tar.gz had that extra level)Now:
input_dir
is asked to user, defaults to/usr/local/EnergyPlus-X.Y.Z
input_dir
(because the embedded tar.gz does not have that extra level)I haven't tested mac and Windows but they should be unaffected. I made one extra commit at the end that might need reversing in case it doesn't work (mac is more at risk in that case)
Work Checklist
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
Review Checklist
This will not be exhaustively relevant to every PR.