GitLab cache

This commit is contained in:
jpic
2020-01-26 20:52:55 +01:00
parent 4f405a8709
commit 47db32ad0c
6 changed files with 25 additions and 11 deletions
+6 -5
View File
@@ -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
+8 -1
View File
@@ -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: