From e149e933232febcccf8baae5af8efa9a4d5cc490 Mon Sep 17 00:00:00 2001 From: Matthias Klumpp Date: Fri, 12 Sep 2014 13:48:17 +0200 Subject: [PATCH 6/7] Remove the PackageKit plugin Tools which modify the AppStream data will now have to call $ appstream-index refresh in order to get the cache updated (or use the equivalent libas API calls) --- src/CMakeLists.txt | 8 +--- src/pk-plugin/CMakeLists.txt | 30 ------------ src/pk-plugin/pk-plugin-appstream.c | 91 ------------------------------------- 3 files changed, 1 insertion(+), 128 deletions(-) delete mode 100644 src/pk-plugin/CMakeLists.txt delete mode 100644 src/pk-plugin/pk-plugin-appstream.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2359144..366833f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -96,10 +96,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/xapian ${YAML_INCLUDE_DIR} ) -add_definitions("-DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE" - "-DI_KNOW_THE_PACKAGEKIT_PLUGIN_API_IS_SUBJECT_TO_CHANGE" - "-DAS_COMPILATION" -) +add_definitions("-DAS_COMPILATION") # ensure that the GI compiler has been found (apparently, the automatic tests fail on some machines) if (INTROSPECTION_COMPILER STREQUAL "") @@ -145,6 +142,3 @@ gir_add_introspections(INTROSPECTION_GIRS) install(TARGETS appstream DESTINATION ${INSTALL_DIR_LIB}) install(FILES ${LIBAPPSTREAM_PUBLIC_HEADERS} DESTINATION include/Appstream) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/appstream.pc DESTINATION ${INSTALL_DIR_LIB}/pkgconfig/) - -# include the PackageKit plugin -add_subdirectory(pk-plugin) diff --git a/src/pk-plugin/CMakeLists.txt b/src/pk-plugin/CMakeLists.txt deleted file mode 100644 index f719dcc..0000000 --- a/src/pk-plugin/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -# CMakeLists for AppStream PackageKit PlugIn - -find_package(GLIB2 REQUIRED) -pkg_check_modules(GIO2 REQUIRED gio-2.0) -pkg_check_modules(PACKAGEKIT REQUIRED packagekit-glib2) -pkg_check_modules(PACKAGEKIT_PLUGIN REQUIRED packagekit-plugin) - -set(PK_APPSTREAM_SOURCES pk-plugin-appstream.c -) - -add_library(pk_plugin_appstream MODULE ${PK_APPSTREAM_SOURCES}) - -target_link_libraries(pk_plugin_appstream - ${M_LIB} - ${GIO2_LIBRARIES} - ${PACKAGEKIT_LIBRARIES} - ${PACKAGEKIT_PLUGIN_LIBRARIES} - appstream -) - -include_directories(${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}/src - ${CMAKE_CURRENT_SOURCE_DIR} - ${GLIB2_INCLUDE_DIR} - ${GIO2_INCLUDE_DIR} - ${PACKAGEKIT_INCLUDE_DIRS} - ${PACKAGEKIT_PLUGIN_INCLUDE_DIRS} -) - -install(TARGETS pk_plugin_appstream DESTINATION ${INSTALL_DIR_LIB}/packagekit-plugins-2) diff --git a/src/pk-plugin/pk-plugin-appstream.c b/src/pk-plugin/pk-plugin-appstream.c deleted file mode 100644 index 2247fd5..0000000 --- a/src/pk-plugin/pk-plugin-appstream.c +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Copyright (C) 2012-2013 Matthias Klumpp - * - * Licensed under the GNU Lesser General Public License Version 2.1 - * - * This library is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 2.1 of the license, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - */ - -#include -#include - -#include "../as-cache-builder.h" - -struct PkPluginPrivate { - guint dummy; -}; - -/** - * pk_plugin_get_description: - */ -const gchar * -pk_plugin_get_description (void) -{ - return "Refreshes the Appstream database of available applications"; -} - -/** - * pk_plugin_initialize: - */ -void -pk_plugin_initialize (PkPlugin *plugin) -{ - /* create private area */ - plugin->priv = PK_TRANSACTION_PLUGIN_GET_PRIVATE (PkPluginPrivate); -} - -/** - * pk_plugin_transaction_finished_end: - */ -void -pk_plugin_transaction_finished_end (PkPlugin *plugin, - PkTransaction *transaction) -{ - AsBuilder *builder = NULL; - PkRoleEnum role; - - /* skip simulate actions */ - if (pk_bitfield_contain (pk_transaction_get_transaction_flags (transaction), - PK_TRANSACTION_FLAG_ENUM_SIMULATE)) { - goto out; - } - - /* skip only-download */ - if (pk_bitfield_contain (pk_transaction_get_transaction_flags (transaction), - PK_TRANSACTION_FLAG_ENUM_ONLY_DOWNLOAD)) { - goto out; - } - - /* check the role */ - role = pk_transaction_get_role (transaction); - if (role != PK_ROLE_ENUM_REFRESH_CACHE) - goto out; - - /* use a local backend instance */ - pk_backend_reset_job (plugin->backend, plugin->job); - pk_backend_job_set_status (plugin->job, - PK_STATUS_ENUM_SCAN_APPLICATIONS); - - /* refresh the AppStream cache using the database builder */ - builder = as_builder_new (); - as_builder_initialize (builder); - as_builder_refresh_cache (builder, FALSE, NULL); - - pk_backend_job_set_percentage (plugin->job, 100); - pk_backend_job_set_status (plugin->job, PK_STATUS_ENUM_FINISHED); -out: - if (builder != NULL) - g_object_unref (builder); -} -- 1.9.3