Optional upgrade, build async

This commit is contained in:
jpic 2020-02-16 15:03:27 +01:00
parent e0c902eb47
commit e20946a0f6
3 changed files with 17 additions and 5 deletions

View File

@ -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):

View File

@ -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
])

View File

@ -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',