Browse Source

Добавлено неудаление текущего ядра

master3.3
Mike Khiretskiy 7 years ago
parent
commit
33b3c7dbc0
  1. 28
      update/update.py
  2. 32
      update/variables/update.py
  3. 2
      update/wsdl_update.py

28
update/update.py

@ -706,13 +706,34 @@ class Update:
Выполнить очистку системы от лишних пакетов
"""
deo = self.clVars.Get('cl_emerge_default_opts')
with EmergeParser(EmergeCommand(["--depclean"],
emerge_default_opts=deo)) as emerge:
emerge = None
try:
emerge = EmergeParser(EmergeCommand(["--depclean"],
emerge_default_opts=deo))
try:
emerge.question.action = lambda x: False
emerge.run()
if not emerge.uninstall_packages.list:
return True
kernel_pkg = self.clVars.Get('cl_update_kernel_pkg')
if any(("%s-%s" % (x['CATEGORY/PN'], x['PVR'])) == kernel_pkg
for x in emerge.uninstall_packages.list):
pkglist = [
"=%s-%s" % (x['CATEGORY/PN'], x['PVR']) for x in
emerge.uninstall_packages.list
if ("%s-%s" % (x['CATEGORY/PN'],
x['PVR'])) != kernel_pkg]
emerge.command.send('n\n')
emerge.close()
emerge = None
if not pkglist:
return True
emerge = EmergeParser(
EmergeCommand(pkglist,
extra_params=["--unmerge", '--ask=y'],
emerge_default_opts=deo))
emerge.question.action = lambda x: False
emerge.run()
self._display_remove_list(emerge)
except EmergeError:
self.printPre(self._emerge_translate(emerge.prepare_error))
@ -721,6 +742,9 @@ class Update:
_("Would you like to unmerge these packages?")) != 'yes'):
return False
self._startEmerging(emerge)
finally:
if emerge:
emerge.close()
return True
def update_task(self, task_name):

32
update/variables/update.py

@ -23,7 +23,7 @@ from calculate.lib.datavars import (Variable, VariableError,
SimpleDataVars, DataVarsError)
from calculate.lib.utils.portage import searchProfile
from calculate.lib.utils.files import readLinesFile, readFile, makeDirectory, \
listDirectory
listDirectory, process
from calculate.lib.cl_lang import setLocalTranslate
from calculate.lib.utils.text import simplify_profiles
@ -918,3 +918,33 @@ class VariableClUpdateAutocheckScheduleSet(Variable):
def init(self):
self.label = _("Consider auto-check schedule")
self.help = "consider auto-check schedule"
class VariableClUpdateKernelVersion(ReadonlyVariable):
"""
Текущая версия ядра
"""
def get(self):
return process('/bin/uname','-r').read().strip()
class VariableClUpdateKernelSrcPath(ReadonlyVariable):
"""
Каталог содержащий исходный код текущего ядра
"""
def get(self):
module_build_path = (
"/lib/modules/%s/build" % self.Get('cl_update_kernel_version'))
if path.exists(module_build_path):
return os.readlink(module_build_path)
class VariableClUpdateKernelPkg(ReadonlyVariable):
"""
Пакет текущего ядра
"""
def get(self):
qfile = process('/usr/bin/qfile', '-vC',
self.Get('cl_update_kernel_src_path'))
if qfile.success():
return qfile.read().partition(" ")[0]
else:
return ""

2
update/wsdl_update.py

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys, time, os
import sys
from calculate.lib.datavars import VariableError,DataVarsError,DataVars

Loading…
Cancel
Save