#5 Use official instead of custom tarball
Merged 2 years ago by kevin. Opened 2 years ago by aimylios.
rpms/ aimylios/calibre use-upstream-tarball  into  master

file modified
+1
@@ -300,3 +300,4 @@ 

  /calibre-4.10.1-nofonts.tar.xz

  /calibre-4.11.2-nofonts.tar.xz

  /calibre-4.12.0-nofonts.tar.xz

+ /calibre-4.12.0.tar.xz

file modified
+47 -99
@@ -6,21 +6,12 @@ 

  

  Name:           calibre

  Version:        4.12.0

- Release:        1%{?dist}

+ Release:        2%{?dist}

  Summary:        E-book converter and library manager

  License:        GPLv3

  URL:            https://calibre-ebook.com/

  

- # SourceURL: curl -L http://code.calibre-ebook.com/dist/src > calibre-%%{version}.tar.xz

- # Upstream packages some unfree fonts which we cannot redistribute.

- # While we're at it, also delete the liberation fonts which we already have.

- #

- # Download the upstream tarball and invoke this script while in the tarball's

- # directory:

- # ./getsources.sh %%{version}

- 

- Source0:        calibre-%{version}-nofonts.tar.xz

- Source1:        getsources.sh

+ Source0:        https://download.calibre-ebook.com/%{version}/%{name}-%{version}.tar.xz

  

  # Disable auto update from inside the app

  Patch1:         calibre-no-update.patch
@@ -243,84 +234,44 @@ 

  # these are provided as separate packages

  rm -rf %{buildroot}%{_libdir}/calibre/odf

  

- # link to system fonts after we have deleted (see Source0) the non-free ones

- # http://bugs.calibre-ebook.com/ticket/3832

- %if 0%{?fedora} >= 31

- # In fedora 31 liberation fonts moved directories.

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation-mono/LiberationMono-BoldItalic.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationMono-BoldItalic.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation-mono/LiberationMono-Bold.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationMono-Bold.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation-mono/LiberationMono-Italic.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationMono-Italic.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation-mono/LiberationMono-Regular.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationMono-Regular.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation-sans/LiberationSans-BoldItalic.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSans-BoldItalic.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation-sans/LiberationSans-Bold.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSans-Bold.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation-sans/LiberationSans-Italic.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSans-Italic.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation-sans/LiberationSans-Regular.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSans-Regular.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation-serif/LiberationSerif-BoldItalic.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSerif-BoldItalic.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation-serif/LiberationSerif-Bold.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSerif-Bold.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation-serif/LiberationSerif-Italic.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSerif-Italic.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation-serif/LiberationSerif-Regular.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSerif-Regular.ttf

- %else

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation/LiberationMono-BoldItalic.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationMono-BoldItalic.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation/LiberationMono-Bold.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationMono-Bold.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation/LiberationMono-Italic.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationMono-Italic.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation/LiberationMono-Regular.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationMono-Regular.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation/LiberationSans-BoldItalic.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSans-BoldItalic.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation/LiberationSans-Bold.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSans-Bold.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation/LiberationSans-Italic.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSans-Italic.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation/LiberationSans-Regular.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSans-Regular.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation/LiberationSerif-BoldItalic.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSerif-BoldItalic.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation/LiberationSerif-Bold.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSerif-Bold.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation/LiberationSerif-Italic.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSerif-Italic.ttf

- ln -s --relative \

-       %{buildroot}%{_datadir}/fonts/liberation/LiberationSerif-Regular.ttf \

-       %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSerif-Regular.ttf

- %endif

+ # unbundle Liberation fonts

+ rm -f %{buildroot}%{_datadir}/calibre/fonts/liberation/*

+ ln --symbolic --relative \

+     %{buildroot}%{_datadir}/fonts/liberation-mono/LiberationMono-BoldItalic.ttf \

+     %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationMono-BoldItalic.ttf

+ ln --symbolic --relative \

+     %{buildroot}%{_datadir}/fonts/liberation-mono/LiberationMono-Bold.ttf \

+     %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationMono-Bold.ttf

+ ln --symbolic --relative \

+     %{buildroot}%{_datadir}/fonts/liberation-mono/LiberationMono-Italic.ttf \

+     %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationMono-Italic.ttf

+ ln --symbolic --relative \

+     %{buildroot}%{_datadir}/fonts/liberation-mono/LiberationMono-Regular.ttf \

+     %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationMono-Regular.ttf

+ ln --symbolic --relative \

+     %{buildroot}%{_datadir}/fonts/liberation-sans/LiberationSans-BoldItalic.ttf \

+     %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSans-BoldItalic.ttf

+ ln --symbolic --relative \

+     %{buildroot}%{_datadir}/fonts/liberation-sans/LiberationSans-Bold.ttf \

+     %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSans-Bold.ttf

+ ln --symbolic --relative \

+     %{buildroot}%{_datadir}/fonts/liberation-sans/LiberationSans-Italic.ttf \

+     %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSans-Italic.ttf

+ ln --symbolic --relative \

+     %{buildroot}%{_datadir}/fonts/liberation-sans/LiberationSans-Regular.ttf \

+     %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSans-Regular.ttf

+ ln --symbolic --relative \

+     %{buildroot}%{_datadir}/fonts/liberation-serif/LiberationSerif-BoldItalic.ttf \

+     %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSerif-BoldItalic.ttf

+ ln --symbolic --relative \

+     %{buildroot}%{_datadir}/fonts/liberation-serif/LiberationSerif-Bold.ttf \

+     %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSerif-Bold.ttf

+ ln --symbolic --relative \

+     %{buildroot}%{_datadir}/fonts/liberation-serif/LiberationSerif-Italic.ttf \

+     %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSerif-Italic.ttf

+ ln --symbolic --relative \

+     %{buildroot}%{_datadir}/fonts/liberation-serif/LiberationSerif-Regular.ttf \

+     %{buildroot}%{_datadir}/calibre/fonts/liberation/LiberationSerif-Regular.ttf

  

  # Remove these 2 appdata files, we can only include one

  rm -f %{buildroot}/%{_datadir}/metainfo/calibre-ebook-edit.appdata.xml
@@ -331,20 +282,14 @@ 

  mv %{buildroot}%{_datadir}/calibre/mathjax %{buildroot}%{_datadir}/calibre/mathjax-fedora

  

  %check

- # skip some tests which are failing because of missing dependencies (unrar),

- # problems in mock (bonjour), or they require removed fonts

- # skip qt test on 32 bit arches for now as there's a pdf issue

+ # skip failing tests:

+ # - unrar (missing dependencies)

+ # - bonjour (problems in mock)

+ # - qt (fails on 32-bit architectures only)

  CALIBRE_PY3_PORT=1 \

  %{__python3} setup.py test \

      --exclude-test-name unrar \

      --exclude-test-name bonjour \

-     --exclude-test-name actual_case \

-     --exclude-test-name clone \

-     --exclude-test-name file_add \

-     --exclude-test-name file_removal \

-     --exclude-test-name file_rename \

-     --exclude-test-name folder_type_map_case \

-     --exclude-test-name merge_file \

  %ifarch i686 armv7hl

      --exclude-test-name qt

  %endif
@@ -396,6 +341,9 @@ 

  %{_datadir}/metainfo/*.appdata.xml

  

  %changelog

+ * Sun Mar 15 2020 Marcus A. Romer <aimylios@gmx.de> - 4.12.0-2

+ - Use official instead of custom tarball.

+ 

  * Fri Mar 06 2020 Kevin Fenzi <kevin@scrye.com> - 4.12.0-1

  - Update to 4.12.0. Fixes bug 1810856

  

file removed
-25
@@ -1,25 +0,0 @@ 

- #!/bin/sh -e

- 

- # Usage: ./getsources.sh [version]

- #     (this produces calibre-[version]-nofonts.tar.xz)

- if [ -n "$1" ]; then

-     version="$1"

- else

-     version="$(awk '/^Version:/{print $2}' *.spec)"

- fi

- 

- fname="calibre-${version}-nofonts.tar.xz"

- if [ -e "$fname" ]; then

-     echo "$fname already exists, not downloading"

-     exit 0

- fi

- 

- echo "Downloading version ${version}"

- [ -x /bin/pxz ] && xz=pxz || xz=xz

- 

- curl -sSL http://code.calibre-ebook.com/dist/src | \

-     xzcat | \

-     tar --delete --wildcards -f - '*/fonts/liberation/*' | \

-     $xz -9v > "$fname"

- 

- echo "$fname is ready"

file modified
+1 -1
@@ -1,1 +1,1 @@ 

- SHA512 (calibre-4.12.0-nofonts.tar.xz) = b22fecd1d60d32647a0b2140caa5e257afa13bcbea2422349b3165744a3a0ea86c76026775c2f8545c87eb4652ee58e1051084e6efd7200b0e5b44e40994b506

+ SHA512 (calibre-4.12.0.tar.xz) = 628308273b507ee2557cd089e5c7b77f8304c1728b9aadfe5493b22042bdcf2da4c07652a6432121b5dd432807bcda21fabb81c37e59f87d24ace52539f3244c

Since it was first packaged for Fedora, Calibre relies on a script creating a custom tarball from the offical tarball by removing the included fonts. The motivation for this was that there were some non-free fonts (from Sony) which Fedora could not redistribute. As part of this, the Liberation fonts were removed as well, because there is a dedicated package available for them.

The non-free fonts have been removed from Calibre already more than six years ago:
https://github.com/kovidgoyal/calibre/commit/50beda31ae41eacbecdecc5464eddae134c45ad8

I therefore would like to suggest to directly use the official Calibre tarball instead. This would not only simplify the packaging script and process, it also allows to execute seven more test cases which rely on the Liberation font files to be present in the source folder. The only disadvantage I see is that the Fedora sources will include a copy of the Liberation fonts, but the same is true for other parts of Calibre (like MathJax).

The RPMs and build logs for F32 and Rawhide based on this PR are available in my private Copr repository:
https://copr.fedorainfracloud.org/coprs/aimylios/calibre-python3/build/1305626/

Please note that I have removed support for F30 (and older releases) as part of this PR, because it is nearing its end of life. If anyone has the intention to push another update to F30 (currently has calibre-3.36.0-9) I can easily revert this part of the change.

Well, the guidelines say not to bundle fonts in non font packages:

https://docs.fedoraproject.org/en-US/packaging-guidelines/#_avoid_bundling_of_fonts_in_other_packages

How about using the default tar, but then removing the bundled font and linking it to the font package that has them in fedora? Ah, thats what you are doing. Great. ;)

Looks fine to me, and thanks so much for submitting it.

Pull-Request has been merged by kevin

2 years ago