-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathupdate_backend_versions.sh
More file actions
executable file
·218 lines (191 loc) · 7.28 KB
/
Copy pathupdate_backend_versions.sh
File metadata and controls
executable file
·218 lines (191 loc) · 7.28 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#!/bin/bash
# Script to update backend versions from neuriplo and VideoCapture repositories
# This script copies the versions.env files from the fetched repos, but local files override them
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Function to show usage
show_usage() {
echo "Usage: $0 [OPTIONS]"
echo ""
echo "This script updates backend versions from the neuriplo and VideoCapture repositories."
echo "Local version files override the fetched repository versions:"
echo " - versions.neuriplo.env overrides neuriplo versions"
echo " - versions.videocapture.env overrides VideoCapture versions"
echo ""
echo "Options:"
echo " --force Force update even if local files exist"
echo " --show-versions Show current versions after update"
echo " --neuriplo Only update neuriplo versions"
echo " --videocapture Only update VideoCapture versions"
echo " --help Show this help message"
echo ""
echo "Examples:"
echo " $0 # Update if local files don't exist"
echo " $0 --force # Force update from repositories"
echo " $0 --show-versions # Update and show versions"
echo " $0 --neuriplo --show-versions # Only neuriplo"
}
# Function to update neuriplo versions
update_neuriplo_versions() {
local local_versions_file="versions.neuriplo.env"
local inference_versions_file="build/_deps/neuriplo-src/versions.env"
local github_url="https://raw.githubusercontent.com/olibartfast/neuriplo/master/versions.env"
print_status "Updating neuriplo versions..."
# Check if local versions file exists
if [[ -f "$local_versions_file" && "$force" != "true" ]]; then
print_warning "Local neuriplo versions file $local_versions_file already exists."
print_status "Use --force to overwrite with versions from neuriplo repo."
print_status "Current local versions:"
source "$local_versions_file"
echo "ONNX Runtime: $ONNX_RUNTIME_VERSION"
echo "TensorRT: $TENSORRT_VERSION"
echo "LibTorch: $PYTORCH_VERSION"
echo "OpenVINO: $OPENVINO_VERSION"
echo "TensorFlow: $TENSORFLOW_VERSION"
echo "CUDA: $CUDA_VERSION"
return 0
fi
# Try to get versions from local build folder first, then GitHub
if [[ -f "$inference_versions_file" ]]; then
print_status "Using versions from local build folder..."
cp "$inference_versions_file" "$local_versions_file"
else
print_status "Local build folder not found, fetching from GitHub..."
print_status "URL: $github_url"
# Download versions from GitHub
if curl -s -o "$local_versions_file" "$github_url"; then
print_success "Successfully downloaded neuriplo versions from GitHub"
else
print_error "Failed to download neuriplo versions from GitHub"
return 1
fi
fi
if [[ "$show_versions" == "true" ]]; then
print_success "neuriplo versions updated successfully:"
source "$local_versions_file"
echo "ONNX Runtime: $ONNX_RUNTIME_VERSION"
echo "TensorRT: $TENSORRT_VERSION"
echo "LibTorch: $PYTORCH_VERSION"
echo "OpenVINO: $OPENVINO_VERSION"
echo "TensorFlow: $TENSORFLOW_VERSION"
echo "CUDA: $CUDA_VERSION"
else
print_success "neuriplo versions updated successfully to $local_versions_file"
fi
}
# Function to update VideoCapture versions
update_videocapture_versions() {
local local_versions_file="versions.videocapture.env"
local videocapture_versions_file="build/_deps/videocapture-src/versions.env"
local github_url="https://raw.githubusercontent.com/olibartfast/videocapture/master/versions.env"
print_status "Updating VideoCapture versions..."
# Check if local versions file exists
if [[ -f "$local_versions_file" && "$force" != "true" ]]; then
print_warning "Local VideoCapture versions file $local_versions_file already exists."
print_status "Use --force to overwrite with versions from VideoCapture repo."
print_status "Current local versions:"
source "$local_versions_file"
echo "GStreamer: $GSTREAMER_VERSION"
echo "OpenCV: $OPENCV_VERSION"
echo "CMake: $CMAKE_VERSION"
return 0
fi
# Try to get versions from local build folder first, then GitHub
if [[ -f "$videocapture_versions_file" ]]; then
print_status "Using versions from local build folder..."
cp "$videocapture_versions_file" "$local_versions_file"
else
print_status "Local build folder not found, fetching from GitHub..."
print_status "URL: $github_url"
# Download versions from GitHub
if curl -s -o "$local_versions_file" "$github_url"; then
print_success "Successfully downloaded VideoCapture versions from GitHub"
else
print_error "Failed to download VideoCapture versions from GitHub"
return 1
fi
fi
if [[ "$show_versions" == "true" ]]; then
print_success "VideoCapture versions updated successfully:"
source "$local_versions_file"
echo "GStreamer: $GSTREAMER_VERSION"
echo "OpenCV: $OPENCV_VERSION"
echo "CMake: $CMAKE_VERSION"
else
print_success "VideoCapture versions updated successfully to $local_versions_file"
fi
}
# Main function
main() {
local force=false
local show_versions=false
local update_inference_engines=true
local update_videocapture=true
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--force)
force=true
shift
;;
--show-versions)
show_versions=true
shift
;;
--neuriplo)
update_inference_engines=true
update_videocapture=false
shift
;;
--videocapture)
update_inference_engines=false
update_videocapture=true
shift
;;
--help)
show_usage
exit 0
;;
*)
print_error "Unknown option: $1"
show_usage
exit 1
;;
esac
done
print_status "Starting version update process..."
# Update neuriplo versions
if [[ "$update_inference_engines" == "true" ]]; then
if ! update_neuriplo_versions; then
print_error "Failed to update neuriplo versions"
exit 1
fi
fi
# Update VideoCapture versions
if [[ "$update_videocapture" == "true" ]]; then
if ! update_videocapture_versions; then
print_error "Failed to update VideoCapture versions"
exit 1
fi
fi
print_success "Version update process completed successfully!"
}
# Run main function with all arguments
main "$@"