summaryrefslogtreecommitdiffstats
path: root/meta-multimedia
diff options
context:
space:
mode:
authorAlistair Francis <alistair.francis@wdc.com>2019-04-05 14:41:54 +0000
committerKhem Raj <raj.khem@gmail.com>2019-04-06 08:22:22 -0700
commitfb097550fdc5e8a7de6bdceb87d8aa161b94eb06 (patch)
tree73a0e690aee2c7923e4531ac92eba0076fc105a2 /meta-multimedia
parent47f4a924102d014fcd5e68170b98392cfa1f5f44 (diff)
downloadmeta-openembedded-fb097550fdc5e8a7de6bdceb87d8aa161b94eb06.tar.gz
mycroft: Initial commit
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. This patch also adds two systemd services. The first will setup mycroft on boot, the second will start the mycroft voice assistant. Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-multimedia')
-rw-r--r--meta-multimedia/recipes-multimedia/mycroft/files/0001-Remove-python-venv.patch192
-rw-r--r--meta-multimedia/recipes-multimedia/mycroft/files/0002-pip-requirements-Remove-ones-installed-by-OE.patch62
-rw-r--r--meta-multimedia/recipes-multimedia/mycroft/files/0003-Use-python3-and-pip3-instead-of-python-and-pip.patch135
-rw-r--r--meta-multimedia/recipes-multimedia/mycroft/files/0004-dev_setup.sh-Remove-the-git-dependency.patch48
-rw-r--r--meta-multimedia/recipes-multimedia/mycroft/files/0005-dev_setup.sh-Remove-the-test-setup-dependency.patch31
-rw-r--r--meta-multimedia/recipes-multimedia/mycroft/files/dev_opts.json1
-rw-r--r--meta-multimedia/recipes-multimedia/mycroft/files/mycroft-setup.service11
-rw-r--r--meta-multimedia/recipes-multimedia/mycroft/files/mycroft.service13
-rw-r--r--meta-multimedia/recipes-multimedia/mycroft/mycroft_19.2.2.bb73
9 files changed, 566 insertions, 0 deletions
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 @@
1From 6272f36080bd440a5825b526f4c06223c5bb9fbb Mon Sep 17 00:00:00 2001
2From: Alistair Francis <alistair.francis@wdc.com>
3Date: Mon, 18 Mar 2019 16:30:45 -0700
4Subject: [PATCH 1/5] Remove python venv
5
6Remove the python venv requirements and instead just use the native
7python and pip pacakges.
8
9Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
10Upstream-Status: Inappropriate [embedded specific]
11---
12 dev_setup.sh | 36 ------------------------------------
13 start-mycroft.sh | 13 -------------
14 venv-activate.sh | 44 +-------------------------------------------
15 3 files changed, 1 insertion(+), 92 deletions(-)
16
17diff --git a/dev_setup.sh b/dev_setup.sh
18index e0b07bf25cf..aed54b2167a 100755
19--- a/dev_setup.sh
20+++ b/dev_setup.sh
21@@ -310,18 +310,6 @@ function install_deps() {
22 fi
23 }
24
25-VIRTUALENV_ROOT=${VIRTUALENV_ROOT:-"${TOP}/.venv"}
26-
27-function install_venv() {
28- ${opt_python} -m venv "${VIRTUALENV_ROOT}/" --without-pip
29- # Force version of pip for reproducability, but there is nothing special
30- # about this version. Update whenever a new version is released and
31- # verified functional.
32- curl https://bootstrap.pypa.io/3.3/get-pip.py | "${VIRTUALENV_ROOT}/bin/python" - 'pip==18.0.0'
33- # Function status depending on if pip exists
34- [ -x "${VIRTUALENV_ROOT}/bin/pip" ]
35-}
36-
37 install_deps
38
39 # Configure to use the standard commit template for
40@@ -355,15 +343,7 @@ else
41 fi
42 fi
43
44-if [ ! -x "${VIRTUALENV_ROOT}/bin/activate" ] ; then
45- if ! install_venv ; then
46- echo "Failed to set up virtualenv for mycroft, exiting setup."
47- exit 1
48- fi
49-fi
50-
51 # Start the virtual environment
52-source "${VIRTUALENV_ROOT}/bin/activate"
53 cd "${TOP}"
54
55 # Install pep8 pre-commit hook
56@@ -380,22 +360,6 @@ fi
57
58 PYTHON=$( python -c "import sys;print('python{}.{}'.format(sys.version_info[0], sys.version_info[1]))" )
59
60-# Add mycroft-core to the virtualenv path
61-# (This is equivalent to typing 'add2virtualenv $TOP', except
62-# you can't invoke that shell function from inside a script)
63-VENV_PATH_FILE="${VIRTUALENV_ROOT}/lib/$PYTHON/site-packages/_virtualenv_path_extensions.pth"
64-if [ ! -f "$VENV_PATH_FILE" ] ; then
65- echo "import sys; sys.__plen = len(sys.path)" > "$VENV_PATH_FILE" || return 1
66- 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
67-fi
68-
69-if ! grep -q "$TOP" $VENV_PATH_FILE ; then
70- echo "Adding mycroft-core to virtualenv path"
71- sed -i.tmp '1 a\
72-'"$TOP"'
73-' "${VENV_PATH_FILE}"
74-fi
75-
76 # install required python modules
77 if ! pip install -r requirements.txt ; then
78 echo "Warning: Failed to install all requirements. Continue? y/N"
79diff --git a/start-mycroft.sh b/start-mycroft.sh
80index b9514a61ba5..64e0216a62f 100755
81--- a/start-mycroft.sh
82+++ b/start-mycroft.sh
83@@ -20,7 +20,6 @@ script=${0}
84 script=${script##*/}
85 cd -P "$( dirname "$SOURCE" )"
86 DIR="$( pwd )"
87-VIRTUALENV_ROOT=${VIRTUALENV_ROOT:-"${DIR}/.venv"}
88
89 function help() {
90 echo "${script}: Mycroft command/service launcher"
91@@ -76,19 +75,11 @@ function name-to-script-path() {
92 esac
93 }
94
95-function source-venv() {
96- # Enter Python virtual environment, unless under Docker
97- if [ ! -f "/.dockerenv" ] ; then
98- source ${VIRTUALENV_ROOT}/bin/activate
99- fi
100-}
101-
102 first_time=true
103 function init-once() {
104 if ($first_time) ; then
105 echo "Initializing..."
106 "${DIR}/scripts/prepare-msm.sh"
107- source-venv
108 first_time=false
109 fi
110 }
111@@ -225,15 +216,12 @@ case ${_opt} in
112 # launch-background ${_opt}
113 # ;;
114 "unittest")
115- source-venv
116 pytest test/unittests/ --cov=mycroft "$@"
117 ;;
118 "singleunittest")
119- source-venv
120 pytest "$@"
121 ;;
122 "skillstest")
123- source-venv
124 pytest test/integrationtests/skills/discover_tests.py "$@"
125 ;;
126 "audiotest")
127@@ -243,7 +231,6 @@ case ${_opt} in
128 launch-process ${_opt}
129 ;;
130 "sdkdoc")
131- source-venv
132 cd doc
133 make ${opt}
134 cd ..
135diff --git a/venv-activate.sh b/venv-activate.sh
136index d1e7bcb44e7..10b46d4de3b 100644
137--- a/venv-activate.sh
138+++ b/venv-activate.sh
139@@ -22,49 +22,7 @@
140
141 # wrap in function to allow local variables, since this file will be source'd
142 function main() {
143- local quiet=0
144-
145- for arg in "$@"
146- do
147- case $arg in
148- "-q"|"--quiet" )
149- quiet=1
150- ;;
151-
152- "-h"|"--help" )
153- echo "venv-activate.sh: Enter the Mycroft virtual environment"
154- echo "Usage:"
155- echo " source venv-activate.sh"
156- echo "or"
157- echo " . venv-activate.sh"
158- echo ""
159- echo "Options:"
160- echo " -q | --quiet Don't show instructions."
161- echo " -h | --help Show help."
162- return 0
163- ;;
164-
165- *)
166- echo "ERROR: Unrecognized option: $@"
167- return 1
168- ;;
169- esac
170- done
171-
172- if [ "$0" == "$BASH_SOURCE" ] ; then
173- # Prevent running in script then exiting immediately
174- echo "ERROR: Invoke with 'source venv-activate.sh' or '. venv-activate.sh'"
175- else
176- local SRC_DIR="$( builtin cd "$( dirname "${BASH_SOURCE}" )" ; pwd -P )"
177- source ${SRC_DIR}/.venv/bin/activate
178-
179- # Provide an easier to find "mycroft-" prefixed command.
180- unalias mycroft-venv-activate 2>/dev/null
181- alias mycroft-venv-deactivate="deactivate && unalias mycroft-venv-deactivate 2>/dev/null && alias mycroft-venv-activate=\"source '${SRC_DIR}/venv-activate.sh'\""
182- if [ $quiet -eq 0 ] ; then
183- echo "Entering Mycroft virtual environment. Run 'mycroft-venv-deactivate' to exit"
184- fi
185- fi
186+ echo "Not entering Python VENV"
187 }
188
189 main $@
190--
1912.21.0
192
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 @@
1From 142bc3912ea9e1a4ecf4db0e2bec3049aa416464 Mon Sep 17 00:00:00 2001
2From: Alistair Francis <alistair.francis@wdc.com>
3Date: Tue, 19 Mar 2019 13:32:54 -0700
4Subject: [PATCH 2/5] pip requirements: Remove ones installed by OE
5
6Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
7Upstream-Status: Inappropriate [embedded specific]
8---
9 requirements.txt | 14 --------------
10 test-requirements.txt | 1 -
11 2 files changed, 15 deletions(-)
12
13diff --git a/requirements.txt b/requirements.txt
14index 7e4faf48182..29536e990ac 100644
15--- a/requirements.txt
16+++ b/requirements.txt
17@@ -1,20 +1,10 @@
18-six==1.10.0
19-requests==2.20.0
20 gTTS==2.0.3
21 gTTS-token==1.1.3
22-PyAudio==0.2.11
23 pyee==5.0.0
24 SpeechRecognition==3.8.1
25-tornado==4.5.3
26 websocket-client==0.54.0
27 requests-futures==0.9.5
28-pyalsaaudio==0.8.2
29 xmlrunner==1.7.7
30-pyserial==3.0
31-psutil==5.2.1
32-pocketsphinx==0.1.0
33-inflection==0.3.1
34-pillow==4.1.1
35 python-dateutil==2.6.0
36 pychromecast==0.7.7
37 python-vlc==1.1.2
38@@ -26,10 +16,6 @@ msm==0.7.3
39 msk==0.3.12
40 adapt-parser==0.3.2
41 padatious==0.4.6
42-fann2==1.0.7
43 padaos==0.1.9
44 precise-runner==0.2.1
45 petact==0.1.2
46-
47-# dev setup tools
48-pep8==1.7.0
49diff --git a/test-requirements.txt b/test-requirements.txt
50index 8ada8157c95..eb4e364a9b4 100644
51--- a/test-requirements.txt
52+++ b/test-requirements.txt
53@@ -1,6 +1,5 @@
54 pep8==1.7.0
55 coveralls==1.5.0
56-pytest==3.5.0
57 pytest-cov==2.5.1
58 cov-core==1.15.0
59 mock==2.0.0
60--
612.21.0
62
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 @@
1From 87b94e54fefa1f83b41030444fc87b421c97b2c5 Mon Sep 17 00:00:00 2001
2From: Alistair Francis <alistair.francis@wdc.com>
3Date: Tue, 19 Mar 2019 13:38:44 -0700
4Subject: [PATCH 3/5] Use python3 and pip3 instead of python and pip
5
6Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
7Upstream-Status: Inappropriate [embedded specific]
8---
9 bin/mycroft-cli-client | 2 +-
10 bin/mycroft-pip | 2 +-
11 bin/mycroft-say-to | 2 +-
12 bin/mycroft-skill-testrunner | 4 ++--
13 bin/mycroft-speak | 2 +-
14 dev_setup.sh | 10 +++++-----
15 scripts/install-pocketsphinx.sh | 2 +-
16 7 files changed, 12 insertions(+), 12 deletions(-)
17
18diff --git a/bin/mycroft-cli-client b/bin/mycroft-cli-client
19index f40a316e3f6..de2040d9e67 100755
20--- a/bin/mycroft-cli-client
21+++ b/bin/mycroft-cli-client
22@@ -21,4 +21,4 @@ DIR="$( dirname "$SOURCE" )"
23 source "$DIR/../venv-activate.sh" -q
24
25 # Invoke the Command Line Interface
26-python -m mycroft.client.text $@
27+python3 -m mycroft.client.text $@
28diff --git a/bin/mycroft-pip b/bin/mycroft-pip
29index a42b16b847a..81bd5bfb3cf 100755
30--- a/bin/mycroft-pip
31+++ b/bin/mycroft-pip
32@@ -21,4 +21,4 @@ DIR="$( dirname "$SOURCE" )"
33 source "$DIR/../venv-activate.sh" -q
34
35 # Install pip packages within the Mycroft venv
36-pip $@
37\ No newline at end of file
38+pip3 $@
39\ No newline at end of file
40diff --git a/bin/mycroft-say-to b/bin/mycroft-say-to
41index 964e16eb0c5..5575969715c 100755
42--- a/bin/mycroft-say-to
43+++ b/bin/mycroft-say-to
44@@ -22,4 +22,4 @@ DIR="$( pwd )"
45 source "$DIR/../venv-activate.sh" -q
46
47 # Send a message to be spoken
48-output=$(python -m mycroft.messagebus.send "recognizer_loop:utterance" "{\"utterances\": [\"$@\"], \"lang\": \"en-us\"}")
49+output=$(python3 -m mycroft.messagebus.send "recognizer_loop:utterance" "{\"utterances\": [\"$@\"], \"lang\": \"en-us\"}")
50diff --git a/bin/mycroft-skill-testrunner b/bin/mycroft-skill-testrunner
51index 9699a4d138f..282f5ca65b0 100755
52--- a/bin/mycroft-skill-testrunner
53+++ b/bin/mycroft-skill-testrunner
54@@ -22,7 +22,7 @@ source "$DIR/../venv-activate.sh" -q
55
56 # Invoke the individual skill tester
57 if [ "$#" -eq 0 ] ; then
58- python -m test.integrationtests.skills.runner .
59+ python3 -m test.integrationtests.skills.runner .
60 else
61- python -m test.integrationtests.skills.runner $@
62+ python3 -m test.integrationtests.skills.runner $@
63 fi
64\ No newline at end of file
65diff --git a/bin/mycroft-speak b/bin/mycroft-speak
66index 51facf29189..c65556f1173 100755
67--- a/bin/mycroft-speak
68+++ b/bin/mycroft-speak
69@@ -22,4 +22,4 @@ DIR="$( pwd )"
70 source "$DIR/../venv-activate.sh" -q
71
72 # Send a message to be spoken
73-output=$(python -m mycroft.messagebus.send "speak" "{\"utterance\": \"$@\"}")
74\ No newline at end of file
75+output=$(python3 -m mycroft.messagebus.send "speak" "{\"utterance\": \"$@\"}")
76\ No newline at end of file
77diff --git a/dev_setup.sh b/dev_setup.sh
78index aed54b2167a..dd391181f19 100755
79--- a/dev_setup.sh
80+++ b/dev_setup.sh
81@@ -48,7 +48,7 @@ param=""
82
83 for var in "$@" ; do
84 # Check if parameter should be read
85- if [[ ${param} == "python" ]] ; then
86+ if [[ ${param} == "python3" ]] ; then
87 opt_python=${var}
88 param=""
89 continue
90@@ -351,17 +351,17 @@ if [ -z ${INSTALL_PRECOMMIT_HOOK} ] ; then
91 HOOK_FILE="./.git/hooks/pre-commit"
92 if [ ! -f ${HOOK_FILE} ] || grep -q "MYCROFT DEV SETUP" ${HOOK_FILE} ; then
93 echo "Installing PEP8 check as precommit-hook"
94- echo "#! $( which python )" > ${HOOK_FILE}
95+ echo "#! $( which python3 )" > ${HOOK_FILE}
96 echo "# MYCROFT DEV SETUP" >> ${HOOK_FILE}
97 cat ./scripts/pre-commit >> ${HOOK_FILE}
98 chmod +x ${HOOK_FILE}
99 fi
100 fi
101
102-PYTHON=$( python -c "import sys;print('python{}.{}'.format(sys.version_info[0], sys.version_info[1]))" )
103+PYTHON=$( python3 -c "import sys;print('python{}.{}'.format(sys.version_info[0], sys.version_info[1]))" )
104
105 # install required python modules
106-if ! pip install -r requirements.txt ; then
107+if ! pip3 install -r requirements.txt ; then
108 echo "Warning: Failed to install all requirements. Continue? y/N"
109 read -n1 continue
110 if [[ "$continue" != "y" ]] ; then
111@@ -369,7 +369,7 @@ if ! pip install -r requirements.txt ; then
112 fi
113 fi
114
115-if ! pip install -r test-requirements.txt ; then
116+if ! pip3 install -r test-requirements.txt ; then
117 echo "Warning test requirements wasn't installed, Note: normal operation should still work fine..."
118 fi
119
120diff --git a/scripts/install-pocketsphinx.sh b/scripts/install-pocketsphinx.sh
121index 44d329b7985..d45f5c22747 100755
122--- a/scripts/install-pocketsphinx.sh
123+++ b/scripts/install-pocketsphinx.sh
124@@ -47,7 +47,7 @@ function install_pocketsphinx() {
125
126 # build and install pocketsphinx python bindings
127 cd ${TOP}/pocketsphinx-python
128- python setup.py install
129+ python3 setup.py install
130 }
131
132 if [ "$1" = "-q" ] ; then
133--
1342.21.0
135
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 @@
1From a480dde949f820fda6e46c13261883e851f5a430 Mon Sep 17 00:00:00 2001
2From: Alistair Francis <alistair.francis@wdc.com>
3Date: Fri, 29 Mar 2019 16:09:57 -0700
4Subject: [PATCH 4/5] dev_setup.sh: Remove the git dependency
5
6Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
7Upstream-Status: Inappropriate [embedded specific]
8---
9 dev_setup.sh | 16 ----------------
10 1 file changed, 16 deletions(-)
11
12diff --git a/dev_setup.sh b/dev_setup.sh
13index dd391181f19..c6aa783e1ef 100755
14--- a/dev_setup.sh
15+++ b/dev_setup.sh
16@@ -312,10 +312,6 @@ function install_deps() {
17
18 install_deps
19
20-# Configure to use the standard commit template for
21-# this repo only.
22-git config commit.template .gitmessage
23-
24 # Check whether to build mimic (it takes a really long time!)
25 build_mimic="n"
26 if [[ ${opt_forcemimicbuild} == true ]] ; then
27@@ -346,18 +342,6 @@ fi
28 # Start the virtual environment
29 cd "${TOP}"
30
31-# Install pep8 pre-commit hook
32-if [ -z ${INSTALL_PRECOMMIT_HOOK} ] ; then
33- HOOK_FILE="./.git/hooks/pre-commit"
34- if [ ! -f ${HOOK_FILE} ] || grep -q "MYCROFT DEV SETUP" ${HOOK_FILE} ; then
35- echo "Installing PEP8 check as precommit-hook"
36- echo "#! $( which python3 )" > ${HOOK_FILE}
37- echo "# MYCROFT DEV SETUP" >> ${HOOK_FILE}
38- cat ./scripts/pre-commit >> ${HOOK_FILE}
39- chmod +x ${HOOK_FILE}
40- fi
41-fi
42-
43 PYTHON=$( python3 -c "import sys;print('python{}.{}'.format(sys.version_info[0], sys.version_info[1]))" )
44
45 # install required python modules
46--
472.21.0
48
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 @@
1From 7fc38ae0dec30789fa0d365f1764f4950b700a98 Mon Sep 17 00:00:00 2001
2From: Alistair Francis <alistair.francis@wdc.com>
3Date: Tue, 2 Apr 2019 16:52:44 -0700
4Subject: [PATCH 5/5] dev_setup.sh: Remove the test setup dependency
5
6Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
7Upstream-Status: Inappropriate [embedded specific]
8
9Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
10---
11 dev_setup.sh | 4 ----
12 1 file changed, 4 deletions(-)
13
14diff --git a/dev_setup.sh b/dev_setup.sh
15index c6aa783e1ef..bcfaa0c16c2 100755
16--- a/dev_setup.sh
17+++ b/dev_setup.sh
18@@ -353,10 +353,6 @@ if ! pip3 install -r requirements.txt ; then
19 fi
20 fi
21
22-if ! pip3 install -r test-requirements.txt ; then
23- echo "Warning test requirements wasn't installed, Note: normal operation should still work fine..."
24-fi
25-
26 SYSMEM=$( free | awk '/^Mem:/ { print $2 }' )
27 MAXCORES=$(($SYSMEM / 512000))
28 MINCORES=1
29--
302.21.0
31
diff --git a/meta-multimedia/recipes-multimedia/mycroft/files/dev_opts.json b/meta-multimedia/recipes-multimedia/mycroft/files/dev_opts.json
new file mode 100644
index 000000000..5ed85faf4
--- /dev/null
+++ b/meta-multimedia/recipes-multimedia/mycroft/files/dev_opts.json
@@ -0,0 +1 @@
{"use_branch": "dev", "auto_update": false} \ No newline at end of file
diff --git a/meta-multimedia/recipes-multimedia/mycroft/files/mycroft-setup.service b/meta-multimedia/recipes-multimedia/mycroft/files/mycroft-setup.service
new file mode 100644
index 000000000..07598235e
--- /dev/null
+++ b/meta-multimedia/recipes-multimedia/mycroft/files/mycroft-setup.service
@@ -0,0 +1,11 @@
1[Unit]
2Description=Mycroft Setup
3DefaultDependencies=no
4After=systemd-user-sessions.service
5
6[Service]
7Type=oneshot
8ExecStart=@LIBDIR@/mycroft/dev_setup.sh --allow-root
9
10[Install]
11WantedBy=multi-user.target
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..04cf43620
--- /dev/null
+++ b/meta-multimedia/recipes-multimedia/mycroft/files/mycroft.service
@@ -0,0 +1,13 @@
1[Unit]
2Description=Mycroft
3DefaultDependencies=no
4After=mycroft-setup
5
6[Service]
7Type=forking
8ExecStartPre=mkdir -p /var/log/mycroft
9ExecStart=@LIBDIR@/mycroft/start-mycroft.sh all
10ExecStop=@LIBDIR@/mycroft/stop-mycroft.sh all
11
12[Install]
13WantedBy=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..c8ae53468
--- /dev/null
+++ b/meta-multimedia/recipes-multimedia/mycroft/mycroft_19.2.2.bb
@@ -0,0 +1,73 @@
1SUMMARY = "Mycroft is a hackable open source voice assistant."
2DESCRIPTION = "Mycroft is the world’s first open source assistant. "
3HOMEPAGE = "https://mycroft.ai/"
4SECTION = "multimedia"
5
6LICENSE = "Apache-2.0"
7LIC_FILES_CHKSUM = "file://LICENSE.md;md5=79aa497b11564d1d419ee889e7b498f6"
8
9SRCREV = "6706c377820912f83c1838d9eb32950ca9e39ec7"
10SRC_URI = "git://github.com/MycroftAI/mycroft-core.git;branch=master \
11 file://0001-Remove-python-venv.patch \
12 file://0002-pip-requirements-Remove-ones-installed-by-OE.patch \
13 file://0003-Use-python3-and-pip3-instead-of-python-and-pip.patch \
14 file://0004-dev_setup.sh-Remove-the-git-dependency.patch \
15 file://0005-dev_setup.sh-Remove-the-test-setup-dependency.patch \
16 file://dev_opts.json \
17 file://mycroft-setup.service \
18 file://mycroft.service \
19 "
20
21S = "${WORKDIR}/git"
22
23inherit systemd
24
25# Mycroft installs itself on the host
26# Just copy the setup files to the rootfs
27do_install() {
28 install -d ${D}${libdir}/
29 cp -r ${B} ${D}${libdir}/mycroft
30 rm -r ${D}${libdir}/mycroft/.git
31
32 # Install the dev opts so it doesn't ask us on initial setup.
33 install -m 644 ${WORKDIR}/dev_opts.json ${D}${libdir}/mycroft/.dev_opts.json
34
35 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
36 install -d ${D}${systemd_unitdir}/system
37 install -m 644 ${WORKDIR}/mycroft-setup.service ${D}${systemd_unitdir}/system
38 sed -i -e 's,@LIBDIR@,${libdir},g' ${D}${systemd_unitdir}/system/mycroft-setup.service
39 fi
40
41 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
42 install -d ${D}${systemd_unitdir}/system
43 install -m 644 ${WORKDIR}/mycroft.service ${D}${systemd_unitdir}/system
44 sed -i -e 's,@LIBDIR@,${libdir},g' ${D}${systemd_unitdir}/system/mycroft.service
45 fi
46}
47
48FILES_${PN} += "${libdir}/mycroft"
49
50RDEPENDS_${PN} = "python3"
51
52# Install as many Python packages as we can.
53# We don't yet have all the packages in meta-python.
54# Install as many as we can and we will install the rest on the target with pip.
55# TODO: Add all the remaining packages and remove pip
56RDEPENDS_${PN} += "python3-pip \
57 python3-requests python3-pillow \
58 python3-tornado python3-pyyaml \
59 python3-pyalsaaudio python3-inflection \
60 python3-pyserial python3-psutil \
61 python3-pyaudio python3-fann2 \
62 python3-pocketsphinx \
63 python3-xxhash \
64 "
65
66# Mycroft uses Alsa and PulseAudio
67RDEPENDS_${PN} += "alsa-oss alsa-utils alsa-plugins alsa-tools"
68RDEPENDS_${PN} += "pulseaudio pulseaudio-misc pulseaudio-server"
69
70# Mycroft can do this itself on the target, but it's quicker to do it here
71RDEPENDS_${PN} += "mimic"
72
73SYSTEMD_SERVICE_${PN} = "mycroft-setup.service mycroft.service"