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

Added new packages borgbackup and its dependency libacl #4644

Merged
5 commits merged into from
Dec 11, 2019

Conversation

amaramrahul
Copy link
Contributor

No description provided.

@Grimler91
Copy link
Member

Hi, it looks like borgbackup is licensed under the BSD 3 clause license (though with small modifications/reformulation to 3rd point(?)), so TERMUX_PKG_LICENSE="BSD 3-Clause" should be set.

That being said, we don't usually package python packages. Are there any problems when trying to install borg through pip (after building/installing dependencies)?

@ghost
Copy link

ghost commented Dec 11, 2019

Package uses native extensions and can't be cross compiled properly (that's python issue) - arch is set as x86_64 even if it actually aarch64 or something else:

./data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/platform/linux.cpython-38-x86_64-linux-gnu.so
./data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/platform/posix.cpython-38-x86_64-linux-gnu.so
./data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/hashindex.cpython-38-x86_64-linux-gnu.so
./data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/crypto/low_level.cpython-38-x86_64-linux-gnu.so
./data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/chunker.cpython-38-x86_64-linux-gnu.so
./data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/compress.cpython-38-x86_64-linux-gnu.so
./data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/item.cpython-38-x86_64-linux-gnu.so
./data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/algorithms/checksums.cpython-38-x86_64-linux-gnu.so
./data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/algorithms/msgpack/_packer.cpython-38-x86_64-linux-gnu.so
./data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/algorithms/msgpack/_unpacker.cpython-38-x86_64-linux-gnu.so

packages/borgbackup/build.sh Outdated Show resolved Hide resolved
packages/borgbackup/build.sh Outdated Show resolved Hide resolved
@amaramrahul
Copy link
Contributor Author

Hi, it looks like borgbackup is licensed under the BSD 3 clause license (though with small modifications/reformulation to 3rd point(?)), so TERMUX_PKG_LICENSE="BSD 3-Clause" should be set.

That being said, we don't usually package python packages. Are there any problems when trying to install borg through pip (after building/installing dependencies)?

Just gave it a shot. Installed all the packages mentioned in scripts/setup-termux.sh and then ran:

$ env BORG_OPENSSL_PREFIX="/data/data/com.termux/files/usr" BORG_LIBLZ4_PREFIX="/data/data/com.termux/files/usr" BORG_LIBZSTD_PREFIX="/data/data/com.termux/files/usr" pip install borgbackup

borg got successfully installed. Its dependency libacl could also probably be installed using ./configure, make and make install.

However, installing all these additional packages, using the custom environment and compiling from source would be pretty difficult for the regular user.

@ghost
Copy link

ghost commented Dec 11, 2019

Cross-compilation and building on device are different things.
Python does not behave well when cross-compiling package with native extensions (that is why we actually don't like adding python packages).

@ghost
Copy link

ghost commented Dec 11, 2019

borg a patch to change libc.so name, otherwise it fails at runtime:

Exception: Can't find C library [dlopen failed: library "libc.so.6" not found]. Try installing ldconfig, gcc/cc or objdump.

@amaramrahul
Copy link
Contributor Author

borg a patch to change libc.so name, otherwise it fails at runtime:

Exception: Can't find C library [dlopen failed: library "libc.so.6" not found]. Try installing ldconfig, gcc/cc or objdump.

When does this exception get thrown? It is working fine on anrdoid. also not sure how to go about this.

@ghost
Copy link

ghost commented Dec 11, 2019

Looks like it wants to use hardlinks:

Local Exception
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/archiver.py", line 4501, in main
    exit_code = archiver.run(args)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/archiver.py", line 4433, in run
    return set_ec(func(args))
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/archiver.py", line 166, in wrapper
    return method(self, args, repository=repository, **kwargs)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/archiver.py", line 280, in do_init
    key = key_creator(repository, args)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/crypto/key.py", line 110, in key_creator
    return key.create(repository, args)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/crypto/key.py", line 690, in create
    key.save(target, passphrase)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/crypto/key.py", line 800, in save
    target.save_key(key_data)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/repository.py", line 310, in save_key
    self.save_config(self.path, self.config)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/repository.py", line 292, in save_config
    os.link(config_path, old_config_path)
AttributeError: module 'os' has no attribute 'link'

Platform: Linux localhost 3.18.91-15877854-QB25123770 #1 SMP PREEMPT Mon Jul 29 11:47:47 KST 2019 aarch64
Linux: Unknown Linux  
Borg: 1.1.10  Python: CPython 3.8.0 msgpack: 0.5.6
PID: 839  CWD: /data/data/com.termux/files/home
sys.argv: ['/data/data/com.termux/files/usr/bin/borg', 'init', '--encryption=repokey', './test']
SSH_ORIGINAL_COMMAND: None

Our python build does not support link() because hardlinks are disallowed by SELinux policy on Android.

@amaramrahul
Copy link
Contributor Author

Looks like it wants to use hardlinks:

Local Exception
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/archiver.py", line 4501, in main
    exit_code = archiver.run(args)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/archiver.py", line 4433, in run
    return set_ec(func(args))
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/archiver.py", line 166, in wrapper
    return method(self, args, repository=repository, **kwargs)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/archiver.py", line 280, in do_init
    key = key_creator(repository, args)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/crypto/key.py", line 110, in key_creator
    return key.create(repository, args)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/crypto/key.py", line 690, in create
    key.save(target, passphrase)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/crypto/key.py", line 800, in save
    target.save_key(key_data)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/repository.py", line 310, in save_key
    self.save_config(self.path, self.config)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/borgbackup-1.1.10-py3.8-linux-x86_64.egg/borg/repository.py", line 292, in save_config
    os.link(config_path, old_config_path)
AttributeError: module 'os' has no attribute 'link'

Platform: Linux localhost 3.18.91-15877854-QB25123770 #1 SMP PREEMPT Mon Jul 29 11:47:47 KST 2019 aarch64
Linux: Unknown Linux  
Borg: 1.1.10  Python: CPython 3.8.0 msgpack: 0.5.6
PID: 839  CWD: /data/data/com.termux/files/home
sys.argv: ['/data/data/com.termux/files/usr/bin/borg', 'init', '--encryption=repokey', './test']
SSH_ORIGINAL_COMMAND: None

Our python build does not support link() because hardlinks are disallowed by SELinux policy on Android.
Hard links are only needed if you are running borg as a server. I have been using it for running on the client to backup my mobile to another server running borg and it has been working successfully.

Our python build does not have that function implemented and
borg will crash.
@ghost
Copy link

ghost commented Dec 11, 2019

os.link problem for borg init is now fixed and cross-compiled package seems to work fine even if *.so extensions have wrong name.

Merging.

This pull request was closed.
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

Successfully merging this pull request may close these issues.

2 participants