Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create AR archive #4

Open
davinerd opened this issue Apr 25, 2015 · 0 comments
Open

Cannot create AR archive #4

davinerd opened this issue Apr 25, 2015 · 0 comments

Comments

@davinerd
Copy link

I'm trying to create a custom deb package (ar format) and I'm receiving an error when setting the libarchive.constants.ARCHIVE_FORMAT_AR in libarchive.public.create_file.
The code is below:

import libarchive.constants
import libarchive.public

newDeb = ''.join(random.choice(string.ascii_lowercase + string.digits + string.ascii_uppercase) for _ in range(8))

tmpRan = ''.join(random.choice(string.ascii_lowercase + string.digits + string.ascii_uppercase) for _ in range(8))
tmpDir = '/tmp/' + tmpRan

newDeb = newDeb + ".deb"

for entry in libarchive.public.create_file('/tmp/'+newDeb,
                libarchive.constants.ARCHIVE_FORMAT_AR,
                [tmpDir+'/debian-binary', tmpDir+'/control.tar.gz', tmpDir+'/data.tar.gz' ]):
                print(entry)

the error is:

Traceback (most recent call last):
  File "test.py", line 429, in ar_files
    [tmpDir+'/debian-binary', tmpDir+'/control.tar.gz', tmpDir+'/data.tar.gz' ]):
  File "/usr/local/lib/python2.7/dist-packages/libarchive/adapters/archive_write.py", line 199, in _create
    _set_write_context(a, format_code, filter_code)
  File "/usr/local/lib/python2.7/dist-packages/libarchive/adapters/archive_write.py", line 184, in _set_write_context
    format_code)
  File "/usr/local/lib/python2.7/dist-packages/libarchive/adapters/archive_write_set_format.py", line 8, in archive_write_set_format
    code)
  File "/usr/local/lib/python2.7/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)

If I change the format to libarchive.constants.ARCHIVE_FORMAT_7ZIP, everything goes well and it creates the archive.
Here are some info on my env:

root@ubuntu:/tmp# pip list | grep libarchive
libarchive (0.4.3)
root@ubuntu:/tmp# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.2 LTS
Release:    14.04
Codename:   trusty
root@ubuntu:/tmp# python -V
Python 2.7.6
root@ubuntu:/tmp# 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant