Loading docker/ci/alpine/code-server-dev/Dockerfile 0 → 100644 +53 −0 Original line number Diff line number Diff line FROM qcor/llvm-alpine as llvm_install FROM xacc/alpine COPY --from=llvm_install /usr/local/aideqc/llvm /usr/local/aideqc/llvm ENV VERSION=3.11.0 RUN apk add nodejs openssh-client gnupg bash sudo curl && \ wget https://github.com/cdr/code-server/releases/download/v$VERSION/code-server-$VERSION-linux-amd64.tar.gz && \ tar x -zf code-server-$VERSION-linux-amd64.tar.gz && \ rm code-server-$VERSION-linux-amd64.tar.gz && \ rm code-server-$VERSION-linux-amd64/node && \ rm code-server-$VERSION-linux-amd64/code-server && \ rm code-server-$VERSION-linux-amd64/lib/node && \ mv code-server-$VERSION-linux-amd64 /usr/lib/code-server && \ sed -i 's/"$ROOT\/lib\/node"/node/g' /usr/lib/code-server/bin/code-server \ && apk add libc6-compat ninja bash sudo curl \ && adduser --gecos '' --disabled-password coder \ && echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd \ && curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.5.1/fixuid-0.5.1-linux-amd64.tar.gz" | tar -C /usr/local/bin -xzf - \ && chown root:root /usr/local/bin/fixuid \ && chmod 4755 /usr/local/bin/fixuid \ && mkdir -p /etc/fixuid \ && printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml \ && rm -rf fixuid-0.5-linux* \ && ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2 USER 1000 ENV USER=coder WORKDIR /home/coder COPY patch_Error.cpp /home/coder/ COPY patch_glucose.hpp /home/coder/ RUN git clone --recursive https://github.com/eclipse/xacc && sudo chown -R coder /usr/local/aideqc && sudo chgrp -R coder /usr/local/aideqc \ && mv /home/coder/patch_Error.cpp xacc/tpls/cppmicroservices/util/src/Error.cpp \ && mv /home/coder/patch_glucose.hpp xacc/tpls/staq/libs/glucose/glucose.hpp \ && cd xacc && mkdir build && cd build/ \ && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/aideqc/qcor && make -j8 install && cd ../.. \ && git clone https://github.com/ornl-qci/qcor && cd qcor && mkdir build && cd build \ && cmake .. -G Ninja -DXACC_DIR=/usr/local/aideqc/qcor -DCMAKE_INSTALL_PREFIX=/usr/local/aideqc/qcor \ -DLLVM_ROOT=/usr/local/aideqc/llvm -DQCOR_EXTRA_COMPILER_FLAGS="-B /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1 -L /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1" \ -DQCOR_EXTRA_HEADERS="/usr/include/c++/10.3.1;/usr/include/c++/10.3.1/x86_64-alpine-linux-musl" \ && cmake --build . --target install && cd ../../ \ && mkdir -p /home/coder/.local/share/code-server/User \ && printf "{\"workbench.startupEditor\": \"readme\", \"workbench.colorTheme\": \"Monokai Dimmed\", \"workbench.panel.defaultLocation\": \"right\", \"terminal.integrated.shell.linux\": \"bash\", \"files.associations\": {\"*.qasm\": \"cpp\"}}" | tee /home/coder/.local/share/code-server/User/settings.json \ && wget https://github.com/microsoft/vscode-cpptools/releases/download/1.5.1/cpptools-linux.vsix \ && wget https://github.com/microsoft/vscode-python/releases/download/2020.10.332292344/ms-python-release.vsix \ && /usr/lib/code-server/bin/code-server --install-extension cpptools-linux.vsix \ && /usr/lib/code-server/bin/code-server --install-extension ms-python-release.vsix \ && rm -rf cpptools-linux.vsix ms-python-release.vsix ENV PYTHONPATH "${PYTHONPATH}:/usr/local/aideqc/qcor" ENV PATH "${PATH}:/usr/local/aideqc/qcor/bin:/usr/lib/code-server/bin" ENTRYPOINT ["/usr/lib/code-server/bin/code-server", "--bind-addr", "0.0.0.0:8080", "--auth", "none", "."] docker/ci/alpine/code-server-dev/patch_Error.cpp 0 → 100644 +137 −0 Original line number Diff line number Diff line /*============================================================================= Library: CppMicroServices Copyright (c) The CppMicroServices developers. See the COPYRIGHT file at the top-level directory of this distribution and at https://github.com/CppMicroServices/CppMicroServices/COPYRIGHT . Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =============================================================================*/ #include "cppmicroservices/util/Error.h" #include "cppmicroservices/util/String.h" #ifdef US_PLATFORM_POSIX #include <errno.h> #include <string.h> #else #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include <windows.h> #include <crtdbg.h> #endif namespace cppmicroservices { namespace util { #ifdef US_PLATFORM_WINDOWS std::string GetLastWin32ErrorStr() { // Retrieve the system error message for the last-error code LPVOID lpMsgBuf; DWORD dw = GetLastError(); DWORD rc = FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast<LPWSTR>(&lpMsgBuf), 0, NULL ); // If FormatMessage fails using FORMAT_MESSAGE_ALLOCATE_BUFFER // it means that the size of the error message exceeds an internal // buffer limit (128 kb according to MSDN) and lpMsgBuf will be // uninitialized. // Inform the caller that the error message couldn't be retrieved. if (rc == 0) { return std::string("Failed to retrieve error message."); } std::string errMsg(ToUTF8String(std::wstring(reinterpret_cast<LPCWSTR>(lpMsgBuf)))); LocalFree(lpMsgBuf); return errMsg; } #endif std::string GetLastCErrorStr() { char errorString[128]; //#if ((_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE) || defined(US_PLATFORM_APPLE) // This is the XSI strerror_r version int en = errno; int r = strerror_r(errno, errorString, sizeof errorString); if (r) { std::string errMsg = "Unknown error " + util::ToString(en) + ": strerror_r failed with error code "; if (r < 0) { errMsg += util::ToString(static_cast<int>(errno)); } else { errMsg += util::ToString(r); } return errMsg; } return errorString; //#elif defined(US_PLATFORM_WINDOWS) // if (strerror_s(errorString, sizeof errorString, errno)) // { // return "Unknown error"; // } // return errorString; //#else // return strerror_r(errno, errorString, sizeof errorString); //#endif } std::string GetExceptionStr(const std::exception_ptr& exc) { std::string excStr; if (!exc) { return excStr; } try { std::rethrow_exception(exc); } catch (const std::exception& e) { excStr = e.what(); } catch (...) { excStr = "unknown"; } return excStr; } std::string GetLastExceptionStr() { return GetExceptionStr(std::current_exception()); } } // namespace util } // namespace cppmicroservices docker/ci/alpine/code-server-dev/patch_glucose.hpp 0 → 100644 +5930 −0 File added.Preview size limit exceeded, changes collapsed. Show changes docker/ci/alpine/code-server/Dockerfile +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ RUN sudo chown coder README.md && sudo chgrp coder README.md \ && git clone https://github.com/ornl-qci/qcor && cp -r qcor/examples cpp-examples \ && cp -r qcor/python/examples py-examples && rm -rf qcor \ && mkdir -p /home/coder/.local/share/code-server/User \ && printf "{\"workbench.startupEditor\": \"readme\", \"workbench.colorTheme\": \"Monokai Dimmed\", \"workbench.panel.defaultLocation\": \"right\", \"terminal.integrated.shell.linux\": \"bash\", \"files.associations\": {\"*.qasm\": \"cpp\"}" | tee /home/coder/.local/share/code-server/User/settings.json \ && printf "{\"workbench.startupEditor\": \"readme\", \"workbench.colorTheme\": \"Monokai Dimmed\", \"workbench.panel.defaultLocation\": \"right\", \"terminal.integrated.shell.linux\": \"bash\", \"files.associations\": {\"*.qasm\": \"cpp\"}}" | tee /home/coder/.local/share/code-server/User/settings.json \ && wget https://github.com/microsoft/vscode-cpptools/releases/download/1.5.1/cpptools-linux.vsix \ && wget https://github.com/microsoft/vscode-python/releases/download/2020.10.332292344/ms-python-release.vsix \ && /usr/lib/code-server/bin/code-server --install-extension cpptools-linux.vsix \ Loading tools/driver/qcor.in +19 −1 Original line number Diff line number Diff line Loading @@ -246,10 +246,27 @@ def main(argv=None): if '-set-credentials' in sys.argv[1:]: idx = sys.argv.index('-set-credentials') accName = sys.argv[idx+1] if accName not in ['ibm', 'qcs', 'rigetti', 'dwave']: if accName not in ['ibm', 'qcs', 'rigetti', 'dwave', 'honeywell']: print('invalid remote qpu name: ', accName) exit(1) if accName == 'honeywell': # get user email and password import getpass, requests, json email = input(bcolors.BOLD+bcolors.OKBLUE+'Enter Honeywell User Email: '+bcolors.ENDC) p = getpass.getpass(prompt=bcolors.BOLD+bcolors.OKBLUE+'Password: '+bcolors.ENDC) r = requests.post('https://qapi.honeywell.com/v1/login', data='{{"email":"{}", "password":"{}"}}'.format(email,p)) rd = json.loads(r.text) if 'error' in rd: print(bcolors.BOLD+bcolors.FAIL+'[qcor-exec] Error with honeywell login: ', rd['error']['text']) exit(1) s = 'key:{}\nrefresh:{}\nemail:{}\n'.format(rd['id-token'],rd['refresh-token'], email) f = open(os.getenv('HOME')+'/.honeywell_config', 'w') f.write(s) f.close() info('Credentials saved to $HOME/.honeywell_config.') exit(0) try: kidx = sys.argv.index('-key') except: Loading Loading @@ -277,6 +294,7 @@ def main(argv=None): print(s) exit(0) if '-print-credentials' in sys.argv[1:]: idx = sys.argv.index('-print-credentials') try: Loading Loading
docker/ci/alpine/code-server-dev/Dockerfile 0 → 100644 +53 −0 Original line number Diff line number Diff line FROM qcor/llvm-alpine as llvm_install FROM xacc/alpine COPY --from=llvm_install /usr/local/aideqc/llvm /usr/local/aideqc/llvm ENV VERSION=3.11.0 RUN apk add nodejs openssh-client gnupg bash sudo curl && \ wget https://github.com/cdr/code-server/releases/download/v$VERSION/code-server-$VERSION-linux-amd64.tar.gz && \ tar x -zf code-server-$VERSION-linux-amd64.tar.gz && \ rm code-server-$VERSION-linux-amd64.tar.gz && \ rm code-server-$VERSION-linux-amd64/node && \ rm code-server-$VERSION-linux-amd64/code-server && \ rm code-server-$VERSION-linux-amd64/lib/node && \ mv code-server-$VERSION-linux-amd64 /usr/lib/code-server && \ sed -i 's/"$ROOT\/lib\/node"/node/g' /usr/lib/code-server/bin/code-server \ && apk add libc6-compat ninja bash sudo curl \ && adduser --gecos '' --disabled-password coder \ && echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd \ && curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.5.1/fixuid-0.5.1-linux-amd64.tar.gz" | tar -C /usr/local/bin -xzf - \ && chown root:root /usr/local/bin/fixuid \ && chmod 4755 /usr/local/bin/fixuid \ && mkdir -p /etc/fixuid \ && printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml \ && rm -rf fixuid-0.5-linux* \ && ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2 USER 1000 ENV USER=coder WORKDIR /home/coder COPY patch_Error.cpp /home/coder/ COPY patch_glucose.hpp /home/coder/ RUN git clone --recursive https://github.com/eclipse/xacc && sudo chown -R coder /usr/local/aideqc && sudo chgrp -R coder /usr/local/aideqc \ && mv /home/coder/patch_Error.cpp xacc/tpls/cppmicroservices/util/src/Error.cpp \ && mv /home/coder/patch_glucose.hpp xacc/tpls/staq/libs/glucose/glucose.hpp \ && cd xacc && mkdir build && cd build/ \ && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/aideqc/qcor && make -j8 install && cd ../.. \ && git clone https://github.com/ornl-qci/qcor && cd qcor && mkdir build && cd build \ && cmake .. -G Ninja -DXACC_DIR=/usr/local/aideqc/qcor -DCMAKE_INSTALL_PREFIX=/usr/local/aideqc/qcor \ -DLLVM_ROOT=/usr/local/aideqc/llvm -DQCOR_EXTRA_COMPILER_FLAGS="-B /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1 -L /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1" \ -DQCOR_EXTRA_HEADERS="/usr/include/c++/10.3.1;/usr/include/c++/10.3.1/x86_64-alpine-linux-musl" \ && cmake --build . --target install && cd ../../ \ && mkdir -p /home/coder/.local/share/code-server/User \ && printf "{\"workbench.startupEditor\": \"readme\", \"workbench.colorTheme\": \"Monokai Dimmed\", \"workbench.panel.defaultLocation\": \"right\", \"terminal.integrated.shell.linux\": \"bash\", \"files.associations\": {\"*.qasm\": \"cpp\"}}" | tee /home/coder/.local/share/code-server/User/settings.json \ && wget https://github.com/microsoft/vscode-cpptools/releases/download/1.5.1/cpptools-linux.vsix \ && wget https://github.com/microsoft/vscode-python/releases/download/2020.10.332292344/ms-python-release.vsix \ && /usr/lib/code-server/bin/code-server --install-extension cpptools-linux.vsix \ && /usr/lib/code-server/bin/code-server --install-extension ms-python-release.vsix \ && rm -rf cpptools-linux.vsix ms-python-release.vsix ENV PYTHONPATH "${PYTHONPATH}:/usr/local/aideqc/qcor" ENV PATH "${PATH}:/usr/local/aideqc/qcor/bin:/usr/lib/code-server/bin" ENTRYPOINT ["/usr/lib/code-server/bin/code-server", "--bind-addr", "0.0.0.0:8080", "--auth", "none", "."]
docker/ci/alpine/code-server-dev/patch_Error.cpp 0 → 100644 +137 −0 Original line number Diff line number Diff line /*============================================================================= Library: CppMicroServices Copyright (c) The CppMicroServices developers. See the COPYRIGHT file at the top-level directory of this distribution and at https://github.com/CppMicroServices/CppMicroServices/COPYRIGHT . Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =============================================================================*/ #include "cppmicroservices/util/Error.h" #include "cppmicroservices/util/String.h" #ifdef US_PLATFORM_POSIX #include <errno.h> #include <string.h> #else #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include <windows.h> #include <crtdbg.h> #endif namespace cppmicroservices { namespace util { #ifdef US_PLATFORM_WINDOWS std::string GetLastWin32ErrorStr() { // Retrieve the system error message for the last-error code LPVOID lpMsgBuf; DWORD dw = GetLastError(); DWORD rc = FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast<LPWSTR>(&lpMsgBuf), 0, NULL ); // If FormatMessage fails using FORMAT_MESSAGE_ALLOCATE_BUFFER // it means that the size of the error message exceeds an internal // buffer limit (128 kb according to MSDN) and lpMsgBuf will be // uninitialized. // Inform the caller that the error message couldn't be retrieved. if (rc == 0) { return std::string("Failed to retrieve error message."); } std::string errMsg(ToUTF8String(std::wstring(reinterpret_cast<LPCWSTR>(lpMsgBuf)))); LocalFree(lpMsgBuf); return errMsg; } #endif std::string GetLastCErrorStr() { char errorString[128]; //#if ((_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE) || defined(US_PLATFORM_APPLE) // This is the XSI strerror_r version int en = errno; int r = strerror_r(errno, errorString, sizeof errorString); if (r) { std::string errMsg = "Unknown error " + util::ToString(en) + ": strerror_r failed with error code "; if (r < 0) { errMsg += util::ToString(static_cast<int>(errno)); } else { errMsg += util::ToString(r); } return errMsg; } return errorString; //#elif defined(US_PLATFORM_WINDOWS) // if (strerror_s(errorString, sizeof errorString, errno)) // { // return "Unknown error"; // } // return errorString; //#else // return strerror_r(errno, errorString, sizeof errorString); //#endif } std::string GetExceptionStr(const std::exception_ptr& exc) { std::string excStr; if (!exc) { return excStr; } try { std::rethrow_exception(exc); } catch (const std::exception& e) { excStr = e.what(); } catch (...) { excStr = "unknown"; } return excStr; } std::string GetLastExceptionStr() { return GetExceptionStr(std::current_exception()); } } // namespace util } // namespace cppmicroservices
docker/ci/alpine/code-server-dev/patch_glucose.hpp 0 → 100644 +5930 −0 File added.Preview size limit exceeded, changes collapsed. Show changes
docker/ci/alpine/code-server/Dockerfile +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ RUN sudo chown coder README.md && sudo chgrp coder README.md \ && git clone https://github.com/ornl-qci/qcor && cp -r qcor/examples cpp-examples \ && cp -r qcor/python/examples py-examples && rm -rf qcor \ && mkdir -p /home/coder/.local/share/code-server/User \ && printf "{\"workbench.startupEditor\": \"readme\", \"workbench.colorTheme\": \"Monokai Dimmed\", \"workbench.panel.defaultLocation\": \"right\", \"terminal.integrated.shell.linux\": \"bash\", \"files.associations\": {\"*.qasm\": \"cpp\"}" | tee /home/coder/.local/share/code-server/User/settings.json \ && printf "{\"workbench.startupEditor\": \"readme\", \"workbench.colorTheme\": \"Monokai Dimmed\", \"workbench.panel.defaultLocation\": \"right\", \"terminal.integrated.shell.linux\": \"bash\", \"files.associations\": {\"*.qasm\": \"cpp\"}}" | tee /home/coder/.local/share/code-server/User/settings.json \ && wget https://github.com/microsoft/vscode-cpptools/releases/download/1.5.1/cpptools-linux.vsix \ && wget https://github.com/microsoft/vscode-python/releases/download/2020.10.332292344/ms-python-release.vsix \ && /usr/lib/code-server/bin/code-server --install-extension cpptools-linux.vsix \ Loading
tools/driver/qcor.in +19 −1 Original line number Diff line number Diff line Loading @@ -246,10 +246,27 @@ def main(argv=None): if '-set-credentials' in sys.argv[1:]: idx = sys.argv.index('-set-credentials') accName = sys.argv[idx+1] if accName not in ['ibm', 'qcs', 'rigetti', 'dwave']: if accName not in ['ibm', 'qcs', 'rigetti', 'dwave', 'honeywell']: print('invalid remote qpu name: ', accName) exit(1) if accName == 'honeywell': # get user email and password import getpass, requests, json email = input(bcolors.BOLD+bcolors.OKBLUE+'Enter Honeywell User Email: '+bcolors.ENDC) p = getpass.getpass(prompt=bcolors.BOLD+bcolors.OKBLUE+'Password: '+bcolors.ENDC) r = requests.post('https://qapi.honeywell.com/v1/login', data='{{"email":"{}", "password":"{}"}}'.format(email,p)) rd = json.loads(r.text) if 'error' in rd: print(bcolors.BOLD+bcolors.FAIL+'[qcor-exec] Error with honeywell login: ', rd['error']['text']) exit(1) s = 'key:{}\nrefresh:{}\nemail:{}\n'.format(rd['id-token'],rd['refresh-token'], email) f = open(os.getenv('HOME')+'/.honeywell_config', 'w') f.write(s) f.close() info('Credentials saved to $HOME/.honeywell_config.') exit(0) try: kidx = sys.argv.index('-key') except: Loading Loading @@ -277,6 +294,7 @@ def main(argv=None): print(s) exit(0) if '-print-credentials' in sys.argv[1:]: idx = sys.argv.index('-print-credentials') try: Loading