parent
b0024f816c
commit
1626b0f13c
@ -0,0 +1,51 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
EAPI="3"
|
||||
SUPPORT_PYTHON_ABIS="1"
|
||||
PYTHON_DEPEND="2:2.7"
|
||||
RESTRICT_PYTHON_ABIS="2.4 2.5 2.6 3.*"
|
||||
|
||||
inherit distutils eutils
|
||||
|
||||
SRC_URI="ftp://ftp.calculate.ru/pub/calculate/calculate3/${PN}/${P}.tar.bz2"
|
||||
|
||||
DESCRIPTION="The WSDL core for Calculate 3"
|
||||
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
|
||||
LICENSE="Apache-2.0"
|
||||
SLOT="3"
|
||||
KEYWORDS="amd64 x86"
|
||||
IUSE="minimal"
|
||||
|
||||
DEPEND="~sys-apps/calculate-lib-3.2.0_alpha4
|
||||
>=dev-python/soaplib-1.0
|
||||
!minimal? ( dev-python/sudsds
|
||||
net-libs/dslib
|
||||
dev-python/pyopenssl
|
||||
dev-libs/openssl
|
||||
dev-python/m2crypto
|
||||
dev-python/cherrypy )"
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
pkg_preinst() {
|
||||
dosym /usr/sbin/cl-core /usr/sbin/cl-core-setup
|
||||
dosym /usr/sbin/cl-core /usr/sbin/cl-core-patch
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
einfo "For autoconfigure calculate-core for adminuser perform:"
|
||||
einfo " cl-core --bootstrap <username>"
|
||||
einfo "For run calculate-core perform:"
|
||||
einfo " /etc/init.d/calculate-core start"
|
||||
einfo "Add calcualte core to autorun:"
|
||||
einfo " rc-update add calculate-core boot"
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
unpack "${A}"
|
||||
cd "${S}"
|
||||
|
||||
# apply revision changes
|
||||
epatch "${FILESDIR}/calculate-core-3.2.0_alpha4-r3.patch"
|
||||
}
|
@ -0,0 +1,465 @@
|
||||
diff --git core/server/api_types.py core/server/api_types.py
|
||||
index 3863d53..eb205c1 100644
|
||||
--- core/server/api_types.py
|
||||
+++ core/server/api_types.py
|
||||
@@ -164,6 +164,97 @@ class Table(DataVarsSerializer):
|
||||
self.onClick = onClick
|
||||
self.addAction = addAction
|
||||
|
||||
+class ChoiceValueAdapter(object):
|
||||
+ def __init__(self, choicevalue):
|
||||
+ self.choicevalue = choicevalue
|
||||
+
|
||||
+ @property
|
||||
+ def values(self):
|
||||
+ return self.choicevalue.values.string
|
||||
+
|
||||
+ @property
|
||||
+ def comments(self):
|
||||
+ return self.choicevalue.comments.string
|
||||
+
|
||||
+ @property
|
||||
+ def onChanged(self):
|
||||
+ return self.choicevalue.onChanged.string
|
||||
+
|
||||
+ def __getattr__(self, item):
|
||||
+ return getattr(self.choicevalue, item)
|
||||
+
|
||||
+ @classmethod
|
||||
+ def from_detect(cls, choicevalue):
|
||||
+ if isinstance(choicevalue, ChoiceValue):
|
||||
+ return choicevalue
|
||||
+ else:
|
||||
+ return cls(choicevalue)
|
||||
+
|
||||
+class TableAdapter(object):
|
||||
+ def __init__(self, table):
|
||||
+ self.table = table
|
||||
+
|
||||
+ @property
|
||||
+ def fields(self):
|
||||
+ return self.table.fields.string
|
||||
+
|
||||
+ @property
|
||||
+ def head(self):
|
||||
+ return self.table.head.string
|
||||
+
|
||||
+ @property
|
||||
+ def body(self):
|
||||
+ if hasattr(self.table.body,'stringArray'):
|
||||
+ return [row.string
|
||||
+ for row in self.table.body.stringArray
|
||||
+ if hasattr(row, "string")]
|
||||
+ return []
|
||||
+
|
||||
+ @property
|
||||
+ def values(self):
|
||||
+ return [ChoiceValueAdapter(x) for x in self.table.values.ChoiceValue]
|
||||
+
|
||||
+ def __getattr__(self, item):
|
||||
+ return getattr(self.table, item)
|
||||
+
|
||||
+ @classmethod
|
||||
+ def from_detect(cls, table):
|
||||
+ if isinstance(table, Table):
|
||||
+ return table
|
||||
+ else:
|
||||
+ return cls(table)
|
||||
+
|
||||
+class FieldAdapter(object):
|
||||
+ def __init__(self, field):
|
||||
+ self.field = field
|
||||
+
|
||||
+ @property
|
||||
+ def choice(self):
|
||||
+ return self.field.choice.string
|
||||
+
|
||||
+ @property
|
||||
+ def listvalue(self):
|
||||
+ return self.field.listvalue.string
|
||||
+
|
||||
+ @property
|
||||
+ def comments(self):
|
||||
+ return self.field.comments.string
|
||||
+
|
||||
+ @property
|
||||
+ def tablevalue(self):
|
||||
+ return TableAdapter(self.field.tablevalue)
|
||||
+
|
||||
+ def __getattr__(self, item):
|
||||
+ return getattr(self.field, item)
|
||||
+
|
||||
+ @classmethod
|
||||
+ def from_detect(cls, field):
|
||||
+ if isinstance(field, Field):
|
||||
+ return field
|
||||
+ else:
|
||||
+ return cls(field)
|
||||
+
|
||||
+
|
||||
class Option(DataVarsSerializer):
|
||||
shortopt = String
|
||||
longopt = String
|
||||
diff --git core/server/replace_class.py core/server/replace_class.py
|
||||
index 23c5282..1318deb 100644
|
||||
--- core/server/replace_class.py
|
||||
+++ core/server/replace_class.py
|
||||
@@ -34,6 +34,7 @@ from calculate.lib.utils.colortext.output import BaseOutput
|
||||
from calculate.lib.cl_print import color_print
|
||||
from calculate.lib.datavars import VariableError
|
||||
from calculate.lib.cl_lang import setLocalTranslate
|
||||
+from calculate.core.server.api_types import FieldAdapter
|
||||
|
||||
from methods_func import get_method_argparser, collect_object, \
|
||||
check_result_msg, get_param_pwd, _print
|
||||
@@ -44,7 +45,7 @@ from func import shortTraceback, CommonMethods
|
||||
|
||||
|
||||
setLocalTranslate('cl_core3', sys.modules[__name__])
|
||||
-from itertools import cycle
|
||||
+from itertools import cycle, izip, ifilter
|
||||
import time
|
||||
|
||||
|
||||
@@ -531,7 +532,7 @@ class replaceClass():
|
||||
def startGroup(self, message):
|
||||
_print = get_terminal_print()
|
||||
self.printDefault(
|
||||
- _print.foreground(TextState.Colors.WHITE).bold(message))
|
||||
+ _print.foreground(TextState.Colors.WHITE)(message))
|
||||
#self.addMessage(type='startGroup', message=message)
|
||||
|
||||
def endGroup(self):
|
||||
@@ -766,159 +767,179 @@ def print_brief(view, brief_label):
|
||||
print_brief_group(Group.fields, Group.name)
|
||||
|
||||
|
||||
-def print_brief_group(Fields, group_name):
|
||||
- print_group_flag = False
|
||||
- # if group_name:
|
||||
- # _print ('\b'+group_name)
|
||||
- uncompatible_count = 0
|
||||
- colorPrint = color_print()
|
||||
- _colorprint = get_terminal_print(_print)
|
||||
- for field in Fields:
|
||||
- if field.uncompatible:
|
||||
- uncompatible_count += 1
|
||||
- continue
|
||||
- if field.element in ['input', 'openfile']:
|
||||
- value = field.value if field.value else ''
|
||||
- if not print_group_flag:
|
||||
- if group_name:
|
||||
- print_group_flag = True
|
||||
- _colorprint.bold.foreground(
|
||||
- TextState.Colors.WHITE)(group_name)
|
||||
- colorPrint.printSUCCESS('%s: %s' % (field.label, value))
|
||||
-
|
||||
- elif field.element in ['combo', 'comboEdit', 'radio', 'file']:
|
||||
- if field.choice:
|
||||
- if not field.choice[0]:
|
||||
- field.choice.pop(0)
|
||||
- if field.comments:
|
||||
- if not field.comments[0]:
|
||||
- field.comments.pop(0)
|
||||
- if field.comments and field.choice:
|
||||
- if not field.value in field.choice:
|
||||
- field.choice.append(field.value)
|
||||
- value = map(lambda x: field.comments[x] \
|
||||
- if len(field.comments) > x else field.choice[x],
|
||||
- map(lambda x: field.choice.index(x),
|
||||
- filter(lambda x: x in field.choice,
|
||||
- [field.value])))
|
||||
- value = ', '.join(value)
|
||||
- else:
|
||||
- value = field.value if field.value else ''
|
||||
- if not print_group_flag:
|
||||
- if group_name:
|
||||
- print_group_flag = True
|
||||
- #_print('\b' + group_name)
|
||||
- _colorprint.bold.foreground(
|
||||
- TextState.Colors.WHITE)(group_name)
|
||||
- colorPrint.printSUCCESS('%s: %s' % (field.label, value))
|
||||
-
|
||||
- elif field.element in ['multichoice', 'multichoice_add', \
|
||||
- 'selecttable', 'selecttable_add']:
|
||||
- if field.choice:
|
||||
- if not field.choice[0]:
|
||||
- field.choice.pop(0)
|
||||
- if field.comments:
|
||||
- if not field.comments[0]:
|
||||
- field.comments.pop(0)
|
||||
- if field.listvalue:
|
||||
- if not field.listvalue[0]:
|
||||
- field.listvalue.pop(0)
|
||||
- if field.choice:
|
||||
- value = map(lambda x: field.comments[x] \
|
||||
- if len(field.comments) > x \
|
||||
- else field.choice[x],
|
||||
- map(lambda x: field.choice.index(x), \
|
||||
- field.listvalue))
|
||||
+class Display(object):
|
||||
+ def __init__(self):
|
||||
+ self._print = get_terminal_print(color_print().defaultPrint)
|
||||
+
|
||||
+ def print_info(self, label, value):
|
||||
+ GREEN = TextState.Colors.GREEN
|
||||
+ self.display_asterisk(GREEN)
|
||||
+ self._print("%s: " % label)
|
||||
+ WHITE = TextState.Colors.WHITE
|
||||
+ self._print.foreground(WHITE)(value)
|
||||
+ self._print("\n")
|
||||
+
|
||||
+ def print_label(self, label):
|
||||
+ GREEN = TextState.Colors.GREEN
|
||||
+ self.display_asterisk(GREEN)
|
||||
+ self._print("%s: " % label)
|
||||
+ self._print("\n")
|
||||
+
|
||||
+ def display_asterisk(self, color):
|
||||
+ self._print(" ")
|
||||
+ self._print.foreground(color).bold("*")
|
||||
+ self._print(" ")
|
||||
+
|
||||
+ def print_error(self, message):
|
||||
+ RED = TextState.Colors.RED
|
||||
+ self.display_asterisk(RED)
|
||||
+ self._print(message)
|
||||
+ self._print("\n")
|
||||
+
|
||||
+ def print_table(self, data, head):
|
||||
+
|
||||
+ sys.stdout.write('%s\n' % printTable(data, head))
|
||||
+
|
||||
+ def print_group(self, label):
|
||||
+ #WHITE = TextState.Colors.WHITE
|
||||
+ #self._print.foreground(WHITE).bold(label)
|
||||
+ #self._print.underline(label)
|
||||
+ self._print(label)
|
||||
+ self._print("\n")
|
||||
+
|
||||
+
|
||||
+class InformationElement(object):
|
||||
+ def __init__(self, field, display):
|
||||
+ self.value = ""
|
||||
+ self.label = ""
|
||||
+ self.display = display
|
||||
+
|
||||
+ @classmethod
|
||||
+ def from_field(cls, field, display):
|
||||
+ if field.type == 'steps':
|
||||
+ return None
|
||||
+ map_elements = {'input': ValueInfo,
|
||||
+ 'openfile': ValueInfo,
|
||||
+ 'combo': ChoiceInfo,
|
||||
+ 'comboEdit': ChoiceInfo,
|
||||
+ 'radio': ChoiceInfo,
|
||||
+ 'file': ChoiceInfo,
|
||||
+ 'multichoice': MultiChoiceInfo,
|
||||
+ 'multichoice_add': MultiChoiceInfo,
|
||||
+ 'selecttable': MultiChoiceInfo,
|
||||
+ 'selecttable_add': MultiChoiceInfo,
|
||||
+ 'error': ErrorInfo,
|
||||
+ 'check': CheckInfo,
|
||||
+ 'check_tristate': CheckInfo,
|
||||
+ 'table': TableInfo
|
||||
+ }
|
||||
+ if field.element in map_elements:
|
||||
+ return map_elements[field.element](field, display)
|
||||
+ return None
|
||||
+
|
||||
+ def show(self):
|
||||
+ self.display.print_info(self.label, self.value)
|
||||
+
|
||||
+
|
||||
+class ValueInfo(InformationElement):
|
||||
+ def __init__(self, field, display):
|
||||
+ super(ValueInfo, self).__init__(field, display)
|
||||
+ self.value = field.value or ''
|
||||
+ self.label = field.label
|
||||
+
|
||||
+class CheckInfo(InformationElement):
|
||||
+ def __init__(self, field, display):
|
||||
+ super(CheckInfo, self).__init__(field, display)
|
||||
+ self.label = field.label
|
||||
+ map_answer = {'on':_('yes'), 'off': _("no"), 'auto': _('auto')}
|
||||
+ self.value = map_answer.get(field.value, field.value)
|
||||
+
|
||||
+class ChoiceInfo(InformationElement):
|
||||
+ def __init__(self, field, display):
|
||||
+ super(ChoiceInfo, self).__init__(field, display)
|
||||
+ self.label = field.label or ''
|
||||
+ if field.choice and field.comments:
|
||||
+ map_comment = dict(zip(field.choice, field.comments))
|
||||
+ self.value = map_comment.get(field.value, field.value) or ''
|
||||
+ else:
|
||||
+ self.value = field.value if field.value else ''
|
||||
+
|
||||
+
|
||||
+class MultiChoiceInfo(InformationElement):
|
||||
+ def __init__(self, field, display):
|
||||
+ super(MultiChoiceInfo, self).__init__(field, display)
|
||||
+ self.label = field.label or ''
|
||||
+ if field.listvalue:
|
||||
+ value = field.listvalue
|
||||
+ # удалить пустой первый элемент (особенности wsdl)
|
||||
+ if value and not value[0]:
|
||||
+ value.pop(0)
|
||||
+ if field.choice and field.comments:
|
||||
+ map_comment = dict(zip(field.choice, field.comments))
|
||||
else:
|
||||
- value = []
|
||||
- value = ', '.join(value)
|
||||
- if field.listvalue and not value:
|
||||
- value = ', '.join(field.listvalue)
|
||||
- elif not value:
|
||||
- value = field.value if field.value else ''
|
||||
- if not print_group_flag:
|
||||
- if group_name:
|
||||
- print_group_flag = True
|
||||
- #_print('\b' + group_name)
|
||||
- _colorprint.bold.foreground(
|
||||
- TextState.Colors.WHITE)(group_name)
|
||||
- colorPrint.printSUCCESS('%s: %s' % (field.label, value))
|
||||
-
|
||||
- # elif field.element == 'label':
|
||||
- # print field.label
|
||||
-
|
||||
- elif field.element == 'error':
|
||||
- if not print_group_flag:
|
||||
- if group_name:
|
||||
- print_group_flag = True
|
||||
- _colorprint.bold.foreground(
|
||||
- TextState.Colors.WHITE)(group_name)
|
||||
- colorPrint.printERROR(field.label)
|
||||
-
|
||||
- elif field.element in ['check', 'check_tristate']:
|
||||
- if field.value == 'on':
|
||||
- value = _('yes')
|
||||
- elif field.value == 'off':
|
||||
- value = _('no')
|
||||
- elif field.value == 'auto':
|
||||
- value = _('auto')
|
||||
+ map_comment = {}
|
||||
+ self.value = ", ".join([map_comment.get(x, x) or '' for x in value])
|
||||
+ else:
|
||||
+ self.value = field.value or ""
|
||||
+
|
||||
+
|
||||
+class ErrorInfo(InformationElement):
|
||||
+ def __init__(self, field, display):
|
||||
+ super(ErrorInfo, self).__init__(field, display)
|
||||
+ self.label = field.label
|
||||
+
|
||||
+ def show(self):
|
||||
+ self.display.print_error(self.label)
|
||||
+
|
||||
+
|
||||
+class TableInfo(InformationElement):
|
||||
+ """
|
||||
+ Табличная информация
|
||||
+ """
|
||||
+
|
||||
+ def map_row(self, row, typedata):
|
||||
+ map_answer = {'on':_('yes'), 'off': _("no"), 'auto': _('auto')}
|
||||
+ for cell, typefield in izip(row, typedata):
|
||||
+ if typefield in ['check', 'check_tristate']:
|
||||
+ yield map_answer.get(cell, cell) or ""
|
||||
+ elif "password" in typefield:
|
||||
+ yield "***"
|
||||
else:
|
||||
- value = field.value
|
||||
- if not print_group_flag:
|
||||
- if group_name:
|
||||
- print_group_flag = True
|
||||
- _colorprint.bold.foreground(
|
||||
- TextState.Colors.WHITE)(group_name)
|
||||
- colorPrint.printSUCCESS('%s: %s' % (field.label, value))
|
||||
-
|
||||
- elif field.element == 'table' and field.type != 'steps':
|
||||
- head = field.tablevalue.head
|
||||
-
|
||||
- body = []
|
||||
- for row in field.tablevalue.body:
|
||||
- if not row[0]:
|
||||
- row.pop(0)
|
||||
- body.append(row)
|
||||
-
|
||||
- # if empty table
|
||||
- if not filter(None, map(lambda x: x, body)):
|
||||
- body = [[''] * len(head)]
|
||||
- res = printTable(body, head)
|
||||
- sys.stdout.flush()
|
||||
- sys.stdout.write(res + "\n")
|
||||
- continue
|
||||
- ChoiceValue = field.tablevalue.values
|
||||
- for row in xrange(len(ChoiceValue)):
|
||||
- if ChoiceValue[row].typefield in ['check', 'check_tristate']:
|
||||
- for i in xrange(len(body)):
|
||||
- if body[i][row] == 'on':
|
||||
- body[i][row] = _('yes')
|
||||
- if body[i][row] == 'off':
|
||||
- body[i][row] = _('no')
|
||||
- if body[i][row] == 'auto':
|
||||
- body[i][row] = _('auto')
|
||||
- if "password" in ChoiceValue[row].typefield:
|
||||
- for i in xrange(len(body)):
|
||||
- if body[i][row]:
|
||||
- body[i][row] = '***'
|
||||
- data = []
|
||||
- for body_row in body:
|
||||
- data.append(map(lambda x: x if x else '', body_row))
|
||||
- if not print_group_flag:
|
||||
- if group_name:
|
||||
- print_group_flag = True
|
||||
- _colorprint.bold.foreground(
|
||||
- TextState.Colors.WHITE)(group_name)
|
||||
- colorPrint.printSUCCESS(field.label + ': ')
|
||||
- res = printTable(data, head)
|
||||
- sys.stdout.flush()
|
||||
- sys.stdout.write(res + "\n")
|
||||
+ yield cell or ""
|
||||
+
|
||||
+ def __init__(self, field, display):
|
||||
+ super(TableInfo, self).__init__(field, display)
|
||||
+ self.label = field.label
|
||||
+ self.head = field.tablevalue.head
|
||||
+
|
||||
+ # удаление первого элемента строки (для wsdl)
|
||||
+ body = [x[1:] if x and not x[0] else x for x in field.tablevalue.body]
|
||||
+
|
||||
+ if not filter(None, map(lambda x: x, body)):
|
||||
+ self.body = None
|
||||
else:
|
||||
- uncompatible_count += 1
|
||||
+ type_values = [x.typefield for x in field.tablevalue.values]
|
||||
+ self.body = [list(self.map_row(x, type_values)) for x in body]
|
||||
+
|
||||
+ def show(self):
|
||||
+ if self.body:
|
||||
+ self.display.print_label(self.label)
|
||||
+ self.display.print_table(self.body, self.head)
|
||||
|
||||
|
||||
-# if uncompatible_count == len (Fields) and group_name:
|
||||
-# colorPrint.printSUCCESS(_('Not used'))
|
||||
+def print_brief_group(Fields, group_name):
|
||||
+ display = Display()
|
||||
+ show_group = True
|
||||
+ for element in ifilter(None,
|
||||
+ (InformationElement.from_field(
|
||||
+ FieldAdapter.from_detect(x),
|
||||
+ display)
|
||||
+ for x in Fields if not x.uncompatible)):
|
||||
+ if show_group:
|
||||
+ display.print_group(group_name)
|
||||
+ show_group = False
|
||||
+ element.show()
|
||||
+
|
||||
|
||||
class Table(tableReport):
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -953,4 +974,3 @@ def printTable(data, header=None):
|
||||
except Exception as e:
|
||||
print str(e)
|
||||
raise
|
||||
-
|
@ -0,0 +1,33 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
EAPI="3"
|
||||
SUPPORT_PYTHON_ABIS="1"
|
||||
PYTHON_DEPEND="2:2.7"
|
||||
RESTRICT_PYTHON_ABIS="2.4 2.5 2.6 3.*"
|
||||
|
||||
inherit distutils eutils
|
||||
|
||||
SRC_URI="ftp://ftp.calculate.ru/pub/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="amd64 x86"
|
||||
IUSE=""
|
||||
|
||||
DEPEND="~sys-apps/calculate-core-3.2.0_alpha4
|
||||
~sys-apps/calculate-install-3.2.0_alpha4
|
||||
dev-python/pexpect"
|
||||
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
src_unpack() {
|
||||
unpack "${A}"
|
||||
cd "${S}"
|
||||
|
||||
# apply revision changes
|
||||
epatch "${FILESDIR}/calculate-update-3.2.0_alpha4-r3.patch"
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
diff --git update/emerge_parser.py update/emerge_parser.py
|
||||
index 50d53aa..6d677a0 100644
|
||||
--- update/emerge_parser.py
|
||||
+++ update/emerge_parser.py
|
||||
@@ -13,6 +13,7 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
+import hashlib
|
||||
|
||||
import os
|
||||
from os import path
|
||||
@@ -159,9 +160,9 @@ class EmergeInformationBlock(object):
|
||||
|
||||
def __contains__(self, item):
|
||||
if self.result is None:
|
||||
- return 0
|
||||
+ return False
|
||||
else:
|
||||
- return item in self.result
|
||||
+ return item in str(self)
|
||||
|
||||
def _get_text(self, result):
|
||||
"""
|
||||
@@ -448,6 +449,29 @@ class EmergeingErrorBlock(EmergeInformationBlock):
|
||||
raise EmergeError(_("Emerge %s is failed") % self.package)
|
||||
|
||||
|
||||
+class RevdepPercentBlock(NotifierInformationBlock):
|
||||
+ """
|
||||
+ Блок определния статуса revdep-rebuild
|
||||
+ """
|
||||
+ token = "Collecting system binaries"
|
||||
+ end_token = [re.compile("Assigning files to packages|"
|
||||
+ "All prepared. Starting rebuild"), pexpect.EOF]
|
||||
+ re_block = re.compile("\[\s(\d+)%\s\]")
|
||||
+
|
||||
+ def notify(self, observer, groups):
|
||||
+ percent = int(groups[0])
|
||||
+ observer(percent)
|
||||
+
|
||||
+ def get_block(self, child):
|
||||
+ while True:
|
||||
+ index = child.expect([self.re_block]+self.end_token)
|
||||
+ if index == 0:
|
||||
+ for observer in self.observers:
|
||||
+ self.notify(observer, child.match.groups())
|
||||
+ else:
|
||||
+ self.result = child.match
|
||||
+ break
|
||||
+
|
||||
class EmergeParser(object):
|
||||
"""
|
||||
Парсер вывода emerge
|
||||
@@ -531,6 +555,10 @@ class MtimeCheckvalue(object):
|
||||
return self.get_check_values(self.fname)
|
||||
|
||||
|
||||
+class Md5Checkvalue(MtimeCheckvalue):
|
||||
+ def value_func(self, fn):
|
||||
+ return hashlib.md5(readFile(fn)).hexdigest()
|
||||
+
|
||||
class GitCheckvalue(object):
|
||||
def __init__(self, rpath):
|
||||
self.rpath = rpath
|
||||
@@ -550,9 +578,9 @@ class EmergeCache(object):
|
||||
# список файлов проверяемый по mtime на изменения
|
||||
check_list = [MtimeCheckvalue('/etc/make.conf',
|
||||
'/etc/portage',
|
||||
- '/var/lib/portage/world',
|
||||
- '/var/lib/portage/world_sets',
|
||||
- '/etc/make.profile')]
|
||||
+ '/etc/make.profile'),
|
||||
+ Md5Checkvalue('/var/lib/portage/world',
|
||||
+ '/var/lib/portage/world_sets')]
|
||||
|
||||
def __init__(self):
|
||||
self.files_control_values = {}
|
||||
diff --git update/update.py update/update.py
|
||||
index 5d8936c..ac654b1 100644
|
||||
--- update/update.py
|
||||
+++ update/update.py
|
||||
@@ -20,6 +20,7 @@ from os import path
|
||||
from calculate.lib.utils.tools import AddonError
|
||||
from calculate.lib.utils.colortext.palette import TextState
|
||||
from calculate.lib.utils.colortext import get_color_print
|
||||
+from calculate.update.emerge_parser import RevdepPercentBlock
|
||||
import pexpect
|
||||
|
||||
from package_tools import Git, Layman,\
|
||||
@@ -298,6 +299,31 @@ class Update:
|
||||
raise
|
||||
return True
|
||||
|
||||
+ def revdep_rebuild(self, cmd, *params):
|
||||
+ cmd_path = getProgPath(cmd)
|
||||
+ if not cmd_path:
|
||||
+ raise UpdateError(_("Failed to find %s command") % cmd)
|
||||
+ with EmergeParser(
|
||||
+ emerge_parser.CommandExecutor(cmd_path, params)) as emerge:
|
||||
+ revdep = RevdepPercentBlock(emerge)
|
||||
+ self.addProgress()
|
||||
+ revdep.add_observer(self.setProgress)
|
||||
+ revdep.action = lambda x: (self.endTask(), self.startTask(
|
||||
+ _("Calculating dependencies")) if "Assign" in revdep else None)
|
||||
+ emerge.emerging.add_observer(self._printEmergePackage)
|
||||
+ emerge.installing.add_observer(self._printInstallPackage)
|
||||
+ emerge.uninstalling.add_observer(self._printUninstallPackage)
|
||||
+ try:
|
||||
+ emerge.run()
|
||||
+ except EmergeError:
|
||||
+ if emerge.emerging_error:
|
||||
+ self.printPre(
|
||||
+ self._emerge_translate(emerge.emerging_error.log))
|
||||
+ else:
|
||||
+ self.printPre(self._emerge_translate(emerge.prepare_error))
|
||||
+ raise
|
||||
+ return True
|
||||
+
|
||||
def _display_pretty_package_list(self, pkglist, remove_list=False):
|
||||
"""
|
||||
Отобразить список пакетов в "удобночитаемом" виде
|
||||
@@ -323,7 +349,7 @@ class Update:
|
||||
else:
|
||||
size = ""
|
||||
mult = _print.bold("*")
|
||||
- self.printDefault(" {mult} {fullname} {shortname}{size}".format(
|
||||
+ self.printDefault(" {mult} {fullname} {shortname}{size}".format(
|
||||
mult=mult, fullname=fullname, shortname=shortname, size=size))
|
||||
|
||||
def _display_install_package(self, emerge):
|
||||
@@ -467,7 +493,7 @@ class Update:
|
||||
emerge.uninstalling.add_observer(self._printUninstallPackage)
|
||||
try:
|
||||
emerge.run()
|
||||
- except EmergeError as e:
|
||||
+ except EmergeError:
|
||||
self.emerge_cache.drop_cache()
|
||||
if emerge.emerging_error:
|
||||
self.printPre(
|
||||
diff --git update/utils/cl_update.py update/utils/cl_update.py
|
||||
index 111b369..6122db4 100644
|
||||
--- update/utils/cl_update.py
|
||||
+++ update/utils/cl_update.py
|
||||
@@ -180,16 +180,16 @@ class ClUpdateAction(Action):
|
||||
'preserved_libs']
|
||||
},
|
||||
{'name': 'update:revdev_rebuild',
|
||||
- 'message': __('Executing {0}').format("revdep-rebuild"),
|
||||
- 'method': 'Update.emergelike("revdep-rebuild")',
|
||||
+ 'message': __('Checking reverse dependencies'),
|
||||
+ 'method': 'Update.revdep_rebuild("revdep-rebuild")',
|
||||
'condition': was_installed('.*', log_names['revdep']),
|
||||
'decoration': 'Update.update_task("%s")' % log_names['revdep']
|
||||
},
|
||||
- {'name': 'update:set_upto_date_cache',
|
||||
- 'method': 'Update.setUpToDateCache()'
|
||||
- }
|
||||
]
|
||||
},
|
||||
+ {'name': 'update:set_upto_date_cache',
|
||||
+ 'method': 'Update.setUpToDateCache()'
|
||||
+ }
|
||||
]
|
||||
|
||||
# список задач для дейсвия
|
||||
diff --git update/variables/update.py update/variables/update.py
|
||||
index 0f79468..a000e45 100644
|
||||
--- update/variables/update.py
|
||||
+++ update/variables/update.py
|
||||
@@ -117,8 +117,10 @@ class VariableClUpdateSystemProfile(ReadonlyVariable):
|
||||
"""
|
||||
def get(self):
|
||||
try:
|
||||
+ make_profile = self.Get('cl_make_profile')
|
||||
return path.normpath(
|
||||
- path.join('/etc',os.readlink('/etc/make.profile')))
|
||||
+ path.join(path.dirname(make_profile),
|
||||
+ os.readlink(make_profile)))
|
||||
except:
|
||||
raise VariableError(_("Failed to determine system profile"))
|
||||
|
@ -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="amd64 x86"
|
||||
IUSE="cl_consolegui cl_client cl_desktop cl_console"
|
||||
|
||||
RDEPEND="${RDEPEND}
|
||||
=sys-apps/calculate-install-3.2.0_alpha4-r1
|
||||
=sys-apps/calculate-i18n-3.2.0_alpha4
|
||||
=sys-apps/calculate-lib-3.2.0_alpha4-r3
|
||||
=sys-apps/calculate-core-3.2.0_alpha4-r3
|
||||
=sys-apps/calculate-update-3.2.0_alpha4-r3
|
||||
cl_client? ( =sys-apps/calculate-client-3.2.0_alpha4 )
|
||||
cl_desktop? ( =sys-apps/calculate-desktop-3.2.0_alpha4 )
|
||||
cl_consolegui? ( =sys-apps/calculate-console-gui-3.2.0_alpha4 )
|
||||
cl_console? ( =sys-apps/calculate-console-3.2.0_alpha4-r1 )
|
||||
"
|
Loading…
Reference in new issue