mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-03 17:50:11 +02:00
makebuildserver: refactored cachedir variable away
This commit is contained in:
parent
b6e45753da
commit
7662520b54
@ -43,10 +43,6 @@ logging.basicConfig(format=logformat, level=loglevel)
|
|||||||
|
|
||||||
tail = None
|
tail = None
|
||||||
|
|
||||||
# set up default config
|
|
||||||
cachedir = os.path.join(os.getenv('HOME'), '.cache', 'fdroidserver')
|
|
||||||
logging.debug('cachedir set to: %s', cachedir)
|
|
||||||
|
|
||||||
BASEBOX_DEFAULT = 'fdroid/basebox-stretch64'
|
BASEBOX_DEFAULT = 'fdroid/basebox-stretch64'
|
||||||
BASEBOX_VERSION_DEFAULT = '0.5.1'
|
BASEBOX_VERSION_DEFAULT = '0.5.1'
|
||||||
BASEBOX_CHECKSUMS = {
|
BASEBOX_CHECKSUMS = {
|
||||||
@ -97,7 +93,7 @@ config = {
|
|||||||
'apt_package_cache': False,
|
'apt_package_cache': False,
|
||||||
'copy_caches_from_host': False,
|
'copy_caches_from_host': False,
|
||||||
'boot_timeout': 600,
|
'boot_timeout': 600,
|
||||||
'cachedir': cachedir,
|
'cachedir': os.path.join(os.getenv('HOME'), '.cache', 'fdroidserver'),
|
||||||
'cpus': 1,
|
'cpus': 1,
|
||||||
'memory': 2048,
|
'memory': 2048,
|
||||||
'hwvirtex': 'off',
|
'hwvirtex': 'off',
|
||||||
@ -123,13 +119,12 @@ if 'basebox_version' in config and 'basebox' in config and '/' not in config['ba
|
|||||||
.format(box=config['basebox'], version=config['basebox_version']))
|
.format(box=config['basebox'], version=config['basebox_version']))
|
||||||
|
|
||||||
# Update cached files.
|
# Update cached files.
|
||||||
cachedir = config['cachedir']
|
if not os.path.exists(config['cachedir']):
|
||||||
if not os.path.exists(cachedir):
|
os.makedirs(config['cachedir'], 0o755)
|
||||||
os.makedirs(cachedir, 0o755)
|
logging.debug('created cachedir {} because it did not exists.'.format(config['cachedir']))
|
||||||
logging.debug('created cachedir %s because it did not exists.', cachedir)
|
|
||||||
|
|
||||||
if config['vm_provider'] == 'libvirt':
|
if config['vm_provider'] == 'libvirt':
|
||||||
tmp = cachedir
|
tmp = config['cachedir']
|
||||||
while tmp != '/':
|
while tmp != '/':
|
||||||
mode = os.stat(tmp).st_mode
|
mode = os.stat(tmp).st_mode
|
||||||
if not (stat.S_IXUSR & mode and stat.S_IXGRP & mode and stat.S_IXOTH & mode):
|
if not (stat.S_IXUSR & mode and stat.S_IXGRP & mode and stat.S_IXOTH & mode):
|
||||||
@ -137,10 +132,10 @@ if config['vm_provider'] == 'libvirt':
|
|||||||
logging.critical(' chmod a+X %s', tmp)
|
logging.critical(' chmod a+X %s', tmp)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
tmp = os.path.dirname(tmp)
|
tmp = os.path.dirname(tmp)
|
||||||
logging.debug('cache dir %s is accessible for libvirt vm.', cachedir)
|
logging.debug('cache dir %s is accessible for libvirt vm.', config['cachedir'])
|
||||||
|
|
||||||
if config['apt_package_cache']:
|
if config['apt_package_cache']:
|
||||||
config['aptcachedir'] = cachedir + '/apt/archives'
|
config['aptcachedir'] = config['cachedir'] + '/apt/archives'
|
||||||
logging.debug('aptcachedir is set to %s', config['aptcachedir'])
|
logging.debug('aptcachedir is set to %s', config['aptcachedir'])
|
||||||
aptcachelock = os.path.join(config['aptcachedir'], 'lock')
|
aptcachelock = os.path.join(config['aptcachedir'], 'lock')
|
||||||
if os.path.isfile(aptcachelock):
|
if os.path.isfile(aptcachelock):
|
||||||
@ -485,12 +480,12 @@ def debug_log_vagrant_vm(vm_dir, config):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global cachedir, config, tail
|
global config, tail
|
||||||
|
|
||||||
if options.skip_cache_update:
|
if options.skip_cache_update:
|
||||||
logging.info('skipping cache update and verification...')
|
logging.info('skipping cache update and verification...')
|
||||||
else:
|
else:
|
||||||
update_cache(cachedir)
|
update_cache(config['cachedir'])
|
||||||
|
|
||||||
# use VirtualBox software virtualization if hardware is not available,
|
# use VirtualBox software virtualization if hardware is not available,
|
||||||
# like if this is being run in kvm or some other VM platform, like
|
# like if this is being run in kvm or some other VM platform, like
|
||||||
|
Loading…
Reference in New Issue
Block a user