From 4e2c84f6b4d200e35afc7fff1b39de85afb480af Mon Sep 17 00:00:00 2001
From: Mark Hatle <mhatle@windriver.com>
Date: Wed, 4 Aug 2010 06:45:10 -0700
Subject: pseudo: Change pseudo integration to better support local DBs

Change the pseudo integration:
  * Uprev to latest open source version
  * Restructure the patches to allow for many local DBs, as well as
    pseudo specific lib dirs.

Signed-off-by: Mark Hatle <mhatle@windriver.com>
---
 meta/classes/base.bbclass                          |   2 +-
 meta/conf/bitbake.conf                             |   5 +-
 .../conf/distro/include/poky-default-revisions.inc |  10 +-
 meta/packages/pseudo/pseudo/data-as-env.patch      | 382 ---------------------
 meta/packages/pseudo/pseudo/ld_sacredness.patch    |  76 ----
 meta/packages/pseudo/pseudo/make_parallel.patch    |  14 -
 meta/packages/pseudo/pseudo/path-munge.patch       | 159 ---------
 meta/packages/pseudo/pseudo/tweakflags.patch       |  87 -----
 meta/packages/pseudo/pseudo_git.bb                 |  17 +-
 9 files changed, 17 insertions(+), 735 deletions(-)
 delete mode 100644 meta/packages/pseudo/pseudo/data-as-env.patch
 delete mode 100644 meta/packages/pseudo/pseudo/ld_sacredness.patch
 delete mode 100644 meta/packages/pseudo/pseudo/make_parallel.patch
 delete mode 100644 meta/packages/pseudo/pseudo/path-munge.patch
 delete mode 100644 meta/packages/pseudo/pseudo/tweakflags.patch

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 816de3fcf2..a3b5a49621 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -148,7 +148,7 @@ python base_do_setscene () {
 		bb.build.make_stamp("do_setscene", d)
 }
 do_setscene[selfstamp] = "1"
-do_setscene[dirs] = "${PSEUDO_DATADIR}"
+do_setscene[dirs] = "${PSEUDO_LOCALSTATEDIR}"
 addtask setscene before do_fetch
 
 addtask fetch
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 49ea3fc959..29dab544f7 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -530,9 +530,8 @@ SRC_URI = "file://${FILE}"
 
 # We can choose which provider of fake root privileges to use
 # default is fakeroot but in Poky we use 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_NOSYMLINKEXP=1 pseudo"
+PSEUDO_LOCALSTATEDIR ?= "${WORKDIR}/pseudo/"
+FAKEROOT = "PSEUDO_PREFIX=${STAGING_DIR_NATIVE}${prefix_native} PSEUDO_LOCALSTATEDIR=${PSEUDO_LOCALSTATEDIR} PSEUDO_NOSYMLINKEXP=1 pseudo"
 PREFERRED_PROVIDER_virtual/fakeroot-native ?= "pseudo-native"
 
 
diff --git a/meta/conf/distro/include/poky-default-revisions.inc b/meta/conf/distro/include/poky-default-revisions.inc
index 2edc019acc..838d09b10e 100644
--- a/meta/conf/distro/include/poky-default-revisions.inc
+++ b/meta/conf/distro/include/poky-default-revisions.inc
@@ -106,11 +106,13 @@ SRCREV_pn-tcf-agent ??= "1078"
 SRCREV_pn-osc-native ??= "9096"
 SRCREV_pn-owl-video ??= "394"
 SRCREV_pn-pkgconfig ??= "66d49f1375fec838bcd301bb4ca2ef76cee0e47c"
-SRCREV_pn-prelink ??= "909470ee441237563d6236c505cb2d02ddc48704"
-SRCREV_pn-prelink-native ??= "909470ee441237563d6236c505cb2d02ddc48704"
+PRELINKSRCREV ??= "909470ee441237563d6236c505cb2d02ddc48704"
+SRCREV_pn-prelink ??= "${PRELINKSRCREV}"
+SRCREV_pn-prelink-native ??= "${PRELINKSRCREV}"
 SRCREV_pn-psplash ??= "424"
-SRCREV_pn-pseudo ??= "973e40da8e5abb080cc0b9c9eaff4d84dea5b42c"
-SRCREV_pn-pseudo-native ??= "973e40da8e5abb080cc0b9c9eaff4d84dea5b42c"
+PSEUDOSRCREV ??= "551bf567c171c9f6f475f02de80e35df9563dce7"
+SRCREV_pn-pseudo ??= "${PSEUDOSRCREV}"
+SRCREV_pn-pseudo-native ??= "${PSEUDOSRCREV}"
 QEMUSRCREV ??= "72bb3c7571226af13cfe9eec020a56add3d30a70"
 SRCREV_pn-qemu-native ??= "${QEMUSRCREV}"
 SRCREV_pn-qemu-nativesdk ??= "${QEMUSRCREV}"
diff --git a/meta/packages/pseudo/pseudo/data-as-env.patch b/meta/packages/pseudo/pseudo/data-as-env.patch
deleted file mode 100644
index 6cef1b316b..0000000000
--- a/meta/packages/pseudo/pseudo/data-as-env.patch
+++ /dev/null
@@ -1,382 +0,0 @@
-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)
-
-Updates to include lock/log/socket/pid files
-
-RP (24/07/10)
-
-Index: git/pseudo.h
-===================================================================
---- git.orig/pseudo.h	2010-07-24 00:28:35.762423800 +0100
-+++ git/pseudo.h	2010-07-24 10:34:33.902335659 +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);
-@@ -134,10 +135,16 @@
- 
- extern char *pseudo_version;
- 
--#define PSEUDO_LOCKFILE PSEUDO_DATA "/pseudo.lock"
--#define PSEUDO_LOGFILE PSEUDO_DATA "/pseudo.log"
--#define PSEUDO_PIDFILE PSEUDO_DATA "/pseudo.pid"
--#define PSEUDO_SOCKET PSEUDO_DATA "/pseudo.socket"
-+#define PSEUDO_LOCKFILE "/pseudo.lock"
-+#define PSEUDO_LOGFILE "/pseudo.log"
-+#define PSEUDO_PIDFILE "/pseudo.pid"
-+#define PSEUDO_SOCKET "/pseudo.socket"
-+
-+extern char *pseudo_get_pid();
-+extern char *pseudo_get_lockfile();
-+extern char *pseudo_get_logfile();
-+extern char *pseudo_get_socketfile();
-+
- 
- /* some systems might not have *at().  We like to define operations in
-  * terms of each other, and for instance, open(...) is the same as
-Index: git/pseudo_db.c
-===================================================================
---- git.orig/pseudo_db.c	2010-07-24 00:28:35.762423800 +0100
-+++ git/pseudo_db.c	2010-07-24 00:28:36.282335730 +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-24 00:28:35.762423800 +0100
-+++ git/pseudo_server.c	2010-07-24 10:27:59.242335869 +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;
-@@ -138,9 +138,9 @@
- 		return 0;
- 	}
- 	setsid();
--	pseudo_path = strdup(PSEUDO_PIDFILE);
-+	pseudo_path = pseudo_get_pid();
- 	if (!pseudo_path) {
--		pseudo_diag("Couldn't get path for %s\n", PSEUDO_PIDFILE);
-+		pseudo_diag("Couldn't get pid path\n");
- 		return 1;
- 	}
- 	fp = fopen(pseudo_path, "w");
-@@ -156,7 +156,7 @@
- 		pseudo_new_pid();
- 		fclose(stdin);
- 		fclose(stdout);
--		if (!pseudo_logfile(PSEUDO_LOGFILE))
-+		if (!pseudo_logfile(pseudo_get_logfile()))
- 			fclose(stderr);
- 	}
- 	signal(SIGHUP, quit_now);
-Index: git/pseudo_util.c
-===================================================================
---- git.orig/pseudo_util.c	2010-07-24 00:28:35.962336149 +0100
-+++ git/pseudo_util.c	2010-07-24 10:50:48.062336358 +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.
-  */
-@@ -691,6 +735,26 @@
- 	return s;
- }
- 
-+char *
-+pseudo_get_pid() {
-+	return pseudo_data_path(PSEUDO_PIDFILE);
-+}
-+
-+char *
-+pseudo_get_lockfile() {
-+	return pseudo_data_path(PSEUDO_LOCKFILE);
-+}
-+
-+char *
-+pseudo_get_logfile() {
-+	return pseudo_data_path(PSEUDO_LOGFILE);
-+}
-+
-+char *
-+pseudo_get_socketfile() {
-+	return pseudo_data_path(PSEUDO_SOCKET);
-+}
-+
- /* these functions define the sizes pseudo will try to use
-  * when trying to allocate space, or guess how much space
-  * other people will have allocated; see the GNU man page
-@@ -844,20 +908,14 @@
- 
- /* set up a log file */
- int
--pseudo_logfile(char *defname) {
--	char *pseudo_path;
-+pseudo_logfile(char *pseudo_path) {
- 	char *filename, *s;
- 	extern char *program_invocation_short_name; /* glibcism */
- 	int fd;
- 
- 	if ((filename = getenv("PSEUDO_DEBUG_FILE")) == NULL) {
--		if (!defname) {
--			pseudo_debug(3, "no special log file requested, using stderr.\n");
--			return -1;
--		}
--		pseudo_path = strdup(defname);
- 		if (!pseudo_path) {
--			pseudo_diag("can't get path for prefix/%s\n", PSEUDO_LOGFILE);
-+			pseudo_debug(3, "no special log file requested or unable to malloc space, using stderr.\n");
- 			return -1;
- 		}
- 	} else {
-@@ -903,6 +961,7 @@
- 			len += 8;
- 		if (prog)
- 			len += strlen(program_invocation_short_name);
-+		free(pseudo_path);
- 		pseudo_path = malloc(len);
- 		if (!pseudo_path) {
- 			pseudo_diag("can't allocate space for debug file name.\n");
-Index: git/pseudo.c
-===================================================================
---- git.orig/pseudo.c	2010-07-24 10:22:10.053594896 +0100
-+++ git/pseudo.c	2010-07-24 10:23:20.883585467 +0100
-@@ -272,7 +272,7 @@
- 	pseudo_new_pid();
- 
- 	pseudo_debug(3, "opening lock.\n");
--	lockname = strdup(PSEUDO_LOCKFILE);
-+	lockname = pseudo_get_lockfile();
- 	if (!lockname) {
- 		pseudo_diag("Couldn't allocate a file path.\n");
- 		exit(EXIT_FAILURE);
-Index: git/pseudo_client.c
-===================================================================
---- git.orig/pseudo_client.c	2010-07-24 10:03:51.933588401 +0100
-+++ git/pseudo_client.c	2010-07-25 00:30:29.152364992 +0100
-@@ -359,6 +359,7 @@
- 	FILE *fp;
- 	extern char **environ;
- 	int cwd_fd;
-+	char *pidpath;
- 
- 	if ((server_pid = fork()) != 0) {
- 		if (server_pid == -1) {
-@@ -383,7 +384,12 @@
- 			pseudo_diag("Couldn't change to server dir [%d]: %s\n",
- 				pseudo_dir_fd, strerror(errno));
- 		}
--		fp = fopen(PSEUDO_PIDFILE, "r");
-+		pidpath = pseudo_get_pid();
-+		if (!pidpath) {
-+			pseudo_diag("Couldn't get pid path\n");
-+			return 1;
-+		}
-+		fp = fopen(pidpath, "r");
- 		if (fchdir(cwd_fd) == -1) {
- 			pseudo_diag("return to previous directory failed: %s\n",
- 				strerror(errno));
-@@ -396,8 +402,9 @@
- 			fclose(fp);
- 		} else {
- 			pseudo_diag("no pid file (%s): %s\n",
--				PSEUDO_PIDFILE, strerror(errno));
-+				pidpath, strerror(errno));
- 		}
-+		free(pidpath);
- 		pseudo_debug(2, "read new pid file: %d\n", server_pid);
- 		/* at this point, we should have a new server_pid */
- 		return 0;
-@@ -407,6 +414,8 @@
- 		char **new_environ;
- 		int args;
- 		int fd;
-+		int pseudo_prefix_fd;
-+		char *pseudo_path;
- 
- 		pseudo_new_pid();
- 		base_args[0] = "bin/pseudo";
-@@ -439,9 +448,21 @@
- 		} else {
- 			argv = base_args;
- 		}
--		if (fchdir(pseudo_dir_fd)) {
-+
-+
-+		pseudo_path = pseudo_prefix_path(NULL);
-+		if (pseudo_path) {
-+			pseudo_prefix_fd = open(pseudo_path, O_RDONLY);
-+			pseudo_prefix_fd = pseudo_fd(pseudo_prefix_fd, MOVE_FD);
-+			free(pseudo_path);
-+		} else {
-+			pseudo_diag("No prefix available to to find server.\n");
-+			exit(1);
-+		}
-+
-+		if (fchdir(pseudo_prefix_fd)) {
- 			pseudo_diag("Couldn't change to server dir [%d]: %s\n",
--				pseudo_dir_fd, strerror(errno));
-+				pseudo_prefix_fd, strerror(errno));
- 		}
- 		/* close any higher-numbered fds which might be open,
- 		 * such as sockets.  We don't have to worry about 0 and 1;
-@@ -535,10 +556,17 @@
- 
- static int
- client_connect(void) {
-+	char *socketfile = pseudo_get_socketfile();
- 	/* we have a server pid, is it responsive? */
--	struct sockaddr_un sun = { AF_UNIX, PSEUDO_SOCKET };
-+	struct sockaddr_un sun = { AF_UNIX, "pseudo.socket" };
- 	int cwd_fd;
- 
-+	if (!socketfile) {
-+		pseudo_diag("Couldn't malloc socketfile");
-+
-+		return 1;
-+	}
-+
- 	connect_fd = socket(PF_UNIX, SOCK_STREAM, 0);
- 	connect_fd = pseudo_fd(connect_fd, MOVE_FD);
- 	if (connect_fd == -1) {
-@@ -564,7 +592,7 @@
- 		return 1;
- 	}
- 	if (connect(connect_fd, (struct sockaddr *) &sun, sizeof(sun)) == -1) {
--		pseudo_debug(3, "can't connect socket to pseudo.socket: (%s)\n", strerror(errno));
-+		pseudo_debug(3, "can't connect socket to %s: (%s)\n", sun.sun_path, strerror(errno));
- 		close(connect_fd);
- 		if (fchdir(cwd_fd) == -1) {
- 			pseudo_diag("return to previous directory failed: %s\n",
-@@ -588,6 +616,7 @@
- 	FILE *fp;
- 	server_pid = 0;
- 	int cwd_fd;
-+	char *pidpath;
- 
- 	/* avoid descriptor leak, I hope */
- 	if (connect_fd >= 0) {
-@@ -604,7 +633,12 @@
- 		return 1;
- 	}
- 	if (fchdir(pseudo_dir_fd) != 1) {
--		fp = fopen(PSEUDO_PIDFILE, "r");
-+		pidpath = pseudo_get_pid();
-+		if (!pidpath) {
-+			pseudo_diag("Couldn't get pid path\n");
-+			return 1;
-+		}
-+		fp = fopen(pidpath, "r");
- 		if (fchdir(cwd_fd) == -1) {
- 			pseudo_diag("return to previous directory failed: %s\n",
- 				strerror(errno));
-@@ -619,6 +653,7 @@
- 			pseudo_debug(1, "Opened server PID file, but didn't get a pid.\n");
- 		}
- 		fclose(fp);
-+		free(pidpath);
- 	}
- 	if (server_pid) {
- 		if (kill(server_pid, 0) == -1) {
-@@ -710,7 +745,7 @@
- 	pseudo_msg_t *ack;
- 	char *pseudo_path;
- 
--	pseudo_path = pseudo_prefix_path(NULL);
-+	pseudo_path = pseudo_data_path(NULL);
- 	if (pseudo_dir_fd == -1) {
- 		if (pseudo_path) {
- 			pseudo_dir_fd = open(pseudo_path, O_RDONLY);
-Index: git/pseudo_wrappers.c
-===================================================================
---- git.orig/pseudo_wrappers.c	2010-07-25 00:21:35.263587003 +0100
-+++ git/pseudo_wrappers.c	2010-07-25 00:29:03.052345996 +0100
-@@ -180,7 +180,7 @@
- 	 * value for cwd.
- 	 */
- 	pseudo_client_reset();
--	pseudo_path = pseudo_prefix_path(NULL);
-+	pseudo_path = pseudo_data_path(NULL);
- 	if (pseudo_dir_fd == -1) {
- 		if (pseudo_path) {
- 			pseudo_dir_fd = open(pseudo_path, O_RDONLY);
diff --git a/meta/packages/pseudo/pseudo/ld_sacredness.patch b/meta/packages/pseudo/pseudo/ld_sacredness.patch
deleted file mode 100644
index 568c899d7c..0000000000
--- a/meta/packages/pseudo/pseudo/ld_sacredness.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-Image creation runs under a pseudo context and calls a script which refers 
-to the build systems's python. This loads but can find a libpython from staging
-if these are incompatible, anything can break. These scripts should *not* be
-changing LD_LIBRARY_PATH, just adding an LD_PRELOAD with an absolute path. The
-dyanmic linker can figure out anything else with rpaths.
-
-Inspired by RP's patch of a similar intent for fakeroot
-
-JL 15/07/10
-(updated 20/7/2010 - MGH)
-
---- git.orig/pseudo_util.c	2010-07-20 15:34:41.000000000 -0700
-+++ git/pseudo_util.c	2010-07-20 16:00:35.000000000 -0700
-diff -ur git.orig/pseudo_util.c git/pseudo_util.c
---- git.orig/pseudo_util.c	2010-07-20 17:02:13.000000000 -0700
-+++ git/pseudo_util.c	2010-07-20 17:03:26.000000000 -0700
-@@ -65,7 +65,7 @@
-  * the end of the string or a space after it.
-  */
- static char *libpseudo_name = "libpseudo.so";
--static char *libpseudo_pattern = "(=| )libpseudo[^ ]*\\.so($| )";
-+static char *libpseudo_pattern = "(=| )[^ ]*libpseudo[^ ]*\\.so($| )";
- static regex_t libpseudo_regex;
- static int libpseudo_regex_compiled = 0;
- 
-@@ -499,8 +499,10 @@
- 			found_opts = 1;
- 		if (!memcmp(environ[i], "PSEUDO_DEBUG=", 13))
- 			found_debug = 1;
-+#if 0
- 		if (!memcmp(environ[i], "LD_LIBRARY_PATH=", 16))
- 			found_libpath = 1;
-+#endif
- 		++env_count;
- 	}
- 	env_count += 4 - (found_preload + found_libpath + found_debug + found_opts);
-@@ -520,6 +522,7 @@
- 				return NULL;
- 			}
- 			new_environ[j++] = newenv;
-+#if 0
- 		} else if (!memcmp(environ[i], "LD_LIBRARY_PATH=", 16)) {
- 			if (!strstr(environ[i], PSEUDO_PREFIX)) {
- 				char *e1, *e2;
-@@ -537,10 +540,12 @@
- 			} else {
- 				new_environ[j++] = environ[i];
- 			}
-+#endif
- 		} else {
- 			new_environ[j++] = environ[i];
- 		}
- 	}
-+#if 0
- 	if (!found_libpath) {
- 		char *e1, *e2;
- 		e1 = pseudo_prefix_path("lib");
-@@ -553,8 +558,18 @@
- 		snprintf(newenv, len, "LD_LIBRARY_PATH=%s:%s", e1, e2);
- 		new_environ[j++] = newenv;
- 	}
-+#endif
- 	if (!found_preload) {
-+#if 0
- 		new_environ[j++] = "LD_PRELOAD=libpseudo.so";
-+#else
-+		char *libname = "libpseudo.so";
-+		char *prefix = pseudo_prefix_path("lib");
-+		len = 11 + strlen(prefix) + strlen(libname) + 2;
-+		newenv = malloc(len);
-+		snprintf(newenv, len, "LD_PRELOAD=%s/%s", prefix, libname);
-+		new_environ[j++] = newenv;
-+#endif
- 	}
- 	if (!found_debug && max_debug_level > 0) {
- 		len = 16;
diff --git a/meta/packages/pseudo/pseudo/make_parallel.patch b/meta/packages/pseudo/pseudo/make_parallel.patch
deleted file mode 100644
index 697b576f74..0000000000
--- a/meta/packages/pseudo/pseudo/make_parallel.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Add a missing dependency to fix a problem with building pseudo in a 
-parallel build.
-
---- git.orig/Makefile.in	2010-07-20 16:15:30.000000000 -0700
-+++ git/Makefile.in	2010-07-20 16:15:58.000000000 -0700
-@@ -105,7 +105,7 @@
- 
- .SECONDARY: wrappers
- 
--pseudo_wrapfuncs.c: wrappers
-+pseudo_wrapfuncs.c pseudo_wrapfuncs.h: wrappers
- 
- # no-strict-aliasing is needed for the function pointer trickery.
- pseudo_wrappers.o: $(GUTS) pseudo_wrappers.c pseudo_wrapfuncs.c pseudo_wrapfuncs.h
diff --git a/meta/packages/pseudo/pseudo/path-munge.patch b/meta/packages/pseudo/pseudo/path-munge.patch
deleted file mode 100644
index 2ccdea17ea..0000000000
--- a/meta/packages/pseudo/pseudo/path-munge.patch
+++ /dev/null
@@ -1,159 +0,0 @@
-Pseudo defaults to storing state files in ${prefix}/var/pseudo, we want them in
-$(localstatedir) so this quick hack makes pseudo use a data directory specified
-with --data, and defaults to pseudo's way if it's not set.
-
-JL 14/07/10
-(updated 20/7/2010 - MGH)
-
-diff -urN git.orig/Makefile.in git/Makefile.in
---- git.orig/Makefile.in	2010-07-20 15:47:46.000000000 -0700
-+++ git/Makefile.in	2010-07-20 15:43:31.000000000 -0700
-@@ -20,6 +20,7 @@
- # configuration flags
- PREFIX=@PREFIX@
- SUFFIX=@SUFFIX@
-+DATA=@DATA@
- SQLITE=@SQLITE@
- BITS=@BITS@
- MARK64=@MARK64@
-@@ -27,11 +28,15 @@
- 
- LIBDIR=$(PREFIX)/lib
- BINDIR=$(PREFIX)/bin
-+ifndef DATA
- DATADIR=$(PREFIX)/var/pseudo
-+else
-+DATADIR=$(DATA)/pseudo
-+endif
- 
- CFLAGS_BASE=-pipe -std=gnu99 -Wall -W -Wextra
- CFLAGS_CODE=-fPIC -D_LARGEFILE64_SOURCE -D_ATFILE_SOURCE -m$(BITS)
--CFLAGS_DEFS=-DPSEUDO_PREFIX='"$(PREFIX)"' -DPSEUDO_SUFFIX='"$(SUFFIX)"' -DPSEUDO_VERSION='"$(VERSION)"'
-+CFLAGS_DEFS=-DPSEUDO_PREFIX='"$(PREFIX)"' -DPSEUDO_SUFFIX='"$(SUFFIX)"' -DPSEUDO_VERSION='"$(VERSION)"' -DPSEUDO_DATA='"$(DATADIR)"'
- CFLAGS_DEBUG=-O2 -g
- CFLAGS_SQL=-L$(SQLITE)/lib -I$(SQLITE)/include
- EXTRA_CFLAGS=$(CFLAGS_BASE) $(CFLAGS_CODE) $(CFLAGS_DEFS) \
-diff -urN git.orig/configure git/configure
---- git.orig/configure	2010-07-20 15:34:41.000000000 -0700
-+++ git/configure	2010-07-20 15:42:23.000000000 -0700
-@@ -20,13 +20,14 @@
- # not a real configure script...
- opt_prefix=
- opt_suffix=
-+opt_data=
- opt_bits=32
- opt_sqlite=/usr
- 
- usage()
- {
- 	echo >&2 "usage:"
--	echo >&2 "  configure --prefix=... [--suffix=...] [--with-sqlite=...] [--bits=32|64]"
-+	echo >&2 "  configure --prefix=... [--suffix=...] [--data=...] [--with-sqlite=...] [--bits=32|64]"
- 	exit 1
- }
- 
-@@ -43,6 +44,9 @@
- 	--suffix=*)
- 		opt_suffix=${arg#--suffix=}
- 		;;
-+	--data=*)
-+		opt_data=${arg#--data=}
-+		;;
- 	--bits=*)
- 		opt_bits=${arg#--bits=}
- 		case $opt_bits in
-@@ -65,6 +69,7 @@
- sed -e '
-   s,@PREFIX@,'"$opt_prefix"',g
-   s,@SUFFIX@,'"$opt_suffix"',g
-+  s,@DATA@,'"$opt_data"',g
-   s,@SQLITE@,'"$opt_sqlite"',g
-   s,@MARK64@,'"$opt_mark64"',g
-   s,@BITS@,'"$opt_bits"',g
-diff -urN git.orig/pseudo.c git/pseudo.c
---- git.orig/pseudo.c	2010-07-20 15:34:41.000000000 -0700
-+++ git/pseudo.c	2010-07-20 15:42:23.000000000 -0700
-@@ -272,7 +272,7 @@
- 	pseudo_new_pid();
- 
- 	pseudo_debug(3, "opening lock.\n");
--	lockname = pseudo_prefix_path(PSEUDO_LOCKFILE);
-+	lockname = strdup(PSEUDO_LOCKFILE);
- 	if (!lockname) {
- 		pseudo_diag("Couldn't allocate a file path.\n");
- 		exit(EXIT_FAILURE);
-diff -urN git.orig/pseudo.h git/pseudo.h
---- git.orig/pseudo.h	2010-07-20 15:34:41.000000000 -0700
-+++ git/pseudo.h	2010-07-20 15:44:31.000000000 -0700
-@@ -134,11 +134,10 @@
- 
- extern char *pseudo_version;
- 
--#define PSEUDO_DATA "var/pseudo/"
--#define PSEUDO_LOCKFILE PSEUDO_DATA "pseudo.lock"
--#define PSEUDO_LOGFILE PSEUDO_DATA "pseudo.log"
--#define PSEUDO_PIDFILE PSEUDO_DATA "pseudo.pid"
--#define PSEUDO_SOCKET PSEUDO_DATA "pseudo.socket"
-+#define PSEUDO_LOCKFILE PSEUDO_DATA "/pseudo.lock"
-+#define PSEUDO_LOGFILE PSEUDO_DATA "/pseudo.log"
-+#define PSEUDO_PIDFILE PSEUDO_DATA "/pseudo.pid"
-+#define PSEUDO_SOCKET PSEUDO_DATA "/pseudo.socket"
- 
- /* some systems might not have *at().  We like to define operations in
-  * terms of each other, and for instance, open(...) is the same as
-diff -urN git.orig/pseudo_db.c git/pseudo_db.c
---- git.orig/pseudo_db.c	2010-07-20 15:34:41.000000000 -0700
-+++ git/pseudo_db.c	2010-07-20 15:42:23.000000000 -0700
-@@ -471,11 +471,11 @@
- 	if (*db)
- 		return 0;
- 	if (db == &file_db) {
--		dbfile = pseudo_prefix_path(PSEUDO_DATA "files.db");
-+		dbfile = strdup(PSEUDO_DATA "/files.db");
- 		rc = sqlite3_open(dbfile, db);
- 		free(dbfile);
- 	} else {
--		dbfile = pseudo_prefix_path(PSEUDO_DATA "logs.db");
-+		dbfile = strdup(PSEUDO_DATA "/logs.db");
- 		rc = sqlite3_open(dbfile, db);
- 		free(dbfile);
- 	}
-diff -urN git.orig/pseudo_server.c git/pseudo_server.c
---- git.orig/pseudo_server.c	2010-07-20 15:34:41.000000000 -0700
-+++ git/pseudo_server.c	2010-07-20 15:46:09.000000000 -0700
-@@ -107,9 +107,9 @@
- 	}
- 
- 	/* cd to the data directory */
--	pseudo_path = pseudo_prefix_path(PSEUDO_DATA);
-+	pseudo_path = strdup(PSEUDO_DATA);
- 	if (!pseudo_path) {
--		pseudo_diag("can't find prefix/%s directory.\n", PSEUDO_DATA);
-+		pseudo_diag("can't find %s directory.\n", PSEUDO_DATA);
- 		return 1;
- 	}
- 	if (chdir(pseudo_path) == -1) {
-@@ -138,9 +138,9 @@
- 		return 0;
- 	}
- 	setsid();
--	pseudo_path = pseudo_prefix_path(PSEUDO_PIDFILE);
-+	pseudo_path = strdup(PSEUDO_PIDFILE);
- 	if (!pseudo_path) {
--		pseudo_diag("Couldn't get path for prefix/%s\n", PSEUDO_PIDFILE);
-+		pseudo_diag("Couldn't get path for %s\n", PSEUDO_PIDFILE);
- 		return 1;
- 	}
- 	fp = fopen(pseudo_path, "w");
-diff -ur git.orig/pseudo_util.c git/pseudo_util.c
---- git.orig/pseudo_util.c	2010-07-20 17:06:22.000000000 -0700
-+++ git/pseudo_util.c	2010-07-20 17:10:50.000000000 -0700
-@@ -855,7 +855,7 @@
- 			pseudo_debug(3, "no special log file requested, using stderr.\n");
- 			return -1;
- 		}
--		pseudo_path = pseudo_prefix_path(defname);
-+		pseudo_path = strdup(defname);
- 		if (!pseudo_path) {
- 			pseudo_diag("can't get path for prefix/%s\n", PSEUDO_LOGFILE);
- 			return -1;
diff --git a/meta/packages/pseudo/pseudo/tweakflags.patch b/meta/packages/pseudo/pseudo/tweakflags.patch
deleted file mode 100644
index a7458f5f4a..0000000000
--- a/meta/packages/pseudo/pseudo/tweakflags.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-CFLAGS is overridden from the environment by Poky. We need boths sets of
-flags so we adjust the Makefile accordingly.
-
-Also the default target is "test" which runs install which we don't want
-until "make install" time when DESTDIR is set. Change the first target
-to "all" for this reason.
-
-RP 18/3/10
-(updated 20/7/2010 - MGH)
-
---- git.orig/Makefile.in	2010-07-20 15:34:41.000000000 -0700
-+++ git/Makefile.in	2010-07-20 15:40:42.000000000 -0700
-@@ -25,7 +25,7 @@
- MARK64=@MARK64@
- VERSION=0.3
- 
--LIBDIR=$(PREFIX)/lib$(MARK64)
-+LIBDIR=$(PREFIX)/lib
- BINDIR=$(PREFIX)/bin
- DATADIR=$(PREFIX)/var/pseudo
- 
-@@ -34,7 +34,7 @@
- CFLAGS_DEFS=-DPSEUDO_PREFIX='"$(PREFIX)"' -DPSEUDO_SUFFIX='"$(SUFFIX)"' -DPSEUDO_VERSION='"$(VERSION)"'
- CFLAGS_DEBUG=-O2 -g
- CFLAGS_SQL=-L$(SQLITE)/lib -I$(SQLITE)/include
--CFLAGS=$(CFLAGS_BASE) $(CFLAGS_CODE) $(CFLAGS_DEFS) \
-+EXTRA_CFLAGS=$(CFLAGS_BASE) $(CFLAGS_CODE) $(CFLAGS_DEFS) \
- 	$(CFLAGS_DEBUG) $(CFLAGS_SQL)
- 
- GLOB_PATTERN=guts/*.c
-@@ -47,11 +47,11 @@
- DBOBJS=pseudo_db.o -ldl -lpthread
- WRAPOBJS=pseudo_wrappers.o
- 
-+all: libpseudo.so pseudo pseudodb pseudolog
-+
- test: install
- 	@echo "No tests yet."
- 
--all: libpseudo.so pseudo pseudodb pseudolog
--
- install-lib: libpseudo.so
- 	mkdir -p $(DESTDIR)$(LIBDIR)
- 	cp libpseudo*.so $(DESTDIR)$(LIBDIR)
-@@ -66,26 +66,29 @@
- install: all install-lib install-bin install-data
- 
- pseudo: pseudo.o $(SHOBJS) $(DBOBJS) pseudo_client.o pseudo_server.o pseudo_ipc.o
--	$(CC) $(CFLAGS) -o pseudo \
-+	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o pseudo \
- 		pseudo.o pseudo_server.o pseudo_client.o pseudo_ipc.o \
- 		$(DBOBJS) $(SHOBJS) $(DBLDFLAGS)
- 
- pseudolog: pseudolog.o $(SHOBJS) $(DBOBJS) pseudo_client.o pseudo_ipc.o
--	$(CC) $(CFLAGS) -o pseudolog pseudolog.o pseudo_client.o pseudo_ipc.o \
-+	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o pseudolog pseudolog.o pseudo_client.o pseudo_ipc.o \
- 		$(DBOBJS) $(SHOBJS) $(DBLDFLAGS)
- 
- pseudodb: pseudodb.o $(SHOBJS) $(DBOBJS) pseudo_ipc.o
--	$(CC) $(CFLAGS) -o pseudodb pseudodb.o \
-+	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o pseudodb pseudodb.o \
- 		$(DBOBJS) $(SHOBJS) $(DBLDFLAGS) pseudo_ipc.o
- 
- libpseudo.so: $(WRAPOBJS) pseudo_client.o pseudo_ipc.o $(SHOBJS)
--	$(CC) $(CFLAGS) -shared -o libpseudo.so \
-+	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -shared -o libpseudo.so \
- 		pseudo_client.o pseudo_ipc.o \
- 		$(WRAPOBJS) $(SHOBJS) -ldl
- 	if test -n "$(SUFFIX)"; then \
- 	  cp libpseudo.so libpseudo$(SUFFIX).so ; \
- 	fi
- 
-+%.o: %.c
-+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) $<
-+
- pseudo_client.o pseudo_server.o pseudo_ipc.o: pseudo_ipc.h
- 
- pseudo_client.o: pseudo_client.h
-@@ -101,7 +104,7 @@
- 
- # no-strict-aliasing is needed for the function pointer trickery.
- pseudo_wrappers.o: $(GUTS) pseudo_wrappers.c pseudo_wrapfuncs.c pseudo_wrapfuncs.h
--	$(CC) -fno-strict-aliasing $(CFLAGS) -D_GNU_SOURCE -c -o pseudo_wrappers.o pseudo_wrappers.c
-+	$(CC) -fno-strict-aliasing $(CFLAGS) $(EXTRA_CFLAGS) -D_GNU_SOURCE -c -o pseudo_wrappers.o pseudo_wrappers.c
- 
- offsets32:
- 	$(CC) -m32 -o offsets32 offsets.c
diff --git a/meta/packages/pseudo/pseudo_git.bb b/meta/packages/pseudo/pseudo_git.bb
index 9efed11fbf..78d1720501 100644
--- a/meta/packages/pseudo/pseudo_git.bb
+++ b/meta/packages/pseudo/pseudo_git.bb
@@ -6,15 +6,10 @@ LICENSE = "LGPL2.1"
 DEPENDS = "sqlite3"
 
 PV = "0.0+git${SRCPV}"
-PR = "r10"
+PR = "r11"
 
 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://data-as-env.patch"
+           file://static_sqlite.patch"
 
 FILES_${PN} = "${libdir}/libpseudo.so ${bindir}/* ${localstatedir}/pseudo"
 PROVIDES += "virtual/fakeroot"
@@ -24,11 +19,15 @@ S = "${WORKDIR}/git"
 inherit siteinfo
 
 do_configure () {
-	${S}/configure --prefix=${prefix} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --bits=${SITEINFO_BITS} --data=${localstatedir}
+	${S}/configure --prefix=${prefix} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --bits=${SITEINFO_BITS}
+}
+
+do_compile () {
+	oe_runmake 'LIB=lib/pseudo/lib'
 }
 
 do_install () {
-	oe_runmake 'DESTDIR=${D}' install
+	oe_runmake 'DESTDIR=${D}' 'LIB=lib/pseudo/lib' install
 }
 
 BBCLASSEXTEND = "native"
-- 
cgit v1.2.3