Merge lp:~compiz-team/compiz/libcompizconfig-test-setup into lp:compiz/0.9.8

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 3215
Proposed branch: lp:~compiz-team/compiz/libcompizconfig-test-setup
Merge into: lp:compiz/0.9.8
Prerequisite: lp:~compiz-team/compiz/build-libcompizconfig
Diff against target: 107 lines (+49/-2)
2 files modified
compizconfig/libcompizconfig/src/compiz.cpp (+22/-1)
compizconfig/libcompizconfig/src/main.c (+27/-1)
To merge this branch: bzr merge lp:~compiz-team/compiz/libcompizconfig-test-setup
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Compiz Maintainers Pending
Review via email: mp+106659@code.launchpad.net

Description of the change

Adds some environment variables to change where libcompizconfig looks for things to be used by tests

1. Read "COMPIZ_METADATA_PATH" to find plugins
2. Read "LIBCOMPIZCONFIG_BACKEND_PATH" to find and load backends

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

This one also fails to build the same as its siblings and parent (the prerequisite). Now fixing...

review: Needs Fixing
3212. By Daniel van Vugt

Fix a couple of build failures

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Revision 3212 works for me.

Though something like this:
64 + if (asprintf (&backenddir, "%s",
65 + override_backend) == -1)
66 + backenddir = NULL;

would be more clearly written:
    backenddir = strdup(override_backend);

However if you look at the surrounding code you will notice that any allocation and free of backenddir is pointless. Should just use override_backend in place.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'compizconfig/libcompizconfig/src/compiz.cpp'
--- compizconfig/libcompizconfig/src/compiz.cpp 2012-05-22 07:41:20 +0000
+++ compizconfig/libcompizconfig/src/compiz.cpp 2012-05-22 07:41:20 +0000
@@ -37,6 +37,7 @@
37#include <dirent.h>37#include <dirent.h>
38#include <sys/stat.h>38#include <sys/stat.h>
39#include <errno.h>39#include <errno.h>
40#include <glib.h>
4041
41#include <libxslt/transform.h>42#include <libxslt/transform.h>
42#include <libxslt/xsltutils.h>43#include <libxslt/xsltutils.h>
@@ -2845,7 +2846,9 @@
28452846
2846 // Load from .xml2847 // Load from .xml
2847 FILE *fp = fopen (xmlFilePath, "r");2848 FILE *fp = fopen (xmlFilePath, "r");
2849#ifdef USE_PROTOBUF
2848 Bool xmlLoaded = FALSE;2850 Bool xmlLoaded = FALSE;
2851#endif
28492852
2850 if (fp)2853 if (fp)
2851 {2854 {
@@ -2853,7 +2856,10 @@
2853 xmlDoc *doc = xmlReadFile (xmlFilePath, NULL, 0);2856 xmlDoc *doc = xmlReadFile (xmlFilePath, NULL, 0);
2854 if (doc)2857 if (doc)
2855 {2858 {
2856 xmlLoaded = loadPluginFromXML (context, doc, xmlFilePath,2859#ifdef USE_PROTOBUF
2860 xmlLoaded =
2861#endif
2862 loadPluginFromXML (context, doc, xmlFilePath,
2857 pluginInfoPBv);2863 pluginInfoPBv);
2858 xmlFreeDoc (doc);2864 xmlFreeDoc (doc);
2859 }2865 }
@@ -3035,6 +3041,21 @@
3035#endif3041#endif
30363042
3037 char *home = getenv ("HOME");3043 char *home = getenv ("HOME");
3044 char *overload_metadata = getenv ("COMPIZ_METADATA_PATH");
3045
3046 if (overload_metadata && strlen (overload_metadata))
3047 {
3048 char *overloadmetaplugins = NULL;
3049 if (asprintf (&overloadmetaplugins, "%s", overload_metadata) == -1)
3050 overloadmetaplugins = NULL;
3051
3052 if (overloadmetaplugins)
3053 {
3054 loadPluginsFromXMLFiles (context, overloadmetaplugins);
3055 free (overloadmetaplugins);
3056 }
3057 }
3058
3038 if (home && strlen (home))3059 if (home && strlen (home))
3039 {3060 {
3040 char *homeplugins = NULL;3061 char *homeplugins = NULL;
30413062
=== modified file 'compizconfig/libcompizconfig/src/main.c'
--- compizconfig/libcompizconfig/src/main.c 2012-05-22 07:41:20 +0000
+++ compizconfig/libcompizconfig/src/main.c 2012-05-22 07:41:20 +0000
@@ -596,11 +596,23 @@
596openBackend (char *backend)596openBackend (char *backend)
597{597{
598 char *home = getenv ("HOME");598 char *home = getenv ("HOME");
599 char *override_backend = getenv ("LIBCOMPIZCONFIG_BACKEND_PATH");
599 void *dlhand = NULL;600 void *dlhand = NULL;
600 char *dlname = NULL;601 char *dlname = NULL;
601 char *err = NULL;602 char *err = NULL;
602603
603 if (home && strlen (home))604 if (override_backend && strlen (override_backend))
605 {
606 if (asprintf (&dlname, "%s/lib%s.so",
607 override_backend, backend) == -1)
608 dlname = NULL;
609
610 dlerror ();
611 dlhand = dlopen (dlname, RTLD_NOW | RTLD_NODELETE | RTLD_LOCAL);
612 err = dlerror ();
613 }
614
615 if (!dlhand && home && strlen (home))
604 {616 {
605 if (asprintf (&dlname, "%s/.compizconfig/backends/lib%s.so",617 if (asprintf (&dlname, "%s/.compizconfig/backends/lib%s.so",
606 home, backend) == -1)618 home, backend) == -1)
@@ -2695,8 +2707,22 @@
2695{2707{
2696 CCSBackendInfoList rv = NULL;2708 CCSBackendInfoList rv = NULL;
2697 char *home = getenv ("HOME");2709 char *home = getenv ("HOME");
2710 char *override_backend = getenv ("LIBCOMPIZCONFIG_BACKEND_PATH");
2698 char *backenddir;2711 char *backenddir;
26992712
2713 if (override_backend && strlen (override_backend))
2714 {
2715 if (asprintf (&backenddir, "%s",
2716 override_backend) == -1)
2717 backenddir = NULL;
2718
2719 if (backenddir)
2720 {
2721 getBackendInfoFromDir (&rv, backenddir);
2722 free (backenddir);
2723 }
2724 }
2725
2700 if (home && strlen (home))2726 if (home && strlen (home))
2701 {2727 {
2702 if (asprintf (&backenddir, "%s/.compizconfig/backends", home) == -1)2728 if (asprintf (&backenddir, "%s/.compizconfig/backends", home) == -1)

Subscribers

People subscribed via source and target branches