GitLab cache
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
|
||||
@@ -42,11 +43,11 @@ class Packages:
|
||||
raise Exception('Packages does not yet support this distro')
|
||||
|
||||
def build(self, script):
|
||||
cache = f'.cache/{self.mgr}'
|
||||
script.mount(
|
||||
'$(pwd)/' + cache,
|
||||
f'/var/cache/{self.mgr}'
|
||||
)
|
||||
if 'CACHE_DIR' in os.environ:
|
||||
cache = os.path.join(os.getenv('CACHE_DIR'), self.mgr)
|
||||
else:
|
||||
cache = os.path.join(os.getenv('HOME'), '.cache', self.mgr)
|
||||
script.mount(cache, f'/var/cache/{self.mgr}')
|
||||
|
||||
if self.mgr == 'apk':
|
||||
# special step to enable apk cache
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import os
|
||||
|
||||
|
||||
class Pip:
|
||||
def __init__(self, *pip_packages, pip=None):
|
||||
self.pip_packages = pip_packages
|
||||
@@ -16,7 +19,11 @@ class Pip:
|
||||
_pip=pip2
|
||||
fi
|
||||
''')
|
||||
script.mount('.cache/pip', '/root/.cache/pip')
|
||||
if 'CACHE_DIR' in os.environ:
|
||||
cache = os.path.join(os.getenv('CACHE_DIR'), 'pip')
|
||||
else:
|
||||
cache = os.path.join(os.getenv('HOME'), '.cache', 'pip')
|
||||
script.mount(cache, '/root/.cache/pip')
|
||||
script.run('sudo $_pip install --upgrade pip')
|
||||
source = [p for p in self.pip_packages if p.startswith('/')]
|
||||
if source:
|
||||
|
||||
Reference in New Issue
Block a user