From a14d7c79c39ff2c2688ece9addf35fe1baa9cc02 Mon Sep 17 00:00:00 2001 From: bennahugo Date: Wed, 31 Jan 2024 14:54:28 +0200 Subject: [PATCH 1/3] Fixes #6 --- LOFAR/CEP/MS/src/CMakeLists.txt | 1 - LOFAR/CMakeLists.txt | 8 ++-- LOFAR/LCS/Common/include/Common/StringUtil.h | 44 ++++++++++---------- LOFAR/LCS/Common/src/StringUtil.cc | 42 +++++++++---------- 4 files changed, 47 insertions(+), 48 deletions(-) diff --git a/LOFAR/CEP/MS/src/CMakeLists.txt b/LOFAR/CEP/MS/src/CMakeLists.txt index 6dbb568..80064b0 100644 --- a/LOFAR/CEP/MS/src/CMakeLists.txt +++ b/LOFAR/CEP/MS/src/CMakeLists.txt @@ -19,7 +19,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(LofarPackageVersion) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w -Wno-deprecated -Wno-write-strings") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -Wno-deprecated -Wno-write-strings") diff --git a/LOFAR/CMakeLists.txt b/LOFAR/CMakeLists.txt index a444381..27695f0 100644 --- a/LOFAR/CMakeLists.txt +++ b/LOFAR/CMakeLists.txt @@ -31,6 +31,9 @@ include(LofarInit) project(LOFAR) include(LofarGeneral) +lofar_find_package(Casacore COMPONENTS casa measures ms tables REQUIRED) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CASACORE_INCLUDE_DIR} -I${CASACORE_INCLUDE_DIR}/../ -w -Wno-deprecated -Wno-write-strings") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CASACORE_INCLUDE_DIR} -I${CASACORE_INCLUDE_DIR}/../ -w -Wno-deprecated -Wno-write-strings") ## --------------------------------------------------------------------------- ## Subdirectories ## --------------------------------------------------------------------------- @@ -59,7 +62,4 @@ if(0) include(AllVariables) all_variables() message(STATUS "^^^^^^^^ Variables ^^^^^^^^") -endif(0) - -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w -Wno-deprecated -Wno-write-strings") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -Wno-deprecated -Wno-write-strings") \ No newline at end of file +endif(0) \ No newline at end of file diff --git a/LOFAR/LCS/Common/include/Common/StringUtil.h b/LOFAR/LCS/Common/include/Common/StringUtil.h index cd55f5e..8a2f7b2 100644 --- a/LOFAR/LCS/Common/include/Common/StringUtil.h +++ b/LOFAR/LCS/Common/include/Common/StringUtil.h @@ -301,17 +301,17 @@ inline std::string toString(long double val, const char* fmt = 0) // \attention These functions will be deprecated in a next release. // @{ -bool StringToBool (const string& aString) throw(Exception); -int16 StringToInt16 (const string& aString,const char* fmt=0) throw(Exception); -uint16 StringToUint16(const string& aString,const char* fmt=0) throw(Exception); -int32 StringToInt32 (const string& aString,const char* fmt=0) throw(Exception); -uint32 StringToUint32(const string& aString,const char* fmt=0) throw(Exception); +bool StringToBool (const string& aString); +int16 StringToInt16 (const string& aString,const char* fmt=0); +uint16 StringToUint16(const string& aString,const char* fmt=0); +int32 StringToInt32 (const string& aString,const char* fmt=0); +uint32 StringToUint32(const string& aString,const char* fmt=0); #if HAVE_LONG_LONG -int64 StringToInt64 (const string& aString,const char* fmt=0) throw(Exception); -uint64 StringToUint64(const string& aString,const char* fmt=0) throw(Exception); +int64 StringToInt64 (const string& aString,const char* fmt=0); +uint64 StringToUint64(const string& aString,const char* fmt=0); #endif -float StringToFloat (const string& aString,const char* fmt=0) throw(Exception); -double StringToDouble(const string& aString,const char* fmt=0) throw(Exception); +float StringToFloat (const string& aString,const char* fmt=0); +double StringToDouble(const string& aString,const char* fmt=0); // @} @@ -322,21 +322,21 @@ double StringToDouble(const string& aString,const char* fmt=0) throw(Exception); // Leading and trailing whitespace is allowed. // It checks if an integer value does not exceed the data type range. // @{ -long strToLong (const string& aString) throw(Exception); -int strToInt (const string& aString) throw(Exception); -int32 strToInt32 (const string& aString) throw(Exception); -int16 strToInt16 (const string& aString) throw(Exception); -unsigned long strToUlong (const string& aString) throw(Exception); -uint strToUint (const string& aString) throw(Exception); -uint32 strToUint32 (const string& aString) throw(Exception); -uint16 strToUint16 (const string& aString) throw(Exception); +long strToLong (const string& aString); +int strToInt (const string& aString); +int32 strToInt32 (const string& aString); +int16 strToInt16 (const string& aString); +unsigned long strToUlong (const string& aString); +uint strToUint (const string& aString); +uint32 strToUint32 (const string& aString); +uint16 strToUint16 (const string& aString); #if HAVE_LONG_LONG -int64 strToInt64 (const string& aString) throw(Exception); -uint64 strToUint64 (const string& aString) throw(Exception); +int64 strToInt64 (const string& aString); +uint64 strToUint64 (const string& aString); #endif -float strToFloat (const string& aString) throw(Exception); -double strToDouble (const string& aString) throw(Exception); -inline bool strToBool (const string& aString) throw(Exception) +float strToFloat (const string& aString); +double strToDouble (const string& aString); +inline bool strToBool (const string& aString) { return StringToBool (aString); } // @} diff --git a/LOFAR/LCS/Common/src/StringUtil.cc b/LOFAR/LCS/Common/src/StringUtil.cc index 81c1995..5a6d709 100644 --- a/LOFAR/LCS/Common/src/StringUtil.cc +++ b/LOFAR/LCS/Common/src/StringUtil.cc @@ -176,7 +176,7 @@ string toLower(string str) return str; } -bool StringToBool(const string& aString) throw(Exception) +bool StringToBool(const string& aString) { char firstChar = aString.c_str()[0]; if ((firstChar == 't') || (firstChar == 'T') || (firstChar == '1') || (firstChar == 'Y') || (firstChar == 'y')) @@ -188,7 +188,7 @@ bool StringToBool(const string& aString) throw(Exception) THROW (Exception, aString + " is not a boolean value"); } -int16 StringToInt16(const string& aString, const char* fmt) throw(Exception) +int16 StringToInt16(const string& aString, const char* fmt) { int16 theShort; if ((fmt ? std::sscanf(aString.c_str(), fmt, &theShort) : @@ -199,7 +199,7 @@ int16 StringToInt16(const string& aString, const char* fmt) throw(Exception) return (theShort); } -uint16 StringToUint16(const string& aString, const char* fmt) throw(Exception) +uint16 StringToUint16(const string& aString, const char* fmt) { uint16 theUshort; if ((fmt ? std::sscanf(aString.c_str(), fmt, &theUshort) : @@ -210,7 +210,7 @@ uint16 StringToUint16(const string& aString, const char* fmt) throw(Exception) return (theUshort); } -int32 StringToInt32(const string& aString, const char* fmt) throw(Exception) +int32 StringToInt32(const string& aString, const char* fmt) { int32 theInt; if ((fmt ? std::sscanf(aString.c_str(), fmt, &theInt) : @@ -220,7 +220,7 @@ int32 StringToInt32(const string& aString, const char* fmt) throw(Exception) return (theInt); } -uint32 StringToUint32(const string& aString, const char* fmt) throw(Exception) +uint32 StringToUint32(const string& aString, const char* fmt) { uint32 theUint; if ((fmt ? std::sscanf(aString.c_str(), fmt, &theUint) : @@ -232,7 +232,7 @@ uint32 StringToUint32(const string& aString, const char* fmt) throw(Exception) } #if HAVE_LONG_LONG -int64 StringToInt64(const string& aString, const char* fmt) throw(Exception) +int64 StringToInt64(const string& aString, const char* fmt) { int64 theLong; if ((fmt ? std::sscanf(aString.c_str(), fmt, &theLong) : @@ -243,7 +243,7 @@ int64 StringToInt64(const string& aString, const char* fmt) throw(Exception) return (theLong); } -uint64 StringToUint64(const string& aString, const char* fmt) throw(Exception) +uint64 StringToUint64(const string& aString, const char* fmt) { uint64 theUlong; if ((fmt ? std::sscanf(aString.c_str(), fmt, &theUlong) : @@ -255,7 +255,7 @@ uint64 StringToUint64(const string& aString, const char* fmt) throw(Exception) } #endif -float StringToFloat(const string& aString, const char* fmt) throw(Exception) +float StringToFloat(const string& aString, const char* fmt) { float theFloat; if ((fmt ? std::sscanf(aString.c_str(), fmt, &theFloat) : @@ -267,7 +267,7 @@ float StringToFloat(const string& aString, const char* fmt) throw(Exception) } -double StringToDouble(const string& aString, const char* fmt) throw(Exception) +double StringToDouble(const string& aString, const char* fmt) { double theDouble; if ((fmt ? std::sscanf(aString.c_str(), fmt, &theDouble) : @@ -279,7 +279,7 @@ double StringToDouble(const string& aString, const char* fmt) throw(Exception) } -long strToLong (const string& aString) throw(Exception) +long strToLong (const string& aString) { const char* str = aString.c_str(); int st = lskipws(aString, 0, aString.size()); @@ -300,7 +300,7 @@ long strToLong (const string& aString) throw(Exception) return val; } -int strToInt (const string& aString) throw(Exception) +int strToInt (const string& aString) { long val = strToLong (aString); if (sizeof(int) != sizeof(long)) { @@ -312,7 +312,7 @@ int strToInt (const string& aString) throw(Exception) return val; } -int32 strToInt32 (const string& aString) throw(Exception) +int32 strToInt32 (const string& aString) { long val = strToLong (aString); if (sizeof(int32) != sizeof(long)) { @@ -322,7 +322,7 @@ int32 strToInt32 (const string& aString) throw(Exception) return val; } -int16 strToInt16 (const string& aString) throw(Exception) +int16 strToInt16 (const string& aString) { long val = strToLong (aString); ASSERTSTR (val >= -32768L && val <= 32767L, @@ -330,7 +330,7 @@ int16 strToInt16 (const string& aString) throw(Exception) return val; } -unsigned long strToUlong (const string& aString) throw(Exception) +unsigned long strToUlong (const string& aString) { const char* str = aString.c_str(); int st = lskipws(aString, 0, aString.size()); @@ -351,7 +351,7 @@ unsigned long strToUlong (const string& aString) throw(Exception) return val; } -uint strToUint (const string& aString) throw(Exception) +uint strToUint (const string& aString) { unsigned long val = strToUlong (aString); if (sizeof(uint) != sizeof(unsigned long)) { @@ -363,7 +363,7 @@ uint strToUint (const string& aString) throw(Exception) return val; } -uint32 strToUint32 (const string& aString) throw(Exception) +uint32 strToUint32 (const string& aString) { unsigned long val = strToUlong (aString); if (sizeof(uint32) != sizeof(unsigned long)) { @@ -373,7 +373,7 @@ uint32 strToUint32 (const string& aString) throw(Exception) return val; } -uint16 strToUint16 (const string& aString) throw(Exception) +uint16 strToUint16 (const string& aString) { unsigned long val = strToUlong (aString); ASSERTSTR (val <= 65535UL, @@ -381,7 +381,7 @@ uint16 strToUint16 (const string& aString) throw(Exception) return val; } -float strToFloat (const string& aString) throw(Exception) +float strToFloat (const string& aString) { const char* str = aString.c_str(); int st = lskipws(aString, 0, aString.size()); @@ -396,7 +396,7 @@ float strToFloat (const string& aString) throw(Exception) return val; } -double strToDouble (const string& aString) throw(Exception) +double strToDouble (const string& aString) { const char* str = aString.c_str(); int st = lskipws(aString, 0, aString.size()); @@ -412,7 +412,7 @@ double strToDouble (const string& aString) throw(Exception) } #if HAVE_LONG_LONG -int64 strToInt64 (const string& aString) throw(Exception) +int64 strToInt64 (const string& aString) { if (sizeof(int64) == sizeof(long)) return strToLong(aString); ASSERTSTR (sizeof(int64)==sizeof(long long), @@ -436,7 +436,7 @@ int64 strToInt64 (const string& aString) throw(Exception) return val; } -uint64 strToUint64 (const string& aString) throw(Exception) +uint64 strToUint64 (const string& aString) { if (sizeof(uint64) == sizeof(unsigned long)) return strToUlong(aString); ASSERTSTR (sizeof(uint64)==sizeof(unsigned long long), From 1aa8fbf1890b51ae66705a4872392c60a449bc25 Mon Sep 17 00:00:00 2001 From: bennahugo Date: Wed, 31 Jan 2024 15:01:59 +0200 Subject: [PATCH 2/3] Move test to 20.04 test --- .github/workflows/docker-image.yml | 4 ++-- Dockerfile => docker.20.04 | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename Dockerfile => docker.20.04 (100%) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 785f6e4..94b9876 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -14,5 +14,5 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag makems:$(date +%s) + - name: Build on Ubuntu 20.04 + run: docker build . --file docker.20.04 --tag makems2004:$(date +%s) diff --git a/Dockerfile b/docker.20.04 similarity index 100% rename from Dockerfile rename to docker.20.04 From 43d176aad0cafe7812cf58561bd97416d3671c24 Mon Sep 17 00:00:00 2001 From: bennahugo Date: Wed, 31 Jan 2024 15:36:32 +0200 Subject: [PATCH 3/3] Add 22.04 test, add dockerignore --- docker.20.04 => .ci/ubuntu.20.04.docker | 0 .ci/ubuntu.22.04.docker | 38 +++++++++++++++++++++++++ .dockerignore | 1 + .github/workflows/docker-image.yml | 4 ++- 4 files changed, 42 insertions(+), 1 deletion(-) rename docker.20.04 => .ci/ubuntu.20.04.docker (100%) create mode 100644 .ci/ubuntu.22.04.docker create mode 100644 .dockerignore diff --git a/docker.20.04 b/.ci/ubuntu.20.04.docker similarity index 100% rename from docker.20.04 rename to .ci/ubuntu.20.04.docker diff --git a/.ci/ubuntu.22.04.docker b/.ci/ubuntu.22.04.docker new file mode 100644 index 0000000..33296e2 --- /dev/null +++ b/.ci/ubuntu.22.04.docker @@ -0,0 +1,38 @@ +FROM ubuntu:22.04 +ENV DEBIAN_FRONTEND noninteractive +ENV DEBIAN_PRIORITY critical +RUN apt update && apt install -y libblitz0-dev python3-dev libblas-dev liblapack-dev libqdbm-dev wcslib-dev \ + libfftw3-dev python3-numpy libcfitsio-dev libboost-all-dev libboost-system-dev cmake g++ wget gfortran \ + libncurses5-dev bison libbison-dev flex libreadline6-dev python3-pip rsync casacore-dev casacore-data + +##################################################################### +## CASArest from source +##################################################################### +# BH: TODO - this should go to KERN once that is ready... +WORKDIR /opt +RUN wget https://github.com/casacore/casarest/archive/v1.8.1.tar.gz && \ + tar xvf v1.8.1.tar.gz && \ + rm v1.8.1.tar.gz && \ + cd /opt/casarest-1.8.1 && \ + mkdir -p build && \ + cd /opt/casarest-1.8.1/build && \ + cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release ../ && \ + make -j 16 && \ + make install && \ + rm -r /opt/casarest-1.8.1 && \ + ldconfig + +RUN mkdir -p /src/ +ENV BUILD /src +ADD . /src/makems +RUN mkdir -p $BUILD/makems/LOFAR/build/gnu_opt +WORKDIR $BUILD/makems/LOFAR/build/gnu_opt +RUN cmake -DCMAKE_MODULE_PATH:PATH=$BUILD/makems/LOFAR/CMake \ +-DUSE_LOG4CPLUS=OFF -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release \ +-DCMAKE_INSTALL_PREFIX=/usr ../.. +RUN make -j 16 +RUN make install + +WORKDIR $BUILD/makems/test +RUN makems WSRT_makems.cfg +ENTRYPOINT makems diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..866ee3d --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +LOFAR/build diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 94b9876..284878d 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -15,4 +15,6 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build on Ubuntu 20.04 - run: docker build . --file docker.20.04 --tag makems2004:$(date +%s) + run: docker build . --file .ci/ubuntu.20.04.docker --tag makems2004:$(date +%s) + - name: Build on Ubuntu 22.04 + run: docker build . --file .ci/ubuntu.22.04.docker --tag makems2204:$(date +%s)