Skip to content

Commit 3429c22

Browse files
authored
Merge pull request #93 from marcosps/module-path-resolving
Module path resolving
2 parents b983cf6 + 44460f6 commit 3429c22

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

klpbuild/klplib/codestream.py

+5-10
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,6 @@ def validate_config(self, conf, mod):
268268
print(configs["m"])
269269
raise RuntimeError(f"{self.name()}: Configuration mismatach between codestreams. Aborting.")
270270

271-
272-
# Return only the name of the module to be livepatched
273271
def find_obj_path(self, arch, mod):
274272
# Return the path if the modules was previously found for ARCH, or refetch if
275273
# the obejct is for a different architecture
@@ -291,15 +289,12 @@ def find_obj_path(self, arch, mod):
291289
if not obj_match:
292290
raise RuntimeError(f"{self.name()}-{arch} ({self.kernel}): Module not found: {mod}")
293291

294-
# modules.order will show the module with suffix .o, so
295-
# make sure the extension. Also check for multiple extensions since we
296-
# can have modules being compressed using different algorithms.
297-
for ext in [".ko", ".ko.zst", ".ko.gz"]:
298-
obj = str(PurePath(obj_match.group(1)).with_suffix(ext))
299-
if Path(mod_path, obj).exists():
300-
break
292+
# modules.order will show the module with suffix .o, so make sure the extension.
293+
obj_path = mod_path/(PurePath(obj_match.group(1)).with_suffix(".ko"))
294+
# Make sure that the .ko file exists
295+
assert obj_path.exists(), f"Module {str(obj_path)} doesn't exists. Aborting"
301296

302-
return Path(mod_path, obj).relative_to(get_datadir(arch))
297+
return obj_path.relative_to(get_datadir(arch))
303298

304299

305300
def lp_out_file(self, lp_name, fname):

klpbuild/klplib/ibs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def download_cs_data(self, cs_list):
205205

206206
rpms = self.get_cs_packages(cs_list, dest)
207207

208-
logging.info(f"Downloading {len(rpms)} rpms...")
208+
logging.info("Downloading %s rpms...", len(rpms))
209209
self.total = len(rpms)
210210
self.do_work(self.download_and_extract, rpms)
211211

@@ -215,7 +215,7 @@ def download_cs_data(self, cs_list):
215215
for arch in cs.archs:
216216
# Extract modules and vmlinux files that are compressed
217217
mod_path = cs.get_mod_path(arch)
218-
for fext, ecmd in [("zst", "unzstd -f -d"), ("xz", "xz --quiet -d -k")]:
218+
for fext, ecmd in [("zst", "unzstd --rm -f -d"), ("xz", "xz --quiet -d -k")]:
219219
cmd = rf'find {mod_path} -name "*.{fext}" -exec {ecmd} --quiet {{}} \;'
220220
subprocess.check_output(cmd, shell=True)
221221

0 commit comments

Comments
 (0)