How to use the pycdlib.rockridge.RockRidge function in pycdlib

To help you get started, we’ve selected a few pycdlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github clalancette / pycdlib / tests / unit / test_rockridge.py View on Github external
def test_rr_parse_bad_padding_byte():
    rr = pycdlib.rockridge.RockRidge()
    with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidISO) as excinfo:
        rr.parse(b'\x01', False, 0, False)
    assert(str(excinfo.value) == 'Invalid pad byte')
github clalancette / pycdlib / tests / unit / test_rockridge.py View on Github external
def test_rr_record_sf_record():
    rr = pycdlib.rockridge.RockRidge()
    rr.parse(b'SF\x0c\x01\x00\x00\x00\x00\x00\x00\x00\x00', False, 0, False)
    assert(rr.record_dr_entries() == b'SF\x0c\x01\x00\x00\x00\x00\x00\x00\x00\x00')
github clalancette / pycdlib / tests / unit / test_rockridge.py View on Github external
def test_rr_child_link_extent_not_initialized():
    rr = pycdlib.rockridge.RockRidge()
    with pytest.raises(pycdlib.pycdlibexception.PyCdlibInternalError) as excinfo:
        rr.child_link_extent()
    assert(str(excinfo.value) == 'Rock Ridge extension not initialized')
github clalancette / pycdlib / tests / unit / test_rockridge.py View on Github external
def test_rr_new_sprecord_ce_record():
    rr = pycdlib.rockridge.RockRidge()
    rr.new(True, b'foo', 0, None, '1.09', False, False, False, 0, 254-28)
    assert(rr.dr_entries.ce_record is not None)
    assert(rr.ce_entries.sp_record is not None)
github clalancette / pycdlib / tests / unit / test_rockridge.py View on Github external
def test_rr_parse_pn_record():
    rr = pycdlib.rockridge.RockRidge()
    rr.parse(b'PN\x14\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', False, 0, False)
    assert(rr.dr_entries.pn_record is not None)
github clalancette / pycdlib / tests / unit / test_rockridge.py View on Github external
def test_rr_add_to_file_links_not_initialized():
    rr = pycdlib.rockridge.RockRidge()
    with pytest.raises(pycdlib.pycdlibexception.PyCdlibInternalError) as excinfo:
        rr.add_to_file_links()
    assert(str(excinfo.value) == 'Rock Ridge extension not initialized')
github clalancette / pycdlib / tests / unit / test_rockridge.py View on Github external
def test_rr_new_rerecord_ce_record():
    rr = pycdlib.rockridge.RockRidge()
    rr.new(False, b'foo', 0, None, '1.09', False, True, False, 0, 254-28)
    assert(rr.dr_entries.ce_record is not None)
    assert(rr.ce_entries.re_record is not None)
github clalancette / pycdlib / tests / unit / test_rockridge.py View on Github external
def test_rr_parse_invalid_rtype():
    rr = pycdlib.rockridge.RockRidge()
    with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidISO) as excinfo:
        rr.parse(b'\x00\x00\x01\x01', False, 0, False)
    assert(str(excinfo.value) == 'Unknown SUSP record')
github clalancette / pycdlib / pycdlib / dr.py View on Github external
record (otherwise, None).
         rr_relocated_child - True if this is a directory record for a rock
                              ridge relocated child.
         rr_relocated - True if this is a directory record for a relocated
                        entry.
         rr_relocated_parent - True if this is a directory record for a rock
                               ridge relocated parent.
         file_mode - The Unix file mode for this Rock Ridge entry.
        Returns:
         Nothing.
        '''

        if self.parent is None:
            raise pycdlibexception.PyCdlibInternalError('Invalid call to create new Rock Ridge on root directory')

        self.rock_ridge = rockridge.RockRidge()
        is_first_dir_record_of_root = self.file_ident == b'\x00' and self.parent.is_root
        bytes_to_skip = 0
        if self.xa_record is not None:
            bytes_to_skip = XARecord.length()
        self.dr_len = self.rock_ridge.new(is_first_dir_record_of_root, rr_name,
                                          file_mode, rr_symlink_target,
                                          rr_version, rr_relocated_child,
                                          rr_relocated, rr_relocated_parent,
                                          bytes_to_skip, self.dr_len)

        # For files, we are done
        if not self.isdir:
            return

        # If this is a directory, we have to manipulate the file links
        # appropriately.