Ejemplo n.º 1
0
 def _query_xattr(cls, path, siz, syscall, *a):
     if siz:
         buf = gr_create_string_buffer(siz)
     else:
         buf = None
     ret = getattr(cls.libc, syscall)(*((path, ) + a + (buf, siz)))
     if ret == -1:
         cls.raise_oserr()
     if siz:
         # py2 and py3 compatibility. Convert bytes array
         # to string
         result = bytearray_to_str(buf.raw)
         return result[:ret]
     else:
         return ret
Ejemplo n.º 2
0
    def cl_history_getchanges(cls):
        """ remove hardcoding for path name length """
        def clsort(f):
            return f.split('.')[-1]

        changes = []
        buf = gr_create_string_buffer(4096)
        call = cls._get_api('gf_history_changelog_next_change')

        while True:
            ret = call(buf, 4096)
            if ret in (0, -1):
                break
            # py2 and py3 compatibility
            result = bytearray_to_str(buf.raw[:ret - 1])
            changes.append(result)
        if ret == -1:
            cls.raise_changelog_err()

        return sorted(changes, key=clsort)
Ejemplo n.º 3
0
    def cl_getchanges(cls):
        """ remove hardcoding for path name length """
        def clsort(f):
            return f.split('.')[-1]
        changes = []
        buf = gr_create_string_buffer(4096)
        call = cls._get_api('gf_changelog_next_change')

        while True:
            ret = call(buf, 4096)
            if ret in (0, -1):
                break
            # py2 and py3 compatibility
            result = bytearray_to_str(buf.raw[:ret - 1])
            changes.append(result)
        if ret == -1:
            cls.raise_changelog_err()
        # cleanup tracker
        cls.cl_startfresh()
        return sorted(changes, key=clsort)
Ejemplo n.º 4
0
def history_getchanges():
    def clsort(cfile):
        return cfile.split('.')[-1]

    changes = []
    buf = gr_create_string_buffer(4096)
    call = libgfc.gf_history_changelog_next_change

    while True:
        ret = call(buf, 4096)
        if ret in (0, -1):
            break

        # py2 and py3 compatibility
        result = bytearray_to_str(buf.raw[:ret - 1])
        changes.append(result)

    if ret == -1:
        _raise_changelog_err()

    return sorted(changes, key=clsort)