Skip to content

Instantly share code, notes, and snippets.

@synthead
Created July 6, 2022 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save synthead/819fa9bad91f9ba905125b2c7f34937d to your computer and use it in GitHub Desktop.
Save synthead/819fa9bad91f9ba905125b2c7f34937d to your computer and use it in GitHub Desktop.
PKGBUILD for home-assistant 2202.6.7 with workaround for pip --prefix= incompatibility
[Unit]
Description=Home assistant
After=network.target
[Service]
Restart=on-failure
User=hass
Group=hass
DynamicUser=true
LogsDirectory=hass
StateDirectory=hass
WorkingDirectory=/var/lib/hass
Environment=HOME=/var/lib/hass
ExecStart=/usr/bin/hass \
--config /var/lib/hass/ \
--log-file /var/log/hass/home-assistant.log \
--log-rotate-days 1
RestartForceExitStatus=100
AmbientCapabilities=
CapabilityBoundingSet=
LockPersonality=true
ProtectControlGroups=true
ProtectKernelModules=true
ProtectKernelTunables=true
[Install]
WantedBy=multi-user.target
# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Ethan Skinner <aur@etskinner.com>
# Contributor: Grégoire Seux <grego_aur@familleseux.net>
# Contributor: Dean Galvin <deangalvin3@gmail.com>
# Contributor: NicoHood <archlinux@nicohood.de>
pkgname=home-assistant
pkgdesc='Open source home automation that puts local control and privacy first'
pkgver=2022.6.7
pkgrel=2
epoch=1
arch=(any)
url=https://home-assistant.io/
license=(APACHE)
depends=(
gcc
python-aiodiscover
python-aiohttp
python-aiohttp-cors
python-astral
python-async-timeout
python-atomicwrites
python-attrs
python-awesomeversion
python-bcrypt
python-certifi
python-ciso8601
python-cryptography
python-defusedxml
python-httpx
python-jinja
python-lru-dict
python-mutagen
python-pillow
python-pip
python-pyjwt
python-pytz
python-requests
python-ruamel-yaml
python-slugify
python-sqlalchemy
python-voluptuous
python-voluptuous-serialize
python-yaml
python-yarl
python-zeroconf
)
makedepends=(
git
python-build
python-pip
python-setuptools
)
optdepends=(
'net-tools: Nmap host discovery'
'openzwave: Z-Wave integration'
'python-dtlssocket: Ikea Tradfri integration'
'python-lxml: Meteo France integration'
)
_tag=f97e95134b4e9f3628a1cd4527dc11cf038003a2
source=(
git+https://github.com/home-assistant/home-assistant.git#tag=${_tag}
home-assistant.service
remove-prefix-workaround.patch
)
b2sums=('SKIP'
'b5e181e00e499cd0c6e3922af44afe7e8043063d49c89c207beeff9b56ea2920a6f7b6d211be027cb4b6cf8450396623515dadcebdbdbdf0f934d3d16963790e'
'33850a7d278d3197fd5699cf3606f59468bc7b58414728cba4f44fc3546e391c483f444c03dc2104f2f889bb8487e130455570a38db48bf7bf828ecd2ee58897')
pkgver() {
cd home-assistant
git describe --tags
}
prepare() {
cd home-assistant
# lift hard dep constraints, we'll deal with breaking changes ourselves
sed 's/==/>=/g' -i requirements.txt setup.cfg homeassistant/package_constraints.txt
# allow pip >= 20.3 to be used
sed 's/,<20.3//g' -i requirements.txt setup.cfg homeassistant/package_constraints.txt
patch -p 1 < "$srcdir/remove-prefix-workaround.patch"
}
build() {
cd home-assistant
python -m build
}
package() {
PIP_CONFIG_FILE=/dev/null pip install --isolated --root="${pkgdir}" --ignore-installed --no-deps home-assistant/dist/*.whl
install -Dm 644 home-assistant.service -t "${pkgdir}"/usr/lib/systemd/system/
}
# vim: ts=2 sw=2 et:
diff -u -r a/homeassistant/util/package.py b/homeassistant/util/package.py
--- a/homeassistant/util/package.py 2022-07-05 16:52:26.521425410 -0700
+++ b/homeassistant/util/package.py 2022-07-05 20:31:51.517144042 -0700
@@ -89,9 +89,6 @@
# This only works if not running in venv
args += ["--user"]
env["PYTHONUSERBASE"] = os.path.abspath(target)
- # Workaround for incompatible prefix setting
- # See http://stackoverflow.com/a/4495175
- args += ["--prefix="]
_LOGGER.debug("Running pip command: args=%s", args)
with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env) as process:
_, stderr = process.communicate()
@rautesamtr
Copy link

Can confirm this also works with 2022.7.1 but needs python-orjson as dependency added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment