Is there a way to utilize a bz2 file in the source
directive?
I’m working on a snap for Restic in which the author prefers that the snap use the “official” binary. But his releases come out as a bz2 file. When targeting the file I get an error stating:
raise ValueError(‘no handler to manage source ({})’.format(source))
ValueError: no handler to manage source (https://github.com/restic/restic/releases/download/v0.8.1/restic_0.8.1_linux_amd64.bz2)
So if I am reading that correctly - my assumption is that bz2 is either unsupported or requires some type of additional config in the YAML file.
EDIT - I do realise that I could likely pull the file down and use various directives to prep the source locally. Just hoping to keep the yaml as dirt simple as possible.
EDIT2 - Ok, found many examples of people using bz2 files. So I must be doing something else wrong. And I am guessing that it might be because there is a binary in the bz2 file and not the source.
name: restic # you probably want to 'snapcraft register <name>'
version: '0.8.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Fast, secure, efficient backup program. # 79 char long summary
description: |
"Restic is a program that does backups right. The design goals are :
- Easy: Doing backups should be a frictionless process.
- Fast: Backing up your data with restic should only be limited by your
network or hard disk bandwidth.
- Verifiable: Much more important than backup is restore, so restic
enables you to easily verify that all data can be restored.
- Secure: Restic uses cryptography to guarantee confidentiality and
integrity of your data. The location the backup data is stored is
assumed not to be a trusted environment.
- Efficient: With the growth of data, additional snapshots should
only take the storage of the actual increment.
- Free: restic is free software and licensed under the
BSD 2-Clause License and actively developed on GitHub."
confinement: devmode # use 'strict' once you have the right plugs and slots
grade: devel
parts:
restic:
# See 'snapcraft plugins'
plugin: dump
source: https://github.com/restic/restic/releases/download/v$SNAPCRAFT_PROJECT_VERSION/restic_$SNAPCRAFT_PROJECT_VERSION_linux_amd64.bz2
source-type: tar
apps:
restic:
command: restic
Just for reference. This is not yet complete as I need this snap to be “classic” I believe as it will need to access the entire file system (backup tool).
EDIT3 - Further in. Current error (updated my YAML file above):
tarfile.ReadError: file could not be opened successfully
EDIT4
So I tested that on the download…
➤ tar xvjf restic_0.8.1_linux_amd64.bz2 19:53:28
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors
But then realised that tar can only handle .tar files with or without compression, but not non tar’ed archives.
So back to my original question - can we use bz2 files (that are not tar’s)?
Thanks, all.