Optional upgrade, build async
This commit is contained in:
parent
e0c902eb47
commit
e20946a0f6
@ -121,7 +121,8 @@ class Packages(Action):
|
|||||||
self.cmds = self.mgrs[self.mgr]
|
self.cmds = self.mgrs[self.mgr]
|
||||||
if not getattr(self, '_packages_upgraded', None):
|
if not getattr(self, '_packages_upgraded', None):
|
||||||
await self.update()
|
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
|
self._packages_upgraded = True
|
||||||
|
|
||||||
packages = []
|
packages = []
|
||||||
@ -147,7 +148,7 @@ class Packages(Action):
|
|||||||
async def dnf_setup(self):
|
async def dnf_setup(self):
|
||||||
cachedir = os.path.join(self.cache_root, self.mgr)
|
cachedir = os.path.join(self.cache_root, self.mgr)
|
||||||
await self.mount(cachedir, f'/var/cache/{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
|
return cachedir
|
||||||
|
|
||||||
async def apt_setup(self):
|
async def apt_setup(self):
|
||||||
|
|||||||
@ -6,6 +6,6 @@ from .script import Script
|
|||||||
class Async(Script):
|
class Async(Script):
|
||||||
async def call(self, *args, **kwargs):
|
async def call(self, *args, **kwargs):
|
||||||
return asyncio.gather(*[
|
return asyncio.gather(*[
|
||||||
procs.append(action(*args, **kwargs))
|
action(*args, **kwargs)
|
||||||
for action in self.actions
|
for action in self.actions
|
||||||
])
|
])
|
||||||
|
|||||||
15
shlaxfile.py
15
shlaxfile.py
@ -4,8 +4,19 @@ from shlax.contrib.gitlab import *
|
|||||||
PYTEST = 'py.test -svv tests'
|
PYTEST = 'py.test -svv tests'
|
||||||
|
|
||||||
build = Buildah(
|
build = Buildah(
|
||||||
Packages('py3-yaml'),
|
'quay.io/podman/stable',
|
||||||
Copy('shlax/', 'setup.py', '/app'),
|
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'),
|
Pip('/app'),
|
||||||
commit='yourlabs/shlax',
|
commit='yourlabs/shlax',
|
||||||
workdir='/app',
|
workdir='/app',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user