File: 2002_use-dpkg-to-select-platform.patch

package info (click to toggle)
caja-dropbox 1.26.0-2
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm
  • size: 1,056 kB
  • sloc: python: 2,020; ansic: 1,970; makefile: 199; sh: 80
file content (32 lines) | stat: -rw-r--r-- 1,066 bytes parent folder | download | duplicates (2)
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
Description: Use dpkg to identify the architecture to use
 The upstream check is not reliable because if you run i386
 with a 64 bit kernel, you download the wrong binaries.
 .
 This patch is Debian specific since it relies on dpkg and thus can't be
 upstreamed.
Author: Raphaƫl Hertzog <hertzog@debian.org>
Origin: vendor
Forwarded: not-needed

--- a/caja-dropbox.in
+++ b/caja-dropbox.in
@@ -128,13 +128,13 @@
 
 def plat():
     if sys.platform.lower().startswith('linux'):
-        arch = platform.machine()
-        if (arch[0] == 'i' and
-            arch[1].isdigit() and
-            arch[2:4] == '86'):
+        arch = subprocess.Popen(["dpkg", "--print-architecture"],
+                                stdout=subprocess.PIPE).communicate()[0]
+        arch = arch.rstrip(b"\n")
+        if arch == b"i386":
             plat = "x86"
-        elif arch == 'x86_64':
-            plat = arch
+        elif arch == b"amd64":
+            plat = "x86_64"
         else:
             FatalVisibleError("Platform not supported")
         return "lnx.%s" % plat