[oe] [meta-multimedia][PATCH 6/6] mycroft: Initial commit

Khem Raj raj.khem at gmail.com
Fri Apr 5 17:30:32 UTC 2019


On Fri, Apr 5, 2019 at 7:44 AM Alistair Francis <alistair23 at gmail.com> wrote:
>
> On Wed, Apr 3, 2019 at 4:26 PM Alistair Francis
> <Alistair.Francis at wdc.com> wrote:
> >
> > Mycroft is an open source speech assistant. It traditionally runs inside
> > Python virtual env and installs all of the pip and native packages and
> > programs that is needs at setup. This generally includes a native gcc
> > build for some of the binaries in the pip packages.
> >
> > This patch adds Mycroft support and edits the source to remove the
> > Python venv usage so we can just run in standard Python world. This
> > allows us to use the preinstalled Python packages where avaliable and
> > avoid installing too much on the target at runtime. At the moment we
> > still require a few simple Python packages to be installed but we don't
> > requrie any target compilation.
> >
> > Hopefully in the future we can remove all of the runtime install
> > requirements by adding all the Python packages to the rootFS pre-boot
> > and setting up the other files/directories as required during the build
> > process.
> >
> > Signed-off-by: Alistair Francis <alistair.francis at wdc.com>
>
> I have sent a v2, it only affects this patch (patch 6). It changes it
> to setup Mycroft on the first boot instead of forcing the user to
> manually do it.
>

thanks I have take v2 series

