[opencv] 179/251: Updated package dependency list & package check script.

Nobuhiro Iwamatsu iwamatsu at moszumanska.debian.org
Sun Aug 27 23:27:40 UTC 2017


This is an automated email from the git hooks/post-receive script.

iwamatsu pushed a commit to annotated tag 3.3.0
in repository opencv.

commit 04cd09a30a8e9d8a3b36c9d2e9409bb6db6a21b0
Author: Kerry Billingham <contact at AvionicEngineers.com>
Date:   Wed Jul 26 09:28:42 2017 +0100

    Updated package dependency list & package check script.
---
 platforms/maven/opencv/pom.xml                   | 12 ++--
 platforms/maven/opencv/scripts/deb_package_check | 88 ++++++++++++++++++++----
 2 files changed, 80 insertions(+), 20 deletions(-)

diff --git a/platforms/maven/opencv/pom.xml b/platforms/maven/opencv/pom.xml
index e3e424b..33d9162 100644
--- a/platforms/maven/opencv/pom.xml
+++ b/platforms/maven/opencv/pom.xml
@@ -67,6 +67,10 @@
                             <workingDirectory>${project.basedir}/scripts</workingDirectory>
                             <arguments>
                                 <argument>deb_package_check</argument>
+                                <argument>-olibpng-dev|libpng12-dev</argument>
+                                <argument>-olibopenjp2-7-dev|libjasper-dev</argument>
+                                <argument>-opython-dev</argument>
+                                <argument>-opython-numpy</argument>
                                 <argument>build-essential</argument>
                                 <argument>cmake</argument>
                                 <argument>git</argument>
@@ -75,14 +79,10 @@
                                 <argument>libavcodec-dev</argument>
                                 <argument>libavformat-dev</argument>
                                 <argument>libswscale-dev</argument>
-                                <argument>python-dev</argument>
-                                <argument>python-numpy</argument>
                                 <argument>libtbb2</argument>
                                 <argument>libtbb-dev</argument>
                                 <argument>libjpeg-dev</argument>
-                                <argument>libpng12-dev</argument>
                                 <argument>libtiff5-dev</argument>
-                                <argument>libjasper-dev</argument>
                                 <argument>libdc1394-22-dev</argument>
                                 <argument>execstack</argument>
                                 <argument>ant</argument>
@@ -182,13 +182,13 @@
                                 <requireEnvironmentVariable>
                                     <level>WARN</level>
                                     <variableName>JAVA_HOME</variableName>
-                                    <message>$JAVA_HOME is not set. Build WILL fail.</message>
+                                    <message>$JAVA_HOME is not set. Build may fail.</message>
                                 </requireEnvironmentVariable>
                                 <requireEnvironmentVariable>
                                     <level>WARN</level>
                                     <variableName>MAKEFLAGS</variableName>
                                     <message>No MAKEFLAGS environment variable. Build may be slow.
-                                        To speed up the build you can try exporting MAKEFLAGS=-jX where X equals the number of parallel builds.</message>
+To speed up the build you can try exporting MAKEFLAGS=-jX where X equals the number of parallel builds.</message>
                                 </requireEnvironmentVariable>
                             </rules>
                         </configuration>
diff --git a/platforms/maven/opencv/scripts/deb_package_check b/platforms/maven/opencv/scripts/deb_package_check
index 504e758..ced31ac 100755
--- a/platforms/maven/opencv/scripts/deb_package_check
+++ b/platforms/maven/opencv/scripts/deb_package_check
@@ -1,10 +1,16 @@
 #!/bin/bash
-###########################################################################################
+##################################################################################################
 #
 # 		This script checks for the required Debian packages are installed
 # 		to build OpenCV.
 # Commandline parameters:
-# $@ - These are the names of the packages to check with 'dpkg'
+# $@                These are the names of the packages to check with 'dpkg'. Multiple values may
+#         be specified per package by using pipe as a delimiter, e.g. libpng-dev|libpng12-dev.
+#         Multiple values are evaluated left-to-right and the first found prevents checking of
+#         the remaining package options.
+#
+# -o <package_name> Specifying this switch with a package name marks it as optional
+#                   i.e. it is not required to be installed.
 #
 # Returns:
 #   0 - All packages installed (success)
@@ -13,29 +19,83 @@
 #   Kerry Billingham <contact (at) avionicengineers (d0t) com>
 #   20 April 2016
 #
-###########################################################################################
+##################################################################################################
 red=$'\e[1;31m'
 green=$'\e[1;32m'
+yellow=$'\e[1;33m'
 end=$'\e[0m'
-check_message="Checking for 'dpkg'"
+check_message="Checking for "
+declare -i packageMissing=0
+declare -i installed=1
+
+#########################
+# Function declarations.
+#########################
+function check_package() {
+     check_message="Checking for package "
+     dpkg -s $1 &>/dev/null
+     is_installed=$?
+     if [ ${is_installed} -ne 0 ]; then
+          printf "%-80s%s\n" "$2${check_message}${red}$1" " MISSING.${end}"
+          packageMissing=1
+     else
+          printf "%-80s%s\n" "$2${check_message}${green}$1" " INSTALLED.${end}"
+          packageMissing=0
+     fi
+     return $is_installed
+}
+
+# Main part of script.
+ORIGINAL_IFS=$IFS
+
 dpkg -? &>/dev/null
 if [ $? -ne 0 ]; then
-    printf "%-80s%s\n" "${check_message}" "${red} MISSING.${end}"
+    printf "%-80s%s\n" "${check_message} ${red}'dpkg'" " MISSING.${end}"
     exit 1
 else
-    printf "%-80s%s\n" "${check_message}" "${green} INSTALLED.${end}"
+    printf "%-80s%s\n" "${check_message} ${green}'dpkg'" " INSTALLED.${end}"
 fi
 
-declare -i packageMissing=0
-packageArray=( "$@" )
+while getopts o: option; do
+    case $option in
+        o)
+            IFS="|"
+            packageChoices=( ${OPTARG} )
+            if [ ${#packageChoices[@]} -gt 1 ]; then
+                echo "Optional package. One of ${yellow}${packageChoices[@]}${end} can be installed."
+                for choice in ${packageChoices[@]}; do
+                    check_package ${choice} "    "
+                    if [ $? -eq 0 ]; then
+                        break
+                    fi
+                done
+            else
+                echo "Optional package ${yellow}${packageChoices}${end}"
+                check_package ${OPTARG} "    "
+            fi
+            IFS=$ORIGINAL_IFS
+            ;;
+        \?)
+            echo "No option found"
+            ;;
+    esac
+done
+
+shift $((OPTIND-1))
+packageArray=( $@ )
 for package in ${packageArray[@]}; do
-    check_message="Checking for package ${package}"
-    dpkg -s ${package} &>/dev/null
-    if [ $? -ne 0 ]; then
-        printf "%-80s%s\n" "${check_message}" "${red} MISSING.${end}"
-        packageMissing=1
+    IFS="|"
+    packageChoices=( ${package} )
+    if [ ${#packageChoices[@]} -gt 1 ]; then
+        echo "Multiple options. One of ${yellow}${packageChoices[@]}${end} must be installed."
+        for choice in ${packageChoices[@]}; do
+            check_package ${choice} "    "
+            if [ $? -eq 0 ]; then
+                break
+            fi
+        done
     else
-        printf "%-80s%s\n" "${check_message}" "${green} INSTALLED.${end}"
+        check_package ${package} ""
     fi
 done
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git



More information about the debian-science-commits mailing list