Commit graph

64 commits

Author SHA1 Message Date
Alexis Métaireau
396c3b56c8
packaging: replace stdeb by pybuild
As a result, a new `debian` folder is now living in the repository.
Debian packaging is now done manually rather than using tools that do
the heavy-lifting for us.

The `build-deb.py` script has also been updated to use `dpkg-buildpackage`
2024-09-11 16:20:27 +02:00
Alexis Métaireau
c2a47ec46b
Drop support for Fedora 38
Fedora 38 is EOL since 21 May 2024, so this removes the specific branches
we had checking for it, and updates the related instructions.
2024-06-20 17:08:27 +02:00
Alexis Métaireau
83061eae4f
Update version to 0.7.0 2024-06-20 15:56:34 +02:00
Alex Pyrgiotis
2aee6f4ad2
Fix some minor lint issues 2024-06-04 13:16:06 +03:00
Alex Pyrgiotis
797b28e191
install: Build RPM in different directory
Switch build directory for the `rpmbuild` command from
`./install/linux/rpm-build` to `~/rpmbuild`. The main reason for this is
that we want a build directory that will not be mounted in the
container, since we've experienced issues with file permissions.

Regarding the choice of directories, we went with `~/rpmbuild` because
it's outside the Dangerzone source, and also because it's the default
choice in Fedora [1].

[1]: 3ae1eeafee/rpmdev-setuptree (L60)

Closes #727
2024-05-28 18:06:33 +03:00
Alex Pyrgiotis
a22f12ab6a
install: Detect bad file permissions in RPMs
When building the Dangerzone RPM package, detect if the files bundled in
it have any incorrect permissions. We have seen in the past that
building RPMs from the Dangerzone source, mounted to a macOS Docker
container, can lead to files readable only by the root user (600 /
rw-------).

Refs #727
2024-05-28 13:15:05 +03:00
Naglis Jonaitis
c3a570eb7d
Use %F field code in .desktop entry
On Linux, the `%u` field code results in multiple Dangerzone instances
being launched when opening multiple documents with Dangerzone from
e.g. Nautilus, as `%u` signifies that the application (in this case -
Dangerzone) can only open a single file/URL at once.

This changes the field code to `%F` as Dangerzone (now) supports
converting multiple files at once. We use `%F` (multiple local files)
instead of `%U` (multiple files and/or URLs) since Dangerzone does not
support opening URLs.

See also the Desktop Entry Specification [1] for more information on the
field codes.

Fixes #797

[1]: https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html
2024-05-08 14:17:35 +03:00
Alex Pyrgiotis
bc36c97840
Bump version to 0.6.1 2024-04-25 16:23:39 +03:00
deeplow
832775f34e
Bump version to 0.6.0 2024-02-13 11:12:19 +00:00
deeplow
7f0346686d
Add Dangerzone logo to Fedora build
Fixes #645
2024-02-01 13:53:49 +00:00
deeplow
cd99122385
Adds file formats: epub svg bmp pnm bpm ppm
Partially fix for #660. Missing some files due to limitations [1]:
- PSD - only available from PyMuPDF>=1.23.0 (qubes-fedora is lower)
- TXT - only available from PyMuPDF>=1.23.7 (qubes-fedora is lower)
- JXR - PyMuPDF was refusing to due to missing codec [1]
- JPX - Generated test file was rejected by PyMuPDF [2]
- FB2 - Most often cannot be detected by mime type alone [3]
- CBZ - (idem)
- XPS - (idem)
- MOBI - (idem)
- PAM - General version of other file format already included, so I
  decided not to include this extension [0]

New test files were generated locally:
 - epub - generated with calibre's convert-ebook from another
   sample file
 - svg - generated with inkscape from a mix of a default template
   (hexagons) and a logo's PNG file
 - bmp, pnm, bpm, ppm - generated with ImageMagick's 'convert' from
   tests/test_docs/sample-png.png

[0]: https://github.com/freedomofpress/dangerzone/issues/660#issuecomment-1914681487
[1]: https://github.com/freedomofpress/dangerzone/issues/660#issuecomment-1916803201
[2]: https://github.com/freedomofpress/dangerzone/issues/660#issuecomment-1916870347
[3]: https://github.com/freedomofpress/dangerzone/issues/688
2024-01-31 19:58:48 +00:00
Alex Pyrgiotis
3684b7ff61
Build Dangerzone RPM with PySide6 dependency
Update our RPM spec file to include PySide6 as a dependency, for Fedora
39 onward.
2024-01-31 17:07:32 +02:00
Alex Pyrgiotis
d854657883
Include data files only in source distribution
Make Poetry include data files only in the source distribution, and not
on our wheels. This mainly makes RPM packaging a bit easier, but does
not solve the problem of how to install files to
`/usr/share/dangerzone`.

Also, include files using globs, which is the way Poetry prefers.

Fixes #678
Refs #677
2024-01-23 16:19:45 +02:00
Alex Pyrgiotis
067e787a3d
install: Remove .gitignore for rpm-build
Remove the .gitignore file for rpm-build, because it leads to making
Poetry ignore the Dangerzone module, when building the Python wheel.

Refs #678
2024-01-23 16:19:44 +02:00
sudwhiwdh
3d426ed36b
Linux desktop entry capitalisation 2024-01-22 11:49:42 +00:00
deeplow
f27296cd45
Replace MIT license with AGPLv3
License change required due to the inclusion of the AGPL-licensed
PyMuPDF. This library greatly benefited Dangerzone in many aspects
detailed in [1].

Fixes #658

[1]: https://github.com/freedomofpress/dangerzone/issues/658
2024-01-04 09:57:49 +00:00
deeplow
250d8356cd
Hash-verify container pip install & merge build-image
Ensure that when the container image is installing pymupdf (unavailable
in the repos) with verified hashes. To do so, it has the pymupdf
dependency declared in a "container" group in `pyproject.toml`, which
then gets exported into a requirements.txt, which is then used for
hash-verification when building the container.

Because this required modifying the container image build scripts, they
were all merged to avoid duplicate code. This was an overdue change
anyways.
2024-01-03 12:58:35 +00:00
deeplow
77d5ea5940
Add PyMuPDF in pixels_to_pdf replacing old logic
Adding PyMuPDF essentially make the code much simpler since it can do
everything that we'd need multiple programs for. It also includes
tesseract-OCR integration, which this commit makes use of.
2024-01-03 12:56:33 +00:00
deeplow
780ea18d22
Remove support for Fedora 37 (EOL)
Fixes #637
2023-12-08 11:08:25 +00:00
deeplow
6c59b1f41d
Adds missing client-side packages to Qubes-Dangerzone
Dangerzone was failing to convert documents in Qubes due to missing
client-side dependencies. In particular poppler-utils, ghostscript and
graphicsmagick.

Fixes #647
2023-12-08 10:35:15 +00:00
Alex Pyrgiotis
7fc797f913
Bump version to 0.5.1 2023-12-06 17:54:25 +02:00
Alex Pyrgiotis
c4c46a0a8d
Small fixes for Qubes PRM
This commit fixes 3 small issues with the way we produce our Qubes RPM:

1. The `.exists()` method follows symlinks by default, whereas we want
   to check if a symlink exists. This functionality has been added in
   Python
   3.12.

   Instead of checking if a symlink exists and then removing it, simply
   remove it and don't throw an error if it doesn't exist in the first
   place.

2. The `dz.Convert*` policies were not installed with the executable bit
   set, therefore the qube could not start.

3. The `dz.ConvertDev` policy in particular had an ambiguous shebang,
   thus we change it to explicitly call Python3
2023-10-11 15:54:06 +01:00
Alex Pyrgiotis
1961899bed
Bump version to 0.5.0 2023-10-03 11:32:38 +03:00
Alex Pyrgiotis
22a58d83df
install: Add Tesseract models as package reqs
Add Tesseract models for the 10 most spoken languages as package
requirements for Qubes. For containers, this problem is already solved
since we install all Tesseract models.

If a user is not covered by the installed models, they can install
extras on their own. We will add a note for this in subsequent commits.

Refs #431
2023-09-25 12:51:40 +03:00
Alex Pyrgiotis
215fa8b558
install: Add conflict if Dangerzone is installed
Add a "Conflicts:" entry in the RPM spec, in case another version of
Dangerzone is already installed.
2023-09-25 12:49:58 +03:00
Alex Pyrgiotis
01d63e4eda
install: Build Dangerzone RPMs using our SPEC file
Replace the deprecated `bdist_rpm` method of creating RPMs for
Dangerzone. Instead, update our `install/linux/build-rpm.py` script, to
build Dangerzone RPMs using our SPEC file under
`install/linux/dangerzone.spec`. The script now essentially creates a
source distribution (sdist) using `poetry build`, and then uses
`rpmbuild` to create binary and source RPMs.

Fixes #298
2023-09-20 16:48:53 +03:00
Alex Pyrgiotis
6cc2a953ff
install: Add directory for building Dangerzone RPMs
Add an `rpm-build` directory under `install/linux`, which will be used
for building Dangerzone RPMs. For the time being, it only has a
.gitignore file there, but in the future, invoking
`install/linux/build-rpm.py` will populate it.
2023-09-20 16:48:53 +03:00
Alex Pyrgiotis
33197f26b7
install: Introduce a SPEC file for creating RPMs
Introduce a SPEC file that can be used to create an RPM from a Python
source distribution. Some notable features of this SPEC file follow:

1. We can use this SPEC file to create both regular RPM packages and
   ones targeted for Qubes.
2. It has a post installation script that removes stale .egg-info
   directories, which previously caused issues to our users.
3. It automatically creates a changelog from our Git logs, which differs
   from the actual CHANGELOG.md.
4. It folloes the latest Fedora guidelines (as of writing this) for
   packaging Python projects.

Fixes #514
2023-09-20 16:48:52 +03:00
Alex Pyrgiotis
03df60db5f
Always pull base image when building ours
Always pull the base container image (alpine:latest) before building our
own container image. Else, in an environments that we haven't touched
for a while, an older image may be used.
2023-08-02 13:47:59 +03:00
Alex Pyrgiotis
5ae8b871b6
Add UpdaterThread class
Add a new Python module called "updater", which contains the logic for
prompting the user to enable updates, and checking our GitHub releases
for new updates.

This class has some light dependency to Qt functionality, since it needs
to:

* Show a prompt to the user,
* Run update checks asynchronously in a Qt thread,
* Provide the main window with the result of the update check

Refs #189
2023-07-24 14:22:27 +03:00
deeplow
a1d40fde78
Create an RPM for Qubes
Allow creating an RPM package that is to be installed specifically on
Qubes. This package has the following extra properties from our regular
RPM packages:

1. Make `python3-magic`, `libreoffice` and `tesseract` requirements
   for installing Dangerzone, since the conversion takes place in a
   disposable qube that needs these packages.
2. Ignore the container.tar.gz file, if it exists.
3. Add our RPC calls under `/etc/qubes-rpc`
2023-06-21 11:46:43 +03:00
deeplow
814d533c3b
Restructure container code
The files in `container/` no longer make sense to have that name since
the "document to pixels" part will run in Qubes OS in its own virtual
machine.

To adapt to this, this PR does the following:
- Moves all the files in `container` to `dangerzone/conversion`
- Splits the old `container/dangerzone.py` into its two components
  `dangerzone/conversion/{doc_to_pixels,pixels_to_pdf}.py` with a
  `common.py` file for shared functions
- Moves the Dockerfile to the project root and adapts it to the new
  container code location
