Move the bugreport library to the diagnostics repository 78/255878/3
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>
Wed, 24 Mar 2021 11:54:02 +0000 (12:54 +0100)
committerMateusz Moscicki <m.moscicki2@partner.samsung.com>
Wed, 24 Mar 2021 13:23:21 +0000 (14:23 +0100)
Change-Id: I05ee9089e4fa74fa58f0a8554aa67e82a10372f2

packaging/libbugreport.spec [deleted file]
src/bugreport-service/bugreport-service.c
src/bugreport-service/systemdump.c
src/bugreport/CMakeLists.txt [deleted file]
src/bugreport/bugreport.pc.in [deleted file]
src/bugreport/libbugreport-service.c [deleted file]
src/bugreport/libbugreport.h [deleted file]

diff --git a/packaging/libbugreport.spec b/packaging/libbugreport.spec
deleted file mode 100644 (file)
index 4ce2d90..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-# "on_off foo" wil turn into "ON" or "OFF"
-%define on_off() %{expand:%%{?with_%{1}:ON}%%{!?with_%{1}:OFF}}
-
-Name:           libbugreport
-Summary:        libbugreport provides API to communicate with bugreport-service
-Version:        1.0.1
-Release:        1
-Provides:       libcrash-service = %{version}-%{release}
-Group:          Framework/system
-License:        Apache-2.0
-Source0:        %{name}-%{version}.tar.gz
-Source1001:     crash-worker.manifest
-BuildRequires:  pkgconfig(dlog)
-BuildRequires:  pkgconfig(glib-2.0)
-BuildRequires:  cmake
-
-%description
-
-%package -n     libbugreport-devel
-Summary:        package provides headers needed to develop programs using bugreport-service
-%description -n libbugreport-devel
-%description -n libbugreport-devel
-
-%prep
-%setup -q
-
-%build
-cp %{SOURCE1001} .
-
-export CFLAGS+=" -Werror"
-
-%cmake src/bugreport/ \
-          -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-          -DLOGGER=dlog \
-          -DDLOG_LOG_LEVEL=DLOG_INFO \
-          -DVERSION=%{version}
-
-make %{?jobs:-j%jobs}
-
-%install
-rm -rf %{buildroot}
-%make_install
-
-%files
-%license LICENSE
-%manifest crash-worker.manifest
-%{_libdir}/libbugreport.so.*
-
-%files -n libbugreport-devel
-%license LICENSE
-%manifest crash-worker.manifest
-%{_includedir}/libbugreport.h
-%{_libdir}/libbugreport.so
-%{_libdir}/pkgconfig/bugreport.pc
index 54ba621..8ee62db 100644 (file)
 #include <diagnostics.h>
 #include <unistd.h>
 #include <signal.h>
+#include <libbugreport.h>
 
 #include "bugreport-service.h"
 
 #include "crash-manager/crash-manager.h"
-#include "libbugreport.h"
 #include "shared/log.h"
 #include "shared/util.h"
 #include "diagnostics/diagnostics.h"
index bfc899c..df3e146 100644 (file)
@@ -21,8 +21,8 @@
 #include <time.h>
 #include <stdio.h>
 #include <string.h>
+#include <libbugreport.h>
 
-#include "libbugreport.h"
 #include "bugreport-service.h"
 
 #include "systemdump.h"
