示例#1
0
文件: yum_client.py 项目: rbuj/yumex
    def get_groups(self):
        '''

        '''
        self._send_command('get-groups', [])
        msgs = self._get_messages()
        return unpack(msgs['groups'][0])
示例#2
0
文件: yum_client.py 项目: rbuj/yumex
    def build_transaction(self):
        '''

        '''
        self._send_command('build-transaction', [])
        msgs = self._get_messages()
        return msgs['return_code'][0], msgs['messages'], unpack(msgs['transaction'][0]), msgs['size']
示例#3
0
文件: yum_client.py 项目: rbuj/yumex
 def get_changelog(self, ident, num):
     ''' get an attribute of an package '''
     self._send_command('get-changelog', [ident, str(num)])
     args = self._get_result(':attr')
     if args:
         return unpack(args[0])
     else:
         return None
示例#4
0
文件: yum_client.py 项目: rbuj/yumex
 def _gpg_check(self, value):
     """ yum download action progress message """
     (po, userid, hexkeyid) = unpack(value)
     ok = self.gpg_check(po, userid, hexkeyid)
     if ok:
         self.child.sendline(":true")
     else:
         self.child.sendline(":false")
示例#5
0
文件: yum_client.py 项目: rbuj/yumex
 def get_attribute(self, ident, attr):
     ''' get an attribute of an package '''
     self._send_command('get-attribute', [ident, attr])
     args = self._get_result(':attr')
     if args:
         return unpack(args[0])
     else:
         return None
示例#6
0
文件: yum_client.py 项目: rbuj/yumex
    def is_ended(self, cmd, args):
        '''

        @param cmd:
        @param args:
        '''
        if cmd == ':end':
            if args:
                self.end_state = unpack(args[0])
            else: # no parameter to :end
                self.end_state = True
            return True
        else:
            return False
示例#7
0
def parse_command(cmd, param):
    if cmd == "#run":
        parameters = unpack(param)
        print ":debug\tLAUNCHER - Starting : %s" % parameters
        rc = run(parameters)
    elif cmd == "#testrun":
        print ":debug\ttest running : %s" % param
        run(param)
        rc = True
    elif cmd == "#exit":
        rc = False
    else:
        print ":error\tunknown launcher command : %s" % cmd
        rc = False
    return rc
示例#8
0
文件: yum_client.py 项目: rbuj/yumex
 def _get_messages(self):
     '''
     read a list of :msg commands from the server, until and
     :end command is received
     '''
     msgs = {}
     while True:
         cmd, args = self._readline()
         if self.is_ended(cmd, args):
             break
         elif cmd == ':msg':
             msg_type = args[0]
             value = unpack(args[1])
             if msg_type in msgs:
                 msgs[msg_type].append(value)
             else:
                 msgs[msg_type] = [value]
     return msgs
示例#9
0
文件: yum_client.py 项目: rbuj/yumex
 def _get_packed_list(self, result_cmd):
     '''
     read a list of :hist commands from the server, until and
     :end command is received
     '''
     data = []
     while True:
         cmd, args = self._readline()
         if self.is_ended(cmd, args):
             break
         if cmd == None: # readline is locked:
             break
         elif not cmd == result_cmd:
             self.warning("_get_list unexpected command : %s (%s)" % (cmd, args))
         else:
             elem = unpack(args[0])
             data.append(elem)
     return data
示例#10
0
文件: yum_client.py 项目: rbuj/yumex
 def _get_history_pkgs(self):
     '''
     read a list of :histpkg commands from the server, until and
     :end command is received
     '''
     data = []
     while True:
         cmd, args = self._readline()
         if self.is_ended(cmd, args):
             break
         if cmd == None: # readline is locked:
             break
         elif cmd == ':histpkg':
             po = unpack(args[0])
             data.append(po)
         else:
             data.append(args)
     return data
示例#11
0
文件: yum_client.py 项目: rbuj/yumex
 def _yum_logger(self, msg):
     '''
     unpack yum messages
     '''
     msg = unpack(msg)
     self.yum_logger(msg)
示例#12
0
文件: yum_client.py 项目: rbuj/yumex
 def fatal(self, args):
     """ fatal backend error """
     err = args[0]
     msg = unpack(args[1])
     # Trigger the frontend fatal error handler
     self.frontend.handle_error(err, msg)
示例#13
0
文件: yum_client.py 项目: rbuj/yumex
 def _media_change(self, value):
     """ media change signal """
     (prompt_first, media_id, media_name, media_num) = unpack(value)
     mp = self.media_change(prompt_first, media_id, media_name, media_num)
     self.child.sendline(":mountpoint\t%s" % pack(mp))
示例#14
0
文件: yum_client.py 项目: rbuj/yumex
 def _yum_dnl(self, value):
     """ yum download action progress message """
     (ftype, name, percent, cur, tot, fread, ftotal, ftime) = unpack(value)
     self.yum_dnl_progress(ftype, name, percent, cur, tot, fread, ftotal, ftime)
示例#15
0
文件: yum_client.py 项目: rbuj/yumex
 def _yum_rpm(self, value):
     """ yum rpm action progress message """
     (action, package, percent, ts_current, ts_total) = unpack(value)
     self.yum_rpm_progress(action, package, percent, ts_current, ts_total)