- Updates the CircleCI config to properly cache Docker images.
- Updates our install scripts to properly build Docker images.
- Adds the new conversion module to the container image, so that it can
  be imported as a package.
- Adapts the container isolation provider to use the new way of calling
  the code.

NOTE: We have made zero changes to the conversion code in this commit,
except for necessary imports in order to factor out some common parts.
Any changes necessary for Qubes integration follow in the subsequent
commits.
2023-06-21 11:44:47 +03:00
Alex Pyrgiotis
d768099912
Grab just the image ID
When building the image, grab the image id using `-q`, which removes all
the decorations in the output and just keeps the image ID.
2023-03-09 19:04:59 +02:00
Alex Pyrgiotis
a33dcfbb51
Replace First Look Media references
Update several references to First Look Media in the code, to better
reflect the current status, where Freedom of the Press Foundation has
taken over the stewardship of the project.

Fixes #343
2023-03-08 18:40:55 +02:00
Alex Pyrgiotis
4668443be6
install: Use the full image tag
Use the full image tag (dangerzone.rocks/dangerzone:latest) when
building the image. Else, we risk creating a `share/image-id.txt` file
with multiple IDs in it, if we have another
`dangerzone.rocks/dangerzone` image (with a different tag) in our dev
environment.
2023-03-08 17:40:26 +02:00
deeplow
9b3d98b20b
Build arm64 docker image for arm-based Macs
Remove --patform args completely so that by default we build natively
on each platform.

Partial fix for #50
2023-02-16 10:59:00 +00:00
Maeve Andrews
c26326450b
Add a --distro option to build-deb.py
Add an optional --distro argument to build-deb.py, to specify the Debian
version in the package name, which currently is "1". This option may
prove useful when publishing packages to freedomofpress/apt-tools-prod,
where packages from different distros with the same names but different
contents are not accepted.
2023-02-14 15:49:51 +02:00
Alex Pyrgiotis
4eead90c00
install: Fail early when image build fails 2023-01-16 18:48:09 +02:00
Alex Pyrgiotis
624d480cca
install: Do not create intermediate tarfile for container
Skip the creation of the `share/container.tar` file, since it's not used
anywhere. Instead, pipe our `docker/podman save` invocations to `gzip`
directly, which will compress the tarfile on the fly. This saves both
time and disk space.
2023-01-16 18:48:08 +02:00
Alex Pyrgiotis
a0503c8c40
install: Do not create Debian source package twice 2023-01-16 18:48:08 +02:00
Alex Pyrgiotis
1daaafe2a3
install: Introduce a script for installing Podman
Introduce a script for installing Podman in Ubuntu Focal, in
environments that may, or may not, have sudo installed.

Also, update our CircleCI configuration to use this script when
installing Podman.
2022-11-10 16:35:48 +02:00
deeplow
4d8e4c53e3
sort imports with isort linter 2022-08-22 10:15:26 +01:00
Guthrie McAfee Armstrong
395eba0a74
Remove requests dependency 2022-08-19 15:16:14 +01:00
Micah Lee
433639d51f
Explicitly build linux/amd64 container 2021-11-29 15:51:18 -08:00
Micah Lee
2de2b6dca5
Rename dangerzone-converter to container 2021-11-29 15:30:21 -08:00
Micah Lee
b3b52c3963
Rename build scripts 2021-11-23 15:47:25 -08:00
Micah Lee
9acfd2764e
Make the new code work in linux 2021-11-22 18:51:47 -05:00
Micah Lee
588206a9e8
Start implementing built-in container in Linux, without a VM 2021-08-04 14:42:46 -07:00
Micah Lee
d24d593094
Rip out everything required to make dangerzone-container run with root privs 2021-06-17 14:16:27 -07:00
Micah Lee
d50b0c1bed
Remove docker dependency in Linux and replace with podman 2021-06-17 14:12:44 -07:00