File: 0001-Link-system-tsk-statically-talloc-dynamically-instea.patch

package info (click to toggle)
pytsk 20190121-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,344 kB
  • sloc: python: 3,645; ansic: 3,090; makefile: 69; sh: 40
file content (95 lines) | stat: -rw-r--r-- 3,537 bytes parent folder | 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
From: Hilko Bengen <bengen@debian.org>
Date: Sat, 19 Mar 2016 22:31:25 +0100
Subject: Link system tsk (statically),
 talloc (dynamically) instead of embedding

---
 setup.py | 47 ++++++++++++-----------------------------------
 1 file changed, 12 insertions(+), 35 deletions(-)

diff --git a/setup.py b/setup.py
index 612319c..1af21a2 100755
--- a/setup.py
+++ b/setup.py
@@ -230,9 +230,9 @@ class BuildExtCommand(build_ext):
   def run(self):
     compiler = new_compiler(compiler=self.compiler)
     # pylint: disable=attribute-defined-outside-init
-    self.define = self.configure_source_tree(compiler)
+    self.define = [("HAVE_TSK_LIBTSK_H", "")]
 
-    libtsk_path = os.path.join("sleuthkit", "tsk")
+    libtsk_path = "/usr/include/tsk"
 
     if not os.access("pytsk3.c", os.R_OK):
       # Generate the Python binding code (pytsk3.c).
@@ -254,7 +254,7 @@ class BuildExtCommand(build_ext):
 class SDistCommand(sdist):
   """Custom handler for generating source dist."""
   def run(self):
-    libtsk_path = os.path.join("sleuthkit", "tsk")
+    libtsk_path = "/usr/include/tsk"
 
     # sleuthkit submodule is not there, probably because this has been
     # freshly checked out.
@@ -349,35 +349,10 @@ class UpdateCommand(Command):
       subprocess.check_call(["git", "apply", patch_file], cwd="sleuthkit")
 
   def run(self):
-    subprocess.check_call(["git", "stash"], cwd="sleuthkit")
-
-    subprocess.check_call(["git", "submodule", "init"])
-    subprocess.check_call(["git", "submodule", "update"])
-
-    print("Updating sleuthkit")
-    subprocess.check_call(["git", "reset", "--hard"], cwd="sleuthkit")
-    subprocess.check_call(["git", "clean", "-x", "-f", "-d"], cwd="sleuthkit")
-    subprocess.check_call(["git", "checkout", "master"], cwd="sleuthkit")
-    subprocess.check_call(["git", "pull"], cwd="sleuthkit")
-    if self.use_head:
-      print("Pulling from HEAD")
-    else:
-      print("Pulling from tag: {0:s}".format(self._SLEUTHKIT_GIT_TAG))
-      subprocess.check_call(["git", "fetch", "--tags"], cwd="sleuthkit")
-      git_tag_path = "tags/sleuthkit-{0:s}".format(self._SLEUTHKIT_GIT_TAG)
-      subprocess.check_call(["git", "checkout", git_tag_path], cwd="sleuthkit")
-
-      self.patch_sleuthkit()
-
-    compiler_type = distutils.ccompiler.get_default_compiler()
-    if compiler_type != "msvc":
-      subprocess.check_call(["./bootstrap"], cwd="sleuthkit")
-
-    # Now derive the version based on the date.
     with open("version.txt", "w") as fd:
       fd.write(self.version)
 
-    libtsk_path = os.path.join("sleuthkit", "tsk")
+    libtsk_path = "/usr/include/tsk"
 
     # Generate the Python binding code (pytsk3.c).
     libtsk_header_files = [
@@ -412,16 +387,17 @@ class ProjectBuilder(object):
     # The args for the extension builder.
     self.extension_args = {
         "define_macros": [],
-        "include_dirs": ["talloc", self._libtsk_path, "sleuthkit", "."],
+        "include_dirs": ["."],
         "library_dirs": [],
-        "libraries": []}
+        "libraries": [ "talloc" ],
+        "extra_link_args": [
+          "-Wl,-Bstatic", "-ltsk", "-Wl,-Bdynamic",
+          "-lafflib", "-lewf", "-lstdc++", "-lz",
+        ]}
 
     # The sources to build.
     self._source_files = [
-        "class.c", "error.c", "tsk3.c", "pytsk3.c", "talloc/talloc.c"]
-
-    # Path to the top of the unpacked sleuthkit sources.
-    self._sleuthkit_path = "sleuthkit"
+        "class.c", "error.c", "tsk3.c", "pytsk3.c"]
 
   def build(self):
     """Build everything."""