Skip to content

ARCHIVE_FORMAT_CPIO_SVR4_CRC not working #54

@Mk-arc

Description

@Mk-arc

Hi,

I am basically trying to create a. Before i used cpio directly "cpio -ov -A -H crc -F" to create the archive, which works fine. Now I want to use libarchive from python to achieve the same result. Howver there are some issues with the Archive Format. With the format "ARCHIVE_FORMAT_CPIO" I can create the archive, but SWU-Update claims the archive has not the correct format. I think "ARCHIVE_FORMAT_CPIO_SVR4_CRC" needs to be used, but with this format, libarchive somehow exits with an error.

    for entry in libarchive.public.create_file(
            self._strUpdateFileName,
            libarchive.constants.ARCHIVE_FORMAT_CPIO_SVR4_CRC,
            lstCopyFile):
        pass
Traceback (most recent call last):
  File "swufilecreator.py", line 355, in <module>
    swuCreator.CreateUpdateFile('./output/')
  File "swufilecreator.py", line 100, in CreateUpdateFile
    strSha256 = swuCreatorRec.CreateUpdateFile(self._strBuildDirectory + '/')
  File "swufilecreator.py", line 140, in CreateUpdateFile
    self.__CreateOutputFile()
  File "swufilecreator.py", line 320, in __CreateOutputFile
    lstFilesToAdd):
  File "/usr/local/lib/python3.6/dist-packages/libarchive/adapters/archive_write.py", line 284, in create_file
    return _create(opener, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/libarchive/adapters/archive_write.py", line 198, in _create
    _set_write_context(a, format_code, filter_code)
  File "/usr/local/lib/python3.6/dist-packages/libarchive/adapters/archive_write.py", line 183, in _set_write_context
    format_code)
  File "/usr/local/lib/python3.6/dist-packages/libarchive/adapters/archive_write_set_format.py", line 6, in archive_write_set_format
    code)
  File "/usr/local/lib/python3.6/dist-packages/libarchive/calls/archive_write_set_format.py", line 8, in _check_zero_success
    raise ValueError("Function returned failure: (%d)" % (value))
ValueError: Function returned failure: (-30)

The same code works well to create an archive with the option "ARCHIVE_FORMAT_CPIO". I wonder what is the problem here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions