From: Michael Tremer Date: Mon, 30 Dec 2024 15:33:34 +0000 (+0000) Subject: stripper: Write the debug information directory the Build ID file X-Git-Tag: 0.9.30~644 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3106fb7ae49cb48dbcb50cc605c3a4d092da9b3d;p=pakfire.git stripper: Write the debug information directory the Build ID file Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/stripper.c b/src/libpakfire/stripper.c index 58abe1d3f..e135fb71e 100644 --- a/src/libpakfire/stripper.c +++ b/src/libpakfire/stripper.c @@ -399,42 +399,21 @@ static int __pakfire_stripper_build_id_path(struct pakfire_stripper* stripper, buildroot, build_id[0], build_id[1], build_id + 2); } -#define pakfire_stripper_debug_path(stripper, buffer, file) \ - __pakfire_stripper_debug_path(stripper, buffer, sizeof(buffer), file) - -static int __pakfire_stripper_debug_path(struct pakfire_stripper* stripper, - char* buffer, size_t length, struct pakfire_file* file) { - const char* buildroot = pakfire_relpath(stripper->pakfire, stripper->path); - - return __pakfire_path(stripper->pakfire, buffer, length, - "%s/usr/lib/debug%s.debug", buildroot, pakfire_file_get_path(file)); -} - static int pakfire_stripper_extract_debug_sections(struct pakfire_stripper* stripper, struct pakfire_file* file, const char* build_id) { char build_id_path[PATH_MAX]; - char debug_path[PATH_MAX]; const char* path = NULL; int r; // Fetch the path path = pakfire_file_get_abspath(file); - // Make the debug path - r = pakfire_stripper_debug_path(stripper, debug_path, file); - if (r < 0) - return r; - // Make Build ID path r = pakfire_stripper_build_id_path(stripper, build_id_path, build_id); if (r < 0) return r; // Create the directories - r = pakfire_mkparentdir(debug_path, 0755); - if (r < 0) - return r; - r = pakfire_mkparentdir(build_id_path, 0755); if (r < 0) return r; @@ -443,28 +422,24 @@ static int pakfire_stripper_extract_debug_sections(struct pakfire_stripper* stri "objcopy", "--only-keep-debug", pakfire_relpath(stripper->pakfire, path), - pakfire_relpath(stripper->pakfire, debug_path), + pakfire_relpath(stripper->pakfire, build_id_path), NULL, }; // Run the command r = pakfire_jail_exec_command(stripper->jail, argv, NULL, 0); if (r < 0) { - ERROR(stripper->ctx, "Could not strip debug sections from %s: %s\n", + ERROR(stripper->ctx, "Could not extract debug sections from %s: %s\n", pakfire_file_get_path(file), strerror(-r)); return r; // The command returned an error } else if (r > 0) { - ERROR(stripper->ctx, "Could not strip debug sections from %s\n", + ERROR(stripper->ctx, "Could not extract debug sections from %s\n", pakfire_file_get_path(file)); return -ENOTSUP; } - // Create a symlink - r = pakfire_symlink(stripper->ctx, debug_path, build_id_path); - if (r < 0) - return r; return r; }