Skip to content

Commit

Permalink
Merge pull request #5458 from BOINC/dpa_vboxw_share
Browse files Browse the repository at this point in the history
vboxwrapper: add the ability to share project and slot directories
  • Loading branch information
AenBleidd authored Dec 19, 2023
2 parents 07ffc85 + d72cbd1 commit 3833dc2
Show file tree
Hide file tree
Showing 29 changed files with 680 additions and 545 deletions.
45 changes: 25 additions & 20 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ jobs:
run: |
sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
apt-get -qq update
apt-get install -y make build-essential m4 pkg-config autoconf libtool git libcurl4-openssl-dev
apt-get install -y make build-essential m4 pkg-config autoconf libtool git libcurl4-openssl-dev p7zip-full python3
- name: Install dependencies for x64
if: success() && matrix.type == 'apps'
Expand Down Expand Up @@ -248,6 +248,7 @@ jobs:
export CFLAGS="-O3"
export CXXFLAGS="-O3"
export LDFLAGS="-static-libstdc++ -s"
export RELEASE_ARCH=x86_64
./configure --enable-apps --enable-apps-vbox --disable-server --disable-client --disable-manager
make -j $(nproc --all)
Expand All @@ -257,29 +258,31 @@ jobs:
export CFLAGS="-O3 -m32"
export CXXFLAGS="-O3 -m32"
export LDFLAGS="-static-libstdc++ -s -m32"
export RELEASE_ARCH=i686
./configure --enable-apps --enable-apps-vbox --disable-server --disable-client --disable-manager --host=i686-linux-gnu
make -j $(nproc --all)
- name: Prepare logs on failure
if: ${{ failure() }}
run: python3 ./deploy/prepare_deployment.py logs

- name: Upload logs on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v1
with:
name: linux_release_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }}
path: config.log
path: deploy/logs.7z

- name: Upload wrapper artifacts
uses: actions/upload-artifact@v1
- name: Prepare artifacts for deploy
if: success()
with:
name: linux_release_${{ matrix.type }}_wrapper_${{ github.event.pull_request.head.sha }}
path: samples/wrapper/wrapper
run: python3 ./deploy/prepare_deployment.py linux_apps

- name: Upload vboxwrapper artifacts
- name: Upload wrapper artifacts
uses: actions/upload-artifact@v1
if: success()
with:
name: linux_release_${{ matrix.type }}_vboxwrapper_${{ github.event.pull_request.head.sha }}
path: samples/vboxwrapper/vboxwrapper
name: linux_release_${{ matrix.type }}_${{ github.event.pull_request.head.sha }}
path: deploy/linux_apps.7z

build-release-arm64:
name: ${{ matrix.type }}-build-release
Expand All @@ -299,7 +302,7 @@ jobs:
- name: Install dependencies for arm64
if: success()
run: |
apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu wget ca-certificates
apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu wget ca-certificates p7zip-full python3
- uses: actions/checkout@v3
with:
Expand All @@ -314,28 +317,30 @@ jobs:
run: |
export CI=yes
export RELEASE=yes
export RELEASE_ARCH=arm64
./linux/arm64/build_libraries_arm64.sh
./linux/arm64/build_openssl_arm64.sh
./linux/arm64/build_curl_arm64.sh
./linux/arm64/build_example_arm64.sh
- name: Prepare logs on failure
if: ${{ failure() }}
run: python3 ./deploy/prepare_deployment.py logs

- name: Upload logs on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: linux_release_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }}
path: config.log
path: deploy/logs.7z

- name: Upload wrapper artifacts
uses: actions/upload-artifact@v3
- name: Prepare artifacts for deploy
if: success()
with:
name: linux_release_${{ matrix.type }}_wrapper_${{ github.event.pull_request.head.sha }}
path: samples/wrapper/wrapper
run: python3 ./deploy/prepare_deployment.py linux_apps

