コード例 #1
0
ファイル: xdelta3-regtest.py プロジェクト: incrop/xdelta-rs
 def Main(self, args):
     try:
         if self.forkexec:
             RunCommand(['../xdelta3'] + args)
         else:
             xdelta3.xd3_main_cmdline(args)
     except Exception, e:
         raise CommandError(args, "xdelta3.main exception: %s" % e)
コード例 #2
0
ファイル: xdelta3-regtest.py プロジェクト: dellis1972/xdelta
 def Main(self, args):
     try:
         if self.forkexec:
             RunCommand(['../xdelta3'] + args)
         else:
             xdelta3.xd3_main_cmdline(args)
     except Exception, e:
         raise CommandError(args, "xdelta3.main exception: %s" % e)
コード例 #3
0
ファイル: tool.py プロジェクト: scolphoy/elijah-provisioning
def diff_files(source_file, target_file, output_file, **kwargs):
    # kwargs
    # skip_validation   :   skipp sha1 validation
    # LOG = log object for nova
    # nova_util = nova_util is executioin wrapper for nova framework
    #           You should use nova_util in OpenStack, or subprocess 
    #           will be returned without finishing their work
    log = kwargs.get("log", None)
    nova_util = kwargs.get('nova_util', None)

    if os.path.exists(source_file) == False or open(source_file, "rb") == None:
        raise IOError('[Error] No such file %s' % (source_file))
        return None
    if os.path.exists(target_file) == False or open(target_file, "rb") == None:
        raise IOError('[Error] No such file %s' % (target_file))
    if os.path.exists(output_file):
        os.remove(output_file)

    if nova_util:
        nova_util.execute("xdelta3", "-f", "-s", str(source_file), str(target_file), str(output_file))
        return 0
    else:
        LOG.info('%s(base) - %s  =  %s' % (os.path.basename(source_file), \
                os.path.basename(target_file), os.path.basename(output_file)))
        command_delta = ['xdelta3', '-f', '-s', source_file, target_file, output_file]
        ret = xdelta3.xd3_main_cmdline(command_delta)
        if ret != 0:
            raise IOError('Cannot do file diff')
        return ret
コード例 #4
0
ファイル: tool.py プロジェクト: MHZarei/elijah-provisioning
def diff_files(source_file, target_file, output_file, **kwargs):
    # kwargs
    # skip_validation   :   skipp sha1 validation
    # LOG = log object for nova
    # nova_util = nova_util is executioin wrapper for nova framework
    #           You should use nova_util in OpenStack, or subprocess
    #           will be returned without finishing their work
    log = kwargs.get("log", None)
    nova_util = kwargs.get('nova_util', None)

    if os.path.exists(source_file) == False or open(source_file, "rb") == None:
        raise IOError('[Error] No such file %s' % (source_file))
        return None
    if os.path.exists(target_file) == False or open(target_file, "rb") == None:
        raise IOError('[Error] No such file %s' % (target_file))
    if os.path.exists(output_file):
        os.remove(output_file)

    if nova_util:
        nova_util.execute("xdelta3", "-f", "-s", str(source_file),
                          str(target_file), str(output_file))
        return 0
    else:
        LOG.info('%s(base) - %s  =  %s' % (os.path.basename(source_file), \
                os.path.basename(target_file), os.path.basename(output_file)))
        command_delta = [
            'xdelta3', '-f', '-s', source_file, target_file, output_file
        ]
        ret = xdelta3.xd3_main_cmdline(command_delta)
        if ret != 0:
            raise IOError('Cannot do file diff')
        return ret
コード例 #5
0
def diff_files(source_file, target_file, output_file):
    if os.path.exists(source_file) == False:
        print '[Error] No such file %s' % (source_file)
        return None
    if os.path.exists(target_file) == False:
        print '[Error] No such file %s' % (target_file)
        return None
    if os.path.exists(output_file):
        os.remove(output_file)

    print '[INFO] %s(base) - %s  =  %s' % (os.path.basename(source_file), os.path.basename(target_file), os.path.basename(output_file))
    command_delta = ['xdelta3', '-f', '-s', source_file, target_file, output_file]
    ret = xdelta3.xd3_main_cmdline(command_delta)
    if ret == 0:
        return output_file
    else:
        return None
コード例 #6
0
def diff_files(source_file, target_file, output_file):
    if os.path.exists(source_file) == False:
        print '[Error] No such file %s' % (source_file)
        return None
    if os.path.exists(target_file) == False:
        print '[Error] No such file %s' % (target_file)
        return None
    if os.path.exists(output_file):
        os.remove(output_file)

    print '[INFO] %s(base) - %s  =  %s' % (os.path.basename(source_file),
                                           os.path.basename(target_file),
                                           os.path.basename(output_file))
    command_delta = [
        'xdelta3', '-f', '-s', source_file, target_file, output_file
    ]
    ret = xdelta3.xd3_main_cmdline(command_delta)
    if ret == 0:
        return output_file
    else:
        return None
コード例 #7
0
 def Main(self, args):
     try:
         #print 'Run %s' % (' '.join(args))
         xdelta3.xd3_main_cmdline(args)
     except Exception, e:
         raise CommandError(args, "xdelta3.main exception: %s" % e)