Skip to content

Commit da9c9c5

Browse files
esteveEsteve Fernandez
and
Esteve Fernandez
authored
fix(yabloc_pose_initializer): disable downloading artifacts by default (autowarefoundation#4110)
Signed-off-by: Esteve Fernandez <esteve.fernandez@tier4.jp> Co-authored-by: Esteve Fernandez <esteve.fernadnez@tier4.jp>
1 parent e88ccad commit da9c9c5

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

localization/yabloc/yabloc_pose_initializer/download.cmake

+15-10
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
set(DOWNLOAD_ARTIFACTS OFF CACHE BOOL "enable artifacts download")
16+
1517
set(DATA_URL "https://s3.ap-northeast-2.wasabisys.com/pinto-model-zoo/136_road-segmentation-adas-0001/resources.tar.gz")
1618
set(DATA_PATH "${CMAKE_CURRENT_SOURCE_DIR}/data")
1719
set(FILE_HASH 146ed8af689a30b898dc5369870c40fb)
1820
set(FILE_NAME "resources.tar.gz")
1921

20-
function(download)
22+
function(download_and_extract)
2123
message(STATUS "Checking and downloading ${FILE_NAME}")
2224
set(FILE_PATH ${DATA_PATH}/${FILE_NAME})
2325
set(STATUS_CODE 0)
@@ -38,25 +40,28 @@ function(download)
3840
list(GET DOWNLOAD_STATUS 1 ERROR_MESSAGE)
3941
endif()
4042
else()
41-
message(STATUS "not found ${FILE_NAME}")
42-
message(STATUS "File doesn't exists. Downloading now ...")
43-
file(DOWNLOAD ${DATA_URL} ${FILE_PATH} STATUS DOWNLOAD_STATUS TIMEOUT 3600)
44-
list(GET DOWNLOAD_STATUS 0 STATUS_CODE)
45-
list(GET DOWNLOAD_STATUS 1 ERROR_MESSAGE)
43+
if(DOWNLOAD_ARTIFACTS)
44+
message(STATUS "not found ${FILE_NAME}")
45+
message(STATUS "File doesn't exists. Downloading now ...")
46+
file(DOWNLOAD ${DATA_URL} ${FILE_PATH} STATUS DOWNLOAD_STATUS TIMEOUT 3600)
47+
list(GET DOWNLOAD_STATUS 0 STATUS_CODE)
48+
list(GET DOWNLOAD_STATUS 1 ERROR_MESSAGE)
49+
else()
50+
message(WARNING "Skipped download for ${FILE_NAME} (enable by setting DOWNLOAD_ARTIFACTS)")
51+
file(MAKE_DIRECTORY "${DATA_PATH}")
52+
return()
53+
endif()
4654
endif()
4755

4856
if(${STATUS_CODE} EQUAL 0)
4957
message(STATUS "Download completed successfully!")
5058
else()
5159
message(FATAL_ERROR "Error occurred during download: ${ERROR_MESSAGE}")
5260
endif()
53-
endfunction()
5461

55-
function(extract)
5662
execute_process(COMMAND
5763
${CMAKE_COMMAND} -E
5864
tar xzf "${DATA_PATH}/${FILE_NAME}" WORKING_DIRECTORY "${DATA_PATH}")
5965
endfunction()
6066

61-
download()
62-
extract()
67+
download_and_extract()

0 commit comments

Comments
 (0)