parent
7d69a1e462
commit
bef97250e6
@ -0,0 +1,29 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
EAPI="3"
|
||||
|
||||
inherit distutils eutils
|
||||
|
||||
SRC_URI="ftp://ftp.calculate.ru/pub/calculate/calculate3/${PN}/${P}.tar.bz2"
|
||||
|
||||
DESCRIPTION="Qt gui console client for WSDL Calculate 3"
|
||||
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
|
||||
LICENSE="Apache-2.0"
|
||||
SLOT="3"
|
||||
KEYWORDS="amd64 x86"
|
||||
|
||||
DEPEND="~sys-apps/calculate-core-3.0.0
|
||||
dev-python/dbus-python
|
||||
dev-python/imaging
|
||||
dev-python/pyside[script]"
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
src_unpack() {
|
||||
unpack "${A}"
|
||||
cd "${S}"
|
||||
|
||||
# changes
|
||||
epatch "${FILESDIR}/calculate-console-gui-3.0.0-r1.patch"
|
||||
}
|
@ -0,0 +1,211 @@
|
||||
diff --git consolegui/application/MainFrameResult.py consolegui/application/MainFrameResult.py
|
||||
index 13ec7c1..8f6f21f 100755
|
||||
--- consolegui/application/MainFrameResult.py
|
||||
+++ consolegui/application/MainFrameResult.py
|
||||
@@ -139,8 +139,14 @@ class MainFrameRes(QtGui.QWidget):
|
||||
len(table.head[0]), self)
|
||||
|
||||
if not hasattr (self, 'mytable'):
|
||||
- self.mytable = SelectedTableWidget(len(table.body[0]), \
|
||||
- len(table.head[0]), self, readonly = True)
|
||||
+ if table.body:
|
||||
+ len_body = len(table.body[0])
|
||||
+ else: len_body = 1
|
||||
+ if table.head:
|
||||
+ len_head = len(table.head[0])
|
||||
+ else: len_head = 1
|
||||
+ self.mytable = SelectedTableWidget(len_body, len_head, self,
|
||||
+ readonly = True)
|
||||
list_head = table.head[0]
|
||||
self.mytable.setHorizontalHeaderLabels(list_head)
|
||||
for line in range(len(table.body[0])):
|
||||
diff --git consolegui/application/mainframe.py consolegui/application/mainframe.py
|
||||
index f001ba5..de578c2 100755
|
||||
--- consolegui/application/mainframe.py
|
||||
+++ consolegui/application/mainframe.py
|
||||
@@ -41,7 +41,6 @@ class CallMethod(QtCore.QThread):
|
||||
def run(self):
|
||||
self.collect_sig.emit()
|
||||
time.sleep(0.1)
|
||||
-
|
||||
self.call_meth_sig.emit()
|
||||
|
||||
class TableValue():
|
||||
@@ -106,7 +105,7 @@ class MainFrame(QtGui.QWidget):
|
||||
self.setObjectName('MainFrame')
|
||||
self.setStyleSheet("QWidget#MainFrame "
|
||||
"{background-color: #E4E1E0;}")
|
||||
-# " QWidget { border: 1px solid blue;}")
|
||||
+ # " QWidget { border: 1px solid blue;}")
|
||||
# x = 0 - space for image
|
||||
x = 1
|
||||
y = 0
|
||||
@@ -500,6 +499,8 @@ class MainFrame(QtGui.QWidget):
|
||||
else:
|
||||
self.view_dict[field.name] = QCheckBox(self)
|
||||
|
||||
+ self.view_dict[field.name].setFocusPolicy(QtCore.Qt.NoFocus)
|
||||
+
|
||||
if field.element.lower() == 'check_tristate' or self.expert:
|
||||
self.view_dict[field.name].setTristate()
|
||||
if field.value == 'on':
|
||||
@@ -613,6 +614,7 @@ class MainFrame(QtGui.QWidget):
|
||||
|
||||
for i in range(0,len(choice)):
|
||||
radio_but = RadioButton(self)
|
||||
+ radio_but.setFocusPolicy(QtCore.Qt.NoFocus)
|
||||
if choice[i] == None:
|
||||
choice[i] = ''
|
||||
try:
|
||||
diff --git consolegui/application/more.py consolegui/application/more.py
|
||||
index f68979f..17951c8 100755
|
||||
--- consolegui/application/more.py
|
||||
+++ consolegui/application/more.py
|
||||
@@ -655,6 +655,7 @@ class ComboFileWgt(QtGui.QWidget):
|
||||
class ReadonlyCheckBox(QtGui.QCheckBox):
|
||||
def __init__(self, parent):
|
||||
QtGui.QCheckBox.__init__(self, parent)
|
||||
+ self.setFocusPolicy(QtCore.Qt.NoFocus)
|
||||
self.disabled = False
|
||||
|
||||
def mousePressEvent(self, event):
|
||||
@@ -680,6 +681,7 @@ class CentralCheckBox (QtGui.QWidget):
|
||||
self.pCheckB.clicked.connect(self.change_label)
|
||||
self.change_label()
|
||||
self.setStyleSheet('padding: 0px; margin-left: 2px;')
|
||||
+ self.setFocusPolicy(QtCore.Qt.NoFocus)
|
||||
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
||||
|
||||
def setChecked(self, check = True):
|
||||
@@ -848,7 +850,21 @@ class MultipleChoiceDialog (QtGui.QWidget):
|
||||
|
||||
p_m_wgt = QtGui.QWidget(self)
|
||||
p_m_layout = QtGui.QVBoxLayout(p_m_wgt)
|
||||
- # add '+' button
|
||||
+
|
||||
+ # add '++' button
|
||||
+ self.plus_all_Button = QtGui.QPushButton(self)
|
||||
+ plus_all_icons = ['go-last-view', 'go-last']
|
||||
+ for icon in plus_all_icons:
|
||||
+ icon_next = QtGui.QIcon.fromTheme(icon)
|
||||
+ if not icon_next.isNull():
|
||||
+ self.plus_all_Button.setIcon(icon_next)
|
||||
+ break
|
||||
+ if icon_next.isNull():
|
||||
+ self.plus_all_Button.setText('->\n->')
|
||||
+ self.plus_all_Button.clicked.connect(self.plus_all_items)
|
||||
+ p_m_layout.addWidget(self.plus_all_Button)
|
||||
+
|
||||
+ # add '+' button
|
||||
self.plus_Button = QtGui.QPushButton(self)
|
||||
plus_icons = ['go-next-view','go-next']
|
||||
for icon in plus_icons:
|
||||
@@ -876,6 +892,19 @@ class MultipleChoiceDialog (QtGui.QWidget):
|
||||
|
||||
self.layout.addWidget(p_m_wgt, 2, 2, 2, 1)
|
||||
|
||||
+ # add '--' button
|
||||
+ self.minus_all_Button = QtGui.QPushButton(self)
|
||||
+ minus_all_icons = ['go-first-view', 'go-first']
|
||||
+ for icon in minus_all_icons:
|
||||
+ icon_next = QtGui.QIcon.fromTheme(icon)
|
||||
+ if not icon_next.isNull():
|
||||
+ self.minus_all_Button.setIcon(icon_next)
|
||||
+ break
|
||||
+ if icon_next.isNull():
|
||||
+ self.minus_all_Button.setText('<-\n<-')
|
||||
+ self.minus_all_Button.clicked.connect(self.minus_all_items)
|
||||
+ p_m_layout.addWidget(self.minus_all_Button)
|
||||
+
|
||||
#add right list
|
||||
self.right_ListWidget = ListWidget(self)
|
||||
self.right_ListWidget.itemDoubleClicked.connect(self.minus_item)
|
||||
@@ -919,6 +948,14 @@ class MultipleChoiceDialog (QtGui.QWidget):
|
||||
self.add_LineEdit.setText('')
|
||||
self.add_LineEdit.setFocus()
|
||||
|
||||
+ def plus_all_items(self):
|
||||
+ # get item in left_ListWidget and set this item in right_ListWidget
|
||||
+ while True:
|
||||
+ temp_item = self.left_ListWidget.takeItem(0)
|
||||
+ if not temp_item:
|
||||
+ return
|
||||
+ self.right_ListWidget.addItem(temp_item)
|
||||
+
|
||||
def plus_item(self):
|
||||
# get item in left_ListWidget and set this item in right_ListWidget
|
||||
temp_item = self.left_ListWidget.takeItem \
|
||||
@@ -931,6 +968,14 @@ class MultipleChoiceDialog (QtGui.QWidget):
|
||||
(self.right_ListWidget.currentRow())
|
||||
self.left_ListWidget.addItem(temp_item)
|
||||
|
||||
+ def minus_all_items(self):
|
||||
+ # get item in left_ListWidget and set this item in right_ListWidget
|
||||
+ while True:
|
||||
+ temp_item = self.right_ListWidget.takeItem(0)
|
||||
+ if not temp_item:
|
||||
+ return
|
||||
+ self.left_ListWidget.addItem(temp_item)
|
||||
+
|
||||
def ok_pressed(self):
|
||||
# save all lists and close this widget
|
||||
self._parent.Selected = []
|
||||
@@ -961,12 +1006,12 @@ class MultipleChoiceDialog (QtGui.QWidget):
|
||||
class MultipleButton(QtGui.QPushButton):
|
||||
def __init__(self, text, parent):
|
||||
QtGui.QPushButton.__init__(self, text, parent)
|
||||
- self.setStyleSheet ("text-align: left;")
|
||||
- self.setContentsMargins(0, 0, 0, 0)
|
||||
+ self.setStyleSheet("text-align: left; padding: 3px;")
|
||||
+ self.setFocusPolicy(QtCore.Qt.NoFocus)
|
||||
|
||||
def mousePressEvent(self, button = None):
|
||||
self.parent().mousePressEvent()
|
||||
-
|
||||
+
|
||||
class MultipleChoice (QtGui.QWidget):
|
||||
Changed = QtCore.Signal()
|
||||
# multiple-choice widget displayed in the table
|
||||
@@ -1369,6 +1414,7 @@ class SelectList(QtGui.QGroupBox):
|
||||
self.CheckBoxList = []
|
||||
for row in range(self.row_count):
|
||||
item = QtGui.QCheckBox(self.comments[row])
|
||||
+ item.setFocusPolicy(QtCore.Qt.NoFocus)
|
||||
item.setStyleSheet("QCheckBox {margin: 2px;}"
|
||||
"QCheckBox:hover { margin: 2px;"
|
||||
"background-color: transparent;}")
|
||||
@@ -1435,6 +1481,7 @@ class SelectList(QtGui.QGroupBox):
|
||||
self.addLineWgt.close()
|
||||
|
||||
item = QtGui.QCheckBox(text)
|
||||
+ item.setFocusPolicy(QtCore.Qt.NoFocus)
|
||||
item.setStyleSheet("QCheckBox {margin: 2px;}"
|
||||
"QCheckBox:hover { margin: 2px;"
|
||||
"background-color: transparent;}")
|
||||
@@ -1515,6 +1562,7 @@ class ExpertWidget (QtGui.QPushButton):
|
||||
layout.addWidget(self.image_lbl)
|
||||
|
||||
self.text_lbl = QtGui.QLabel(label, self)
|
||||
+ self.setFocusPolicy(QtCore.Qt.NoFocus)
|
||||
layout.addWidget(self.text_lbl)
|
||||
layout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
||||
|
||||
@@ -1704,7 +1752,7 @@ class PlusRow (QtGui.QWidget):
|
||||
|
||||
self.grid.addWidget(self.widget_dict[str(i)], x, y+1, \
|
||||
QtCore.Qt.AlignLeft)
|
||||
- x += 1
|
||||
+ x += 1
|
||||
|
||||
elif element == 'combo':
|
||||
ChoiceValue = field.tablevalue.values.ChoiceValue[i]
|
||||
diff --git scripts/cl-console-gui scripts/cl-console-gui
|
||||
index 9cc7777..867932e 100755
|
||||
--- scripts/cl-console-gui
|
||||
+++ scripts/cl-console-gui
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/python
|
||||
+#!/usr/bin/env python2
|
||||
#-*- coding: utf-8 -*-
|
||||
|
||||
import sys, os, pwd
|
@ -0,0 +1,26 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
EAPI="3"
|
||||
|
||||
inherit distutils eutils
|
||||
|
||||
SRC_URI="ftp://ftp.calculate.ru/pub/calculate/calculate3/${PN}/${P}.tar.bz2"
|
||||
|
||||
DESCRIPTION="Console client for WSDL Calculate 3"
|
||||
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
|
||||
LICENSE="Apache-2.0"
|
||||
SLOT="3"
|
||||
KEYWORDS="amd64 x86"
|
||||
|
||||
DEPEND="~sys-apps/calculate-core-3.0.0"
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
src_unpack() {
|
||||
unpack "${A}"
|
||||
cd "${S}"
|
||||
|
||||
# changes
|
||||
epatch "${FILESDIR}/calculate-console-3.0.0-r1.patch"
|
||||
}
|
@ -0,0 +1,223 @@
|
||||
diff --git .gitignore .gitignore
|
||||
index ea7e6a7..279d4d2 100644
|
||||
--- .gitignore
|
||||
+++ .gitignore
|
||||
@@ -3,3 +3,6 @@ build
|
||||
*.pyc
|
||||
*.kate-swp
|
||||
*.mo
|
||||
+mymake
|
||||
+.gitignore
|
||||
+Makefile
|
||||
diff --git console/application/cl_client.py console/application/cl_client.py
|
||||
index 7bdc5b1..1ec21e2 100644
|
||||
--- console/application/cl_client.py
|
||||
+++ console/application/cl_client.py
|
||||
@@ -65,6 +65,8 @@ class StoppableThread(threading.Thread):
|
||||
def __init__(self):
|
||||
super(StoppableThread, self).__init__()
|
||||
self._stop = threading.Event()
|
||||
+ self._pause = threading.Event()
|
||||
+ self._paused = threading.Event()
|
||||
|
||||
def run(self):
|
||||
l = ['|','/','-','\\','|','/','-','\\']
|
||||
@@ -74,10 +76,23 @@ class StoppableThread(threading.Thread):
|
||||
sys.stdout.write("\r\r" + i)
|
||||
sys.stdout.flush()
|
||||
time.sleep(.1)
|
||||
+ while self.paused() and not self.stopped():
|
||||
+ self._paused.set()
|
||||
if self.stopped():
|
||||
sys.stdout.write("\b")
|
||||
sys.stdout.flush()
|
||||
return 0
|
||||
+
|
||||
+
|
||||
+ def pause(self):
|
||||
+ self._pause.set()
|
||||
+ while not self._paused.is_set():
|
||||
+ self._paused.clear()
|
||||
+ sys.stdout.write("\r")
|
||||
+ sys.stdout.flush()
|
||||
+
|
||||
+ def resume(self):
|
||||
+ self._pause.clear()
|
||||
|
||||
def stop(self):
|
||||
self._stop.set()
|
||||
@@ -85,6 +100,9 @@ class StoppableThread(threading.Thread):
|
||||
def stopped(self):
|
||||
return self._stop.isSet()
|
||||
|
||||
+ def paused(self):
|
||||
+ return self._pause.isSet()
|
||||
+
|
||||
def connect_with_cert(cert, path_to_cert, url, args, wait_thread, clVarsCore,
|
||||
crypto_Error, Connect_Error):
|
||||
flag_thread_start = False
|
||||
@@ -237,10 +255,10 @@ def https_server(client, args, unknown_args, url, clVarsCore, wait_thread):
|
||||
view_params = get_view_params(client, args.method + '_view',
|
||||
step = None, expert = True)
|
||||
view = get_view(client, args.method, client.sid, view_params)
|
||||
- method_parser = get_method_argparser(view, args)
|
||||
wait_thread.stop()
|
||||
sys.stdout.write("\b")
|
||||
sys.stdout.flush()
|
||||
+ method_parser = get_method_argparser(view, args)
|
||||
method_parser.print_help()
|
||||
client.service.clear_method_cache(client.sid, args.method)
|
||||
|
||||
@@ -402,7 +420,7 @@ def main(wait_thread):
|
||||
if type(e.message) != int:
|
||||
if e.message:
|
||||
print e.message
|
||||
- else:
|
||||
+ elif e.args:
|
||||
print e
|
||||
# tb.print_exc()
|
||||
return 1
|
||||
@@ -504,7 +522,7 @@ def main(wait_thread):
|
||||
if type(e.message) != int:
|
||||
if e.message:
|
||||
print e.message
|
||||
- else:
|
||||
+ elif e.args:
|
||||
print e
|
||||
# tb.print_exc()
|
||||
return 1
|
||||
diff --git console/application/function.py console/application/function.py
|
||||
index dbcbe5f..22b14d6 100644
|
||||
--- console/application/function.py
|
||||
+++ console/application/function.py
|
||||
@@ -96,8 +96,9 @@ def get_ip_mac_type(client_type = None):
|
||||
return results
|
||||
|
||||
def print_brief_group(Fields, group_name):
|
||||
- if group_name:
|
||||
- _print ('\b'+group_name)
|
||||
+ print_group_flag = False
|
||||
+# if group_name:
|
||||
+# _print ('\b'+group_name)
|
||||
uncompatible_count = 0
|
||||
for field in Fields:
|
||||
if field.uncompatible:
|
||||
@@ -105,6 +106,9 @@ def print_brief_group(Fields, group_name):
|
||||
continue
|
||||
if field.element in ['input', 'openfile']:
|
||||
value = field.value if field.value else ''
|
||||
+ if not print_group_flag:
|
||||
+ _print ('\b'+group_name)
|
||||
+ print_group_flag = True
|
||||
colorPrint._printSUCCESS('%s: %s' %(field.label, value))
|
||||
|
||||
elif field.element in ['combo', 'comboEdit', 'radio', 'file']:
|
||||
@@ -118,6 +122,9 @@ def print_brief_group(Fields, group_name):
|
||||
value = ', '.join(value)
|
||||
else:
|
||||
value = field.value if field.value else ''
|
||||
+ if not print_group_flag:
|
||||
+ _print ('\b'+group_name)
|
||||
+ print_group_flag = True
|
||||
colorPrint._printSUCCESS('%s: %s' %(field.label, value))
|
||||
|
||||
elif field.element in ['multichoice', 'multichoice_add',\
|
||||
@@ -134,12 +141,18 @@ def print_brief_group(Fields, group_name):
|
||||
value = ', '.join(field.listvalue.string)
|
||||
else:
|
||||
value = field.value if field.value else ''
|
||||
+ if not print_group_flag:
|
||||
+ _print ('\b'+group_name)
|
||||
+ print_group_flag = True
|
||||
colorPrint._printSUCCESS('%s: %s' %(field.label, value))
|
||||
|
||||
# elif field.element == 'label':
|
||||
# print field.label
|
||||
|
||||
elif field.element == 'error':
|
||||
+ if not print_group_flag:
|
||||
+ _print ('\b'+group_name)
|
||||
+ print_group_flag = True
|
||||
colorPrint.printERROR(field.label)
|
||||
|
||||
elif field.element in ['check', 'check_tristate']:
|
||||
@@ -151,6 +164,9 @@ def print_brief_group(Fields, group_name):
|
||||
value = _('auto')
|
||||
else:
|
||||
value = field.value
|
||||
+ if not print_group_flag:
|
||||
+ _print ('\b'+group_name)
|
||||
+ print_group_flag = True
|
||||
colorPrint._printSUCCESS('%s: %s' %(field.label, value))
|
||||
|
||||
elif field.element == 'table' and field.type != 'steps':
|
||||
@@ -192,6 +208,9 @@ def print_brief_group(Fields, group_name):
|
||||
for body_row in body:
|
||||
data.append(map(lambda x: x if x else '', body_row))
|
||||
|
||||
+ if not print_group_flag:
|
||||
+ _print ('\b'+group_name)
|
||||
+ print_group_flag = True
|
||||
colorPrint._printSUCCESS('%s: ' %(field.label))
|
||||
res = printTable(data, head)
|
||||
sys.stdout.flush()
|
||||
@@ -200,8 +219,8 @@ def print_brief_group(Fields, group_name):
|
||||
else:
|
||||
uncompatible_count += 1
|
||||
|
||||
- if uncompatible_count == len (Fields) and group_name:
|
||||
- colorPrint._printSUCCESS(_('Not used'))
|
||||
+# if uncompatible_count == len (Fields) and group_name:
|
||||
+# colorPrint._printSUCCESS(_('Not used'))
|
||||
|
||||
def print_brief(view, brief_label):
|
||||
for Group in view.groups.GroupField:
|
||||
diff --git console/application/methods_func.py console/application/methods_func.py
|
||||
index 7afde09..2087b4a 100644
|
||||
--- console/application/methods_func.py
|
||||
+++ console/application/methods_func.py
|
||||
@@ -90,6 +90,10 @@ def parse():
|
||||
parser.add_argument(
|
||||
'-f', '--force', action='store_true', default=False,
|
||||
dest = 'no_questions', help=_('silent during the process'))
|
||||
+ parser.add_argument(
|
||||
+ '-P', action='store_true', default=False,
|
||||
+ dest = 'stdin_passwd',
|
||||
+ help=_('use passwords for the users accounts from standard input'))
|
||||
return parser
|
||||
|
||||
def get_view(client, method, sid, view_params):
|
||||
@@ -103,6 +107,7 @@ def get_view(client, method, sid, view_params):
|
||||
def call_method(client, args, wait_thread):
|
||||
method = args.method
|
||||
no_questions = args.no_questions
|
||||
+ stdin_passwd = args.stdin_passwd
|
||||
view_params = get_view_params(client, method + '_view', step = None, \
|
||||
expert = True)
|
||||
|
||||
@@ -122,7 +127,7 @@ def call_method(client, args, wait_thread):
|
||||
_print (_('Unknown parameter'), i)
|
||||
raise Exception(1)
|
||||
param_object, steps = collect_object(client, param_object, view, args,
|
||||
- wait_thread)
|
||||
+ wait_thread,stdin_passwd=stdin_passwd)
|
||||
if steps.label and hasattr (param_object, 'CheckOnly'):
|
||||
param_object['CheckOnly'] = True
|
||||
check_res = {}
|
||||
diff --git scripts/cl-console scripts/cl-console
|
||||
index 9431995..33650cb 100755
|
||||
--- scripts/cl-console
|
||||
+++ scripts/cl-console
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/python
|
||||
+#!/usr/bin/env python2
|
||||
#-*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2012 Calculate Ltd. http://www.calculate-linux.org
|
||||
@@ -34,4 +34,4 @@ if __name__=='__main__':
|
||||
wait_thread.stop()
|
||||
red = '\033[31m * \033[0m'
|
||||
print '\n'+red+_('Interrupted by the user')
|
||||
- sys.exit(1)
|
||||
\ No newline at end of file
|
||||
+ sys.exit(1)
|
@ -0,0 +1,48 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
EAPI="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.0.0
|
||||
>=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}"
|
||||
|
||||
src_unpack() {
|
||||
unpack "${A}"
|
||||
cd "${S}"
|
||||
|
||||
# changes
|
||||
epatch "${FILESDIR}/calculate-core-3.0.0-r1.patch"
|
||||
}
|
||||
|
||||
|
||||
pkg_preinst() {
|
||||
dosym /usr/sbin/cl-core /usr/sbin/cl-core-setup
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
@ -0,0 +1,500 @@
|
||||
diff --git core/client/sid_func.py core/client/sid_func.py
|
||||
index 16cf68e..09ee616 100644
|
||||
--- core/client/sid_func.py
|
||||
+++ core/client/sid_func.py
|
||||
@@ -100,4 +100,4 @@ def client_session_info(client):
|
||||
print _("Failed to get data")
|
||||
return 1
|
||||
return 0
|
||||
-
|
||||
\ No newline at end of file
|
||||
+
|
||||
diff --git core/server/cert_cmd.py core/server/cert_cmd.py
|
||||
index 0f72d5c..f52b02e 100644
|
||||
--- core/server/cert_cmd.py
|
||||
+++ core/server/cert_cmd.py
|
||||
@@ -1290,6 +1290,10 @@ def parse():
|
||||
'-f', '--force', action='store_true', default=False,
|
||||
dest = 'no_questions', help=_('silent during the process'))
|
||||
parser.add_argument(
|
||||
+ '-P', action='store_true', default=False,
|
||||
+ dest = 'stdin_passwd',
|
||||
+ help=_('use passwords for the users accounts from standard input'))
|
||||
+ parser.add_argument(
|
||||
'--variable', type=str, dest='variable',
|
||||
help=_("display the value for the specified variable "
|
||||
"(section.variablename). If section skipped then use "
|
||||
diff --git core/server/methods_func.py core/server/methods_func.py
|
||||
index 41d4246..fa5338d 100644
|
||||
--- core/server/methods_func.py
|
||||
+++ core/server/methods_func.py
|
||||
@@ -17,13 +17,27 @@
|
||||
|
||||
import sys, os
|
||||
from calculate.lib.utils.common import getpass
|
||||
+from calculate.lib.cl_print import color_print
|
||||
from calculate.lib.cl_lang import setLocalTranslate
|
||||
setLocalTranslate('cl_core',sys.modules[__name__])
|
||||
|
||||
+colorPrint = color_print()
|
||||
+
|
||||
def _print (*args):
|
||||
print " ".join(map(lambda x:unicode(x).encode('utf-8'),args))
|
||||
|
||||
-def get_password(text1 = None, text2 = None):
|
||||
+def get_password(text1 = None, text2 = None, getfromstdin=False):
|
||||
+ if getfromstdin:
|
||||
+ try:
|
||||
+ passwd = ''
|
||||
+ while not passwd:
|
||||
+ passwd = sys.stdin.readline()
|
||||
+ if not passwd:
|
||||
+ return None
|
||||
+ passwd = passwd.rstrip('\n')
|
||||
+ return passwd
|
||||
+ except:
|
||||
+ return None
|
||||
if not text1:
|
||||
text1 = _('Password: ')
|
||||
if not text2:
|
||||
@@ -94,6 +108,14 @@ class RawAndDefaultsHelpFormatter(argparse.HelpFormatter):
|
||||
return _textwrap.wrap(text.decode('utf-8'), width)
|
||||
|
||||
def get_method_argparser(view, args, cl_core = False):
|
||||
+ """
|
||||
+ Get argparser by ViewInfo get from WSDL server (or stub)
|
||||
+
|
||||
+ cl_core - argparser for cl_core (local call)
|
||||
+ """
|
||||
+ # get list (local View) or first element of tuple (WSDL View)
|
||||
+ getlist = (lambda x:x) if cl_core else (lambda x:x[0])
|
||||
+ error_flag = False
|
||||
method = args.method
|
||||
if cl_core:
|
||||
progr = os.path.basename(sys.argv[0])
|
||||
@@ -102,86 +124,47 @@ def get_method_argparser(view, args, cl_core = False):
|
||||
|
||||
parser = argparse.ArgumentParser(prog=progr, add_help=False,
|
||||
formatter_class=RawAndDefaultsHelpFormatter)
|
||||
-# parser = argparse.ArgumentParser(prog=progr, add_help=False)
|
||||
- if type(view.groups) == list:
|
||||
- # for local call method
|
||||
- groups = view.groups
|
||||
- else:
|
||||
- groups = view.groups[0]
|
||||
|
||||
- for Group in groups:
|
||||
+ for Group in getlist(view.groups):
|
||||
if not Group.fields:
|
||||
continue
|
||||
group = parser.add_argument_group(Group.name)
|
||||
- if type(Group.fields) == list:
|
||||
- # for local call method
|
||||
- fields = Group.fields
|
||||
- else:
|
||||
- fields = Group.fields[0]
|
||||
- for field in fields:
|
||||
+ for field in getlist(Group.fields):
|
||||
if field.element == 'error':
|
||||
- print field.label
|
||||
+ error_flag = True
|
||||
+ colorPrint.printERROR(field.label)
|
||||
elif field.opt:
|
||||
- action = None
|
||||
- arg_type = str
|
||||
+ opt = field.opt
|
||||
+ data = {'dest':field.name,'help' : opt.help}
|
||||
+ if field.type == "password":
|
||||
+ data['action'] = "store_true"
|
||||
+ else:
|
||||
+ data['type'] = str
|
||||
if field.element in ['check', 'check_tristate']:
|
||||
- arg_type = bool
|
||||
+ data['type'] = bool
|
||||
elif field.element == 'radio' and field.type == 'bool':
|
||||
- arg_type = bool
|
||||
- elif field.element == 'table' and field.type != 'steps':
|
||||
- action = 'append'
|
||||
-
|
||||
- opt = field.opt
|
||||
- metavalue = opt.metavalue if opt.metavalue \
|
||||
- else field.name.upper()
|
||||
-
|
||||
- if ':' in metavalue:
|
||||
- metavalue = field.name.upper()
|
||||
-
|
||||
+ data['type'] = bool
|
||||
+ if field.element == 'table' and field.type != 'steps':
|
||||
+ data['action'] = 'append'
|
||||
+
|
||||
+ if data.get('action') != "store_true":
|
||||
+ data['metavar'] = opt.metavalue if opt.metavalue \
|
||||
+ else field.name.upper()
|
||||
+ if ':' in data['metavar']:
|
||||
+ data['metavar'] = field.name.upper()
|
||||
try:
|
||||
- if arg_type == str:
|
||||
- if opt.shortopt and opt.longopt:
|
||||
- group.add_argument(opt.shortopt, opt.longopt,
|
||||
- type = arg_type, dest=field.name, metavar = \
|
||||
- metavalue, action = action, help = opt.help)
|
||||
- elif opt.shortopt and not opt.longopt:
|
||||
- group.add_argument(opt.shortopt,
|
||||
- type = arg_type, dest=field.name, metavar = \
|
||||
- metavalue, action = action, help = opt.help)
|
||||
- elif opt.longopt and not opt.shortopt:
|
||||
- group.add_argument(opt.longopt,
|
||||
- type = arg_type, dest=field.name, metavar = \
|
||||
- metavalue, action = action, help = opt.help)
|
||||
-
|
||||
-# elif arg_type == bool:
|
||||
-# if opt.shortopt and opt.longopt:
|
||||
-# group.add_argument(opt.shortopt, opt.longopt,
|
||||
-# action='store_true', dest=field.name,
|
||||
-# default=None, help = opt.help)
|
||||
-# elif opt.shortopt and not opt.longopt:
|
||||
-# group.add_argument(opt.shortopt,
|
||||
-# action='store_true', dest=field.name,
|
||||
-# default=None, help = opt.help)
|
||||
-# elif opt.longopt and not opt.shortopt:
|
||||
-# group.add_argument(opt.longopt,
|
||||
-# action='store_true', dest=field.name,
|
||||
-# default=None, help=opt.help)
|
||||
- elif arg_type == bool:
|
||||
- if opt.shortopt and opt.longopt:
|
||||
- group.add_argument(opt.shortopt, opt.longopt,
|
||||
- type = str, dest=field.name,
|
||||
- help = opt.help)
|
||||
- elif opt.shortopt and not opt.longopt:
|
||||
- group.add_argument(opt.shortopt, type = str,
|
||||
- dest=field.name, help=opt.help)
|
||||
- elif opt.longopt and not opt.shortopt:
|
||||
- group.add_argument(opt.longopt, type = str,
|
||||
- dest=field.name, help=opt.help)
|
||||
+ opts = filter(None,[opt.shortopt,opt.longopt])
|
||||
+ group.add_argument(*opts,**data)
|
||||
except argparse.ArgumentError:
|
||||
continue
|
||||
+ if error_flag:
|
||||
+ raise Exception
|
||||
return parser
|
||||
|
||||
def set_obj_item(client, param_object, field_name, value):
|
||||
+ """
|
||||
+ Set value for Info object. By client detect (local or WSDL call)
|
||||
+ """
|
||||
if client:
|
||||
param_object.__setitem__(field_name, value)
|
||||
else:
|
||||
@@ -306,12 +289,13 @@ def check_result_msg(method_result, view, input_error_dict = {}):
|
||||
if field.name == error.field:
|
||||
if field.opt.shortopt or field.opt.longopt:
|
||||
params_text += _('Wrong option ')
|
||||
- params_text += ', '.join(filter(None,
|
||||
+ params_text += ' '+', '.join(filter(None,
|
||||
[field.opt.shortopt, field.opt.longopt])) \
|
||||
+ '. '
|
||||
|
||||
- red = '\033[31m * \033[0m'
|
||||
- _print ('\r' + red + params_text + error.message)
|
||||
+ sys.stdout.write('\r')
|
||||
+ sys.stdout.flush()
|
||||
+ colorPrint.printERROR(params_text + error.message)
|
||||
|
||||
if len(password_errors) < len(method_result):
|
||||
return None
|
||||
@@ -323,7 +307,8 @@ def check_result_msg(method_result, view, input_error_dict = {}):
|
||||
return None
|
||||
return password_errors
|
||||
|
||||
-def get_param_pwd(check_res, view, param_object, client = None):
|
||||
+def get_param_pwd(check_res, view, param_object, client = None,
|
||||
+ stdin_passwd=False):
|
||||
if hasattr (view.groups, 'GroupField'):
|
||||
groups = view.groups.GroupField
|
||||
else:
|
||||
@@ -338,18 +323,22 @@ def get_param_pwd(check_res, view, param_object, client = None):
|
||||
for field in fields:
|
||||
if field.name == pwd_field:
|
||||
if field.element == 'table':
|
||||
- value = get_password()
|
||||
+ value = get_password(getfromstdin=stdin_passwd)
|
||||
if value == None:
|
||||
raise KeyboardInterrupt
|
||||
set_table_pwd(client, param_object, field, value)
|
||||
else:
|
||||
- value = get_password()
|
||||
+ value = get_password(getfromstdin=stdin_passwd)
|
||||
if value == None:
|
||||
raise KeyboardInterrupt
|
||||
setattr(param_object, pwd_field, value)
|
||||
return param_object
|
||||
|
||||
-def collect_object(client, param_object, view, args, wait_thread = None):
|
||||
+def collect_object(client, param_object, view, args,wait_thread = None,
|
||||
+ stdin_passwd = False):
|
||||
+ """
|
||||
+ Collect Info object by args
|
||||
+ """
|
||||
steps = None
|
||||
if type(view.groups) == list:
|
||||
# for local call method
|
||||
@@ -413,10 +402,20 @@ def collect_object(client, param_object, view, args, wait_thread = None):
|
||||
val)
|
||||
|
||||
elif field.element in ['input', 'openfile',\
|
||||
- 'file', 'password', 'radio']:
|
||||
+ 'file', 'radio']:
|
||||
param_object = set_obj_item(client, param_object, field.name,
|
||||
_getattr(args, field.name))
|
||||
-
|
||||
+ elif field.element in ['password'] and _getattr(args, field.name):
|
||||
+ if wait_thread:
|
||||
+ wait_thread.pause()
|
||||
+ password=get_password("%s: "%field.label,_('Repeat password: '),
|
||||
+ getfromstdin=stdin_passwd)
|
||||
+ if password is None:
|
||||
+ raise KeyboardInterrupt
|
||||
+ param_object = set_obj_item(client, param_object, field.name,
|
||||
+ password)
|
||||
+ if wait_thread:
|
||||
+ wait_thread.resume()
|
||||
elif field.element in ['combo', 'comboEdit']:
|
||||
value = _getattr(args, field.name)
|
||||
if value:
|
||||
@@ -448,7 +447,8 @@ def collect_object(client, param_object, view, args, wait_thread = None):
|
||||
|
||||
elif field.element == 'table' and field.type != 'steps':
|
||||
val = _getattr(args, field.name)
|
||||
- value = collect_table(field, val, client, wait_thread)
|
||||
+ value = collect_table(field, val, client, wait_thread,
|
||||
+ stdin_passwd)
|
||||
param_object = set_obj_item(client, param_object, field.name,
|
||||
value)
|
||||
|
||||
@@ -459,7 +459,8 @@ def collect_object(client, param_object, view, args, wait_thread = None):
|
||||
|
||||
return param_object, steps
|
||||
|
||||
-def collect_table(field, val_list, client, wait_thread = None):
|
||||
+def collect_table(field, val_list, client, wait_thread = None,
|
||||
+ stdin_passwd = False):
|
||||
if not val_list:
|
||||
return None
|
||||
val_table = map(lambda x: x.split(':'), val_list)
|
||||
@@ -500,7 +501,8 @@ def collect_table(field, val_list, client, wait_thread = None):
|
||||
sys.stdout.write('\r')
|
||||
sys.stdout.flush()
|
||||
password=get_password(_('Password for %s: ')%val_table[i][0],\
|
||||
- _('Repeat password for %s: ') %val_table[i][0])
|
||||
+ _('Repeat password for %s: ') %val_table[i][0],
|
||||
+ getfromstdin=stdin_passwd)
|
||||
if password == None:
|
||||
raise KeyboardInterrupt
|
||||
temp_row = []
|
||||
diff --git core/server/replace_class.py core/server/replace_class.py
|
||||
index f3569b9..970e8d0 100644
|
||||
--- core/server/replace_class.py
|
||||
+++ core/server/replace_class.py
|
||||
@@ -220,6 +220,11 @@ def cout_progress(string = None):
|
||||
sys.stdout.flush()
|
||||
|
||||
def local_method(metaclass, args):
|
||||
+ """
|
||||
+ Call method from metaclass, check method existing.
|
||||
+
|
||||
+ Generate help, for method, run method by 'call_method'.
|
||||
+ """
|
||||
import os
|
||||
sym_link = os.path.basename(sys.argv[0])
|
||||
if sym_link != 'cl-core':
|
||||
@@ -250,18 +255,29 @@ def local_method(metaclass, args):
|
||||
view = getattr(metaObject, method_view_name)(0, view_obj)
|
||||
except AttributeError:
|
||||
colorPrint.printERROR (_('Method not found: '), method_view_name)
|
||||
- method_parser = get_method_argparser(view, args, cl_core = True)
|
||||
+
|
||||
+ try:
|
||||
+ method_parser = get_method_argparser(view, args, cl_core = True)
|
||||
+ except Exception as e:
|
||||
+ metaObject.clear_cache(0, method_name)
|
||||
+ return 1
|
||||
method_parser.print_help()
|
||||
else:
|
||||
try:
|
||||
call_method(metaObject, args, colorPrint)
|
||||
except (KeyboardInterrupt, EOFError):
|
||||
colorPrint.printERROR(_('Interrupted by the user'))
|
||||
+ except Exception:
|
||||
+ pass
|
||||
# print 'Error: ', e
|
||||
metaObject.clear_cache(0, method_name)
|
||||
|
||||
def call_method(metaObject, args, colorPrint):
|
||||
+ """
|
||||
+ Function for call method through metaObject and args
|
||||
+ """
|
||||
method_name = args.method
|
||||
+ stdin_passwd = args.stdin_passwd
|
||||
method_view_name = method_name + '_view'
|
||||
metaObject.no_progress = args.no_progress
|
||||
view_obj = ViewInfo()
|
||||
@@ -287,7 +303,8 @@ def call_method(metaObject, args, colorPrint):
|
||||
_print (_('Unknown parameter'), i)
|
||||
return 1
|
||||
|
||||
- param_object, steps = collect_object(None, param_object, view, args)
|
||||
+ param_object, steps = collect_object(None, param_object, view, args,
|
||||
+ stdin_passwd=stdin_passwd)
|
||||
if view.has_brief:
|
||||
setattr(param_object, 'CheckOnly', True)
|
||||
check_res = {}
|
||||
@@ -303,7 +320,8 @@ def call_method(metaObject, args, colorPrint):
|
||||
return None
|
||||
else:
|
||||
param_object = get_param_pwd(check_res, view,
|
||||
- param_object)
|
||||
+ param_object,
|
||||
+ stdin_passwd=stdin_passwd)
|
||||
else:
|
||||
break
|
||||
|
||||
@@ -366,9 +384,17 @@ def create_param_object(view):
|
||||
param_object._type_info[field.name] = None
|
||||
return param_object
|
||||
|
||||
+def print_brief(view, brief_label):
|
||||
+ for Group in view.groups:
|
||||
+ if Group.name:
|
||||
+ if not Group.fields:
|
||||
+ continue
|
||||
+ print_brief_group(Group.fields, Group.name)
|
||||
+
|
||||
def print_brief_group(Fields, group_name):
|
||||
- if group_name:
|
||||
- _print ('\b'+group_name)
|
||||
+ print_group_flag = False
|
||||
+# if group_name:
|
||||
+# _print ('\b'+group_name)
|
||||
uncompatible_count = 0
|
||||
colorPrint = color_print()
|
||||
for field in Fields:
|
||||
@@ -377,6 +403,10 @@ def print_brief_group(Fields, group_name):
|
||||
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
|
||||
+ _print ('\b'+group_name)
|
||||
colorPrint.printSUCCESS('%s: %s' %(field.label, value))
|
||||
|
||||
elif field.element in ['combo', 'comboEdit', 'radio', 'file']:
|
||||
@@ -396,6 +426,10 @@ def print_brief_group(Fields, group_name):
|
||||
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.printSUCCESS('%s: %s' %(field.label, value))
|
||||
|
||||
elif field.element in ['multichoice', 'multichoice_add',\
|
||||
@@ -422,12 +456,20 @@ def print_brief_group(Fields, group_name):
|
||||
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.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
|
||||
+ _print ('\b'+group_name)
|
||||
colorPrint.printERROR(field.label)
|
||||
|
||||
elif field.element in ['check', 'check_tristate']:
|
||||
@@ -439,6 +481,10 @@ def print_brief_group(Fields, group_name):
|
||||
value = _('auto')
|
||||
else:
|
||||
value = field.value
|
||||
+ if not print_group_flag:
|
||||
+ if group_name:
|
||||
+ print_group_flag = True
|
||||
+ _print ('\b'+group_name)
|
||||
colorPrint.printSUCCESS('%s: %s' %(field.label, value))
|
||||
|
||||
elif field.element == 'table' and field.type != 'steps':
|
||||
@@ -474,6 +520,10 @@ def print_brief_group(Fields, group_name):
|
||||
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
|
||||
+ _print ('\b'+group_name)
|
||||
colorPrint.printSUCCESS(field.label+': ')
|
||||
res = printTable(data, head)
|
||||
sys.stdout.flush()
|
||||
@@ -481,15 +531,8 @@ def print_brief_group(Fields, group_name):
|
||||
else:
|
||||
uncompatible_count += 1
|
||||
|
||||
- if uncompatible_count == len (Fields) and group_name:
|
||||
- colorPrint.printSUCCESS(_('Not used'))
|
||||
-
|
||||
-def print_brief(view, brief_label):
|
||||
- for Group in view.groups:
|
||||
- if Group.name:
|
||||
- if not Group.fields:
|
||||
- continue
|
||||
- print_brief_group(Group.fields, Group.name)
|
||||
+# if uncompatible_count == len (Fields) and group_name:
|
||||
+# colorPrint.printSUCCESS(_('Not used'))
|
||||
|
||||
def printTable(data, header=None ):
|
||||
res = []
|
||||
diff --git core/server/server_class.py core/server/server_class.py
|
||||
index 9613a9a..87ea6da 100644
|
||||
--- core/server/server_class.py
|
||||
+++ core/server/server_class.py
|
||||
@@ -497,4 +497,4 @@ class OpenSSLAdapter (pyOpenSSLAdapter):
|
||||
c.load_verify_locations(self.certificate_chain)
|
||||
|
||||
c.use_certificate_file(self.certificate)
|
||||
- return c
|
||||
\ No newline at end of file
|
||||
+ return c
|
||||
diff --git scripts/calculate-core scripts/calculate-core
|
||||
index fd0f448..482068f 100644
|
||||
--- scripts/calculate-core
|
||||
+++ scripts/calculate-core
|
||||
@@ -28,8 +28,8 @@ start() {
|
||||
|
||||
if ! /usr/sbin/cl-core --check &>/dev/null
|
||||
then
|
||||
- ADMINUSER=`/usr/sbin/cl-core --variable install.cl_migrate_user[1]`
|
||||
- [[ -n $ADMINUSER ]] || ADMINUSER=`/usr/sbin/cl-core --variable install.cl_migrate_user[0]`
|
||||
+ ADMINUSER=`/usr/sbin/cl-core --variable install.cl_migrate_user[0]`
|
||||
+ [[ -n $ADMINUSER ]] || ADMINUSER=root
|
||||
/usr/sbin/cl-core --bootstrap $ADMINUSER
|
||||
fi
|
||||
|
||||
diff --git scripts/cl-core scripts/cl-core
|
||||
index f66c1e1..a374f80 100644
|
||||
--- scripts/cl-core
|
||||
+++ scripts/cl-core
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/python
|
||||
+#!/usr/bin/env python2
|
||||
#-*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2012 Calculate Ltd. http://www.calculate-linux.org
|
@ -0,0 +1,48 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
EAPI="3"
|
||||
|
||||
inherit distutils eutils
|
||||
|
||||
SRC_URI="ftp://ftp.calculate.ru/pub/calculate/calculate3/${PN}/${P}.tar.bz2"
|
||||
|
||||
DESCRIPTION="The program of installation Calculate Linux"
|
||||
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
|
||||
LICENSE="Apache-2.0"
|
||||
SLOT="3"
|
||||
KEYWORDS="amd64 x86"
|
||||
IUSE="pxe minimal"
|
||||
|
||||
DEPEND="~sys-apps/calculate-lib-3.0.0
|
||||
!<sys-apps/calculate-install-2.2.29
|
||||
app-portage/layman
|
||||
!app-misc/livecd-tools
|
||||
sys-apps/iproute2[-minimal]
|
||||
!minimal? ( sys-boot/grub
|
||||
sys-apps/gptfdisk
|
||||
>=sys-apps/util-linux-2.19.1
|
||||
sys-fs/dosfstools
|
||||
sys-fs/squashfs-tools
|
||||
sys-block/parted )
|
||||
pxe? ( sys-apps/calculate-server
|
||||
net-ftp/tftp-hpa
|
||||
net-misc/dhcp
|
||||
net-fs/nfs-utils )"
|
||||
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
src_unpack() {
|
||||
unpack "${A}"
|
||||
cd "${S}"
|
||||
|
||||
# changes
|
||||
epatch "${FILESDIR}/calculate-install-3.0.0-r3.patch"
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
einfo "For install wsdl for calculate-install perform:"
|
||||
einfo " cl-core --append-variable cl_wsdl=calculate-install"
|
||||
einfo " cl-core --append-variable cl_merges=calculate-install"
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
diff --git install/cl_install.py install/cl_install.py
|
||||
index 71b3552..12ed5ad 100644
|
||||
--- install/cl_install.py
|
||||
+++ install/cl_install.py
|
||||
@@ -55,6 +55,7 @@ from cl_distr import (PartitionDistributive,
|
||||
from calculate.lib.utils.text import tableReport
|
||||
from calculate.lib.server.utils import dialogYesNo
|
||||
from subprocess import Popen,PIPE,STDOUT
|
||||
+from itertools import *
|
||||
|
||||
class InstallError(Exception):
|
||||
"""Installation Error"""
|
||||
@@ -386,17 +387,34 @@ class Install(color_print):
|
||||
raise DistributiveError(
|
||||
_("Failed to determine the partition number for %s")%partition)
|
||||
bootFlag = "boot" if parttable == "dos" else "legacy_boot"
|
||||
- parted = process(partedProg, "-m",deviceName,"print")
|
||||
- DEVICENUM,FLAGS = 0,6
|
||||
- changeActive = \
|
||||
- map(lambda x:x[DEVICENUM],
|
||||
- filter(lambda x:x[DEVICENUM] != partitionNumber and \
|
||||
- bootFlag in x[FLAGS].strip(';').split(', ') or \
|
||||
- x[DEVICENUM] == partitionNumber and \
|
||||
- not bootFlag in x[FLAGS].strip(';').split(', '),
|
||||
- filter(lambda x:len(x)>=7,
|
||||
- map(lambda x:x.split(':'),
|
||||
- parted.readlines()[2:]))))
|
||||
+ if parttable == "dos":
|
||||
+ fdisk = process(fdiskProg, "-l",deviceName)
|
||||
+ DEVICENUM,AFLAG = 0,1
|
||||
+ changeActive = \
|
||||
+ map(lambda x:x[DEVICENUM],
|
||||
+ filter(lambda x:x[DEVICENUM] != partitionNumber and \
|
||||
+ x[AFLAG] == "*" or \
|
||||
+ x[DEVICENUM] == partitionNumber and \
|
||||
+ not x[AFLAG] == "*",
|
||||
+ list(map(lambda x:[str(x[0]),x[1][1].strip()],
|
||||
+ # enumerate partitions
|
||||
+ enumerate(filter(None,
|
||||
+ map(lambda x:x.split()[:2],
|
||||
+ # drop string before information about partitions
|
||||
+ dropwhile(lambda x:not x.lstrip().startswith("Device"),
|
||||
+ fdisk.readlines()))))))[1:]))
|
||||
+ else:
|
||||
+ parted = process(partedProg, "-m",deviceName,"print")
|
||||
+ DEVICENUM,FLAGS = 0,6
|
||||
+ changeActive = \
|
||||
+ map(lambda x:x[DEVICENUM],
|
||||
+ filter(lambda x:x[DEVICENUM] != partitionNumber and \
|
||||
+ bootFlag in x[FLAGS].strip(';').split(', ') or \
|
||||
+ x[DEVICENUM] == partitionNumber and \
|
||||
+ not bootFlag in x[FLAGS].strip(';').split(', '),
|
||||
+ filter(lambda x:len(x)>=7,
|
||||
+ map(lambda x:x.split(':'),
|
||||
+ parted.readlines()[2:]))))
|
||||
if not changeActive:
|
||||
return True
|
||||
if parttable == "dos":
|
||||
diff --git install/cl_migrate_users.py install/cl_migrate_users.py
|
||||
index fc7f7a2..f7332fb 100644
|
||||
--- install/cl_migrate_users.py
|
||||
+++ install/cl_migrate_users.py
|
||||
@@ -472,6 +472,8 @@ class migrate(color_print):
|
||||
"""Migrate users ang groups to new system"""
|
||||
if not self.checkPermFiles():
|
||||
return False
|
||||
+ if not any(addUsersList):
|
||||
+ addUsersList = []
|
||||
migrateUsers = ["root"]+\
|
||||
map(lambda x: x[0], addUsersList + pwdUsersList)
|
||||
for existMigrUser in existsMigrateUsers:
|
||||
diff --git install/variables/disk.py install/variables/disk.py
|
||||
index a74f737..4b5730a 100644
|
||||
--- install/variables/disk.py
|
||||
+++ install/variables/disk.py
|
||||
@@ -619,6 +619,9 @@ class VariableOsLocationData(LocationHelper,TableVariable):
|
||||
"to specify the source directory as DISK")
|
||||
self.label = _("Locations")
|
||||
|
||||
+ def set(self,value):
|
||||
+ return sorted(value,key=lambda x:x[0])
|
||||
+
|
||||
class VariableOsLocationSource(LocationHelper,DeviceHelper,Variable):
|
||||
"""
|
||||
Source disk or directory
|
||||
diff --git install/variables/distr.py install/variables/distr.py
|
||||
index d9af10e..916d9c8 100644
|
||||
--- install/variables/distr.py
|
||||
+++ install/variables/distr.py
|
||||
@@ -316,7 +316,7 @@ class VariableClImageFilename(Variable,DistroRepository):
|
||||
discardType = []
|
||||
distros = self.getAvailableDristibutives(imagePath,
|
||||
discardType=discardType)
|
||||
- if self.wasSet:
|
||||
+ if self.wasSet and not self.value in distros:
|
||||
distros.append(self.value)
|
||||
return sorted(map(lambda x:(x,
|
||||
self.humanImageName(self._getDistrInfo(x),x)),
|
@ -0,0 +1,33 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
EAPI="3"
|
||||
|
||||
inherit distutils eutils
|
||||
|
||||
SRC_URI="ftp://ftp.calculate.ru/pub/calculate/calculate3/${PN}/${P}.tar.bz2"
|
||||
|
||||
DESCRIPTION="The library for Calculate 3"
|
||||
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
|
||||
LICENSE="Apache-2.0"
|
||||
SLOT="3"
|
||||
KEYWORDS="amd64 x86"
|
||||
IUSE="minimal"
|
||||
DEPEND="!minimal? ( dev-python/py-smbpasswd )
|
||||
>=dev-python/pyxml-0.8
|
||||
sys-apps/iproute2
|
||||
sys-apps/pciutils
|
||||
sys-fs/lvm2
|
||||
sys-fs/mdadm
|
||||
dev-python/pyinotify
|
||||
sys-apps/file[python]"
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
src_unpack() {
|
||||
unpack "${A}"
|
||||
cd "${S}"
|
||||
|
||||
# changes
|
||||
epatch "${FILESDIR}/calculate-lib-3.0.0-r1.patch"
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
diff --git calculate/lib/cl_print.py calculate/lib/cl_print.py
|
||||
index 7c7d979..ff13ed4 100644
|
||||
--- calculate/lib/cl_print.py
|
||||
+++ calculate/lib/cl_print.py
|
||||
@@ -115,7 +115,10 @@ class color_print(object):
|
||||
|
||||
|
||||
def defaultPrint(self, string):
|
||||
- self._printSysOut.write(string)
|
||||
+ try:
|
||||
+ self._printSysOut.write(string)
|
||||
+ except UnicodeError:
|
||||
+ self._printSysOut.write(string.encode('utf-8'))
|
||||
try:
|
||||
self._printSysOut.flush()
|
||||
except IOError:
|
||||
diff --git calculate/lib/cl_template.py calculate/lib/cl_template.py
|
||||
index c7d72e5..831705d 100644
|
||||
--- calculate/lib/cl_template.py
|
||||
+++ calculate/lib/cl_template.py
|
||||
@@ -358,19 +358,16 @@ class _terms(_error, _shareTermsFunction):
|
||||
vals[1] = 0
|
||||
try:
|
||||
valFile = int(vals[1])
|
||||
+ valVar = valVars
|
||||
+ res = dictRuleFunc[sepF](valVar, valFile)
|
||||
+ if res:
|
||||
+ listEqual.append(True)
|
||||
+ else:
|
||||
+ listEqual.append(False)
|
||||
+ break
|
||||
except:
|
||||
- self.setError("'%s'"%rpl(term) +" "+\
|
||||
- _("incorrect"))
|
||||
- self.setError(textError)
|
||||
- return False
|
||||
- valVar = valVars
|
||||
- res = dictRuleFunc[sepF](valVar, valFile)
|
||||
- if res:
|
||||
- listEqual.append(True)
|
||||
- else:
|
||||
- listEqual.append(False)
|
||||
- break
|
||||
- else:
|
||||
+ flagIntTypeVar = False
|
||||
+ if not flagIntTypeVar:
|
||||
if sepF == "!=" or sepF == "==":
|
||||
if not vals[1].strip():
|
||||
vals[1] = ""
|
||||
diff --git calculate/lib/datavars.py calculate/lib/datavars.py
|
||||
index a2f2b0d..835b649 100644
|
||||
--- calculate/lib/datavars.py
|
||||
+++ calculate/lib/datavars.py
|
||||
@@ -415,6 +415,9 @@ class TableVariable(Variable):
|
||||
"""
|
||||
type = "table"
|
||||
|
||||
+ def set(self,value):
|
||||
+ return value
|
||||
+
|
||||
def get(self,hr=False):
|
||||
"""Get table data"""
|
||||
for varname,value in ifilter(lambda x:type(x[1]) != list,
|
||||
@@ -500,6 +503,7 @@ class TableVariable(Variable):
|
||||
fieldname=self.source[0],variablename=self.name))
|
||||
|
||||
def setValue(self,value):
|
||||
+ value = self.set(value)
|
||||
self.untrusted = True
|
||||
oldvalue = self.Get(self.name)
|
||||
# get writable columns
|
@ -0,0 +1,24 @@
|
||||
# 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_console"
|
||||
|
||||
RDEPEND="${RDEPEND}
|
||||
=sys-apps/calculate-install-3.0.0-r3
|
||||
=sys-apps/calculate-i18n-3.0.0
|
||||
=sys-apps/calculate-lib-3.0.0-r1
|
||||
=sys-apps/calculate-core-3.0.0-r1
|
||||
cl_consolegui? ( =sys-apps/calculate-console-gui-3.0.0-r1 )
|
||||
cl_console? ( =sys-apps/calculate-console-3.0.0-r1 )
|
||||
"
|
||||
|
Loading…
Reference in new issue