summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2010-07-23 18:18:51 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-24 00:39:58 +0100
commita4fb2c9666129c0df55f871ddc7bb989909cd31f (patch)
tree830558cefc5ace67d0dc4e7db41f35fa23905455 /meta
parent7de5081857dc145df93ce50ed827fd2ee18dfd41 (diff)
downloadpoky-a4fb2c9666129c0df55f871ddc7bb989909cd31f.tar.gz
pseudo: Enhancements
Enable changing the data directory on the fly from the environment and then use this feature within poky to confine pseudo usage to each WORKDIR. This fixes issues that could be seen under heavy inode reusage e.g. with rm_work. Work based mainly off a patch from Joshua Lock but finished by Richard Purdie. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/base.bbclass1
-rw-r--r--meta/conf/bitbake.conf4
-rw-r--r--meta/packages/pseudo/pseudo/data-as-env.patch114
-rw-r--r--meta/packages/pseudo/pseudo_git.bb5
4 files changed, 121 insertions, 3 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index a67555dc68..bcde312220 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -148,6 +148,7 @@ python base_do_setscene () {
148 bb.build.make_stamp("do_setscene", d) 148 bb.build.make_stamp("do_setscene", d)
149} 149}
150do_setscene[selfstamp] = "1" 150do_setscene[selfstamp] = "1"
151do_setscene[dirs] = "${PSEUDO_DATADIR}"
151addtask setscene before do_fetch 152addtask setscene before do_fetch
152 153
153addtask fetch 154addtask fetch
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 67dd840959..057a213c96 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -528,7 +528,9 @@ SRC_URI = "file://${FILE}"
528 528
529# We can choose which provider of fake root privileges to use 529# We can choose which provider of fake root privileges to use
530# default is fakeroot but in Poky we use pseudo 530# default is fakeroot but in Poky we use pseudo
531FAKEROOT = "PSEUDO_PREFIX=${STAGING_DIR_NATIVE}${prefix_native} pseudo" 531# this is hopefully only temporary, to work around the database becoming corrupt
532PSEUDO_DATADIR ?= "${WORKDIR}/pseudo/"
533FAKEROOT = "PSEUDO_DATADIR=${PSEUDO_DATADIR} PSEUDO_PREFIX=${STAGING_DIR_NATIVE}${prefix_native} pseudo"
532PREFERRED_PROVIDER_virtual/fakeroot-native ?= "pseudo-native" 534PREFERRED_PROVIDER_virtual/fakeroot-native ?= "pseudo-native"
533 535
534 536
diff --git a/meta/packages/pseudo/pseudo/data-as-env.patch b/meta/packages/pseudo/pseudo/data-as-env.patch
new file mode 100644
index 0000000000..4b2b5d0a60
--- /dev/null
+++ b/meta/packages/pseudo/pseudo/data-as-env.patch
@@ -0,0 +1,114 @@
1We observed the pseudo database becoming large and corrupted when undergoing
2significant use (generating multiple output package types).
3
4This patch checks for the existence of an PSEUDO_DATADIR environment variable
5and, when it exists, uses the directory specified there to store the pseudo
6database. This should enable us to use a different database for each run of
7pseudo.
8
9JL (23/07/10)
10Index: git/pseudo.h
11===================================================================
12--- git.orig/pseudo.h 2010-07-23 12:12:21.000000000 +0100
13+++ git/pseudo.h 2010-07-23 13:35:29.044856965 +0100
14@@ -123,6 +123,7 @@
15 extern char *pseudo_fix_path(const char *, const char *, size_t, size_t, size_t *, int);
16 extern char **pseudo_dropenv(char * const *);
17 extern char **pseudo_setupenv(char * const *, char *);
18+extern char *pseudo_data_path(char *);
19 extern char *pseudo_prefix_path(char *);
20 extern char *pseudo_get_prefix(char *);
21 extern int pseudo_logfile(char *defname);
22Index: git/pseudo_db.c
23===================================================================
24--- git.orig/pseudo_db.c 2010-07-23 12:12:21.000000000 +0100
25+++ git/pseudo_db.c 2010-07-23 13:40:21.614745308 +0100
26@@ -465,17 +465,18 @@
27 char *errmsg;
28 static int registered_cleanup = 0;
29 char *dbfile;
30+ char *data_dir;
31
32 if (!db)
33 return 1;
34 if (*db)
35 return 0;
36 if (db == &file_db) {
37- dbfile = strdup(PSEUDO_DATA "/files.db");
38+ dbfile = pseudo_data_path("files.db");
39 rc = sqlite3_open(dbfile, db);
40 free(dbfile);
41 } else {
42- dbfile = strdup(PSEUDO_DATA "/logs.db");
43+ dbfile = pseudo_data_path("logs.db");
44 rc = sqlite3_open(dbfile, db);
45 free(dbfile);
46 }
47Index: git/pseudo_server.c
48===================================================================
49--- git.orig/pseudo_server.c 2010-07-23 12:12:21.000000000 +0100
50+++ git/pseudo_server.c 2010-07-23 13:36:09.340857158 +0100
51@@ -107,7 +107,7 @@
52 }
53
54 /* cd to the data directory */
55- pseudo_path = strdup(PSEUDO_DATA);
56+ pseudo_path = pseudo_data_path(NULL);
57 if (!pseudo_path) {
58 pseudo_diag("can't find %s directory.\n", PSEUDO_DATA);
59 return 1;
60Index: git/pseudo_util.c
61===================================================================
62--- git.orig/pseudo_util.c 2010-07-23 12:12:21.000000000 +0100
63+++ git/pseudo_util.c 2010-07-23 13:41:11.062734484 +0100
64@@ -593,6 +593,50 @@
65 return new_environ;
66 }
67
68+/* get the full path to the datadir for this run of pseudo
69+ * file parameter is optional and returns the datadir path
70+ * with the file name appended.
71+ */
72+char *
73+pseudo_data_path(char *file) {
74+ static char *datadir = NULL;
75+ static size_t datadir_len;
76+ char *path;
77+
78+ if (!datadir) {
79+ datadir = getenv("PSEUDO_DATADIR");
80+ if (!datadir) {
81+ datadir = strdup(PSEUDO_DATA);
82+ }
83+ datadir_len = strlen(datadir);
84+ }
85+
86+ if (!file) {
87+ return strdup(datadir);
88+ } else {
89+ size_t len = datadir_len + strlen(file) + 2;
90+ path = malloc(len);
91+ if (path) {
92+ char *endptr;
93+ int rc;
94+
95+ rc = snprintf(path, len, "%s", datadir);
96+ /* this certainly SHOULD be impossible */
97+ if ((size_t) rc >= len)
98+ rc = len - 1;
99+ endptr = path + rc;
100+ /* strip extra slashes.
101+ * This probably has no real effect, but I don't like
102+ * seeing " //" in paths.
103+ */
104+ while ((endptr > path) && (endptr[-1] == '/'))
105+ --endptr;
106+ snprintf(endptr, len - (endptr - path), "/%s", file);
107+ }
108+ return path;
109+ }
110+}
111+
112 /* get the full path to a file under $PSEUDO_PREFIX. Other ways of
113 * setting the prefix all set it in the environment.
114 */
diff --git a/meta/packages/pseudo/pseudo_git.bb b/meta/packages/pseudo/pseudo_git.bb
index 88c7ee2c5a..e675cbcade 100644
--- a/meta/packages/pseudo/pseudo_git.bb
+++ b/meta/packages/pseudo/pseudo_git.bb
@@ -6,14 +6,15 @@ LICENSE = "LGPL2.1"
6DEPENDS = "sqlite3" 6DEPENDS = "sqlite3"
7 7
8PV = "0.0+git${SRCPV}" 8PV = "0.0+git${SRCPV}"
9PR = "r5" 9PR = "r6"
10 10
11SRC_URI = "git://github.com/wrpseudo/pseudo.git;protocol=git \ 11SRC_URI = "git://github.com/wrpseudo/pseudo.git;protocol=git \
12 file://tweakflags.patch \ 12 file://tweakflags.patch \
13 file://path-munge.patch \ 13 file://path-munge.patch \
14 file://ld_sacredness.patch \ 14 file://ld_sacredness.patch \
15 file://make_parallel.patch \ 15 file://make_parallel.patch \
16 file://static_sqlite.patch" 16 file://static_sqlite.patch \
17 file://data-as-env.patch"
17 18
18FILES_${PN} = "${libdir}/libpseudo.so ${bindir}/* ${localstatedir}/pseudo" 19FILES_${PN} = "${libdir}/libpseudo.so ${bindir}/* ${localstatedir}/pseudo"
19PROVIDES += "virtual/fakeroot" 20PROVIDES += "virtual/fakeroot"