Package: calibre / 6.13.0+repack-2+deb12u4

0020-Sort-object-lists-for-reproducible-build.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
From: YOKOTA Hiroshi <yokota.hgml@gmail.com>
Date: Sun, 7 Nov 2021 16:31:16 +0900
Subject: Sort object lists for reproducible build

Forwarded: not-needed
---
 setup/build.py       |  8 ++++----
 src/calibre/linux.py | 18 +++++++++---------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/setup/build.py b/setup/build.py
index 2b1154e..a3e49f3 100644
--- a/setup/build.py
+++ b/setup/build.py
@@ -566,8 +566,8 @@ class Build(Command):
             compiler = env.cxx if ext.needs_cxx else env.cc
             linker = env.linker or compiler
             cmd = [linker]
-            elib = env.lib_dirs_to_ldflags(ext.lib_dirs)
-            xlib = env.libraries_to_ldflags(ext.libraries)
+            elib = env.lib_dirs_to_ldflags(sorted(ext.lib_dirs))
+            xlib = env.libraries_to_ldflags(sorted(ext.libraries))
             if iswindows or env is self.windows_cross_env:
                 pre_ld_flags = []
                 if ext.uses_icu:
@@ -576,7 +576,7 @@ class Build(Command):
                 cmd += pre_ld_flags + env.ldflags + ext.ldflags + elib + xlib + \
                     ['/EXPORT:' + init_symbol_name(ext.name)] + objects + ext.extra_objs + ['/OUT:'+dest]
             else:
-                cmd += objects + ext.extra_objs + ['-o', dest] + env.ldflags + ext.ldflags + elib + xlib
+                cmd += sorted(objects) + ext.extra_objs + ['-o', dest] + env.ldflags + ext.ldflags + elib + xlib
             return LinkCommand(cmd, objects, dest)
 
         env = self.env_for_compilation_db(ext)
@@ -679,7 +679,7 @@ sip-include-dirs = ["/usr/lib/python3/dist-packages/PyQt6/bindings"]
 
 [tool.sip.bindings.{ext.name}]
 headers = {ext.headers}
-sources = {ext.sources}
+sources = {sorted(ext.sources)}
 exceptions = {needs_exceptions}
 include-dirs = {ext.inc_dirs}
 qmake-QT = {ext.qt_modules}
diff --git a/src/calibre/linux.py b/src/calibre/linux.py
index 265532b..b7b7915 100644
--- a/src/calibre/linux.py
+++ b/src/calibre/linux.py
@@ -286,7 +286,7 @@ class ZshCompleter:  # {{{
                 if opt.dest in {'extract_to', 'debug_pipeline', 'to_dir', 'outbox', 'with_library', 'library_path'}:
                     arg += "'_path_files -/'"
                 elif opt.choices:
-                    arg += "(%s)"%'|'.join(opt.choices)
+                    arg += "(%s)"%'|'.join(sorted(opt.choices))
                 elif set(file_map).intersection(set(opt._long_opts)):
                     k = set(file_map).intersection(set(opt._long_opts))
                     exts = file_map[tuple(k)[0]]
@@ -331,10 +331,10 @@ class ZshCompleter:  # {{{
         from calibre.ebooks.conversion.plumber import supported_input_formats
         from calibre.utils.logging import DevNull
         from calibre.web.feeds.recipes.collection import get_builtin_recipe_titles
-        input_fmts = set(supported_input_formats())
-        output_fmts = set(available_output_formats())
-        iexts = {x.upper() for x in input_fmts}.union(input_fmts)
-        oexts = {x.upper() for x in output_fmts}.union(output_fmts)
+        input_fmts = sorted(set(supported_input_formats()))
+        output_fmts = sorted(set(available_output_formats()))
+        iexts = sorted({x.upper() for x in input_fmts}.union(input_fmts))
+        oexts = sorted({x.upper() for x in output_fmts}.union(output_fmts))
         w = polyglot_write(f)
         # Arg 1
         w('\n_ebc_input_args() {')
@@ -469,7 +469,7 @@ _ebook_edit() {{
 
     return 1
 }}
-'''.format(opt_lines, '|'.join(tweakable_fmts)) + '\n\n')
+'''.format(opt_lines, '|'.join(sorted(tweakable_fmts))) + '\n\n')
 
     def do_calibredb(self, f):
         from calibre.customize.ui import available_catalog_formats
@@ -500,7 +500,7 @@ _ebook_edit() {{
                 exts = ['opf']
             exts = set(exts).union(x.upper() for x in exts)
             pats = ('*.%s'%x for x in exts)
-            extra = ("'*:filename:_files -g \"%s\"' "%' '.join(pats),) if exts else ()
+            extra = ("'*:filename:_files -g \"%s\"' "%' '.join(sorted(pats)),) if exts else ()
             if command in {'add', 'add_format'}:
                 extra = ("'*:filename:_files' ",)
             opts = '\\\n        '.join(tuple(self.get_options(
@@ -918,7 +918,7 @@ class PostInstall:
         mimetypes.discard('application/octet-stream')
 
         def write_mimetypes(f, extra=''):
-            line = 'MimeType={};'.format(';'.join(mimetypes))
+            line = 'MimeType={};'.format(';'.join(sorted(mimetypes)))
             if extra:
                 line += extra + ';'
             f.write(line.encode('utf-8') + b'\n')
@@ -933,7 +933,7 @@ class PostInstall:
         with open('calibre-ebook-edit.desktop', 'wb') as f:
             f.write(ETWEAK.encode('utf-8'))
             mt = {guess_type('a.' + x.lower())[0] for x in (SUPPORTED|IMPORTABLE)} - {None, 'application/octet-stream'}
-            f.write(('MimeType=%s;\n'%';'.join(mt)).encode('utf-8'))
+            f.write(('MimeType=%s;\n'%';'.join(sorted(mt))).encode('utf-8'))
         with open('calibre-gui.desktop', 'wb') as f:
             f.write(GUI.encode('utf-8'))
             write_mimetypes(f, 'x-scheme-handler/calibre')