Skip to content

cmake: download tries, customizable download parameters#15449

Merged
opencv-pushbot merged 2 commits intoopencv:3.4from
mshabunin:cmake-download-params
Sep 13, 2019
Merged

cmake: download tries, customizable download parameters#15449
opencv-pushbot merged 2 commits intoopencv:3.4from
mshabunin:cmake-download-params

Conversation

@mshabunin
Copy link
Copy Markdown
Contributor

@mshabunin mshabunin commented Sep 4, 2019

resolves #13573

This pullrequest changes

Adds two paramters to customize cmake download process for unstable and slow networks:

  • OPENCV_DOWNLOAD_TRIES_LIST - list of items representing download tries:
  • OPENCV_DOWNLOAD_PARAMS - raw parameter string to be used in cmake's file(DOWNLOAD ...) call
  • added directory creation to fallback download_with_*.sh scripts

Examples:

bash:

cmake \
    -DOPENCV_DOWNLOAD_TRIES_LIST=1\;2\;3\;4\;5 \
    -DOPENCV_DOWNLOAD_PARAMS=INACTIVITY_TIMEOUT\;30\;TIMEOUT\;180\;SHOW_PROGRESS \
../opencv

cmd:

cmake ^
    -DOPENCV_DOWNLOAD_TRIES_LIST=a;b;c ^
    -DOPENCV_DOWNLOAD_PARAMS=INACTIVITY_TIMEOUT;30;TIMEOUT;180;SHOW_PROGRESS ^
../opencv

Edit: renamed to OPENCV_DOWNLOAD_TRIES => OPENCV_DOWNLOAD_TRIES_LIST, marked both variables as advanced.

allow_multiple_commits=1

@alalek
Copy link
Copy Markdown
Member

alalek commented Sep 4, 2019

-DOPENCV_DOWNLOAD_TRIES=1\;2\;3\;4\;5

This is confusing approach. This should be a single number.

Also it would be nice to support some value to turn off downloading completely (but use cache). Something like this.

@mshabunin
Copy link
Copy Markdown
Contributor Author

I agree, it is confusing but I don't think it is an issue:

  • this functionality is for automated systems, not humans
  • this approach can be less prone to errors, e.g. TRIES=-8 will work too

Maybe we should mark these variables as ADVANCED?

It is possible to turn download off by providing an empty list: TRIES=

cmake -DOPENCV_DOWNLOAD_TRIES= ../opencv
# a bunch of warnings is shown ...
bash download_with_curl.sh
cmake .

@mshabunin mshabunin force-pushed the cmake-download-params branch from bb4c98e to 9d4f016 Compare September 4, 2019 14:22
@mshabunin mshabunin closed this Sep 4, 2019
@mshabunin mshabunin deleted the cmake-download-params branch September 4, 2019 14:27
@mshabunin mshabunin restored the cmake-download-params branch September 9, 2019 09:56
@mshabunin mshabunin reopened this Sep 9, 2019
Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@opencv-pushbot opencv-pushbot merged commit 9d4f016 into opencv:3.4 Sep 13, 2019
@alalek alalek mentioned this pull request Sep 13, 2019
@mshabunin mshabunin deleted the cmake-download-params branch July 14, 2020 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants