Добавлено скачивание Packages если он отсутствует или у него не тот TTL

master-3.5
rodič 2fbafa7f68
revize d26c91369e

@ -280,7 +280,7 @@ class ClUpdateAction(Action):
"eix_update")),
}
]
},
},
{'name': 'reps_synchronization',
'group': __("System configuration"),
'tasks': [
@ -292,7 +292,7 @@ class ClUpdateAction(Action):
(Get('cl_update_outdate_set') == 'on' or
Get('cl_update_force_fix_set') == 'on'))
},
},
{'name': 'dispatch_conf',
'message': __("Updating configuration files"),
'method': 'Update.dispatchConf()',
@ -300,12 +300,12 @@ class ClUpdateAction(Action):
Get('cl_update_pretend_set') == 'off' and
(Get('cl_update_outdate_set') == 'on' or
Get('cl_update_force_fix_set') == 'on'))
},
},
{'name': 'binhost_changed',
'method': 'Update.message_binhost_changed()'
},
},
]
}
}
] + emerge_tasks + [
{'name': 'failed',
'error': __("Update failed"),

@ -25,7 +25,7 @@ from calculate.lib.datavars import (Variable, VariableError,
TableVariable, FieldValue,
HumanReadable, CriticalError,
SimpleDataVars, DataVarsError)
from calculate.lib.utils.binhosts import Binhosts
from calculate.lib.utils.binhosts import Binhosts, PackagesIndex, HOURS
from calculate.lib.utils.files import readFile, listDirectory, process, pathJoin
from calculate.lib.configparser import ConfigParser
@ -1706,9 +1706,22 @@ class VariableClUpdatePackageCache(ReadonlyVariable):
host, parsed_url.path.lstrip("/"),
"Packages")
class VariableClUpdatePackageCacheSet(Variable):
"""
Необходимость обновить Packages
"""
type = "bool"
value = "off"
def get(self):
packages_fn = self.Get('cl_update_package_cache')
if not path.exists(packages_fn):
return "on"
pi = PackagesIndex(readFile(packages_fn))
try:
ttl = int(pi.get("TTL", "0"))
if ttl > HOURS:
return "off"
except ValueError:
return "on"
return "on"

Načítá se…
Zrušit
Uložit