Исправлен вывод переменных

atratsevskiy
Mike Khiretskiy 10 years ago
parent 2ade02f5a2
commit cfbab3373c

@ -0,0 +1,37 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
PYTHON_COMPAT=(python2_7)
inherit distutils-r1 eutils
SRC_URI="ftp://ftp.calculate.ru/pub/calculate/calculate3/${PN}/${P}.tar.bz2
http://mirror.yandex.ru/calculate/calculate3/${PN}/${P}.tar.bz2"
DESCRIPTION="The program of update Calculate Linux"
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
LICENSE="Apache-2.0"
SLOT="3"
KEYWORDS="x86 amd64"
IUSE=""
DEPEND="~sys-apps/calculate-core-3.2.3
~sys-apps/calculate-install-3.2.3
dev-python/pexpect"
RDEPEND="${DEPEND}"
pkg_preinst() {
dosym /usr/sbin/cl-core /usr/sbin/cl-update
dosym /usr/sbin/cl-core /usr/sbin/cl-update-profile
}
src_unpack() {
unpack "${A}"
cd "${S}"
# apply revision changes
epatch "${FILESDIR}/calculate-update-3.2.3-r3.patch"
}

@ -0,0 +1,160 @@
diff --git pym/update/update.py pym/update/update.py
index 9387524..65062de 100644
--- pym/update/update.py
+++ pym/update/update.py
@@ -284,7 +284,7 @@ class Update(object):
except OSError as e:
raise UpdateError(_("Failed to modify the "
"{repname} repository").format(
- repname=repname)+":"+str(e))
+ repname=repname)+_(": ")+str(e))
finally:
if path.exists(rpath_new):
removeDir(rpath_new)
@@ -833,10 +833,12 @@ class Update(object):
try:
emerge = EmergeParser(EmergeCommand(["--depclean"],
emerge_default_opts=deo))
+ outdated_kernel = False
try:
emerge.question.action = lambda x: False
emerge.run()
if not emerge.uninstall_packages.list:
+ UpdateInfo(self.clVars).outdated_kernel = False
return True
kernel_pkg = self.clVars.Get('cl_update_kernel_pkg')
if any(("%s-%s" % (x['CATEGORY/PN'], x['PVR'])) == kernel_pkg
@@ -850,6 +852,7 @@ class Update(object):
emerge.close()
emerge = None
if not pkglist:
+ UpdateInfo(self.clVars).outdated_kernel = True
return True
emerge = EmergeParser(
EmergeCommand(pkglist,
@@ -857,6 +860,9 @@ class Update(object):
emerge_default_opts=deo))
emerge.question.action = lambda x: False
emerge.run()
+ outdated_kernel = True
+ else:
+ outdated_kernel = False
self._display_remove_list(emerge)
except EmergeError:
self._display_error(emerge.prepare_error)
@@ -864,6 +870,7 @@ class Update(object):
if (self.askConfirm(
_("Would you like to unmerge these packages?")) != 'yes'):
return False
+ UpdateInfo(self.clVars).outdated_kernel = outdated_kernel
self._startEmerging(emerge)
finally:
if emerge:
diff --git pym/update/update_info.py pym/update/update_info.py
index a162631..72069e0 100644
--- pym/update/update_info.py
+++ pym/update/update_info.py
@@ -14,12 +14,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import os
+from os import path
from itertools import ifilter
from calculate.core.datavars import DataVarsCore
from calculate.core.server.gen_pid import search_worked_process
from calculate.lib.cl_template import SystemIni
from calculate.lib.utils.content import getCfgFiles
-from calculate.lib.utils.files import getRunCommands
+from calculate.lib.utils.files import getRunCommands, readFile
+import time
class UpdateInfo(object):
@@ -72,3 +75,27 @@ class UpdateInfo(object):
В системе уже есть работающий процесс обновления
"""
return search_worked_process("update", self.dv)
+
+ @property
+ def outdated_kernel(self):
+ flag_path = self.dv.Get('update.cl_update_outdated_kernel_path')
+ if path.exists(flag_path):
+ try:
+ flag_kernel = readFile(flag_path).strip()
+ current_kernel = self.dv.Get('update.cl_update_kernel_version')
+ if flag_kernel != current_kernel:
+ return True
+ except ValueError:
+ pass
+ return False
+
+ @outdated_kernel.setter
+ def outdated_kernel(self, value):
+ flag_path = self.dv.Get('update.cl_update_outdated_kernel_path')
+
+ if value:
+ with open(flag_path, 'w') as f:
+ f.write(self.dv.Get('update.cl_update_kernel_version'))
+ else:
+ if path.exists(flag_path):
+ os.unlink(flag_path)
diff --git pym/update/utils/cl_update.py pym/update/utils/cl_update.py
index 509aed1..cdc6fcc 100644
--- pym/update/utils/cl_update.py
+++ pym/update/utils/cl_update.py
@@ -45,6 +45,13 @@ class ClUpdateAction(Action):
return bool(PackageList(task.list)[pkg])
return func
+ def need_depclean(pkg, task_name):
+ def func(Get):
+ task = EmergeLog(EmergeLogNamedTask(task_name))
+ return (bool(PackageList(task.list)[pkg])
+ or Get('cl_update_outdated_kernel_set') == 'on')
+ return func
+
def need_upgrade(pkg):
def func():
return bool(Eix(pkg, Eix.Option.Upgrade).get_packages())
@@ -124,7 +131,7 @@ class ClUpdateAction(Action):
{'name': 'update_other:update_depclean',
'message': __("Calculating dependencies"),
'method': 'Update.depclean()',
- 'condition': was_installed('.*', log_names['depclean']),
+ 'condition': need_depclean('.*', log_names['depclean']),
'decoration': 'Update.update_task("%s")' % log_names['depclean']
},
]
diff --git pym/update/variables/update.py pym/update/variables/update.py
index 3bbd583..f3a7144 100644
--- pym/update/variables/update.py
+++ pym/update/variables/update.py
@@ -33,6 +33,7 @@ from calculate.update.profile import RepositoryStorageSet, DEFAULT_BRANCH
from calculate.lib.variables.linux import VariableOsLinuxName, \
VariableOsLinuxSubname, VariableOsLinuxVer, VariableOsLinuxShortname
from calculate.lib.variables.env import VariableClTemplateLocation
+from calculate.update.update_info import UpdateInfo
setLocalTranslate('cl_update3', sys.modules[__name__])
@@ -1087,3 +1088,19 @@ class VariableClUpdateCleanpkgSet(Variable):
def init(self):
self.label = _("Clean obsolete programs archives")
self.help = _("clean obsolete programs archives")
+
+class VariableClUpdateOutdatedKernelPath(Variable):
+ """
+ Файл-флаг наличия устаревшего, неудаленного ядра
+ """
+ value = "/var/lib/calculate/calculate-update/outdated_kernel"
+
+class VariableClUpdateOutdatedKernelSet(ReadonlyVariable):
+ """
+ Есть наличие устаревшего ядра
+ """
+ type = "bool"
+
+ def get(self):
+ ui = UpdateInfo(self.parent)
+ return "on" if ui.outdated_kernel else "off"

@ -0,0 +1,26 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=4
DESCRIPTION="Calculate Utilities meta package"
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
SRC_URI=""
LICENSE="Apache-2.0"
SLOT="3"
KEYWORDS="x86 amd64"
IUSE="cl_consolegui cl_client cl_desktop cl_console"
RDEPEND="${RDEPEND}
=sys-apps/calculate-install-3.2.3-r1
=sys-apps/calculate-i18n-3.2.3-r1
=sys-apps/calculate-lib-3.2.3-r2
=sys-apps/calculate-core-3.2.3-r2
=sys-apps/calculate-update-3.2.3-r3
cl_client? ( =sys-apps/calculate-client-3.2.3-r1 )
cl_desktop? ( =sys-apps/calculate-desktop-3.2.3-r1 )
cl_consolegui? ( =sys-apps/calculate-console-gui-3.2.3 )
cl_console? ( =sys-apps/calculate-console-3.2.3-r1 )
"
Loading…
Cancel
Save