@@ -186,8 +186,6 @@ export SCRIPT_SUFFIX='${SCRIPT_SUFFIX}'
186186export LUAROCKS_SUFFIX='${LUAROCKS_SUFFIX} '
187187export DIST_VERSION='${DIST_VERSION} '
188188export projectDir='${projectDir} '
189- export version='${version:- luajit-2.1} '
190- export suffix='${suffix} '
191189"
192190}
193191
@@ -343,21 +341,53 @@ function push_all() {
343341}
344342
345343function prepublish_stash_push() {
346- for version in luajit-2.1 5.{4,3,2,1}; do
347- for suffix in ' ' ' -contrib' ; do
348- bash -c " cd out/prepublish/${version} /opencv_lua${suffix} && git stash push --include-untracked --all -- samples"
349- wsl -c " source scripts/wsl_init.sh && cd out/prepublish/${version} /opencv_lua${suffix} && git stash push --include-untracked --all -- samples"
350- done
344+ local script=' cd out/prepublish/${version}/opencv_lua${suffix} && git stash push --include-untracked --all -- samples'
345+
346+ bash -c "
347+ for version in luajit-2.1 5.{4,3,2,1}; do
348+ for suffix in '' '-contrib'; do
349+ _PATH=\$ PATH; pushd \$ PWD
350+ ${script}
351+ popd; PATH=\$ _PATH; unset _PATH
352+ done
353+ done
354+ "
355+
356+ wsl -c "
357+ source scripts/wsl_init.sh
358+ for version in luajit-2.1 5.{4,3,2,1}; do
359+ for suffix in '' '-contrib'; do
360+ _PATH=\$ PATH; pushd \$ PWD
361+ ${script}
362+ popd; PATH=\$ _PATH; unset _PATH
351363 done
364+ done
365+ "
352366}
353367
354368function prepublish_stash_pop() {
355- for version in luajit-2.1 5.{4,3,2,1}; do
356- for suffix in ' ' ' -contrib' ; do
357- bash -c " cd out/prepublish/${version} /opencv_lua${suffix} && git reset --hard HEAD && git stash pop"
358- wsl -c " source scripts/wsl_init.sh && cd out/prepublish/${version} /opencv_lua${suffix} && git reset --hard HEAD && git stash pop"
359- done
369+ local script=' cd ${CWD}/out/prepublish/${version}/opencv_lua${suffix} && git reset --hard HEAD && git stash pop'
370+
371+ bash -c "
372+ for version in luajit-2.1 5.{4,3,2,1}; do
373+ for suffix in '' '-contrib'; do
374+ _PATH=\$ PATH; pushd \$ PWD
375+ ${script}
376+ popd; PATH=\$ _PATH; unset _PATH
360377 done
378+ done
379+ "
380+
381+ wsl -c "
382+ source scripts/wsl_init.sh
383+ for version in luajit-2.1 5.{4,3,2,1}; do
384+ for suffix in '' '-contrib'; do
385+ _PATH=\$ PATH; pushd \$ PWD
386+ ${script}
387+ popd; PATH=\$ _PATH; unset _PATH
388+ done
389+ done
390+ "
361391}
362392
363393function prepublish_any() {
@@ -580,6 +610,7 @@ function build_custom_wsl() {
580610 new_version && \
581611 wsl -c "
582612$( export_shared_env /mnt) ; source scripts/wsl_init.sh || exit \$ ?
613+ WORKING_DIRECTORY=\$ {sources}/../opencv-lua-custom
583614[ -d \$ {WORKING_DIRECTORY} ] || mkdir \$ {WORKING_DIRECTORY} || exit \$ ?
584615[ -d \$ {projectDir}/out/prepublish/server-${name} ] || mkdir \$ {projectDir}/out/prepublish/server-${name} || exit \$ ?
585616[ -L \$ {WORKING_DIRECTORY}/server ] || ln -s \$ {projectDir}/out/prepublish/server-wsl \$ {WORKING_DIRECTORY}/server || exit \$ ?
@@ -622,6 +653,7 @@ function test_rock_script() {
622653 local script='
623654
624655if command -v cygpath &>/dev/null; then
656+ unset -f ln
625657function ln() {
626658 local opt="$1"; shift
627659 local dest="$1"; shift
@@ -706,10 +738,6 @@ else
706738 cd ..
707739fi
708740
709- function luarocks() {
710- ./luarocks/luarocks${LUAROCKS_SUFFIX} "$@"
711- }
712-
713741# ================================
714742# Install the rock
715743# ================================
@@ -722,10 +750,10 @@ else
722750 opencv_lua_version=
723751fi
724752
725- luarocks install --deps-only samples/samples-scm-1.rockspec || exit $?
726- opencv_lua_installed="$(luarocks list --porcelain opencv_lua${suffix})"
727- [ ${#opencv_lua_installed} -eq 0 ] || luarocks remove opencv_lua${suffix} || exit $?
728- luarocks install "--server=${projectDir}/out/prepublish/server" opencv_lua${suffix} ${opencv_lua_version} || exit $?
753+ ./ luarocks/luarocks${LUAROCKS_SUFFIX} install --deps-only samples/samples-scm-1.rockspec || exit $?
754+ opencv_lua_installed="$(./ luarocks/luarocks${LUAROCKS_SUFFIX} list --porcelain opencv_lua${suffix})"
755+ [ ${#opencv_lua_installed} -eq 0 ] || ./ luarocks/luarocks${LUAROCKS_SUFFIX} remove opencv_lua${suffix} || exit $?
756+ ./ luarocks/luarocks${LUAROCKS_SUFFIX} install "--server=${projectDir}/out/prepublish/server" opencv_lua${suffix} ${opencv_lua_version} || exit $?
729757
730758# ================================
731759# Run the tests
@@ -749,63 +777,102 @@ PYTHON_VENV_PATH="${CWD}/out/test/.venv" MODELS_PATH="${projectDir}/out/test/.mo
749777 echo " rock_type=${rock_type} ; $script "
750778}
751779
752- function test_prepublished_binary_windows() {
753- local script=" $( test_rock_script 0 binary " $@ " ) "
780+ function test_prepublished_windows() {
781+ local exclude=$1 ; shift
782+ local rock_type=$1 ; shift
783+ local script=" $( test_rock_script $exclude $rock_type " $@ " ) "
784+ local versions
754785
755- for version in luajit-2.1 5.{4,3,2,1}; do
756- for suffix in ' ' ' -contrib' ; do
757- bash -c " source scripts/vcvars_restore_start.sh; $( export_shared_env) ; ${script} " || return $?
758- done
759- done
760- }
786+ if [ " $rock_type " == " source" ]; then
787+ versions=' luajit-2.1'
788+ else
789+ versions=' luajit-2.1 5.{4,3,2,1}'
790+ fi
761791
762- function test_prepublished_binary_wsl() {
763- local script=" $( test_rock_script 1 binary " $@ " ) "
792+ bash -c "
793+ $( export_shared_env)
794+ source scripts/vcvars_restore_start.sh
764795
765- for version in luajit-2.1 5.{4,3,2,1}; do
766- for suffix in ' ' ' -contrib' ; do
767- wsl -c " $( export_shared_env /mnt) ; source \$ {projectDir}/scripts/wsl_init.sh || exit \$ ?; $script " || return $?
768- done
796+ for version in ${versions} ; do
797+ for suffix in '' '-contrib'; do
798+ _PATH=\$ PATH; pushd \$ PWD
799+ ${script} || exit \$ ?
800+ popd; PATH=\$ _PATH; unset _PATH
769801 done
802+ done
803+ "
804+ }
805+
806+ function test_prepublished_binary_windows() {
807+ test_prepublished_windows 0 binary " $@ "
770808}
771809
772810function test_prepublished_source_windows() {
773- local script=" $( test_rock_script 0 source " $@ " ) "
811+ test_prepublished_windows 0 source " $@ "
812+ }
774813
775- for version in luajit-2.1; do
776- for suffix in ' ' ' -contrib' ; do
777- bash -c " source scripts/vcvars_restore_start.sh; $( export_shared_env) ; ${script} " || return $?
778- done
814+ function test_prepublished_wsl() {
815+ local exclude=$1 ; shift
816+ local rock_type=$1 ; shift
817+ local script=" $( test_rock_script $exclude $rock_type " $@ " ) "
818+ local versions
819+
820+ if [ " $rock_type " == " source" ]; then
821+ versions=' luajit-2.1'
822+ else
823+ versions=' luajit-2.1 5.{4,3,2,1}'
824+ fi
825+
826+ wsl -c "
827+ $( export_shared_env /mnt)
828+ source \$ {projectDir}/scripts/wsl_init.sh || exit \$ ?
829+
830+ for version in ${versions} ; do
831+ for suffix in '' '-contrib'; do
832+ _PATH=\$ PATH; pushd \$ PWD
833+ ${script} || exit \$ ?
834+ popd; PATH=\$ _PATH; unset _PATH
779835 done
836+ done
837+ "
780838}
781839
782- function test_prepublished_source_wsl() {
783- local script=" $( test_rock_script 1 source " $@ " ) "
840+ function test_prepublished_binary_wsl() {
841+ test_prepublished_wsl 1 binary " $@ "
842+ }
784843
785- for version in luajit-2.1; do
786- for suffix in ' ' ' -contrib' ; do
787- wsl -c " $( export_shared_env /mnt) ; source \$ {projectDir}/scripts/wsl_init.sh || exit \$ ?; $script " || return $?
788- done
789- done
844+ function test_prepublished_source_wsl() {
845+ test_prepublished_wsl 1 source " $@ "
790846}
791847
792848function test_prepublished_docker() {
793849 local name=$1 ; shift
794850 local exclude=$1 ; shift
795851 local rock_type=$1 ; shift
796852 local script=" $( test_rock_script $exclude $rock_type " $@ " ) "
853+ local versions
797854
798- for version in luajit-2.1 5.{4,3,2,1}; do
799- for suffix in ' ' ' -contrib' ; do
800- docker exec -u 1001 -it ${name} bash -c "
855+ if [ " $rock_type " == " source" ]; then
856+ versions=' luajit-2.1'
857+ else
858+ versions=' luajit-2.1 5.{4,3,2,1}'
859+ fi
860+
861+ docker exec -u 1001 -it ${name} bash -c "
801862git config --global --add safe.directory /src/.git && \
802863source /src/scripts/tasks.sh && \
803864make_available_nvs && nvs add 16 && nvs use 16 && \
804865cd /io || exit \$ ?
805866$( export_shared_env ' ' /src)
806- ${script} " || return $?
807- done
867+
868+ for version in ${versions} ; do
869+ for suffix in '' '-contrib'; do
870+ _PATH=\$ PATH; pushd \$ PWD
871+ ${script} || exit \$ ?
872+ popd; PATH=\$ _PATH; unset _PATH
808873 done
874+ done
875+ "
809876}
810877
811878function install_test_essentials_debian() {
@@ -867,6 +934,11 @@ $(get_current_package_manager)
867934\$ cpm install -y curl gcc gcc-c++ git glib2 readline-devel libglvnd-glx libSM libXext make patch python3-pip unzip wget || \
868935exit \$ ?
869936
937+ source /etc/os-release
938+ if [ \"\$ NAME\" == \" AlmaLinux\" ]; then
939+ \$ cpm install -y python3-devel # needed to install opencv-python || exit \$ ?
940+ fi
941+
870942$( docker_init_script) "
871943}
872944
@@ -989,19 +1061,33 @@ node scripts/test.js --Release'
9891061function test_prepublished_build_windows() {
9901062 local script=" $( test_build_script 0 " $@ " ) "
9911063
992- for version in luajit-2.1 5.{4,3,2,1}; do
993- for suffix in ' ' ' -contrib' ; do
994- bash -c " source scripts/vcvars_restore_start.sh; $( export_shared_env) ; $script " || return $?
995- done
1064+ bash -c "
1065+ source scripts/vcvars_restore_start.sh
1066+ $( export_shared_env)
1067+
1068+ for version in luajit-2.1 5.{4,3,2,1}; do
1069+ for suffix in '' '-contrib'; do
1070+ _PATH=\$ PATH; pushd \$ PWD
1071+ ${script} || exit \$ ?
1072+ popd; PATH=\$ _PATH; unset _PATH
9961073 done
1074+ done
1075+ "
9971076}
9981077
9991078function test_prepublished_build_wsl() {
10001079 local script=" $( test_build_script 1 " $@ " ) "
10011080
1002- for version in luajit-2.1 5.{4,3,2,1}; do
1003- for suffix in ' ' ' -contrib' ; do
1004- wsl -c " $( export_shared_env /mnt) ; source \$ {projectDir}/scripts/wsl_init.sh || exit \$ ?; $script " || return $?
1005- done
1081+ wsl -c "
1082+ $( export_shared_env /mnt)
1083+ source \$ {projectDir}/scripts/wsl_init.sh || exit \$ ?
1084+
1085+ for version in luajit-2.1 5.{4,3,2,1}; do
1086+ for suffix in '' '-contrib'; do
1087+ _PATH=\$ PATH; pushd \$ PWD
1088+ ${script} || exit \$ ?
1089+ popd; PATH=\$ _PATH; unset _PATH
10061090 done
1091+ done
1092+ "
10071093}
0 commit comments