PyEasyArchive icon indicating copy to clipboard operation
PyEasyArchive copied to clipboard

ARCHIVE_FORMAT_CPIO_SVR4_CRC not working

Open Mk-arc opened this issue 3 years ago • 0 comments

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?

Mk-arc avatar Jul 29 '22 12:07 Mk-arc