From e20946a0f60e9be37b7d2de103a23add06afece6 Mon Sep 17 00:00:00 2001 From: jpic Date: Sun, 16 Feb 2020 15:03:27 +0100 Subject: [PATCH] Optional upgrade, build async --- shlax/actions/packages.py | 5 +++-- shlax/strategies/asyn.py | 2 +- shlaxfile.py | 15 +++++++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/shlax/actions/packages.py b/shlax/actions/packages.py index e9f0497..fc11109 100644 --- a/shlax/actions/packages.py +++ b/shlax/actions/packages.py @@ -121,7 +121,8 @@ class Packages(Action): self.cmds = self.mgrs[self.mgr] if not getattr(self, '_packages_upgraded', None): await self.update() - await self.rexec(self.cmds['upgrade']) + if self.kwargs.get('upgrade', True): + await self.rexec(self.cmds['upgrade']) self._packages_upgraded = True packages = [] @@ -147,7 +148,7 @@ class Packages(Action): async def dnf_setup(self): cachedir = os.path.join(self.cache_root, self.mgr) await self.mount(cachedir, f'/var/cache/{self.mgr}') - await self.run('echo keepcache=True >> /etc/dnf/dnf.conf') + await self.rexec('echo keepcache=True >> /etc/dnf/dnf.conf') return cachedir async def apt_setup(self): diff --git a/shlax/strategies/asyn.py b/shlax/strategies/asyn.py index ee45d87..e7944f2 100644 --- a/shlax/strategies/asyn.py +++ b/shlax/strategies/asyn.py @@ -6,6 +6,6 @@ from .script import Script class Async(Script): async def call(self, *args, **kwargs): return asyncio.gather(*[ - procs.append(action(*args, **kwargs)) + action(*args, **kwargs) for action in self.actions ]) diff --git a/shlaxfile.py b/shlaxfile.py index ec57e48..f67184d 100755 --- a/shlaxfile.py +++ b/shlaxfile.py @@ -4,8 +4,19 @@ from shlax.contrib.gitlab import * PYTEST = 'py.test -svv tests' build = Buildah( - Packages('py3-yaml'), - Copy('shlax/', 'setup.py', '/app'), + 'quay.io/podman/stable', + Packages('python38', 'buildah', 'unzip', 'findutils', 'python3-yaml', upgrade=False), + Async( + # python3.8 on centos with pip dance ... + Run(''' + curl -o setuptools.zip https://files.pythonhosted.org/packages/42/3e/2464120172859e5d103e5500315fb5555b1e908c0dacc73d80d35a9480ca/setuptools-45.1.0.zip + unzip setuptools.zip + mkdir -p /usr/local/lib/python3.8/site-packages/ + sh -c "cd setuptools-* && python3.8 setup.py install" + easy_install-3.8 pip + '''), + Copy('shlax/', 'setup.py', '/app'), + ), Pip('/app'), commit='yourlabs/shlax', workdir='/app',