summaryrefslogtreecommitdiffstats
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
parent7de5081857dc145df93ce50ed827fd2ee18dfd41 (diff)
downloadopenembedded-core-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>
-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 () {
bb.build.make_stamp("do_setscene", d)
}
do_setscene[selfstamp] = "1"
+do_setscene[dirs] = "${PSEUDO_DATADIR}"
addtask setscene before do_fetch
addtask 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}"
# We can choose which provider of fake root privileges to use
# default is fakeroot but in Poky we use pseudo
-FAKEROOT = "PSEUDO_PREFIX=${STAGING_DIR_NATIVE}${prefix_native} pseudo"
+# this is hopefully only temporary, to work around the database becoming corrupt
+PSEUDO_DATADIR ?= "${WORKDIR}/pseudo/"
+FAKEROOT = "PSEUDO_DATADIR=${PSEUDO_DATADIR} PSEUDO_PREFIX=${STAGING_DIR_NATIVE}${prefix_native} pseudo"
PREFERRED_PROVIDER_virtual/fakeroot-native ?= "pseudo-native"
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 @@
+We observed the pseudo database becoming large and corrupted when undergoing
+significant use (generating multiple output package types).
+
+This patch checks for the existence of an PSEUDO_DATADIR environment variable
+and, when it exists, uses the directory specified there to store the pseudo
+database. This should enable us to use a different database for each run of
+pseudo.
+
+JL (23/07/10)
+Index: git/pseudo.h
+===================================================================
+--- git.orig/pseudo.h 2010-07-23 12:12:21.000000000 +0100
++++ git/pseudo.h 2010-07-23 13:35:29.044856965 +0100
+@@ -123,6 +123,7 @@
+ extern char *pseudo_fix_path(const char *, const char *, size_t, size_t, size_t *, int);
+ extern char **pseudo_dropenv(char * const *);
+ extern char **pseudo_setupenv(char * const *, char *);
++extern char *pseudo_data_path(char *);
+ extern char *pseudo_prefix_path(char *);
+ extern char *pseudo_get_prefix(char *);
+ extern int pseudo_logfile(char *defname);
+Index: git/pseudo_db.c
+===================================================================
+--- git.orig/pseudo_db.c 2010-07-23 12:12:21.000000000 +0100
++++ git/pseudo_db.c 2010-07-23 13:40:21.614745308 +0100
+@@ -465,17 +465,18 @@
+ char *errmsg;
+ static int registered_cleanup = 0;
+ char *dbfile;
++ char *data_dir;
+
+ if (!db)
+ return 1;
+ if (*db)
+ return 0;
+ if (db == &file_db) {
+- dbfile = strdup(PSEUDO_DATA "/files.db");
++ dbfile = pseudo_data_path("files.db");
+ rc = sqlite3_open(dbfile, db);
+ free(dbfile);
+ } else {
+- dbfile = strdup(PSEUDO_DATA "/logs.db");
++ dbfile = pseudo_data_path("logs.db");
+ rc = sqlite3_open(dbfile, db);
+ free(dbfile);
+ }
+Index: git/pseudo_server.c
+===================================================================
+--- git.orig/pseudo_server.c 2010-07-23 12:12:21.000000000 +0100
++++ git/pseudo_server.c 2010-07-23 13:36:09.340857158 +0100
+@@ -107,7 +107,7 @@
+ }
+
+ /* cd to the data directory */
+- pseudo_path = strdup(PSEUDO_DATA);
++ pseudo_path = pseudo_data_path(NULL);
+ if (!pseudo_path) {
+ pseudo_diag("can't find %s directory.\n", PSEUDO_DATA);
+ return 1;
+Index: git/pseudo_util.c
+===================================================================
+--- git.orig/pseudo_util.c 2010-07-23 12:12:21.000000000 +0100
++++ git/pseudo_util.c 2010-07-23 13:41:11.062734484 +0100
+@@ -593,6 +593,50 @@
+ return new_environ;
+ }
+
++/* get the full path to the datadir for this run of pseudo
++ * file parameter is optional and returns the datadir path
++ * with the file name appended.
++ */
++char *
++pseudo_data_path(char *file) {
++ static char *datadir = NULL;
++ static size_t datadir_len;
++ char *path;
++
++ if (!datadir) {
++ datadir = getenv("PSEUDO_DATADIR");
++ if (!datadir) {
++ datadir = strdup(PSEUDO_DATA);
++ }
++ datadir_len = strlen(datadir);
++ }
++
++ if (!file) {
++ return strdup(datadir);
++ } else {
++ size_t len = datadir_len + strlen(file) + 2;
++ path = malloc(len);
++ if (path) {
++ char *endptr;
++ int rc;
++
++ rc = snprintf(path, len, "%s", datadir);
++ /* this certainly SHOULD be impossible */
++ if ((size_t) rc >= len)
++ rc = len - 1;
++ endptr = path + rc;
++ /* strip extra slashes.
++ * This probably has no real effect, but I don't like
++ * seeing " //" in paths.
++ */
++ while ((endptr > path) && (endptr[-1] == '/'))
++ --endptr;
++ snprintf(endptr, len - (endptr - path), "/%s", file);
++ }
++ return path;
++ }
++}
++
+ /* get the full path to a file under $PSEUDO_PREFIX. Other ways of
+ * setting the prefix all set it in the environment.
+ */
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"
DEPENDS = "sqlite3"
PV = "0.0+git${SRCPV}"
-PR = "r5"
+PR = "r6"
SRC_URI = "git://github.com/wrpseudo/pseudo.git;protocol=git \
file://tweakflags.patch \
file://path-munge.patch \
file://ld_sacredness.patch \
file://make_parallel.patch \
- file://static_sqlite.patch"
+ file://static_sqlite.patch \
+ file://data-as-env.patch"
FILES_${PN} = "${libdir}/libpseudo.so ${bindir}/* ${localstatedir}/pseudo"
PROVIDES += "virtual/fakeroot"