- name: Upload vboxwrapper artifacts
- name: Upload wrapper artifacts
uses: actions/upload-artifact@v3
if: success()
with:
name: linux_release_${{ matrix.type }}_vboxwrapper_${{ github.event.pull_request.head.sha }}
path: samples/vboxwrapper/vboxwrapper
name: linux_release_${{ matrix.type }}_${{ github.event.pull_request.head.sha }}
path: deploy/linux_apps.7z
4 changes: 2 additions & 2 deletions client/app_start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ int ACTIVE_TASK::start(bool test) {
break;
} else {
last_error = GetLastError();
windows_format_error_string(last_error, error_msg, sizeof(error_msg));
windows_format_error_string(last_error, error_msg, sizeof(error_msg), exec_path);
msg_printf(wup->project, MSG_INTERNAL_ERROR,
"Process creation failed: %s - error code %d (0x%x)",
error_msg, last_error, last_error
Expand Down Expand Up @@ -813,7 +813,7 @@ int ACTIVE_TASK::start(bool test) {
break;
} else {
last_error = GetLastError();
windows_format_error_string(last_error, error_msg, sizeof(error_msg));
windows_format_error_string(last_error, error_msg, sizeof(error_msg), exec_path);
msg_printf(wup->project, MSG_INTERNAL_ERROR,
"Process creation failed: %s - error code %d (0x%x)",
error_msg, last_error, last_error
Expand Down
5 changes: 4 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ AC_SUBST([LIBBOINC_VERSION])
WRAPPER_RELEASE=26018
AC_SUBST([WRAPPER_RELEASE])

VBOXWRAPPER_RELEASE=26206
VBOXWRAPPER_RELEASE=26207
AC_SUBST([VBOXWRAPPER_RELEASE])

WORKER_RELEASE=2
AC_SUBST([WORKER_RELEASE])

AC_CANONICAL_TARGET

dnl generate .tar.gz, .tar.bz2, .zip
Expand Down
18 changes: 9 additions & 9 deletions deploy/prepare_deployment.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of BOINC.
# http://boinc.berkeley.edu
# Copyright (C) 2021 University of California
# Copyright (C) 2023 University of California
#
# BOINC is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License
Expand Down Expand Up @@ -37,9 +37,9 @@
'./samples/multi_thread/multi_thread',
'./samples/sleeper/sleeper',
'./samples/vboxmonitor/vboxmonitor',
'./samples/vboxwrapper/vboxwrapper',
'./samples/worker/worker',
'./samples/wrapper/wrapper',
'./samples/vboxwrapper/vboxwrapper*pc-linux-gnu',
'./samples/worker/worker*pc-linux-gnu',
'./samples/wrapper/wrapper*pc-linux-gnu',
'./samples/openclapp/openclapp',
'./samples/wrappture/wrappture_example',
'./samples/wrappture/fermi',
Expand All @@ -65,8 +65,8 @@
'./samples/example_app/slide_show.exe',
'./samples/multi_thread/multi_thread.exe',
'./samples/sleeper/sleeper.exe',
'./samples/worker/worker.exe',
'./samples/wrapper/wrapper.exe',
'./samples/worker/worker*.exe',
'./samples/wrapper/wrapper*.exe',
'./samples/wrappture/wrappture_example.exe',
'./samples/wrappture/fermi.exe',
'./samples/sporadic/sporadic.exe'
Expand Down Expand Up @@ -239,12 +239,12 @@
def prepare_7z_archive(archive_name, target_directory, files_list):
os.makedirs(target_directory, exist_ok=True)
archive_path = os.path.join(target_directory, archive_name + '.7z')
command = f'7z a -t7z -r -mx=9 {archive_path} {" ".join(files_list)}'
command = '7z a -t7z -r -mx=9 ' + archive_path + ' ' + " ".join(files_list)
os.system(command)

def help():
print('Usage: python preprare_deployment.py BOINC_TYPE')
print(f'BOINC_TYPE : [{" | ".join(boinc_types.keys())}]')
print('BOINC_TYPE : [' + " | ".join(boinc_types.keys()) + ']')

def prepare_linux_client(target_directory):
prepare_7z_archive('linux_client', target_directory, linux_client_list)
Expand Down Expand Up @@ -349,7 +349,7 @@ def prepare_logs(target_directory):
target_dir = 'deploy'

if (boinc_type not in boinc_types):
print(f'Unknown BOINC_TYPE: {boinc_type}')
print('Unknown BOINC_TYPE: ' + boinc_type)
help()
sys.exit(1)

Expand Down
20 changes: 12 additions & 8 deletions lib/win_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,23 +137,28 @@ std::string boinc_wide_to_ascii(const std::wstring& str) {
// get message for given error
//
char* windows_format_error_string(
unsigned long dwError, char* pszBuf, int iSize
unsigned long dwError, char* pszBuf, int iSize ...
) {
DWORD dwRet;
LPWSTR lpszTemp = NULL;
LPSTR lpszTemp = NULL;

dwRet = FormatMessageW(
FORMAT_MESSAGE_IGNORE_INSERTS |
va_list args;
va_start(args, iSize);
dwRet = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_ARGUMENT_ARRAY,
FORMAT_MESSAGE_FROM_SYSTEM ,
NULL,
dwError,
LANG_NEUTRAL,
#ifdef wxUSE_GUI
(LPWSTR)&lpszTemp,
#else
(LPSTR)&lpszTemp,
#endif
0,
NULL
&args
);
va_end(args);

if (dwRet != 0) {
// include the hex error code as well
Expand All @@ -167,4 +172,3 @@ char* windows_format_error_string(

return pszBuf;
}

2 changes: 1 addition & 1 deletion lib/win_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extern std::wstring boinc_ascii_to_wide(const std::string& str);
extern std::string boinc_wide_to_ascii(const std::wstring& str);

extern char* windows_format_error_string(
unsigned long dwError, char* pszBuf, int iSize
unsigned long dwError, char* pszBuf, int iSize ...
);

#endif
4 changes: 4 additions & 0 deletions samples/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

include $(top_srcdir)/Makefile.incl

export WRAPPER_RELEASE_VERSION=$(WRAPPER_RELEASE)
export VBOXWRAPPER_RELEASE_VERSION=$(VBOXWRAPPER_RELEASE)
export WORKER_RELEASE_VERSION=$(WORKER_RELEASE)

if BUILD_WITH_MINGW
export BUILD_WITH_MINGW="yes"
endif
Expand Down
16 changes: 13 additions & 3 deletions samples/vboxwrapper/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# This should work on Linux. Modify as needed for other platforms.

ifdef ANDROID
VBOXWRAPPER_RELEASE_SUFFIX =
else
ifdef RELEASE_ARCH
VBOXWRAPPER_RELEASE_SUFFIX = _$(VBOXWRAPPER_RELEASE_VERSION)_$(RELEASE_ARCH)-pc-linux-gnu
else
VBOXWRAPPER_RELEASE_SUFFIX = _$(VBOXWRAPPER_RELEASE_VERSION)_x86_64-pc-linux-gnu
endif
endif

# Change the following to match your installation
BOINC_DIR = ../..
BOINC_SOURCE_API_DIR = $(BOINC_DIR)/api
Expand Down Expand Up @@ -31,7 +41,7 @@ CXXFLAGS += -g \
-L$(BOINC_LIB_DIR) \
-L.

PROGS = vboxwrapper
PROGS = vboxwrapper$(VBOXWRAPPER_RELEASE_SUFFIX)

HEADERS = vbox_common.h vboxjob.h vbox_vboxmanage.h vboxwrapper.h

Expand Down Expand Up @@ -66,5 +76,5 @@ vboxlogging.o: vboxlogging.cpp $(HEADERS)
vboxwrapper.o: vboxwrapper.cpp $(HEADERS)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c vboxwrapper.cpp

vboxwrapper: vboxwrapper.o vbox_common.o vbox_vboxmanage.o vboxcheckpoint.o vboxjob.o vboxlogging.o floppyio.o $(MAKEFILE_STDLIB) $(BOINC_LIB_DIR)/libboinc.a $(BOINC_API_DIR)/libboinc_api.a
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o vboxwrapper vboxwrapper.o vbox_common.o vbox_vboxmanage.o vboxcheckpoint.o vboxjob.o vboxlogging.o floppyio.o $(MAKEFILE_LDFLAGS) -lboinc_api -lboinc $(STDCPPTC)
vboxwrapper$(VBOXWRAPPER_RELEASE_SUFFIX): vboxwrapper.o vbox_common.o vbox_vboxmanage.o vboxcheckpoint.o vboxjob.o vboxlogging.o floppyio.o $(MAKEFILE_STDLIB) $(BOINC_LIB_DIR)/libboinc.a $(BOINC_API_DIR)/libboinc_api.a
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o vboxwrapper$(VBOXWRAPPER_RELEASE_SUFFIX) vboxwrapper.o vbox_common.o vbox_vboxmanage.o vboxcheckpoint.o vboxjob.o vboxlogging.o floppyio.o $(MAKEFILE_LDFLAGS) -lboinc_api -lboinc $(STDCPPTC)
3 changes: 3 additions & 0 deletions samples/vboxwrapper/boinc_resolve_1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /bin/sh

sed 's/<soft_link>..\/..\/projects\///; s/[^\/]*\//\/root\/project\//; s/<\/soft_link>//' $1 | tr -d '\r\n'
Loading

0 comments on commit 3833dc2

Please sign in to comment.