浏览代码

Update readme and do changes

Joachim M. Giæver 4 年之前
父节点
当前提交
a42d6c6f67
共有 4 个文件被更改,包括 83 次插入38 次删除
  1. 67 19
      README.md
  2. 二进制
      snap/plugins/__pycache__/python_wot_plugin.cpython-36.pyc
  3. 0 1
      snap/plugins/python_wot_plugin.py
  4. 16 18
      snap/snapcraft.yaml

+ 67 - 19
README.md

@@ -5,33 +5,81 @@ Snap (Snapcraft.yaml) recipe for the Open source home automation software that p
 Current Home Assistant version: 0.90.1
 
 # Build
-1. Clone the repo ```git clone https://git.giaever.org/joachimmg/home-assistant-snap.git```.
-2. Go into the directoy ```cd home-assistant-snap```.
-3. Check out the latest tag. The versioning is following the version of Home Assistant (e.g 0.90.1) plus a letter describing revision, e.g ```0.90.1.b```.
-4. To compile the snap you can use two options:
-	1. Make sure you have all [necessary tools](https://docs.snapcraft.io/installing-snapd/6735) to build a snap, and issue the command ```snapcraft``` to build with multipass (VM).
-	2. Run ```git submodule update --init``` to fetch the build module, then run the script ```./lddbuild/lxcbuild``` to build with a LXD container, which will install all necessary tools in the container and pull the built snap to the host system. This is the preferred method during development of this recipe. The container can be deleted with ```lxc stop home-assistant-snap && lxc delete home-assistant-snap```.
+Simply
 
-# Install
-A file named ```home-assistant-snap[...].snap``` (e.g home-assistant_0+git.5bd544d_amd64.snap) should now be in the root-folder of the project and now you can install it with
+1. ##### Clone repo over HTTPS
 
-```bash
-snap install [file] --devmode
 ```
+git clone https://git.giaever.org/joachimmg/home-assistant-snap.git
+```
+
+2. ##### Change directory into the cloned repository
+
+```
+$ cd ~/home-assistant-snap/
+```
+
+and checkout the latest tag (e.g `$ git checkout 0.112.3`) as the master branch might not be functioning.
+
+3. ##### Build & install
+3.1 Make sure you have snapcraft installed: 
+
+```
+sudo snap install snapcraft --classic && hash -r
+```
+
+3.2 Build with 
+
+```
+$ snapcraft
+```
+
+3.3 Install with (change «packagename» to filename of the produced snap).
+
+```
+$ ls -al | grep .snap
+$ snap install --devmode --dangerous <packagename>.snap
+``` 
+
+4. #### Notes on building on a Raspberry Pi
 
-## Issues
+Snapcraft will try to install multipass for you, but on *Raspberry Pi* it will fail. You will have to use an LXD container, before any of the previous steps.
 
-For issues directly related to Home Assistant, please read their article on [Reporting Issues](https://www.home-assistant.io/help/reporting_issues/). 
+4.1 Install LXD on the Pi:
 
-Issues with building or issues that is caused by missing dependencies etc and therefore cause problems with the running software, use the [issue tracker](https://git.giaever.org/joachimmg/home-assistant-snap/issues).
+```
+$ snap install lxd
+```
+
+4.2 Create a container
+
+```
+$ sudo lxd init
+```
+
+4.3 Make sure your user is a member of lxd-group
+
+```
+sudo adduser $USER lxd
+```
 
-### Known problems
+_(it might tell that you already are...)_
 
-The build process reports a dependency issue with Selenium/Webdriver.
+4.4 Launche a Ubuntu 20.04 container instance
+```
+lxc launch ubuntu:20.04 home-assistant-container
+```
 
-```wiki
-Unable to determine library dependencies for 'prime/selenium/webdriver/firefox/x86/x_ignore_nofocus.so'
-Unable to determine library dependencies for 'prime/lib/python3.6/site-packages/selenium/webdriver/firefox/x86/x_ignore_nofocus.so'
+4.5 Go into the shell of the container
+
+```
+lxc exec -- home-assistant-container /bin/bash
+```
+
+4.6 Continue with *step 1*, but replace *step 3.2* with the following:
+
+```
+SNAPCRAFT_BUILD_ENVIRONMENT=host snapcraft
 ```
 
-Feel free  to help out solving it!
+as we have to build within the LXD container itself and not through multipass.

二进制
snap/plugins/__pycache__/python_wot_plugin.cpython-36.pyc


+ 0 - 1
snap/plugins/python_wot_plugin.py

@@ -20,7 +20,6 @@ class PluginImpl(plugins.python.PythonPlugin):
             # Find position where to inject pip uninstall
             if cmd.strip().startswith('[ -f setup.py ]'):
                 xcmds = cmd.split("&&", 1)
-                print("Found ", xcmds)
                 # Inject and force removal
                 cmds[idx] = f"{xcmds[0]} && pip uninstall -y typing && {xcmds[1]}"
         return cmds

+ 16 - 18
snap/snapcraft.yaml

@@ -1,13 +1,12 @@
 name: home-assistant
-version: git
+version: '0.112.3'
 summary: Open source home automation that puts local control and privacy first
 description: |
     Home Assistant is a home automation platform running on Python 3. 
     It is able to track and control all devices at home and offer a 
     platform for automating control.
-grade: devel
 base: core20
-confinement: devmode
+confinement: strict
 apps:
   hass:
     command: bin/hass --config $SNAP_DATA
@@ -18,9 +17,7 @@ parts:
   homeassistant:
     plugin: python-wot-plugin
     source: https://github.com/home-assistant/core.git
-    source-tag: 0.112.3
-    #build-environment:
-    #  - SNAPCRAFT_PYTHON_INTERPRETER: "python3.8"
+    source-tag: ${SNAPCRAFT_PROJECT_VERSION}
     python-packages:
       - setuptools
       - wheel
@@ -31,25 +28,26 @@ parts:
       - pkg-config
       - autoconf
       - build-essential
+      - cython3
+      - ffmpeg
+      - libavcodec-dev
+      - libavdevice-dev
+      - libavfilter-dev
+      - libavformat-dev
+      - libavresample-dev
+      - libavutil-dev
       - libffi-dev
       - libglib2.0-dev
+      - libglu1-mesa-dev
       - libjpeg-dev
+      - libopenzwave1.5-dev
       - libssl-dev
+      - libswscale-dev
+      - libudev-dev
       - libxml2-dev
       - libxslt1-dev
-      - libudev-dev
       - zlib1g-dev
-      - cython3
-    stage-packages:
-      - libavformat-dev
-      - libavcodec-dev
-      - libavdevice-dev
-      - libavutil-dev
-      - libswscale-dev
-      - libavresample-dev
-      - libavfilter-dev
-      - libglu1-mesa-dev
-      - ffmpeg
+
     requirements:
       - requirements_all.txt
     constraints: