Skip to content

Commit

Permalink
try to rewrite pull request QubesOS#9 to python3
Browse files Browse the repository at this point in the history
  • Loading branch information
neowutran committed Jul 11, 2020
1 parent c30ec96 commit 98cf125
Show file tree
Hide file tree
Showing 48 changed files with 1,281 additions and 476 deletions.
83 changes: 21 additions & 62 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,77 +19,36 @@
#
#

RPMS_DIR=rpm/
VERSION := $(shell cat version)
PANDOC=pandoc -s -f markdown -t man
NAME := convert-pdf

help:
@echo "Qubes addons main Makefile:" ;\
echo "make rpms <--- make rpms and sign them";\
echo; \
echo "make clean <--- clean all the binary files";\
echo "make update-repo-current <-- copy newly generated rpms to qubes yum repo";\
echo "make update-repo-current-testing <-- same, but for -current-testing repo";\
echo "make update-repo-unstable <-- same, but to -testing repo";\
echo "make update-repo-installer -- copy dom0 rpms to installer repo"
@exit 0;

rpms: rpms-vm

rpms-dom0:
rpmbuild --define "_rpmdir rpm/" -bb rpm_spec/qpdf-converter-dom0.spec
rpm --addsign rpm/x86_64/qubes-pdf-converter-dom0*$(VERSION)*.rpm

rpms-vm:
rpmbuild --define "_rpmdir rpm/" -bb rpm_spec/qpdf-converter.spec
rpm --addsign rpm/x86_64/qubes-pdf-converter*$(VERSION)*.rpm

update-repo-current:
for vmrepo in ../yum/current-release/current/vm/* ; do \
dist=$$(basename $$vmrepo) ;\
ln -f $(RPMS_DIR)/x86_64/qubes-pdf-converter*$(VERSION)*$$dist*.rpm $$vmrepo/rpm/ ;\
done
ln -f $(RPMS_DIR)/x86_64/qubes-pdf-converter-dom0-*$(VERSION)*.rpm ../yum/current-release/current/dom0/rpm/

update-repo-current-testing:
for vmrepo in ../yum/current-release/current-testing/vm/* ; do \
dist=$$(basename $$vmrepo) ;\
ln -f $(RPMS_DIR)/x86_64/qubes-pdf-converter*$(VERSION)*$$dist*.rpm $$vmrepo/rpm/ ;\
done
ln -f $(RPMS_DIR)/x86_64/qubes-pdf-converter-dom0-*$(VERSION)*.rpm ../yum/current-release/current-testing/dom0/rpm/

update-repo-unstable:
for vmrepo in ../yum/current-release/unstable/vm/* ; do \
dist=$$(basename $$vmrepo) ;\
ln -f $(RPMS_DIR)/x86_64/qubes-pdf-converter*$(VERSION)*$$dist*.rpm $$vmrepo/rpm/ ;\
done
ln -f $(RPMS_DIR)/x86_64/qubes-pdf-converter-dom0-*$(VERSION)*.rpm ../yum/current-release/unstable/dom0/rpm/

update-repo-template:
for vmrepo in ../template-builder/yum_repo_qubes/* ; do \
dist=$$(basename $$vmrepo) ;\
ln -f $(RPMS_DIR)/x86_64/qubes-pdf-converter*$(VERSION)*$$dist*.rpm $$vmrepo/rpm/ ;\
done

update-repo-installer:
ln -f $(RPMS_DIR)/x86_64/qubes-pdf-converter-dom0-*$(VERSION)*.rpm ../installer/yum/qubes-dom0/rpm/

build:
make manpages -C doc

install-vm:
make install -C doc
install -D qvm-convert-pdf $(DESTDIR)/usr/bin/qvm-convert-pdf
install -D qpdf-convert-client $(DESTDIR)/usr/lib/qubes/qpdf-convert-client
install -D qpdf-convert-server $(DESTDIR)/usr/lib/qubes/qpdf-convert-server
install-vm: build
install -d $(DESTDIR)/usr/share/man/man1
install -D qvm-$(NAME).1.gz $(DESTDIR)/usr/share/man/man1/
python3 setup.py install -O1 $(PYTHON_PREFIX_ARG) --root $(DESTDIR)
install -d $(DESTDIR)/etc/qubes-rpc
ln -s ../../usr/lib/qubes/qpdf-convert-server $(DESTDIR)/etc/qubes-rpc/qubes.PdfConvert
install -D qvm-convert-pdf.gnome $(DESTDIR)/usr/lib/qubes/qvm-convert-pdf.gnome
install -d $(DESTDIR)/usr/share/nautilus-python/extensions
install -m 0755 qvm_convert_pdf_nautilus.py $(DESTDIR)/usr/share/nautilus-python/extensions
install -m 0644 qvm_convert_pdf_nautilus.py $(DESTDIR)/usr/share/nautilus-python/extensions
install -d $(DESTDIR)/usr/share/kde4/services
install -m 0644 qvm-convert-pdf.desktop $(DESTDIR)/usr/share/kde4/services

install-dom0:
python3 setup.py install -O1 --root $(DESTDIR)
# not needed in dom0
rm -f $(DESTDIR)/usr/bin/qvm-convert-pdf
rm -f $(DESTDIR)/usr/lib/qubes/qpdf-convert-server

qvm-$(NAME).1: README.md
$(PANDOC) $< > $@

qvm-$(NAME).1.gz: qvm-$(NAME).1
gzip -f $<

build: qvm-$(NAME).1.gz

clean:
rm -rf debian/changelog.*
rm -rf pkgs
rm -f qvm-$(NAME).1.gz
8 changes: 4 additions & 4 deletions Makefile.builder
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ifeq ($(PACKAGE_SET),dom0)
RPM_SPEC_FILES := rpm_spec/qpdf-converter-dom0.spec
else ifeq ($(PACKAGE_SET),vm)
ifneq ($(filter $(DISTRIBUTION), debian qubuntu),)
# needs python 3.7+ - exclude stretch, jessie, and centos[78]
ifeq ($(filter $(DIST), stretch jessie centos7 centos8),)
DEBIAN_BUILD_DIRS := debian
RPM_SPEC_FILES := rpm_spec/qpdf-converter.spec
ARCH_BUILD_DIRS := archlinux
endif

RPM_SPEC_FILES := rpm_spec/qpdf-converter.spec
ARCH_BUILD_DIRS := archlinux
endif

# vim: filetype=make
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ qvm-convert-pdf - converts a potentially untrusted file to a safe-to-view pdf
SYNOPSIS
-----------
```bash
qvm-convert-pdf <file to convert>
qvm-convert-pdf <file to convert>...
```

DESCRIPTION
Expand Down
5 changes: 3 additions & 2 deletions archlinux/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ arch=(x86_64)
pkgdesc=$(grep "Summary:" ./rpm_spec/qpdf-converter.spec.in | sed 's/Summary://' | xargs)
url=$(git remote get-url origin)
license=(GPL)
depends=(libreoffice graphicsmagick zenity poppler python-nautilus file net-tools)
makedepends=(git pandoc python-setuptools)
depends=(libreoffice graphicsmagick zenity poppler python-nautilus python-click python-pillow python-tqdm python-magic)

build() {
ln -s "$srcdir"/../ "$srcdir/src"
}
check(){
src/dev_tools/run.sh
src/tests/all
}
package() {
cd src
Expand Down
6 changes: 6 additions & 0 deletions ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# WARNING: those requirements are used only for travis-ci.org
# they SHOULD NOT be used under normal conditions; use system package manager
click
pillow
pylint
tqdm
11 changes: 5 additions & 6 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
qubes-pdf-converter (3.0.0-1) unstable; urgency=medium

[ Neowutran ]
* Add support for libreoffice files type
* Add support for password protected files
qubes-pdf-converter (2.1.8-1) unstable; urgency=medium

-- Marek Marczykowski-Górecki <[email protected]> Sat, 25 Apr 2020 20:41:05 +0100
[ Frédéric Pierret (fepitre) ]
* Drop python2

-- Marek Marczykowski-Górecki <[email protected]> Mon, 25 May 2020 04:16:24 +0200

qubes-pdf-converter (2.1.7-1) unstable; urgency=medium

Expand Down
14 changes: 12 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Source: qubes-pdf-converter
Section: admin
Priority: optional
Maintainer: Jason Mehring <[email protected]>
Build-Depends: pandoc, debhelper (>= 9)
Build-Depends: pandoc, python3-setuptools, debhelper (>= 9)
# For the futures version of debian, delete the "compat" file, and add the line below in "Build-Depends"
# debhelper-compat (= 12)
Standards-Version: 4.5.0
Expand All @@ -11,5 +11,15 @@ Homepage: https://github.com/QubesOS/qubes-app-linux-pdf-converter
Package: qubes-pdf-converter
Section: admin
Architecture: any
Depends: poppler-utils, net-tools, file, libreoffice, graphicsmagick, python-nautilus, ${misc:Depends}
Depends:
poppler-utils,
libreoffice,
graphicsmagick,
python3 (>= 3.7.0),
python3-nautilus | python-nautilus,
python3-click,
python3-pillow,
python3-tqdm,
python3-magic,
${misc:Depends}
Description: The Qubes service for converting untrusted PDF files into trusted ones
3 changes: 2 additions & 1 deletion debian/qubes-pdf-converter.install
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
usr/lib/qubes/qpdf-convert-client
usr/lib/qubes/qpdf-convert-server
etc/qubes-rpc/qubes.PdfConvert
usr/bin/qvm-convert-pdf
Expand All @@ -7,3 +6,5 @@ usr/share/nautilus-python/extensions
usr/share/nautilus-python/extensions/qvm_convert_pdf_nautilus.py
usr/share/kde4/services/qvm-convert-pdf.desktop
usr/share/man/man1/qvm-convert-pdf.1.gz
usr/lib/python3/dist-packages/qubespdfconverter
usr/lib/python3/dist-packages/qubespdfconverter-*.egg-info
5 changes: 5 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export PYTHON_PREFIX_ARG=--install-layout=deb

export DESTDIR=$(shell readlink -m .)/debian/tmp

Expand All @@ -11,3 +12,7 @@ export DESTDIR=$(shell readlink -m .)/debian/tmp

override_dh_auto_install:
make install-vm

override_dh_missing:
dh_missing --fail-missing

2 changes: 2 additions & 0 deletions debian/tests/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Tests: all
Depends: @
30 changes: 0 additions & 30 deletions dev_tools/run.sh

This file was deleted.

23 changes: 0 additions & 23 deletions doc/Makefile

This file was deleted.

1 change: 0 additions & 1 deletion doc/qvm-convert-pdf.md

This file was deleted.

Loading

0 comments on commit 98cf125

Please sign in to comment.