Verified Commit 18c6ce08 authored by Karel Koci's avatar Karel Koci 🤘
Browse files

Add support for boards package lists filter

This is filter for both package lists as well its options to skip them
if they are not compatible with current board. This is primarily
intended to support hardware specific extension in package lists.

No change is required outside of updater-supervisor as package lists are
just skipped and considered as not defined (not existing).
parent ff3302c7
......@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](,
and this project adheres to [Semantic Versioning](
## [Unreleased]
### Added
- Support for package lists filter based on board
- New dependency is now distro
## [1.3.0] - 2020-04-09
### Added
- options for pkglists
......@@ -41,6 +41,7 @@ setup(
"pyuci @ git+",
import distro
# These are all board
# turrishw mapping to updater names
"Turris Mox": "mox",
"Turris Omnia": "omnia",
"Turris 1.x": "turris1x",
__board = None
def board():
"""Returns board name as expected by updater components of current board host.
global __board
if __board is None:
__board = BOARD_MAP.get(distro.os_release_attr("openwrt_device_product"), "unknown")
return __board
......@@ -29,6 +29,7 @@ import typing
from euci import EUci
from .exceptions import UpdaterNoSuchListError, UpdaterNoSuchListOptionError
from . import _board
__PKGLIST_ENTRIES_LABELS = typing.Dict[str, str]
__PKGLIST_ENTRIES_OPTIONS = typing.Dict[str, typing.Union[str, bool, __PKGLIST_ENTRIES_LABELS]]
......@@ -69,6 +70,7 @@ def __options(pkglist_name, trans, uci, known_labels, options):
"url": option.get('url'),
"labels": __labels(known_labels, trans, option.get('labels', {})),
} for name, option in options.items()
if _board.board() in option.get('boards', _board.BOARDS)
......@@ -122,6 +124,7 @@ def pkglists(lang=None) -> typing.Dict[str, __PKGLIST_ENTRIES]:
"options": __options(name, trans, uci, known_labels, lst.get('options', {})),
"labels": __labels(known_labels, trans, lst.get('labels', {})),
} for name, lst in known_lists.items()
if _board.board() in lst.get('boards', _board.BOARDS)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment