mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: ptxdist@pengutronix.de, Marian Cichy <m.cichy@pengutronix.de>
Subject: Re: [ptxdist] [PATCH] OpenCV: fix download in PTXDist prepare stage
Date: Thu, 23 Jan 2020 12:29:27 +0100	[thread overview]
Message-ID: <5c44e0a7-d529-1e42-a5a0-83bc3c86d032@pengutronix.de> (raw)
In-Reply-To: <20200122164845.22356-1-m.cichy@pengutronix.de>

Hello Marian

On 1/22/20 5:48 PM, Marian Cichy wrote:
> OpenCV wants to download the additional framework ADE while executing
> CMake. Therefore, files will be downloaded during PTXDist's prepare
> stage. This is not wanted. We now try to download the files during the
> Get stage and copy the files to the same locations at the Extract.post
> stage. If we cannot download the files during the Get stage, a new
> CMake Flag can be used to abort during the prepare stage if download is
> tried again.

Your signed-off-by is missing.

> ---
>  ...option-to-disallow-download-of-files.patch | 42 +++++++++++
>  patches/opencv-4.1.2/series                   |  1 +
>  rules/opencv.make                             | 74 +++++++++++++++----
>  3 files changed, 102 insertions(+), 15 deletions(-)
>  create mode 100644 patches/opencv-4.1.2/0001-add-option-to-disallow-download-of-files.patch
>  create mode 100644 patches/opencv-4.1.2/series
> 
> diff --git a/patches/opencv-4.1.2/0001-add-option-to-disallow-download-of-files.patch b/patches/opencv-4.1.2/0001-add-option-to-disallow-download-of-files.patch
> new file mode 100644
> index 000000000..0e1504a96
> --- /dev/null
> +++ b/patches/opencv-4.1.2/0001-add-option-to-disallow-download-of-files.patch
> @@ -0,0 +1,42 @@
> +From b71bfe426a68a4603c9b814da68b117602a8b55f Mon Sep 17 00:00:00 2001
> +From: Marian Cichy <m.cichy@pengutronix.de>
> +Date: Wed, 22 Jan 2020 17:14:05 +0100
> +Subject: [PATCH] add option to disallow download of files
> +
> +OpenCV wants to download files for the ADE Framework  when it is at
> +the prepare stage of PTXDist. This is not wanted. The PTXDist rule
> +will download the file during the Get stage and put it at the same
> +location where OpenCV would put it. If the Download at the Get stage
> +does not succeed and if OPENCV_ALLOW_DOWNLOADS is OFF, OpenCV will abort
> +with this patch at the Prepare stage.
> +---
> + cmake/OpenCVDownload.cmake | 6 ++++++
> + 1 file changed, 6 insertions(+)
> +
> +diff --git a/cmake/OpenCVDownload.cmake b/cmake/OpenCVDownload.cmake
> +index 63cf6d3238b1..cd7e50b4edf1 100644
> +--- a/cmake/OpenCVDownload.cmake
> ++++ b/cmake/OpenCVDownload.cmake
> +@@ -14,6 +14,7 @@
> + #    RELATIVE_URL - if set, then URL is treated as a base, and FILENAME will be appended to it
> + #  Note: uses OPENCV_DOWNLOAD_PATH folder as cache, default is <opencv>/.cache
> + 
> ++set(OPENCV_ALLOW_DOWNLOADS ON CACHE BOOL "Allow downloads")
> + set(HELP_OPENCV_DOWNLOAD_PATH "Cache directory for downloaded files")
> + if(DEFINED ENV{OPENCV_DOWNLOAD_PATH})
> +   set(OPENCV_DOWNLOAD_PATH "$ENV{OPENCV_DOWNLOAD_PATH}" CACHE PATH "${HELP_OPENCV_DOWNLOAD_PATH}")
> +@@ -156,6 +157,11 @@ function(ocv_download)
> + 
> +   # Download
> +   if(NOT EXISTS "${CACHE_CANDIDATE}")
> ++	  if(NOT OPENCV_ALLOW_DOWNLOADS)
> ++		  message(FATAL_ERROR "Not going to download ${DL_FILENAME}")
> ++		  return()
> ++	  endif()
> ++
> +     ocv_download_log("#cmake_download \"${CACHE_CANDIDATE}\" \"${DL_URL}\"")
> +     foreach(try ${OPENCV_DOWNLOAD_TRIES_LIST})
> +       ocv_download_log("#try ${try}")
> +-- 
> +2.20.1
> +
> diff --git a/patches/opencv-4.1.2/series b/patches/opencv-4.1.2/series
> new file mode 100644
> index 000000000..aaa28ce52
> --- /dev/null
> +++ b/patches/opencv-4.1.2/series
> @@ -0,0 +1 @@
> +0001-add-option-to-disallow-download-of-files.patch
> diff --git a/rules/opencv.make b/rules/opencv.make
> index 0a6fd7a12..2eab4c9ea 100644
> --- a/rules/opencv.make
> +++ b/rules/opencv.make
> @@ -17,25 +17,70 @@ PACKAGES-$(PTXCONF_OPENCV) += opencv
>  # Paths and names
>  #
>  
> -OPENCV_VERSION	:= 4.1.2
> -OPENCV_MD5	:= 6b390578d57131ae9d6c2a183257399d
> -OPENCV		:= opencv-$(OPENCV_VERSION)
> -OPENCV_SUFFIX	:= zip
> -OPENCV_URL	:= \
> -	$(call ptx/mirror, SF, opencvlibrary/opencv-unix/$(OPENCV_VERSION)/$(OPENCV).$(OPENCV_SUFFIX)) \
> -	https://github.com/opencv/opencv/archive/$(OPENCV_VERSION).$(OPENCV_SUFFIX)
> -OPENCV_SOURCE	:= $(SRCDIR)/$(OPENCV).$(OPENCV_SUFFIX)
> -OPENCV_DIR	:= $(BUILDDIR)/$(OPENCV)
> -OPENCV_LICENSE	:= BSD
> -OPENCV_BUILD_DIR := $(OPENCV_DIR)-build
> +OPENCV_VERSION		:= 4.1.2
> +OPENCV_MD5		:= 6b390578d57131ae9d6c2a183257399d
> +OPENCV			:= opencv-$(OPENCV_VERSION)
> +OPENCV_SUFFIX		:= zip
> +OPENCV_URL		:= \
> +			$(call ptx/mirror, SF, opencvlibrary/opencv-unix/$(OPENCV_VERSION)/$(OPENCV).$(OPENCV_SUFFIX)) \
> +			https://github.com/opencv/opencv/archive/$(OPENCV_VERSION).$(OPENCV_SUFFIX)
> +OPENCV_SOURCE		:= $(SRCDIR)/$(OPENCV).$(OPENCV_SUFFIX)
> +OPENCV_DIR		:= $(BUILDDIR)/$(OPENCV)
> +OPENCV_LICENSE		:= BSD
> +OPENCV_BUILD_DIR 	:= $(OPENCV_DIR)-build
> +
> +OPENCV_ADE_VERSION 	:= v0.1.1f
> +OPENCV_ADE_MD5		:= b624b995ec9c439cbc2e9e6ee940d3a2
> +OPENCV_ADE		:= opencv-ade-$(OPENCV_ADE_VERSION)
> +OPENCV_ADE_SUFFIX	:= zip
> +OPENCV_ADE_URL		:= https://github.com/opencv/ade/archive/$(OPENCV_ADE_VERSION).$(OPENCV_ADE_SUFFIX)
> +OPENCV_ADE_SOURCE	:= $(SRCDIR)/$(OPENCV_ADE).$(OPENCV_ADE_SUFFIX)
> +$(OPENCV_ADE_SOURCE)	:= OPENCV_ADE
> +#OPENCV_ADE_DIR		:= $(OPENCV_DIR)/ade
> +OPENCV_ADE_LICENSE	:= Apache-2.0
> +
> +OPENCV_SOURCES		:= $(OPENCV_SOURCE) $(OPENCV_ADE_SOURCE)
> +
> +
> +OPENCV_DL_DIR		:= $(OPENCV_DIR)/.cache
> +OPENCV_DL_DIR_ADE	:= $(OPENCV_DL_DIR)/ade
> +
> +# ----------------------------------------------------------------------------
> +# Extract
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/opencv.extract:
> +	@$(call targetinfo)
> +	@$(call clean, $(OPENCV_DIR))
> +	@$(call extract, OPENCV)
> +#	@$(call extract, OPENCV_ADE)

