This brings back the former behaviour.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
static int __pakfire_build_remove_static_libraries(
struct pakfire* pakfire, struct pakfire_file* file, void* data) {
struct pakfire_filelist* removees = (struct pakfire_filelist*)data;
+ char path[PATH_MAX];
+ int r;
// Find all static libraries
- if (pakfire_file_matches_class(file, PAKFIRE_FILE_STATIC_LIBRARY))
- return pakfire_filelist_add(removees, file);
+ if (pakfire_file_matches_class(file, PAKFIRE_FILE_STATIC_LIBRARY)) {
+ // Copy the filename
+ r = pakfire_string_set(path, pakfire_file_get_abspath(file));
+ if (r)
+ return -1;
+
+ // Remove the extension
+ r = pakfire_path_replace_extension(path, "so");
+ if (r)
+ return -1;
+
+ // Only delete if there is a shared object with the same name
+ if (pakfire_path_exists(path))
+ return pakfire_filelist_add(removees, file);
+ }
return 0;
}
int pakfire_path_strip_extension(char* path);
+#define pakfire_path_replace_extension(path, extension) \
+ __pakfire_path_replace_extension(path, sizeof(path), extension)
+int __pakfire_path_replace_extension(char* path, const size_t length, const char* extension);
+
const char* pakfire_basename(const char* path);
const char* pakfire_dirname(const char* path);
return 0;
}
+int __pakfire_path_replace_extension(char* path, const size_t length, const char* extension) {
+ char buffer[PATH_MAX];
+ int r;
+
+ // Copy path to buffer
+ r = pakfire_string_set(buffer, path);
+ if (r)
+ return r;
+
+ // Strip any old extension
+ r = pakfire_path_strip_extension(buffer);
+ if (r)
+ return r;
+
+ // Compose the new string
+ return __pakfire_string_format(path, length, "%s.%s", buffer, extension);
+}
+
int pakfire_file_write(struct pakfire* pakfire, const char* path,
uid_t owner, gid_t group, mode_t mode, const char* format, ...) {
va_list args;