From 7ca9930ec1fc0aef059a2d8e81f7db6b3c1085ce Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 26 Nov 2010 13:21:07 +0100 Subject: reorganize libraries This patch does not change any code per se, it renames libABRTfoo -> libabrt_bar and moves a few functions around. After the patch, we are left with the following libs: libabrt - the stuff shared among most of abrt (like xmalloc, logging) libabrt_daemon - only daemon-related things are here (should probably be just moved into daemon - later) libabrt_dbus - daemon, cli and applet use this libabrt_web - abrt-action-foo where foo deals with network/web/ftp/... As a result, we have following reductions in dependent libs: /usr/libexec/abrt-hook-ccpp: linux-vdso.so.1 => () - libABRTUtils.so.0 => /usr/lib64/libABRTUtils.so.0 () + libabrt.so.0 => /usr/lib64/libabrt.so.0 () libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 () - libdbus-1.so.3 => /lib64/libdbus-1.so.3 () - libpthread.so.0 => /lib64/libpthread.so.0 () - librt.so.1 => /lib64/librt.so.1 () - libdl.so.2 => /lib64/libdl.so.2 () /usr/libexec/abrt-action-upload: linux-vdso.so.1 => () libtar.so.1 => /usr/lib64/libtar.so.1 () libcurl.so.4 => /usr/lib64/libcurl.so.4 () - libABRTdUtils.so.0 => /usr/lib64/libABRTdUtils.so.0 () - libABRTUtils.so.0 => /usr/lib64/libABRTUtils.so.0 () + libabrt.so.0 => /usr/lib64/libabrt.so.0 () libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 () - libdbus-1.so.3 => /lib64/libdbus-1.so.3 () Similar savings are in almost every abrt-action-foo. Signed-off-by: Denys Vlasenko --- src/daemon/Makefile.am | 12 ++++++------ src/daemon/rpm.c | 24 ++++++++++++++++++++++++ src/daemon/rpm.h | 2 ++ 3 files changed, 32 insertions(+), 6 deletions(-) (limited to 'src/daemon') diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am index c53af01b..34c7aa7b 100644 --- a/src/daemon/Makefile.am +++ b/src/daemon/Makefile.am @@ -36,8 +36,9 @@ abrtd_CPPFLAGS = \ abrtd_LDADD = \ $(DL_LIBS) \ $(DBUS_LIBS) \ - ../lib/libABRTUtils.la \ - ../lib/libABRTdUtils.la + ../lib/libabrt.la \ + ../lib/libabrt_daemon.la \ + ../lib/libabrt_dbus.la abrt_server_SOURCES = \ abrt-server.c @@ -54,7 +55,7 @@ abrt_server_CPPFLAGS = \ -D_GNU_SOURCE \ -Wall -Werror abrt_server_LDADD = \ - ../lib/libABRTUtils.la + ../lib/libabrt.la abrt_handle_crashdump_SOURCES = \ abrt-handle-crashdump.c @@ -73,7 +74,7 @@ abrt_handle_crashdump_CPPFLAGS = \ -D_GNU_SOURCE \ -Wall -Werror abrt_handle_crashdump_LDADD = \ - ../lib/libABRTUtils.la + ../lib/libabrt.la abrt_action_save_package_data_SOURCES = \ rpm.h rpm.c \ @@ -95,8 +96,7 @@ abrt_action_save_package_data_CPPFLAGS = \ -Wall -Werror abrt_action_save_package_data_LDADD = \ $(RPM_LIBS) \ - ../lib/libABRTdUtils.la \ - ../lib/libABRTUtils.la + ../lib/libabrt.la dbusabrtconfdir = ${sysconfdir}/dbus-1/system.d/ dist_dbusabrtconf_DATA = dbus-abrt.conf diff --git a/src/daemon/rpm.c b/src/daemon/rpm.c index 52ab8ac0..a726d357 100644 --- a/src/daemon/rpm.c +++ b/src/daemon/rpm.c @@ -26,6 +26,30 @@ static GList *list_fingerprints = NULL; +/* cuts the name from the NVR format: foo-1.2.3-1.el6 + returns a newly allocated string +*/ +char* get_package_name_from_NVR_or_NULL(const char* packageNVR) +{ + char* package_name = NULL; + if (packageNVR != NULL) + { + VERB1 log("packageNVR %s", packageNVR); + package_name = xstrdup(packageNVR); + char *pos = strrchr(package_name, '-'); + if (pos != NULL) + { + *pos = 0; + pos = strrchr(package_name, '-'); + if (pos != NULL) + { + *pos = 0; + } + } + } + return package_name; +} + void rpm_init() { int status = rpmReadConfigFiles((const char*)NULL, (const char*)NULL); diff --git a/src/daemon/rpm.h b/src/daemon/rpm.h index 4a82dee9..12b11ca8 100644 --- a/src/daemon/rpm.h +++ b/src/daemon/rpm.h @@ -80,6 +80,8 @@ char* rpm_get_package_nvr(const char* filename); */ char* rpm_get_component(const char* filename); +char* get_package_name_from_NVR_or_NULL(const char* packageNVR); + #ifdef __cplusplus } #endif -- cgit