Why is this commented out?

> +	@$(call patchin, OPENCV)
> +	@$(call touch)
> +
> +
> +# ----------------------------------------------------------------------------
> +# Extract.post
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/opencv.extract.post:
> +	@$(call targetinfo)
> +	mkdir $(OPENCV_DL_DIR)
> +	mkdir $(OPENCV_DL_DIR_ADE)
> +	cp $(OPENCV_ADE_SOURCE) $(OPENCV_DL_DIR_ADE)/$(OPENCV_ADE_MD5)-$(OPENCV_ADE_VERSION).$(OPENCV_ADE_SUFFIX)
> +	@$(call touch)
> +
>  # ----------------------------------------------------------------------------
>  # Prepare
>  # ----------------------------------------------------------------------------
>  
>  OPENCV_CONF_TOOL	:= cmake
>  
> +
> +EXTRA_CMAKE		:= -DOPENCV_ALLOW_DOWNLOADS=OFF \
> +
>  OPENCV_CONF_OPT		:= \
>  	$(CROSS_CMAKE_USR) \
> +	 $(EXTRA_CMAKE) \
>  	-DANT_EXECUTABLE:FILEPATH= \
>  	-DBUILD_CUDA_STUBS:BOOL=OFF \
>  	-DBUILD_DOCS:BOOL=OFF \
> @@ -48,7 +93,7 @@ OPENCV_CONF_OPT		:= \
>  	-DBUILD_OPENEXR=OFF \
>  	-DBUILD_PACKAGE:BOOL=OFF \
>  	-DBUILD_PERF_TESTS=OFF \
> -	-DBUILD_PNG=OFF \
> +	-DBUILD_PNG=ON \

