summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrainDamage2023-01-23 09:47:39 +0100
committerBrainDamage2023-01-23 09:47:39 +0100
commit30f4ea9700f4e37e90b6d3df8f93e33ecc2e3697 (patch)
tree4355a4c8ae97aff5cd38a285829eb4ee09b491d4
parent71b23d8b298ee82921218af18f800d45d29828a5 (diff)
downloadaur-30f4ea9700f4e37e90b6d3df8f93e33ecc2e3697.tar.gz
move the installation to a virtual env so it's fully self contained in a single path, out of tree from the config
enable rust python cryptography compilation move cache path to system's cache added python-wheen to deps to build several packages added rust to deps
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD6
-rw-r--r--hass-update.service24
-rw-r--r--hass.env2
-rw-r--r--hass.service16
-rw-r--r--hass.tmpfiles1
6 files changed, 33 insertions, 22 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 8b59c89b9401..387432af2fc8 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = home-assistant-service-pip
pkgdesc = Self installing package of Home Assistant using pip
- pkgver = 5
+ pkgver = 6
pkgrel = 1
url = https://home-assistant.io/
install = hass.install
@@ -31,14 +31,14 @@ pkgbase = home-assistant-service-pip
depends = python-sqlalchemy
depends = python-voluptuous
depends = python-voluptuous-serialize
+ depends = python-wheel
depends = python-yaml
depends = python-yarl
depends = python-zeroconf
depends = python
+ depends = rust
optdepends = net-tools: Nmap host discovery
optdepends = openzwave: Z-Wave integration
- optdepends = python-dtlssocket: Ikea Tradfri integration
- optdepends = python-lxml: Meteo France integration
provides = home-assistant
backup = etc/hass.env
source = hass.service
diff --git a/PKGBUILD b/PKGBUILD
index 828935b3f442..8957e88d3ec5 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
pkgname=home-assistant-service-pip
_serviceName=hass
pkgdesc='Self installing package of Home Assistant using pip'
-pkgver=5
+pkgver=6
pkgrel=1
arch=('any')
url='https://home-assistant.io/'
@@ -32,16 +32,16 @@ depends=(
python-sqlalchemy
python-voluptuous
python-voluptuous-serialize
+ python-wheel
python-yaml
python-yarl
python-zeroconf
python
+ rust
)
optdepends=(
'net-tools: Nmap host discovery'
'openzwave: Z-Wave integration'
- 'python-dtlssocket: Ikea Tradfri integration'
- 'python-lxml: Meteo France integration'
)
source=("${_serviceName}.service" "${_serviceName}-update.service" "${_serviceName}.sysusers" "${_serviceName}.tmpfiles" "${_serviceName}.env")
sha256sums=('548860a0b1eac13c062afb286f4a971f27a9a41d10d9923d5486dc99d76cc5d7'
diff --git a/hass-update.service b/hass-update.service
index 33bbfe75fca4..bb2d118cb562 100644
--- a/hass-update.service
+++ b/hass-update.service
@@ -6,22 +6,28 @@ After=network.target
User=hass
Group=hass
LogsDirectory=hass
-StateDirectory=hass
+StateDirectory=hass hass-installation
+CacheDirectory=hass
+Environment=CARGO_HOME=%C/hass/cargo
+Environment=PYTHON_EGG_CACHE=%C/hass/python-eggs
+Environment=VIRTUAL_ENV=%S/hass-installation
WorkingDirectory=~
EnvironmentFile=-/etc/hass.env
Type=oneshot
-# upgrade home assistant and all its necessary libs
-ExecStart=pip install --no-warn-script-location --user --upgrade homeassistant
+# install or upgrade the python venv, we want
+ExecStart=python -m venv --system-site-packages --upgrade "${VIRTUAL_ENV}"
-# delete old python version libraries in the venv
+# upgrade home assistant and all its necessary libs
+ExecStart=%S/hass-installation/bin/pip install --no-warn-script-location --upgrade homeassistant
ExecStart=sh -c '\
-find \
-$(python -c "import os.path as path; import site; print(path.dirname(path.dirname(site.getusersitepackages())))") -mindepth 1 -type d \
--path $(python -c "import os.path as path; import site; print(path.basename(path.dirname(path.relpath(site.getusersitepackages(),site.getuserbase()))))") -prune \
--print0 \
-| xargs --no-run-if-empty -0 rm --verbose --recursive'
+ find \
+ $(%S/hass-installation/bin/python -c "import os.path as path; import site; print(path.dirname(path.dirname(site.getsitepackages()[0])))") -mindepth 1 -type d \
+ -path $(%S/hass-installation/bin/python -c "import os.path as path; import site; print(path.basename(path.dirname(path.relpath(site.getsitepackages()[0],'${VIRTUAL_ENV}/lib'))))") -prune \
+ -print0 \
+ | xargs --no-run-if-empty -0 rm --verbose --recursive'
+
LockPersonality=true
RestrictRealtime=true
diff --git a/hass.env b/hass.env
index f8262f4fbc82..68f70c74e6cb 100644
--- a/hass.env
+++ b/hass.env
@@ -1,5 +1,3 @@
-# Strongly recommended to speed up build, it's unused anyway
-Environment=CRYPTOGRAPHY_DONT_BUILD_RUST=1
# set to the number of jobs for the machine
# Environment=MAKEFLAGS="-j4"
# Environment=NPY_NUM_BUILD_JOBS="4" \ No newline at end of file
diff --git a/hass.service b/hass.service
index 46e9c29ee1f8..94695b02a7f3 100644
--- a/hass.service
+++ b/hass.service
@@ -9,15 +9,21 @@ Restart=on-failure
User=hass
Group=hass
LogsDirectory=hass
-StateDirectory=hass
+StateDirectory=hass hass-installation
+CacheDirectory=hass
+Environment=CARGO_HOME=%C/hass/cargo
+Environment=PYTHON_EGG_CACHE=%C/hass/python-eggs
+Environment=VIRTUAL_ENV=%S/hass-installation
+Environment=XDG_CACHE_HOME=%C/hass
WorkingDirectory=~
EnvironmentFile=-/etc/hass.env
-ExecStart=python -m homeassistant \
- --config "." \
- --log-file "${LOGS_DIRECTORY}/home-assistant.log" \
- --log-rotate-days 1
+ExecStart=%S/hass-installation/bin/python -m homeassistant \
+ --config "." \
+ --log-file "${LOGS_DIRECTORY}/home-assistant.log" \
+ --log-rotate-days 1
+
RestartForceExitStatus=100
LockPersonality=true
diff --git a/hass.tmpfiles b/hass.tmpfiles
index 5d57ecf8b1c9..3bd7c6712d62 100644
--- a/hass.tmpfiles
+++ b/hass.tmpfiles
@@ -1 +1,2 @@
d /var/lib/hass/ 700 hass hass
+d /var/lib/hass-installation/ - hass hass \ No newline at end of file