Fix version conflicts

This commit is contained in:
Pascal Vizeli 2018-03-03 11:12:59 +01:00
commit 6e74e4c008
10 changed files with 68 additions and 28 deletions

View File

@ -1,12 +1,12 @@
{
"local": {
"name": "Local Add-Ons",
"name": "Local add-ons",
"url": "https://home-assistant.io/hassio",
"maintainer": "you"
},
"core": {
"name": "Built-in Add-Ons",
"name": "Official add-ons",
"url": "https://home-assistant.io/addons",
"maintainer": "Home Assistant authors"
"maintainer": "Home Assistant"
}
}

View File

@ -8,8 +8,9 @@ import shutil
import git
from .utils import get_hash_from_repository
from ..const import URL_HASSIO_ADDONS
from ..const import URL_HASSIO_ADDONS, ATTR_URL, ATTR_BRANCH
from ..coresys import CoreSysAttributes
from ..validate import RE_REPOSITORY
_LOGGER = logging.getLogger(__name__)
@ -22,9 +23,20 @@ class GitRepo(CoreSysAttributes):
self.coresys = coresys
self.repo = None
self.path = path
self.url = url
self.lock = asyncio.Lock(loop=coresys.loop)
self._data = RE_REPOSITORY.match(url).groupdict()
@property
def url(self):
"""Return repository URL."""
return self._data[ATTR_URL]
@property
def branch(self):
"""Return repository branch."""
return self._data[ATTR_BRANCH]
async def load(self):
"""Init git addon repo."""
if not self.path.is_dir():
@ -46,12 +58,20 @@ class GitRepo(CoreSysAttributes):
async def clone(self):
"""Clone git addon repo."""
async with self.lock:
git_args = {
attribute: value
for attribute, value in (
('recursive', True),
('branch', self.branch)
) if value is not None
}
try:
_LOGGER.info("Clone addon %s repository", self.url)
self.repo = await self._loop.run_in_executor(
None, ft.partial(
git.Repo.clone_from, self.url, str(self.path),
recursive=True))
self.repo = await self._loop.run_in_executor(None, ft.partial(
git.Repo.clone_from, self.url, str(self.path),
**git_args
))
except (git.InvalidGitRepositoryError, git.NoSuchPathError,
git.GitCommandError) as err:

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,7 @@
from pathlib import Path
from ipaddress import ip_network
HASSIO_VERSION = '0.95'
HASSIO_VERSION = '0.96'
URL_HASSIO_VERSION = ('https://raw.githubusercontent.com/home-assistant/'
'hassio/{}/version.json')
@ -158,6 +158,7 @@ ATTR_SERVICES = 'services'
ATTR_DISCOVERY = 'discovery'
ATTR_PROTECTED = 'protected'
ATTR_CRYPTO = 'crypto'
ATTR_BRANCH = 'branch'
SERVICE_MQTT = 'mqtt'

View File

@ -173,7 +173,8 @@ class SnapshotManager(CoreSysAttributes):
if addon and addon.is_installed:
addon_list.append(addon)
continue
_LOGGER.warning("Add-on %s not found/installed", addon_slug)
_LOGGER.warning(
"Add-on %s not found/installed", addon_slug)
if addon_list:
_LOGGER.info("Snapshot %s store Add-ons", snapshot.slug)

View File

@ -1,5 +1,6 @@
"""Validate functions."""
import uuid
import re
import voluptuous as vol
import pytz
@ -11,13 +12,29 @@ from .const import (
ATTR_SSL, ATTR_PORT, ATTR_WATCHDOG, ATTR_WAIT_BOOT, ATTR_UUID)
RE_REPOSITORY = re.compile(r"^(?P<url>[^#]+)(?:#(?P<branch>[\w\-]+))?$")
NETWORK_PORT = vol.All(vol.Coerce(int), vol.Range(min=1, max=65535))
ALSA_CHANNEL = vol.Match(r"\d+,\d+")
WAIT_BOOT = vol.All(vol.Coerce(int), vol.Range(min=1, max=60))
DOCKER_IMAGE = vol.Match(r"^[\w{}]+/[\-\w{}]+$")
def validate_repository(repository):
"""Validate a valide repository."""
data = RE_REPOSITORY.match(repository)
if not data:
raise vol.Invalid("No valid repository format!")
# Validate URL
# pylint: disable=no-value-for-parameter
vol.Url()(data.group('url'))
return repository
# pylint: disable=no-value-for-parameter
REPOSITORIES = vol.All([vol.Url()], vol.Unique())
REPOSITORIES = vol.All([validate_repository], vol.Unique())
def validate_timezone(timezone):

@ -1 +1 @@
Subproject commit 1a18ee27553aaff643a4a06512bc6112f8c8f036
Subproject commit 39172f8c49a5253b28eb8508940e2ffa4f0ca451

View File

@ -1,5 +1,5 @@
{
"hassio": "0.95",
"hassio": "0.96",
"homeassistant": "0.64.3",
"resinos": "1.1",
"resinhup": "0.3",