Should this be a separate change? Seems unrelated

>  	-DBUILD_PROTOBUF=ON \
>  	-DBUILD_SHARED_LIBS:BOOL=ON \
>  	-DBUILD_TBB=OFF \
> @@ -58,7 +103,6 @@ OPENCV_CONF_OPT		:= \
>  	-DBUILD_WEBP=OFF \
>  	-DBUILD_WITH_DEBUG_INFO=OFF \
>  	-DBUILD_WITH_DYNAMIC_IPP=OFF \
> -	-DBUILD_ZLIB=OFF \
>  	-DBUILD_opencv_apps:BOOL=OFF \
>  	-DBUILD_opencv_calib3d:BOOL=$(call ptx/onoff,PTXCONF_OPENCV_CALIB3D) \
>  	-DBUILD_opencv_core:BOOL=ON \
> @@ -110,7 +154,7 @@ OPENCV_CONF_OPT		:= \
>  	-DINSTALL_TO_MANGLED_PATHS:BOOL=OFF \
>  	-DMKL_WITH_OPENMP=OFF \
>  	-DMKL_WITH_TBB=OFF \
> -	-DOPENCV_DOWNLOAD_PATH=$(OPENCV_DIR)/.cache \
> +	-DOPENCV_DOWNLOAD_PATH=$(OPENCV_DL_DIR) \
>  	-DOPENCV_DUMP_HOOKS_FLOW=OFF \
>  	-DOPENCV_ENABLE_MEMALIGN=ON \
>  	-DOPENCV_ENABLE_MEMORY_SANITIZER=OFF \
> @@ -182,7 +226,6 @@ OPENCV_CONF_OPT		:= \
>  	-DWITH_XIMEA:BOOL=OFF \
>  	-DWITH_XINE:BOOL=OFF \
>  
> -
>  $(STATEDIR)/opencv.install:
>  	@$(call targetinfo)
>  	@$(call world/install, OPENCV)
> @@ -194,6 +237,7 @@ ifdef PTXCONF_OPENCV_EXAMPLES
>  endif
>  	@$(call touch)
>  
> +
>  # ----------------------------------------------------------------------------
>  # Target-Install
>  # ----------------------------------------------------------------------------
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

      reply	other threads:[~2020-01-23 11:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-22 16:48 Marian Cichy
2020-01-23 11:29 ` Ahmad Fatoum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c44e0a7-d529-1e42-a5a0-83bc3c86d032@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=m.cichy@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox