lib.Distro._install(): Implement remote installation
lib.Distro._install()'s default implementation allows to install packages specified as direct links, but only to the local machine. Implement installation to arbitrary hosts specified with --target.
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
60de1b0ca0
commit
1c11503dfb
1 changed files with 7 additions and 5 deletions
|
|
@ -354,13 +354,15 @@ class Distro(abc.ABC):
|
|||
|
||||
# Download first and then install. Override if Distro knows better.
|
||||
async def _install_urls(self, urls: Iterable[str], only_update: bool) -> None:
|
||||
import tempfile
|
||||
from .util import copy
|
||||
with tempfile.TemporaryDirectory(prefix='jw-pkg-') as tmp:
|
||||
paths: list[str] = []
|
||||
for url in urls:
|
||||
paths.append(await copy(url, tmp))
|
||||
tmp: str|None = None
|
||||
try:
|
||||
tmp = await self.__exec_context.mktemp('/tmp/jw-pkg-XXXXXX', directory=True)
|
||||
paths = await copy(urls, self.__exec_context.uri.scheme_plus_authority + tmp)
|
||||
await self._install_local_files(paths, only_update=only_update)
|
||||
finally:
|
||||
if tmp is not None:
|
||||
await self.__exec_context.erase(tmp)
|
||||
|
||||
# Default implementation installs in two steps:
|
||||
# - Download URLs into local directories and install
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue