forked from MouseLightPipeline/pipeline-featmatch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_and_install_to_patrick_pipeline.m
48 lines (39 loc) · 2.06 KB
/
build_and_install_to_patrick_pipeline.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function build_and_install_to_patrick_pipeline()
% Define some expected locations
source_repo_folder_path = fileparts(mfilename('fullpath')) ;
%pointmatch_script_path = fullfile(this_folder_path, 'pointmatch.m');
compiled_code_folder_path = fullfile(source_repo_folder_path, 'compiled') ;
compiled_binary_path = fullfile(compiled_code_folder_path, 'pointmatch') ;
% Build
build() ;
% Check that the compiled binary exists
if ~exist(compiled_binary_path, 'file') ,
error('The compiled binary does not exist at %s', compiled_binary_path) ;
end
% Get the git hash
commit_hash = get_git_hash_and_error_if_uncommited_changes(source_repo_folder_path) ;
short_commit_hash = commit_hash(1:7) ;
% Get the git report
breadcrumb_string = get_git_report(source_repo_folder_path) ;
% Delete pre-existing installs
for a_or_b = 'ab' ,
% If the destination folder exists, delete it
install_folder_path = ...
sprintf('/groups/mousebrainmicro/mousebrainmicro/pipeline-systems/pipeline-%s/apps/pipeline-featmatch-%s', a_or_b, short_commit_hash) ;
if exist(install_folder_path, 'file') ,
system(sprintf('rm -rf %s', install_folder_path)) ;
end
end
% Install to both pipelines
for a_or_b = 'ab' ,
install_folder_path = ...
sprintf('/groups/mousebrainmicro/mousebrainmicro/pipeline-systems/pipeline-%s/apps/pipeline-featmatch-%s', a_or_b, short_commit_hash) ;
% Create the install folder, and any needed parent folders
ensure_folder_exists(install_folder_path) ;
% Write a file with the git report into the folder, for good measure
breadcrumb_file_path = fullfile(install_folder_path, 'breadcrumbs.txt') ;
write_string_to_text_file(breadcrumb_file_path, breadcrumb_string) ;
% Copy the compiled code to the install folder
system_with_error_handling(sprintf('cp -R %s/* %s', compiled_code_folder_path, install_folder_path)) ;
end
end