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;
"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;
}