|
|
|
@ -28,7 +28,7 @@ from calculate.lib.datavars import (Variable, VariableError,
|
|
|
|
|
SimpleDataVars, DataVarsError)
|
|
|
|
|
from calculate.lib.utils.binhosts import (Binhosts, PackagesIndex, HOURS,
|
|
|
|
|
BinhostSignError)
|
|
|
|
|
from calculate.lib.utils.files import readFile, listDirectory, process, pathJoin, quite_unlink
|
|
|
|
|
from calculate.lib.utils.files import readFile, listDirectory, process, pathJoin
|
|
|
|
|
|
|
|
|
|
from calculate.lib.configparser import ConfigParser
|
|
|
|
|
from calculate.lib.cl_lang import setLocalTranslate
|
|
|
|
@ -964,25 +964,11 @@ class VariableClUpdateProfileDependUrl(FieldValue, ReadonlyVariable):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableClUpdateProfileCheckSyncAllowed(Variable):
|
|
|
|
|
urls = 'cl_update_rep_url'
|
|
|
|
|
names = 'cl_update_rep_name'
|
|
|
|
|
path = 'cl_update_profile_path'
|
|
|
|
|
cache_path = 'cl_update_package_cache'
|
|
|
|
|
path = 'cl_update_repos_storage'
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
if not self.Get(self.urls) or not self.Get(self.names):
|
|
|
|
|
return False
|
|
|
|
|
repos = self.Get(self.path)
|
|
|
|
|
try:
|
|
|
|
|
for rep in repos:
|
|
|
|
|
with open(f'{rep}/test', 'w') as inf:
|
|
|
|
|
inf.write("test")
|
|
|
|
|
os.unlink(f"{rep}/test")
|
|
|
|
|
path = self.Get(self.cache_path)
|
|
|
|
|
with open(f'{path}/test', 'w') as inf:
|
|
|
|
|
inf.write("test")
|
|
|
|
|
os.unlink(f"{path}/test")
|
|
|
|
|
except OSError:
|
|
|
|
|
repo_path = path.join(self.Get(self.path), self.Get('cl_update_profile_repo_name'))
|
|
|
|
|
if path.exists(repo_path) and not os.access(repo_path, os.W_OK):
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|