[gnome-software] trivial: Split out epiphany to a new directory



commit 9827a0d4d82450c1355623e4a50997342fff1d04
Author: Richard Hughes <richard hughsie com>
Date:   Tue Mar 7 14:00:07 2017 +0000

    trivial: Split out epiphany to a new directory

 configure.ac                                       |    1 +
 plugins/Makefile.am                                |   14 +--
 plugins/epiphany/Makefile.am                       |   31 ++++++
 plugins/{ => epiphany}/gs-plugin-epiphany.c        |    0
 plugins/epiphany/gs-self-test.c                    |  109 ++++++++++++++++++++
 ....gnome.Software.Plugin.Epiphany.metainfo.xml.in |    0
 plugins/gs-self-test.c                             |   43 +--------
 po/POTFILES.in                                     |    2 +-
 8 files changed, 148 insertions(+), 52 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 893efbe..0522e28 100644
--- a/configure.ac
+++ b/configure.ac
@@ -487,6 +487,7 @@ plugins/Makefile
 plugins/core/Makefile
 plugins/dpkg/Makefile
 plugins/dummy/Makefile
+plugins/epiphany/Makefile
 plugins/external-appstream/Makefile
 plugins/fwupd/Makefile
 plugins/limba/Makefile
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 50e6600..140453d 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -50,6 +50,10 @@ if HAVE_GUDEV
 SUBDIRS += modalias
 endif
 
+if HAVE_WEBAPPS
+SUBDIRS += epiphany
+endif
+
 AM_CPPFLAGS =                                          \
        -DDATADIR=\"$(datadir)\"                        \
        -DG_LOG_DOMAIN=\"GsPlugin\"                     \
@@ -67,10 +71,6 @@ plugin_LTLIBRARIES =                                 \
 
 appdata_in_files =
 
-if HAVE_WEBAPPS
-plugin_LTLIBRARIES += libgs_plugin_epiphany.la
-endif
-
 if HAVE_SHELL_EXTENSIONS
 plugin_LTLIBRARIES += libgs_plugin_shell-extensions.la
 endif
@@ -96,12 +96,6 @@ libgs_plugin_fedora_tagger_usage_la_LIBADD = $(GS_PLUGIN_LIBS) $(SQLITE_LIBS)
 libgs_plugin_fedora_tagger_usage_la_LDFLAGS = -module -avoid-version
 libgs_plugin_fedora_tagger_usage_la_CFLAGS = $(GS_PLUGIN_CFLAGS) $(SQLITE_CFLAGS)
 
-appdata_in_files += org.gnome.Software.Plugin.Epiphany.metainfo.xml.in
-libgs_plugin_epiphany_la_SOURCES = gs-plugin-epiphany.c
-libgs_plugin_epiphany_la_LIBADD = $(GS_PLUGIN_LIBS)
-libgs_plugin_epiphany_la_LDFLAGS = -module -avoid-version
-libgs_plugin_epiphany_la_CFLAGS = $(GS_PLUGIN_CFLAGS)
-
 if HAVE_FLATPAK
 appdata_in_files += org.gnome.Software.Plugin.Flatpak.metainfo.xml.in
 libgs_plugin_flatpak_la_SOURCES =                      \
diff --git a/plugins/epiphany/Makefile.am b/plugins/epiphany/Makefile.am
new file mode 100644
index 0000000..7de7e8b
--- /dev/null
+++ b/plugins/epiphany/Makefile.am
@@ -0,0 +1,31 @@
+AM_CPPFLAGS =                                          \
+       -DTESTDATADIR=\""$(top_srcdir)/data"\"          \
+       -DLOCALPLUGINDIR=\""$(builddir)/.libs"\"        \
+       -DLOCALPLUGINDIR_CORE=\""$(top_builddir)/plugins/core/.libs"\"
+
+plugindir = $(GS_PLUGIN_DIR)
+plugin_LTLIBRARIES = libgs_plugin_epiphany.la
+
+libgs_plugin_epiphany_la_SOURCES = gs-plugin-epiphany.c
+libgs_plugin_epiphany_la_LIBADD = $(GS_PLUGIN_LIBS)
+libgs_plugin_epiphany_la_LDFLAGS = -module -avoid-version
+libgs_plugin_epiphany_la_CFLAGS = $(GS_PLUGIN_CFLAGS)
+
+%.metainfo.xml: %.metainfo.xml.in
+       $(AM_V_GEN) msgfmt --xml -d $(top_srcdir)/po --template $< -o $@
+
+appdata_in_files = org.gnome.Software.Plugin.Epiphany.metainfo.xml.in
+appdatadir = $(datadir)/appdata
+appdata_DATA = $(appdata_in_files:.xml.in=.xml)
+EXTRA_DIST = $(appdata_in_files)
+CLEANFILES = $(appdata_DATA)
+
+if ENABLE_TESTS
+check_PROGRAMS = gs-self-test
+gs_self_test_SOURCES = gs-self-test.c
+gs_self_test_LDADD = $(GS_PRIVATE_LIBS)
+gs_self_test_CFLAGS = $(GS_PRIVATE_CFLAGS)
+TESTS = gs-self-test
+endif
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/gs-plugin-epiphany.c b/plugins/epiphany/gs-plugin-epiphany.c
similarity index 100%
rename from plugins/gs-plugin-epiphany.c
rename to plugins/epiphany/gs-plugin-epiphany.c
diff --git a/plugins/epiphany/gs-self-test.c b/plugins/epiphany/gs-self-test.c
new file mode 100644
index 0000000..98f9269
--- /dev/null
+++ b/plugins/epiphany/gs-self-test.c
@@ -0,0 +1,109 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2013-2017 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+
+#include "gnome-software-private.h"
+
+#include "gs-test.h"
+
+static void
+gs_plugin_loader_webapps_func (GsPluginLoader *plugin_loader)
+{
+       gboolean ret;
+       g_autoptr(GError) error = NULL;
+       g_autoptr(GsApp) app = NULL;
+
+       /* no epiphany, abort */
+       if (!gs_plugin_loader_get_enabled (plugin_loader, "epiphany"))
+               return;
+
+       /* a webapp with a local icon */
+       app = gs_app_new ("arachne.desktop");
+       gs_app_set_kind (app, AS_APP_KIND_WEB_APP);
+       ret = gs_plugin_loader_app_refine (plugin_loader, app,
+                                          GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+                                          GS_PLUGIN_FAILURE_FLAGS_FATAL_ANY,
+                                          NULL,
+                                          &error);
+       gs_test_flush_main_context ();
+       g_assert_no_error (error);
+       g_assert (ret);
+
+       g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_AVAILABLE);
+       g_assert (gs_app_get_pixbuf (app) != NULL);
+}
+
+int
+main (int argc, char **argv)
+{
+       gboolean ret;
+       g_autofree gchar *fn = NULL;
+       g_autofree gchar *xml = NULL;
+       g_autoptr(GError) error = NULL;
+       g_autoptr(GsPluginLoader) plugin_loader = NULL;
+       const gchar *whitelist[] = {
+               "appstream",
+               "epiphany",
+               "icons",
+               NULL
+       };
+
+       g_test_init (&argc, &argv, NULL);
+       g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
+
+       fn = gs_test_get_filename (TESTDATADIR, "icons/hicolor/48x48/org.gnome.Software.png");
+       g_assert (fn != NULL);
+       xml = g_strdup_printf ("<?xml version=\"1.0\"?>\n"
+               "<components version=\"0.9\">\n"
+               "  <component type=\"webapp\">\n"
+               "    <id>arachne.desktop</id>\n"
+               "    <name>test</name>\n"
+               "    <icon type=\"remote\">file://%s</icon>\n"
+               "  </component>\n"
+               "</components>\n", fn);
+       g_setenv ("GS_SELF_TEST_APPSTREAM_XML", xml, TRUE);
+
+       /* only critical and error are fatal */
+       g_log_set_fatal_mask (NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);
+
+       /* we can only load this once per process */
+       plugin_loader = gs_plugin_loader_new ();
+       gs_plugin_loader_add_location (plugin_loader, LOCALPLUGINDIR);
+       gs_plugin_loader_add_location (plugin_loader, LOCALPLUGINDIR_CORE);
+       ret = gs_plugin_loader_setup (plugin_loader,
+                                     (gchar**) whitelist,
+                                     NULL,
+                                     GS_PLUGIN_FAILURE_FLAGS_NONE,
+                                     NULL,
+                                     &error);
+       g_assert_no_error (error);
+       g_assert (ret);
+
+       /* plugin tests go here */
+       g_test_add_data_func ("/gnome-software/plugin-loader{webapps}",
+                             plugin_loader,
+                             (GTestDataFunc) gs_plugin_loader_webapps_func);
+
+       return g_test_run ();
+}
+
+/* vim: set noexpandtab: */
diff --git a/plugins/org.gnome.Software.Plugin.Epiphany.metainfo.xml.in 
b/plugins/epiphany/org.gnome.Software.Plugin.Epiphany.metainfo.xml.in
similarity index 100%
rename from plugins/org.gnome.Software.Plugin.Epiphany.metainfo.xml.in
rename to plugins/epiphany/org.gnome.Software.Plugin.Epiphany.metainfo.xml.in
diff --git a/plugins/gs-self-test.c b/plugins/gs-self-test.c
index a0d417c..25d80b3 100644
--- a/plugins/gs-self-test.c
+++ b/plugins/gs-self-test.c
@@ -26,33 +26,6 @@
 #include "gs-test.h"
 
 static void
-gs_plugin_loader_webapps_func (GsPluginLoader *plugin_loader)
-{
-       gboolean ret;
-       g_autoptr(GError) error = NULL;
-       g_autoptr(GsApp) app = NULL;
-
-       /* no epiphany, abort */
-       if (!gs_plugin_loader_get_enabled (plugin_loader, "epiphany"))
-               return;
-
-       /* a webapp with a local icon */
-       app = gs_app_new ("arachne.desktop");
-       gs_app_set_kind (app, AS_APP_KIND_WEB_APP);
-       ret = gs_plugin_loader_app_refine (plugin_loader, app,
-                                          GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
-                                          GS_PLUGIN_FAILURE_FLAGS_FATAL_ANY,
-                                          NULL,
-                                          &error);
-       gs_test_flush_main_context ();
-       g_assert_no_error (error);
-       g_assert (ret);
-
-       g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_AVAILABLE);
-       g_assert (gs_app_get_pixbuf (app) != NULL);
-}
-
-static void
 gs_plugin_loader_flatpak_repo_func (GsPluginLoader *plugin_loader)
 {
        const gchar *group_name = "remote \"example\"";
@@ -1149,14 +1122,12 @@ main (int argc, char **argv)
 {
        const gchar *tmp_root = "/var/tmp/self-test";
        gboolean ret;
-       g_autofree gchar *fn = NULL;
        g_autofree gchar *xml = NULL;
        g_autoptr(GError) error = NULL;
        g_autoptr(GsPluginLoader) plugin_loader = NULL;
        const gchar *whitelist[] = {
                "appstream",
                "dummy",
-               "epiphany",
                "flatpak",
                "generic-updates",
                "hardcoded-blacklist",
@@ -1190,9 +1161,7 @@ main (int argc, char **argv)
                g_assert (!g_file_test (tmp_root, G_FILE_TEST_EXISTS));
        }
 
-       fn = gs_test_get_filename (TESTDATADIR, "icons/hicolor/48x48/org.gnome.Software.png");
-       g_assert (fn != NULL);
-       xml = g_strdup_printf ("<?xml version=\"1.0\"?>\n"
+       xml = g_strdup ("<?xml version=\"1.0\"?>\n"
                "<components version=\"0.9\">\n"
                "  <component type=\"desktop\">\n"
                "    <id>chiron.desktop</id>\n"
@@ -1237,12 +1206,7 @@ main (int argc, char **argv)
                "    <id>org.fedoraproject.release-rawhide.upgrade</id>\n"
                "    <summary>Release specific tagline</summary>\n"
                "  </component>\n"
-               "  <component type=\"webapp\">\n"
-               "    <id>arachne.desktop</id>\n"
-               "    <name>test</name>\n"
-               "    <icon type=\"remote\">file://%s</icon>\n"
-               "  </component>\n"
-               "</components>\n", fn);
+               "</components>\n");
        g_setenv ("GS_SELF_TEST_APPSTREAM_XML", xml, TRUE);
        g_setenv ("GS_SELF_TEST_APPSTREAM_ICON_ROOT",
                  "/var/tmp/self-test/flatpak/appstream/test/x86_64/active/", TRUE);
@@ -1282,9 +1246,6 @@ main (int argc, char **argv)
        g_test_add_data_func ("/gnome-software/plugin-loader{flatpak-app-update-runtime}",
                              plugin_loader,
                              (GTestDataFunc) gs_plugin_loader_flatpak_app_update_func);
-       g_test_add_data_func ("/gnome-software/plugin-loader{webapps}",
-                             plugin_loader,
-                             (GTestDataFunc) gs_plugin_loader_webapps_func);
 
        /* done last as it would otherwise try to do downloading in other
         * gs_plugin_file_to_app()-using tests */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b80d361..5a133b2 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -69,7 +69,7 @@ plugins/core/gs-desktop-common.c
 plugins/external-appstream/gs-install-appstream.c
 plugins/gs-plugin-fedora-distro-upgrades.c
 plugins/core/gs-plugin-generic-updates.c
-plugins/org.gnome.Software.Plugin.Epiphany.metainfo.xml.in
+plugins/epiphany/org.gnome.Software.Plugin.Epiphany.metainfo.xml.in
 plugins/org.gnome.Software.Plugin.Flatpak.metainfo.xml.in
 plugins/fwupd/org.gnome.Software.Plugin.Fwupd.metainfo.xml.in
 plugins/limba/org.gnome.Software.Plugin.Limba.metainfo.xml.in


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]