diff --git a/src/bugreport/CMakeLists.txt b/src/bugreport/CMakeLists.txt
deleted file mode 100644 (file)
index e31a833..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(bugreport C)
-
-ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/../../include include/)
-
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../../src/ ${CMAKE_SOURCE_DIR}/../../include)
-
-INCLUDE(GNUInstallDirs)
-
-INCLUDE(FindPkgConfig)
-
-pkg_check_modules(bugreport_pkgs REQUIRED
-       dlog
-       gio-2.0
-       gio-unix-2.0
-       )
-
-FOREACH(flag ${bugreport_pkgs_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE -Wno-unused-function -Wno-unused-const-variable")
-
-INCLUDE(${CMAKE_SOURCE_DIR}/../../cmake/ProcessM4.cmake)
-
-LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/crash-manager)
-
-ADD_LIBRARY(libbugreport SHARED libbugreport-service.c)
-SET_TARGET_PROPERTIES(libbugreport PROPERTIES
-       SOVERSION 1
-       PUBLIC_HEADER libbugreport.h
-       OUTPUT_NAME bugreport)
-
-CONFIGURE_FILE(bugreport.pc.in ${CMAKE_SOURCE_DIR}/bugreport.pc @ONLY)
-
-INSTALL(TARGETS libbugreport LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
-       PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
-
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bugreport.pc
-       DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-
diff --git a/src/bugreport/bugreport.pc.in b/src/bugreport/bugreport.pc.in
deleted file mode 100644 (file)
index 1ccd264..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=/usr
-exec_prefix=${prefix}
-includedir=${prefix}/include
-libdir=${exec_prefix}/lib
-
-Name: bugreport
-Description: The bugreport library
-Version: @VERSION@
-Cflags: -I${includedir}
-Libs: -L${libdir} -lbugreport
diff --git a/src/bugreport/libbugreport-service.c b/src/bugreport/libbugreport-service.c
deleted file mode 100644 (file)
index 0e731dc..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2016-2019 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gio/gio.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define LOG_TAG "LIBBUGREPORT"
-
-#include "libbugreport.h"
-#include "shared/log.h"
-
-#define BUS_NAME "org.tizen.system.crash.livedump"
-#define OBJECT_PATH "/Org/Tizen/System/Crash/Livedump"
-#define INTERFACE_NAME "org.tizen.system.crash.livedump"
-#define METHOD_NAME "livedump_pid"
-
-static GDBusConnection* dbus_init(void)
-{
-       GError *error = NULL;
-       GDBusConnection *conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
-
-       if (!conn || error) {
-               _E("Failed to get dbus: %s", error ? error->message : "");
-               if (error)
-                       g_error_free(error);
-               return NULL;
-       }
-
-       return conn;
-}
-
-int livedump_pid(pid_t pid, const char *dump_reason, char *report_path, size_t report_path_len)
-{
-       int res = TIZEN_ERROR_NONE;
-       GDBusConnection *conn = dbus_init();
-
-       if (!conn)
-               return TIZEN_ERROR_IO_ERROR;
-
-       GVariant *parameters = g_variant_new("(is)", pid, dump_reason);
-
-       GError *error = NULL;
-       GVariant *reply = g_dbus_connection_call_sync(conn,
-                                      BUS_NAME,
-                                      OBJECT_PATH,
-                                      INTERFACE_NAME,
-                                      METHOD_NAME,
-                                      parameters,
-                                      G_VARIANT_TYPE("(s)"),
-                                      G_DBUS_CALL_FLAGS_NONE,
-                                      -1,
-                                      NULL,
-                                      &error);
-       if (!reply || error) {
-               _E("Error while calling livedump_pid via dbus (pid=%d, reason=%s): %s", pid, dump_reason, error ? error->message : "");
-               res = TIZEN_ERROR_IO_ERROR;
-
-               if (error) {
-                       if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
-                               res = TIZEN_ERROR_PERMISSION_DENIED;
-                       if (error->code == CS_ERR_NO_PROC)
-                               res = TIZEN_ERROR_NO_SUCH_PROCESS;
-                       g_error_free(error);
-               }
-               goto exit;
-       }
-
-       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(s)"))) {
-               _E("reply is not of the correct type (s)");
-               res = TIZEN_ERROR_IO_ERROR;
-               goto exit;
-       }
-
-       gchar *reply_str;
-       g_variant_get(reply, "(&s)", &reply_str);
-       if (strlen(reply_str) <= (report_path_len + 1)) {
-               strncpy(report_path, reply_str, report_path_len);
-       } else {
-               _E("Report path (%s) is longer than report_path_len", reply_str);
-               res = TIZEN_ERROR_IO_ERROR;
-       }
-exit:
-       g_object_unref(conn);
-       return res;
-}
diff --git a/src/bugreport/libbugreport.h b/src/bugreport/libbugreport.h
deleted file mode 100644 (file)
index 570f298..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#pragma once
-
-#include <stdbool.h>
-#include <sys/types.h>
-
-#define CS_ERROR               1
-#define CS_ERR_NO_ERROR        0
-#define CS_ERR_PARAM           1
-#define CS_ERR_TIMEOUT         2
-#define CS_ERR_READ            3
-#define CS_ERR_INTERNAL        4
-#define CS_ERR_UNSUPPORTED     5
-#define CS_ERR_NO_PROC         6
-
-/**
- * @brief Sends a request to the bugreport-service to create livedump report of specific process.
- * @param pid PID of process for which the report should be created.
- * @param dump_reason the reason that should be included in the raport.
- * @param report_path pointer to the buffer in which will be saved the report path.
- * @param report_path_len lenght of buffer for the report path.
- * @return 0 on success, otherwise a negative error value
- * @retval #TIZEN_ERROR_NONE Success
- * @retval #TIZEN_ERROR_PERMISSION_DENIED Permission denied
- * @retval #TIZEN_ERROR_NO_SUCH_PROCESS No such process
- * @retval #TIZEN_ERROR_IO_ERROR Internal error occurred
- */
-extern int livedump_pid(pid_t pid, const char *dump_reason, char *report_path, size_t report_path_len);