aboutsummarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3826765b0e3a2805228f555b9dfa3b5c2a00e9be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Maintainer: Ethan Skinner <aur@etskinner.com>
# Contributor: Grégoire Seux <grego_aur@familleseux.net>
# Contributor: Dean Galvin <deangalvin3@gmail.com>
# Contributor: NicoHood <archlinux {cat} nicohood {dog} de>

pkgname=home-assistant
pkgdesc='Open-source home automation platform running on Python 3'
pkgver=0.95.4
pkgrel=1
url="https://home-assistant.io/"
license=('APACHE')
arch=('any')
replaces=('python-home-assistant')
makedepends=('python-setuptools')
# NB: this package will install additional python packages in /var/lib/hass/lib depending on components present in the configuration files.
depends=('python'
         'python-aiohttp>=3.5.4'
         'python-aiohttp-cors>=0.5.3'
         'python-astral>=1.10.1'
         'python-async-timeout>=3.0.1'
         'python-attrs>=19.1.0'
         'python-bcrypt>=3.1.6'
         'python-certifi>=2018.04.16'
         'python-chardet>=3.0.4'
         'python-cryptography>=2.6.1'
         'python-distro>=1.3.0'
	 'python-idna>=2.7'
	 'python-importlib-metadata>=0.17'
         'python-jinja>=2.10'
         'python-pyjwt>=1.7.1'
         'python-netifaces'
         'python-pip>=8.0.3'
         'python-pytz>=2019.1'
         'python-requests>=2.22.0'
	 'python-ruamel-yaml>=0.15.94'
	 'python-slugify>=3.0.2'
         'python-sqlalchemy>=1.2.11'
         'python-vincenty'
         'python-voluptuous>=0.11.5'
         'python-voluptuous-serialize>=2.1.0'
         'python-webcolors'
         'python-yaml'
         'python-yarl'
         )
optdepends=('git: install component requirements from github'
            'net-tools: necessary for nmap discovery')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/${pkgname}/${pkgname}/archive/${pkgver}.tar.gz"
        "home-assistant.service"
        "home-assistant.sysusers"
        "home-assistant-tmpfile.conf"
        "hass.install")
sha512sums=('596bee4714cf47935cdf017296efb76b0cc8e4cfa28e15b5273c9a9fa1e1926bfcdc9a9fb004ea6e639a3d0a211f43f7df8a85ca0f9741cae9044e6c0f015b32'
            'fe96bd3df3ba666fd9f127c466d1dd1dd7314db2e57826a2b319c8a0bfad7aedeac398e748f93c6ecd9c2247ebbae196b8b0e7263b8681e2b7aeab6a8bfeab80'
            '100665ac35370c3ccec65d73521568de21cebf9e46af364124778861c94e338e32ad9abb675d3917f97d351dd7867e3ab2e80c26616330ae7cf0d9dc3f13369b'
            '3e93118c84954f829767dc71ce534c5d02c1c95fc8748714c7a2df28a3a297f59962f8fb7cddf721987eb97d62feabb25acda5d38209e365646ca4a4ef4356e3'
            '65edbf1e544322deb6b5b8e1197e54c5cb8b25e3dad7b4b882ca4d41d3240b3f049c2e928f083e261d14aa5e54ca0b228f128796a07f151cd01cc867acfdb305')
#validpgpkeys=('') # TODO https://github.com/home-assistant/home-assistant/issues/9487
install=hass.install

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  # TODO remove in future versions https://github.com/home-assistant/home-assistant/issues/9525
  replace '==' '>=' setup.py
  
  # Patches for https://github.com/home-assistant/home-assistant/issues/11906
  sed -i 's/from yarl import unquote/from yarl import URL/' homeassistant/components/http/static.py
  sed -i "s/unquote(request.match_info\['filename'\])/URL(request.match_info['filename'], encoded=True).path/" homeassistant/components/http/static.py
}

replace() {
  pattern=$1
  substitute=$2
  file=$3
  echo -n "Replacing '$pattern' by '$substitute' in $file..."
  if grep -q $pattern $file && sed -i "s/$pattern/$substitute/" $file; then
    echo "DONE"
  else
    echo "FAILED"
    depname=$(echo $pattern | sed 's/[>=<].*$//')
    echo Current line in $file:
    grep $depname $file
    exit 1
  fi
}

package() {
  install -Dm644 home-assistant.service "${pkgdir}/usr/lib/systemd/system/home-assistant.service"
  install -Dm644 home-assistant.sysusers "${pkgdir}/usr/lib/sysusers.d/hass.conf"
  install -Dm644 home-assistant-tmpfile.conf "${pkgdir}/usr/lib/tmpfiles.d/hass.conf"

  cd "${srcdir}/${pkgname}-${pkgver}"
  python setup.py install --root="$pkgdir" --prefix=/usr --optimize=1
}