Browse Source

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

tags/3.5.1_beta4
parent
commit
d26c91369e
2 changed files with 20 additions and 7 deletions
  1. +5
    -5
      pym/update/utils/cl_update.py
  2. +15
    -2
      pym/update/variables/update.py

+ 5
- 5
pym/update/utils/cl_update.py View File

@@ -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"),


+ 15
- 2
pym/update/variables/update.py View File

@@ -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"

Loading…
Cancel
Save