> Alistair
>
> > ---
> >  .../files/0001-Remove-python-venv.patch       | 192 ++++++++++++++++++
> >  ...irements-Remove-ones-installed-by-OE.patch |  62 ++++++
> >  ...3-and-pip3-instead-of-python-and-pip.patch | 135 ++++++++++++
> >  ...v_setup.sh-Remove-the-git-dependency.patch |  48 +++++
> >  ....sh-Remove-the-test-setup-dependency.patch |  31 +++
> >  .../mycroft/files/mycroft.service             |  13 ++
> >  .../mycroft/mycroft_19.2.2.bb                 |  61 ++++++
> >  7 files changed, 542 insertions(+)
> >  create mode 100644 meta-multimedia/recipes-multimedia/mycroft/files/0001-Remove-python-venv.patch
> >  create mode 100644 meta-multimedia/recipes-multimedia/mycroft/files/0002-pip-requirements-Remove-ones-installed-by-OE.patch
> >  create mode 100644 meta-multimedia/recipes-multimedia/mycroft/files/0003-Use-python3-and-pip3-instead-of-python-and-pip.patch
> >  create mode 100644 meta-multimedia/recipes-multimedia/mycroft/files/0004-dev_setup.sh-Remove-the-git-dependency.patch
> >  create mode 100644 meta-multimedia/recipes-multimedia/mycroft/files/0005-dev_setup.sh-Remove-the-test-setup-dependency.patch
> >  create mode 100644 meta-multimedia/recipes-multimedia/mycroft/files/mycroft.service
> >  create mode 100644 meta-multimedia/recipes-multimedia/mycroft/mycroft_19.2.2.bb
> >
> > diff --git a/meta-multimedia/recipes-multimedia/mycroft/files/0001-Remove-python-venv.patch b/meta-multimedia/recipes-multimedia/mycroft/files/0001-Remove-python-venv.patch
> > new file mode 100644
> > index 000000000..c03bccd3d
> > --- /dev/null
> > +++ b/meta-multimedia/recipes-multimedia/mycroft/files/0001-Remove-python-venv.patch
> > @@ -0,0 +1,192 @@
> > +From 6272f36080bd440a5825b526f4c06223c5bb9fbb Mon Sep 17 00:00:00 2001
> > +From: Alistair Francis <alistair.francis at wdc.com>
> > +Date: Mon, 18 Mar 2019 16:30:45 -0700
> > +Subject: [PATCH 1/5] Remove python venv
> > +
> > +Remove the python venv requirements and instead just use the native
> > +python and pip pacakges.
> > +
> > +Signed-off-by: Alistair Francis <alistair.francis at wdc.com>
> > +Upstream-Status: Inappropriate [embedded specific]
> > +---
> > + dev_setup.sh     | 36 ------------------------------------
> > + start-mycroft.sh | 13 -------------
> > + venv-activate.sh | 44 +-------------------------------------------
> > + 3 files changed, 1 insertion(+), 92 deletions(-)
> > +
> > +diff --git a/dev_setup.sh b/dev_setup.sh
> > +index e0b07bf25cf..aed54b2167a 100755
> > +--- a/dev_setup.sh
> > ++++ b/dev_setup.sh
> > +@@ -310,18 +310,6 @@ function install_deps() {
> > +     fi
> > + }
> > +
> > +-VIRTUALENV_ROOT=${VIRTUALENV_ROOT:-"${TOP}/.venv"}
> > +-
> > +-function install_venv() {
> > +-    ${opt_python} -m venv "${VIRTUALENV_ROOT}/" --without-pip
> > +-    # Force version of pip for reproducability, but there is nothing special
> > +-    # about this version.  Update whenever a new version is released and
> > +-    # verified functional.
> > +-    curl https://bootstrap.pypa.io/3.3/get-pip.py | "${VIRTUALENV_ROOT}/bin/python" - 'pip==18.0.0'
> > +-    # Function status depending on if pip exists
> > +-    [ -x "${VIRTUALENV_ROOT}/bin/pip" ]
> > +-}
> > +-
> > + install_deps
> > +
> > + # Configure to use the standard commit template for
> > +@@ -355,15 +343,7 @@ else
> > +     fi
> > + fi
> > +
> > +-if [ ! -x "${VIRTUALENV_ROOT}/bin/activate" ] ; then
> > +-    if ! install_venv ; then
> > +-        echo "Failed to set up virtualenv for mycroft, exiting setup."
> > +-        exit 1
> > +-    fi
> > +-fi
> > +-
> > + # Start the virtual environment
> > +-source "${VIRTUALENV_ROOT}/bin/activate"
> > + cd "${TOP}"
> > +
> > + # Install pep8 pre-commit hook
> > +@@ -380,22 +360,6 @@ fi
> > +
> > + PYTHON=$( python -c "import sys;print('python{}.{}'.format(sys.version_info[0], sys.version_info[1]))" )
> > +
> > +-# Add mycroft-core to the virtualenv path
> > +-# (This is equivalent to typing 'add2virtualenv $TOP', except
> > +-# you can't invoke that shell function from inside a script)
> > +-VENV_PATH_FILE="${VIRTUALENV_ROOT}/lib/$PYTHON/site-packages/_virtualenv_path_extensions.pth"
> > +-if [ ! -f "$VENV_PATH_FILE" ] ; then
> > +-    echo "import sys; sys.__plen = len(sys.path)" > "$VENV_PATH_FILE" || return 1
> > +-    echo "import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)" >> "$VENV_PATH_FILE" || return 1
> > +-fi
> > +-
> > +-if ! grep -q "$TOP" $VENV_PATH_FILE ; then
> > +-    echo "Adding mycroft-core to virtualenv path"
> > +-    sed -i.tmp '1 a\
> > +-'"$TOP"'
> > +-' "${VENV_PATH_FILE}"
> > +-fi
> > +-
> > + # install required python modules
> > + if ! pip install -r requirements.txt ; then
> > +     echo "Warning: Failed to install all requirements. Continue? y/N"
> > +diff --git a/start-mycroft.sh b/start-mycroft.sh
> > +index b9514a61ba5..64e0216a62f 100755
> > +--- a/start-mycroft.sh
> > ++++ b/start-mycroft.sh
> > +@@ -20,7 +20,6 @@ script=${0}
> > + script=${script##*/}
> > + cd -P "$( dirname "$SOURCE" )"
> > + DIR="$( pwd )"
> > +-VIRTUALENV_ROOT=${VIRTUALENV_ROOT:-"${DIR}/.venv"}
> > +
> > + function help() {
> > +     echo "${script}:  Mycroft command/service launcher"
> > +@@ -76,19 +75,11 @@ function name-to-script-path() {
> > +     esac
> > + }
> > +
> > +-function source-venv() {
> > +-    # Enter Python virtual environment, unless under Docker
> > +-    if [ ! -f "/.dockerenv" ] ; then
> > +-        source ${VIRTUALENV_ROOT}/bin/activate
> > +-    fi
> > +-}
> > +-
> > + first_time=true
> > + function init-once() {
> > +     if ($first_time) ; then
> > +         echo "Initializing..."
> > +         "${DIR}/scripts/prepare-msm.sh"
> > +-        source-venv
> > +         first_time=false
> > +     fi
> > + }
> > +@@ -225,15 +216,12 @@ case ${_opt} in
> > +     #    launch-background ${_opt}
> > +     #    ;;
> > +     "unittest")
> > +-        source-venv
> > +         pytest test/unittests/ --cov=mycroft "$@"
> > +         ;;
> > +     "singleunittest")
> > +-        source-venv
> > +         pytest "$@"
> > +         ;;
> > +     "skillstest")
> > +-        source-venv
> > +         pytest test/integrationtests/skills/discover_tests.py "$@"
> > +         ;;
> > +     "audiotest")
> > +@@ -243,7 +231,6 @@ case ${_opt} in
> > +         launch-process ${_opt}
> > +         ;;
> > +     "sdkdoc")
> > +-        source-venv
> > +         cd doc
> > +         make ${opt}
> > +         cd ..
> > +diff --git a/venv-activate.sh b/venv-activate.sh
> > +index d1e7bcb44e7..10b46d4de3b 100644
> > +--- a/venv-activate.sh
> > ++++ b/venv-activate.sh
> > +@@ -22,49 +22,7 @@
> > +
> > + # wrap in function to allow local variables, since this file will be source'd
> > + function main() {
> > +-    local quiet=0
> > +-
> > +-    for arg in "$@"
> > +-    do
> > +-        case $arg in
> > +-            "-q"|"--quiet" )
> > +-               quiet=1
> > +-               ;;
> > +-
> > +-            "-h"|"--help" )
> > +-               echo "venv-activate.sh:  Enter the Mycroft virtual environment"
> > +-               echo "Usage:"
> > +-               echo "   source venv-activate.sh"
> > +-               echo "or"
> > +-               echo "   . venv-activate.sh"
> > +-               echo ""
> > +-               echo "Options:"
> > +-               echo "   -q | --quiet    Don't show instructions."
> > +-               echo "   -h | --help    Show help."
> > +-               return 0
> > +-               ;;
> > +-
> > +-            *)
> > +-               echo "ERROR:  Unrecognized option: $@"
> > +-               return 1
> > +-               ;;
> > +-       esac
> > +-    done
> > +-
> > +-    if [ "$0" == "$BASH_SOURCE" ] ; then
> > +-        # Prevent running in script then exiting immediately
> > +-        echo "ERROR: Invoke with 'source venv-activate.sh' or '. venv-activate.sh'"
> > +-    else
> > +-        local SRC_DIR="$( builtin cd "$( dirname "${BASH_SOURCE}" )" ; pwd -P )"
> > +-        source ${SRC_DIR}/.venv/bin/activate
> > +-
> > +-        # Provide an easier to find "mycroft-" prefixed command.
> > +-        unalias mycroft-venv-activate 2>/dev/null
> > +-        alias mycroft-venv-deactivate="deactivate && unalias mycroft-venv-deactivate 2>/dev/null && alias mycroft-venv-activate=\"source '${SRC_DIR}/venv-activate.sh'\""
> > +-        if [ $quiet -eq 0 ] ; then
> > +-            echo "Entering Mycroft virtual environment.  Run 'mycroft-venv-deactivate' to exit"
> > +-        fi
> > +-    fi
> > ++   echo "Not entering Python VENV"
> > + }
> > +
> > + main $@
> > +--
> > +2.21.0
> > +
> > diff --git a/meta-multimedia/recipes-multimedia/mycroft/files/0002-pip-requirements-Remove-ones-installed-by-OE.patch b/meta-multimedia/recipes-multimedia/mycroft/files/0002-pip-requirements-Remove-ones-installed-by-OE.patch
> > new file mode 100644
> > index 000000000..ca79d00b4
> > --- /dev/null
> > +++ b/meta-multimedia/recipes-multimedia/mycroft/files/0002-pip-requirements-Remove-ones-installed-by-OE.patch
> > @@ -0,0 +1,62 @@
> > +From 142bc3912ea9e1a4ecf4db0e2bec3049aa416464 Mon Sep 17 00:00:00 2001
> > +From: Alistair Francis <alistair.francis at wdc.com>
> > +Date: Tue, 19 Mar 2019 13:32:54 -0700
> > +Subject: [PATCH 2/5] pip requirements: Remove ones installed by OE
> > +
> > +Signed-off-by: Alistair Francis <alistair.francis at wdc.com>
> > +Upstream-Status: Inappropriate [embedded specific]
> > +---
> > + requirements.txt      | 14 --------------
> > + test-requirements.txt |  1 -
> > + 2 files changed, 15 deletions(-)
> > +
> > +diff --git a/requirements.txt b/requirements.txt
> > +index 7e4faf48182..29536e990ac 100644
> > +--- a/requirements.txt
> > ++++ b/requirements.txt
> > +@@ -1,20 +1,10 @@
> > +-six==1.10.0
> > +-requests==2.20.0
> > + gTTS==2.0.3
> > + gTTS-token==1.1.3
> > +-PyAudio==0.2.11
> > + pyee==5.0.0
> > + SpeechRecognition==3.8.1
> > +-tornado==4.5.3
> > + websocket-client==0.54.0
> > + requests-futures==0.9.5
> > +-pyalsaaudio==0.8.2
> > + xmlrunner==1.7.7
> > +-pyserial==3.0
> > +-psutil==5.2.1
> > +-pocketsphinx==0.1.0
> > +-inflection==0.3.1
> > +-pillow==4.1.1
> > + python-dateutil==2.6.0
> > + pychromecast==0.7.7
> > + python-vlc==1.1.2
> > +@@ -26,10 +16,6 @@ msm==0.7.3
> > + msk==0.3.12
> > + adapt-parser==0.3.2
> > + padatious==0.4.6
> > +-fann2==1.0.7
> > + padaos==0.1.9
> > + precise-runner==0.2.1
> > + petact==0.1.2
> > +-
> > +-# dev setup tools
> > +-pep8==1.7.0
> > +diff --git a/test-requirements.txt b/test-requirements.txt
> > +index 8ada8157c95..eb4e364a9b4 100644
> > +--- a/test-requirements.txt
> > ++++ b/test-requirements.txt
> > +@@ -1,6 +1,5 @@
> > + pep8==1.7.0
> > + coveralls==1.5.0
> > +-pytest==3.5.0
> > + pytest-cov==2.5.1
> > + cov-core==1.15.0
> > + mock==2.0.0
> > +--
> > +2.21.0
> > +
> > diff --git a/meta-multimedia/recipes-multimedia/mycroft/files/0003-Use-python3-and-pip3-instead-of-python-and-pip.patch b/meta-multimedia/recipes-multimedia/mycroft/files/0003-Use-python3-and-pip3-instead-of-python-and-pip.patch
> > new file mode 100644
> > index 000000000..a1f04b4b4
> > --- /dev/null
> > +++ b/meta-multimedia/recipes-multimedia/mycroft/files/0003-Use-python3-and-pip3-instead-of-python-and-pip.patch
> > @@ -0,0 +1,135 @@
> > +From 87b94e54fefa1f83b41030444fc87b421c97b2c5 Mon Sep 17 00:00:00 2001
> > +From: Alistair Francis <alistair.francis at wdc.com>
> > +Date: Tue, 19 Mar 2019 13:38:44 -0700
> > +Subject: [PATCH 3/5] Use python3 and pip3 instead of python and pip
> > +
> > +Signed-off-by: Alistair Francis <alistair.francis at wdc.com>
> > +Upstream-Status: Inappropriate [embedded specific]
> > +---
> > + bin/mycroft-cli-client          |  2 +-
> > + bin/mycroft-pip                 |  2 +-
> > + bin/mycroft-say-to              |  2 +-
> > + bin/mycroft-skill-testrunner    |  4 ++--
> > + bin/mycroft-speak               |  2 +-
> > + dev_setup.sh                    | 10 +++++-----
> > + scripts/install-pocketsphinx.sh |  2 +-
> > + 7 files changed, 12 insertions(+), 12 deletions(-)
> > +
> > +diff --git a/bin/mycroft-cli-client b/bin/mycroft-cli-client
> > +index f40a316e3f6..de2040d9e67 100755
> > +--- a/bin/mycroft-cli-client
> > ++++ b/bin/mycroft-cli-client
> > +@@ -21,4 +21,4 @@ DIR="$( dirname "$SOURCE" )"
> > + source "$DIR/../venv-activate.sh" -q
> > +
> > + # Invoke the Command Line Interface
> > +-python -m mycroft.client.text $@
> > ++python3 -m mycroft.client.text $@
> > +diff --git a/bin/mycroft-pip b/bin/mycroft-pip
> > +index a42b16b847a..81bd5bfb3cf 100755
> > +--- a/bin/mycroft-pip
> > ++++ b/bin/mycroft-pip
> > +@@ -21,4 +21,4 @@ DIR="$( dirname "$SOURCE" )"
> > + source "$DIR/../venv-activate.sh" -q
> > +
> > + # Install pip packages within the Mycroft venv
> > +-pip $@
> > +\ No newline at end of file
> > ++pip3 $@
> > +\ No newline at end of file
> > +diff --git a/bin/mycroft-say-to b/bin/mycroft-say-to
> > +index 964e16eb0c5..5575969715c 100755
> > +--- a/bin/mycroft-say-to
> > ++++ b/bin/mycroft-say-to
> > +@@ -22,4 +22,4 @@ DIR="$( pwd )"
> > + source "$DIR/../venv-activate.sh" -q
> > +
> > + # Send a message to be spoken
> > +-output=$(python -m mycroft.messagebus.send "recognizer_loop:utterance"  "{\"utterances\": [\"$@\"], \"lang\": \"en-us\"}")
> > ++output=$(python3 -m mycroft.messagebus.send "recognizer_loop:utterance"  "{\"utterances\": [\"$@\"], \"lang\": \"en-us\"}")
> > +diff --git a/bin/mycroft-skill-testrunner b/bin/mycroft-skill-testrunner
> > +index 9699a4d138f..282f5ca65b0 100755
> > +--- a/bin/mycroft-skill-testrunner
> > ++++ b/bin/mycroft-skill-testrunner
> > +@@ -22,7 +22,7 @@ source "$DIR/../venv-activate.sh" -q
> > +
> > + # Invoke the individual skill tester
> > + if [ "$#" -eq 0 ] ; then
> > +-    python -m test.integrationtests.skills.runner .
> > ++    python3 -m test.integrationtests.skills.runner .
> > + else
> > +-    python -m test.integrationtests.skills.runner $@
> > ++    python3 -m test.integrationtests.skills.runner $@
> > + fi
> > +\ No newline at end of file
> > +diff --git a/bin/mycroft-speak b/bin/mycroft-speak
> > +index 51facf29189..c65556f1173 100755
> > +--- a/bin/mycroft-speak
> > ++++ b/bin/mycroft-speak
> > +@@ -22,4 +22,4 @@ DIR="$( pwd )"
> > + source "$DIR/../venv-activate.sh" -q
> > +
> > + # Send a message to be spoken
> > +-output=$(python -m mycroft.messagebus.send "speak"  "{\"utterance\": \"$@\"}")
> > +\ No newline at end of file
> > ++output=$(python3 -m mycroft.messagebus.send "speak"  "{\"utterance\": \"$@\"}")
> > +\ No newline at end of file
> > +diff --git a/dev_setup.sh b/dev_setup.sh
> > +index aed54b2167a..dd391181f19 100755
> > +--- a/dev_setup.sh
> > ++++ b/dev_setup.sh
> > +@@ -48,7 +48,7 @@ param=""
> > +
> > + for var in "$@" ; do
> > +     # Check if parameter should be read
> > +-    if [[ ${param} == "python" ]] ; then
> > ++    if [[ ${param} == "python3" ]] ; then
> > +         opt_python=${var}
> > +         param=""
> > +         continue
> > +@@ -351,17 +351,17 @@ if [ -z ${INSTALL_PRECOMMIT_HOOK} ] ; then
> > +     HOOK_FILE="./.git/hooks/pre-commit"
> > +     if [ ! -f ${HOOK_FILE} ] || grep -q "MYCROFT DEV SETUP" ${HOOK_FILE} ; then
> > +         echo "Installing PEP8 check as precommit-hook"
> > +-        echo "#! $( which python )" > ${HOOK_FILE}
> > ++        echo "#! $( which python3 )" > ${HOOK_FILE}
> > +         echo "# MYCROFT DEV SETUP" >> ${HOOK_FILE}
> > +         cat ./scripts/pre-commit >> ${HOOK_FILE}
> > +         chmod +x ${HOOK_FILE}
> > +     fi
> > + fi
> > +
> > +-PYTHON=$( python -c "import sys;print('python{}.{}'.format(sys.version_info[0], sys.version_info[1]))" )
> > ++PYTHON=$( python3 -c "import sys;print('python{}.{}'.format(sys.version_info[0], sys.version_info[1]))" )
> > +
> > + # install required python modules
> > +-if ! pip install -r requirements.txt ; then
> > ++if ! pip3 install -r requirements.txt ; then
> > +     echo "Warning: Failed to install all requirements. Continue? y/N"
> > +     read -n1 continue
> > +     if [[ "$continue" != "y" ]] ; then
> > +@@ -369,7 +369,7 @@ if ! pip install -r requirements.txt ; then
> > +     fi
> > + fi
> > +
> > +-if ! pip install -r test-requirements.txt ; then
> > ++if ! pip3 install -r test-requirements.txt ; then
> > +     echo "Warning test requirements wasn't installed, Note: normal operation should still work fine..."
> > + fi
> > +
> > +diff --git a/scripts/install-pocketsphinx.sh b/scripts/install-pocketsphinx.sh
> > +index 44d329b7985..d45f5c22747 100755
> > +--- a/scripts/install-pocketsphinx.sh
> > ++++ b/scripts/install-pocketsphinx.sh
> > +@@ -47,7 +47,7 @@ function install_pocketsphinx() {
> > +
> > +     # build and install pocketsphinx python bindings
> > +     cd ${TOP}/pocketsphinx-python
> > +-    python setup.py install
> > ++    python3 setup.py install
> > + }
> > +
> > + if [ "$1" = "-q" ] ; then
> > +--
> > +2.21.0
> > +
> > diff --git a/meta-multimedia/recipes-multimedia/mycroft/files/0004-dev_setup.sh-Remove-the-git-dependency.patch b/meta-multimedia/recipes-multimedia/mycroft/files/0004-dev_setup.sh-Remove-the-git-dependency.patch
> > new file mode 100644
> > index 000000000..b7ca16013
> > --- /dev/null
> > +++ b/meta-multimedia/recipes-multimedia/mycroft/files/0004-dev_setup.sh-Remove-the-git-dependency.patch
> > @@ -0,0 +1,48 @@
> > +From a480dde949f820fda6e46c13261883e851f5a430 Mon Sep 17 00:00:00 2001
> > +From: Alistair Francis <alistair.francis at wdc.com>
> > +Date: Fri, 29 Mar 2019 16:09:57 -0700
> > +Subject: [PATCH 4/5] dev_setup.sh: Remove the git dependency
> > +
> > +Signed-off-by: Alistair Francis <alistair.francis at wdc.com>
> > +Upstream-Status: Inappropriate [embedded specific]
> > +---
> > + dev_setup.sh | 16 ----------------
> > + 1 file changed, 16 deletions(-)
> > +
> > +diff --git a/dev_setup.sh b/dev_setup.sh
> > +index dd391181f19..c6aa783e1ef 100755
> > +--- a/dev_setup.sh
> > ++++ b/dev_setup.sh
> > +@@ -312,10 +312,6 @@ function install_deps() {
> > +
> > + install_deps
> > +
> > +-# Configure to use the standard commit template for
> > +-# this repo only.
> > +-git config commit.template .gitmessage
> > +-
> > + # Check whether to build mimic (it takes a really long time!)
> > + build_mimic="n"
> > + if [[ ${opt_forcemimicbuild} == true ]] ; then
> > +@@ -346,18 +342,6 @@ fi
> > + # Start the virtual environment
> > + cd "${TOP}"
> > +
> > +-# Install pep8 pre-commit hook
> > +-if [ -z ${INSTALL_PRECOMMIT_HOOK} ] ; then
> > +-    HOOK_FILE="./.git/hooks/pre-commit"
> > +-    if [ ! -f ${HOOK_FILE} ] || grep -q "MYCROFT DEV SETUP" ${HOOK_FILE} ; then
> > +-        echo "Installing PEP8 check as precommit-hook"
> > +-        echo "#! $( which python3 )" > ${HOOK_FILE}
> > +-        echo "# MYCROFT DEV SETUP" >> ${HOOK_FILE}
> > +-        cat ./scripts/pre-commit >> ${HOOK_FILE}
> > +-        chmod +x ${HOOK_FILE}
> > +-    fi
> > +-fi
> > +-
> > + PYTHON=$( python3 -c "import sys;print('python{}.{}'.format(sys.version_info[0], sys.version_info[1]))" )
> > +
> > + # install required python modules
> > +--
> > +2.21.0
> > +
> > diff --git a/meta-multimedia/recipes-multimedia/mycroft/files/0005-dev_setup.sh-Remove-the-test-setup-dependency.patch b/meta-multimedia/recipes-multimedia/mycroft/files/0005-dev_setup.sh-Remove-the-test-setup-dependency.patch
> > new file mode 100644
> > index 000000000..5ae868376
> > --- /dev/null
> > +++ b/meta-multimedia/recipes-multimedia/mycroft/files/0005-dev_setup.sh-Remove-the-test-setup-dependency.patch
> > @@ -0,0 +1,31 @@
> > +From 7fc38ae0dec30789fa0d365f1764f4950b700a98 Mon Sep 17 00:00:00 2001
> > +From: Alistair Francis <alistair.francis at wdc.com>
> > +Date: Tue, 2 Apr 2019 16:52:44 -0700
> > +Subject: [PATCH 5/5] dev_setup.sh: Remove the test setup dependency
> > +
> > +Signed-off-by: Alistair Francis <alistair.francis at wdc.com>
> > +Upstream-Status: Inappropriate [embedded specific]
> > +
> > +Signed-off-by: Alistair Francis <alistair.francis at wdc.com>
> > +---
> > + dev_setup.sh | 4 ----
> > + 1 file changed, 4 deletions(-)
> > +
> > +diff --git a/dev_setup.sh b/dev_setup.sh
> > +index c6aa783e1ef..bcfaa0c16c2 100755
> > +--- a/dev_setup.sh
> > ++++ b/dev_setup.sh
> > +@@ -353,10 +353,6 @@ if ! pip3 install -r requirements.txt ; then
> > +     fi
> > + fi
> > +
> > +-if ! pip3 install -r test-requirements.txt ; then
> > +-    echo "Warning test requirements wasn't installed, Note: normal operation should still work fine..."
> > +-fi
> > +-
> > + SYSMEM=$( free | awk '/^Mem:/ { print $2 }' )
> > + MAXCORES=$(($SYSMEM / 512000))
> > + MINCORES=1
> > +--
> > +2.21.0
> > +
> > diff --git a/meta-multimedia/recipes-multimedia/mycroft/files/mycroft.service b/meta-multimedia/recipes-multimedia/mycroft/files/mycroft.service
> > new file mode 100644
> > index 000000000..2d7085795
> > --- /dev/null
> > +++ b/meta-multimedia/recipes-multimedia/mycroft/files/mycroft.service
> > @@ -0,0 +1,13 @@
> > +[Unit]
> > +Description=Mycroft
> > +DefaultDependencies=no
> > +After=systemd-user-sessions.service plymouth-quit.service systemd-logind.service
> > +
> > +[Service]
> > +Type=forking
> > +ExecStartPre=mkdir -p /var/log/mycroft
> > +ExecStart=@LIBDIR@/mycroft/start-mycroft.sh all
> > +ExecStop=@LIBDIR@/mycroft/stop-mycroft.sh all
> > +
> > +[Install]
> > +WantedBy=multi-user.target
> > diff --git a/meta-multimedia/recipes-multimedia/mycroft/mycroft_19.2.2.bb b/meta-multimedia/recipes-multimedia/mycroft/mycroft_19.2.2.bb
> > new file mode 100644
> > index 000000000..d9b3146bc
> > --- /dev/null
> > +++ b/meta-multimedia/recipes-multimedia/mycroft/mycroft_19.2.2.bb
> > @@ -0,0 +1,61 @@
> > +SUMMARY = "Mycroft is a hackable open source voice assistant."
> > +DESCRIPTION = "Mycroft is the world’s first open source assistant. "
> > +HOMEPAGE = "https://mycroft.ai/"
> > +SECTION = "multimedia"
> > +
> > +LICENSE = "Apache-2.0"
> > +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=79aa497b11564d1d419ee889e7b498f6"
> > +
> > +SRCREV = "6706c377820912f83c1838d9eb32950ca9e39ec7"
> > +SRC_URI = "git://github.com/MycroftAI/mycroft-core.git;branch=master \
> > +           file://0001-Remove-python-venv.patch \
> > +           file://0002-pip-requirements-Remove-ones-installed-by-OE.patch \
> > +           file://0003-Use-python3-and-pip3-instead-of-python-and-pip.patch \
> > +           file://0004-dev_setup.sh-Remove-the-git-dependency.patch \
> > +           file://0005-dev_setup.sh-Remove-the-test-setup-dependency.patch \
> > +           file://mycroft.service \
> > +          "
> > +
> > +S = "${WORKDIR}/git"
> > +
> > +inherit systemd
> > +
> > +# Mycroft installs itself on the host
> > +# Just copy the setup files to the rootfs
> > +do_install() {
> > +    install -d ${D}${libdir}/
> > +    cp -r ${B} ${D}${libdir}/mycroft
> > +    rm -r ${D}${libdir}/mycroft/.git
> > +
> > +    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
> > +        install -d ${D}${systemd_unitdir}/system
> > +        install -m 644 ${WORKDIR}/mycroft.service ${D}${systemd_unitdir}/system
> > +        sed -i -e 's, at LIBDIR@,${libdir},g' ${D}${systemd_unitdir}/system/mycroft.service
> > +    fi
> > +}
> > +
> > +FILES_${PN} += "${libdir}/mycroft"
> > +
> > +RDEPENDS_${PN} = "python3"
> > +
> > +# Install as many Python packages as we can.
> > +# We don't yet have all the packages in meta-python.
> > +# Install as many as we can and we will install the rest on the target with pip.
> > +# TODO: Add all the remaining packages and remove pip
> > +RDEPENDS_${PN} += "python3-pip \
> > +                   python3-requests python3-pillow \
> > +                   python3-tornado python3-pyyaml \
> > +                   python3-pyalsaaudio python3-inflection \
> > +                   python3-pyserial python3-psutil \
> > +                   python3-pyaudio python3-fann2 \
> > +                   python3-pocketsphinx \
> > +                 "
> > +
> > +# Mycroft uses Alsa and PulseAudio
> > +RDEPENDS_${PN} += "alsa-oss alsa-utils alsa-plugins alsa-tools"
> > +RDEPENDS_${PN} += "pulseaudio pulseaudio-misc pulseaudio-server"
> > +
> > +# Mycroft can do this itself on the target, but it's quicker to do it here
> > +RDEPENDS_${PN} += "mimic"
> > +
> > +SYSTEMD_SERVICE_${PN} = "mycroft.service"
> > --
> > 2.21.0
> >
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel


More information about the Openembedded-devel mailing list