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
1=== modified file 'compizconfig/libcompizconfig/src/compiz.cpp'
2--- compizconfig/libcompizconfig/src/compiz.cpp 2012-05-22 07:41:20 +0000
3+++ compizconfig/libcompizconfig/src/compiz.cpp 2012-05-22 07:41:20 +0000
4@@ -37,6 +37,7 @@
5 #include <dirent.h>
6 #include <sys/stat.h>
7 #include <errno.h>
8+#include <glib.h>
9
10 #include <libxslt/transform.h>
11 #include <libxslt/xsltutils.h>
12@@ -2845,7 +2846,9 @@
13
14 // Load from .xml
15 FILE *fp = fopen (xmlFilePath, "r");
16+#ifdef USE_PROTOBUF
17 Bool xmlLoaded = FALSE;
18+#endif
19
20 if (fp)
21 {
22@@ -2853,7 +2856,10 @@
23 xmlDoc *doc = xmlReadFile (xmlFilePath, NULL, 0);
24 if (doc)
25 {
26- xmlLoaded = loadPluginFromXML (context, doc, xmlFilePath,
27+#ifdef USE_PROTOBUF
28+ xmlLoaded =
29+#endif
30+ loadPluginFromXML (context, doc, xmlFilePath,
31 pluginInfoPBv);
32 xmlFreeDoc (doc);
33 }
34@@ -3035,6 +3041,21 @@
35 #endif
36
37 char *home = getenv ("HOME");
38+ char *overload_metadata = getenv ("COMPIZ_METADATA_PATH");
39+
40+ if (overload_metadata && strlen (overload_metadata))
41+ {
42+ char *overloadmetaplugins = NULL;
43+ if (asprintf (&overloadmetaplugins, "%s", overload_metadata) == -1)
44+ overloadmetaplugins = NULL;
45+
46+ if (overloadmetaplugins)
47+ {
48+ loadPluginsFromXMLFiles (context, overloadmetaplugins);
49+ free (overloadmetaplugins);
50+ }
51+ }
52+
53 if (home && strlen (home))
54 {
55 char *homeplugins = NULL;
56
57=== modified file 'compizconfig/libcompizconfig/src/main.c'
58--- compizconfig/libcompizconfig/src/main.c 2012-05-22 07:41:20 +0000
59+++ compizconfig/libcompizconfig/src/main.c 2012-05-22 07:41:20 +0000
60@@ -596,11 +596,23 @@
61 openBackend (char *backend)
62 {
63 char *home = getenv ("HOME");
64+ char *override_backend = getenv ("LIBCOMPIZCONFIG_BACKEND_PATH");
65 void *dlhand = NULL;
66 char *dlname = NULL;
67 char *err = NULL;
68
69- if (home && strlen (home))
70+ if (override_backend && strlen (override_backend))
71+ {
72+ if (asprintf (&dlname, "%s/lib%s.so",
73+ override_backend, backend) == -1)
74+ dlname = NULL;
75+
76+ dlerror ();
77+ dlhand = dlopen (dlname, RTLD_NOW | RTLD_NODELETE | RTLD_LOCAL);
78+ err = dlerror ();
79+ }
80+
81+ if (!dlhand && home && strlen (home))
82 {
83 if (asprintf (&dlname, "%s/.compizconfig/backends/lib%s.so",
84 home, backend) == -1)
85@@ -2695,8 +2707,22 @@
86 {
87 CCSBackendInfoList rv = NULL;
88 char *home = getenv ("HOME");
89+ char *override_backend = getenv ("LIBCOMPIZCONFIG_BACKEND_PATH");
90 char *backenddir;
91
92+ if (override_backend && strlen (override_backend))
93+ {
94+ if (asprintf (&backenddir, "%s",
95+ override_backend) == -1)
96+ backenddir = NULL;
97+
98+ if (backenddir)
99+ {
100+ getBackendInfoFromDir (&rv, backenddir);
101+ free (backenddir);
102+ }
103+ }
104+
105 if (home && strlen (home))
106 {
107 if (asprintf (&backenddir, "%s/.compizconfig/backends", home) == -1)

Subscribers

People subscribed via source and target branches