Skip to content

Commit 26afb11

Browse files
committed
readded find-libgcc to cryptsetup, start pulling python into debug (experimental)
Signed-off-by: Zen <[email protected]>
1 parent cc7438e commit 26afb11

File tree

5 files changed

+33
-4
lines changed

5 files changed

+33
-4
lines changed

ugrd/base/debug.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ def start_shell(self):
1414
return None
1515

1616

17+
def pull_python_parts(self):
18+
"""
19+
Gets stuff from /usr/lib/python-exec/python{version} and adds it to the dependencies.
20+
"""
21+
pyton_parts = ['python', 'python3', 'python-config', 'pydoc']
22+
for part in pyton_parts:
23+
self.config_dict['dependencies'] = Path(f"/usr/lib/python-exec/python{self.config_dict['python_version']}") / part
24+
25+
1726
def pull_valgrind_parts(self):
1827
"""
1928
Gets the stuff which was dostrip -x'd from valgrind and adds it to the dependencies.

ugrd/base/debug.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
binaries = ['cp', 'mv', 'rm', 'nano', 'find', 'grep', 'dmesg', 'chmod', 'touch', 'valgrind', 'gdb', 'python']
22

3-
[imports.build_pre]
4-
"ugrd.base.debug" = [ "pull_valgrind_parts" ]
3+
python_version = "3.11"
54

5+
[imports.build_pre]
6+
"ugrd.base.debug" = [ "pull_python_parts", "pull_valgrind_parts" ]
67

78
[imports.init_debug]
89
"ugrd.base.debug" = [ "start_shell" ]
910

1011
[custom_parameters]
1112
start_shell = "bool" # Start a shell during init_early
13+
python_version = "str" # Python version to use

ugrd/crypto/cryptsetup.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__author__ = 'desultory'
22

3-
__version__ = '0.8.2'
3+
__version__ = '0.9.0'
44

55

66
CRYPTSETUP_PARAMETERS = ['key_type', 'partuuid', 'uuid', 'key_file', 'header_file', 'retries', 'key_command', 'reset_command', 'try_nokey']
@@ -159,3 +159,18 @@ def crypt_init(self):
159159
out += ['fi']
160160
return out
161161

162+
163+
def find_libgcc(self):
164+
"""
165+
Finds libgcc.so, adds a 'dependencies' item for it.
166+
Adds the parend directory to 'library_paths'
167+
"""
168+
from pathlib import Path
169+
170+
ldconfig = self._run(['ldconfig', '-p']).stdout.decode().split("\n")
171+
libgcc = [lib for lib in ldconfig if 'libgcc_s' in lib and 'libc6,x86-64' in lib][0]
172+
source_path = Path(libgcc.partition('=> ')[-1])
173+
self.logger.debug("Source path for libgcc_s: %s" % source_path)
174+
175+
self.config_dict['dependencies'] = source_path
176+
self.config_dict['library_paths'] = str(source_path.parent)

ugrd/crypto/cryptsetup.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ cryptsetup_autoretry = true
1010
[imports.config_processing]
1111
"ugrd.crypto.cryptsetup" = [ "_process_cryptsetup_multi", "_process_cryptsetup_key_types_multi" ]
1212

13+
[imports.build_pre]
14+
"ugrd.crypto.cryptsetup" = [ "find_libgcc" ]
15+
1316
[imports.init_early]
1417
"ugrd.crypto.cryptsetup" = [ "get_crypt_sources" ]
1518

ugrd/initramfs_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def load_config(self):
4040
self.logger.debug("Processing config key: %s" % config)
4141
self.config_dict[config] = value
4242

43-
self.logger.debug("Loaded config: %s" % self.config_dict)
43+
self.logger.debug("Loaded config:\n%s" % self.config_dict)
4444

4545
for parameter in ['build_dir', 'out_dir', 'clean', 'old_count']:
4646
dict_value = self.config_dict[parameter]

0 commit comments

Comments
 (0)