summaryrefslogtreecommitdiff
path: root/meta/packages
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2010-07-14 10:25:06 +0100
committerJoshua Lock <josh@linux.intel.com>2010-07-16 15:40:32 +0100
commit1b6535dc2e556987a8e8a45b4ba8a6d5103b1b9d (patch)
treede23101957bf66b5b407673ce208e8d74c92893b /meta/packages
parentf23aa92f085d058df15f44c0a5ff9024952f1cd9 (diff)
downloadopenembedded-core-1b6535dc2e556987a8e8a45b4ba8a6d5103b1b9d.tar.gz
openembedded-core-1b6535dc2e556987a8e8a45b4ba8a6d5103b1b9d.tar.bz2
openembedded-core-1b6535dc2e556987a8e8a45b4ba8a6d5103b1b9d.zip
pseudo: various enhancements to integrate with Poky
Pseudo defaults to storing state files in ${prefix}/var/pseudo, we want them in $(localstatedir) so a quick hack (path-munge.patch) makes pseudo use a data directory specified with --data, and defaults to pseudo's way if it's not set. Touching LD_LIBRARY_PATH can confuse the system into running Python against a staging python library. When these two are sufficiently diverse in version significant breakage can occur. HOMEPAGE and LIC_FILES_CHKSUM are handy metadata variables to have defined. Signed-off-by: Joshua Lock <josh@linux.intel.com>
Diffstat (limited to 'meta/packages')
-rw-r--r--meta/packages/pseudo/pseudo/ld_sacredness.patch68
-rw-r--r--meta/packages/pseudo/pseudo/path-munge.patch161
-rw-r--r--meta/packages/pseudo/pseudo_git.bb15
3 files changed, 240 insertions, 4 deletions
diff --git a/meta/packages/pseudo/pseudo/ld_sacredness.patch b/meta/packages/pseudo/pseudo/ld_sacredness.patch
new file mode 100644
index 0000000000..55a39d99b4
--- /dev/null
+++ b/meta/packages/pseudo/pseudo/ld_sacredness.patch
@@ -0,0 +1,68 @@
+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
+
+Index: git/pseudo_util.c
+===================================================================
+--- git.orig/pseudo_util.c 2010-03-25 17:57:24.000000000 +0000
++++ git/pseudo_util.c 2010-07-15 16:13:09.431459640 +0100
+@@ -362,40 +362,25 @@
+ */
+ void
+ pseudo_setupenv(char *opts) {
+- char *ld_env;
+ char *newenv;
+ size_t len;
+ char debugvalue[64];
+
+- newenv = "libpseudo.so";
++ /* need to set LD_PRELOAD to the absolute library path, as tweaking
++ * LD_LIBRARY_PATH makes the Beaver sad.
++ * Fortunately we can hack this as we know we don't use lib64 :-)
++ */
++
++ char *libname = "libpseudo.so";
++ char *prefix = pseudo_prefix_path("lib");
++ len = strlen(prefix) + strlen(libname) + 2;
++ newenv = malloc(len);
++
++ snprintf(newenv, len, "%s/%s", prefix, libname);
++
+ setenv("LD_PRELOAD", newenv, 1);
+
+- ld_env = getenv("LD_LIBRARY_PATH");
+- if (ld_env) {
+- char *prefix = pseudo_prefix_path(NULL);
+- if (!strstr(ld_env, prefix)) {
+- char *e1, *e2;
+- e1 = pseudo_prefix_path("lib");
+- e2 = pseudo_prefix_path("lib64");
+- len = strlen(ld_env) + strlen(e1) + strlen(e2) + 3;
+- newenv = malloc(len);
+- snprintf(newenv, len, "%s:%s:%s", ld_env, e1, e2);
+- free(e1);
+- free(e2);
+- setenv("LD_LIBRARY_PATH", newenv, 1);
+- free(newenv);
+- }
+- free(prefix);
+- } else {
+- char *e1, *e2;
+- e1 = pseudo_prefix_path("lib");
+- e2 = pseudo_prefix_path("lib64");
+- len = strlen(e1) + strlen(e2) + 2;
+- newenv = malloc(len);
+- snprintf(newenv, len, "%s:%s", e1, e2);
+- setenv("LD_LIBRARY_PATH", newenv, 1);
+- free(newenv);
+- }
++ free(newenv);
+
+ if (max_debug_level) {
+ sprintf(debugvalue, "%d", max_debug_level);
diff --git a/meta/packages/pseudo/pseudo/path-munge.patch b/meta/packages/pseudo/pseudo/path-munge.patch
new file mode 100644
index 0000000000..2327f2e5af
--- /dev/null
+++ b/meta/packages/pseudo/pseudo/path-munge.patch
@@ -0,0 +1,161 @@
+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
+
+Index: git/Makefile.in
+===================================================================
+--- git.orig/Makefile.in 2010-07-14 16:50:45.772094105 +0100
++++ git/Makefile.in 2010-07-14 16:50:45.897400059 +0100
+@@ -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
+ 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) \
+Index: git/configure
+===================================================================
+--- git.orig/configure 2010-03-25 17:57:24.000000000 +0000
++++ git/configure 2010-07-14 16:50:45.897400059 +0100
+@@ -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
+Index: git/pseudo.c
+===================================================================
+--- git.orig/pseudo.c 2010-03-25 17:57:24.000000000 +0000
++++ git/pseudo.c 2010-07-14 16:50:45.898400595 +0100
+@@ -191,7 +191,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(1);
+Index: git/pseudo.h
+===================================================================
+--- git.orig/pseudo.h 2010-03-25 17:57:24.000000000 +0000
++++ git/pseudo.h 2010-07-14 16:50:45.899360463 +0100
+@@ -121,8 +121,7 @@
+
+ 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"
+Index: git/pseudo_db.c
+===================================================================
+--- git.orig/pseudo_db.c 2010-03-25 17:57:24.000000000 +0000
++++ git/pseudo_db.c 2010-07-14 16:51:07.506464213 +0100
+@@ -458,11 +458,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);
+ }
+Index: git/pseudo_server.c
+===================================================================
+--- git.orig/pseudo_server.c 2010-03-25 17:57:24.000000000 +0000
++++ git/pseudo_server.c 2010-07-14 16:50:45.901462874 +0100
+@@ -101,9 +101,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) {
+@@ -132,9 +132,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");
+@@ -152,9 +152,9 @@
+ pseudo_new_pid();
+ fclose(stdin);
+ fclose(stdout);
+- pseudo_path = pseudo_prefix_path(PSEUDO_LOGFILE);
++ pseudo_path = strdup(PSEUDO_LOGFILE);
+ if (!pseudo_path) {
+- pseudo_diag("can't get path for prefix/%s\n", PSEUDO_LOGFILE);
++ pseudo_diag("can't get path for %s\n", PSEUDO_LOGFILE);
+ return 1;
+ }
+ fd = open(pseudo_path, O_WRONLY | O_APPEND | O_CREAT, 0644);
diff --git a/meta/packages/pseudo/pseudo_git.bb b/meta/packages/pseudo/pseudo_git.bb
index dd62e6f3bc..1ba43c07f7 100644
--- a/meta/packages/pseudo/pseudo_git.bb
+++ b/meta/packages/pseudo/pseudo_git.bb
@@ -1,23 +1,30 @@
DESCRIPTION = "Pseudo gives fake root capabilities to a normal user"
+HOMEPAGE = "http://wiki.github.com/wrpseudo/pseudo/"
+LIC_FILES_CHKSUM = "file://COPYING;md5=243b725d71bb5df4a1e5920b344b86ad"
SECTION = "base"
LICENSE = "LGPL2.1"
DEPENDS = "sqlite3"
PV = "0.0+git${SRCPV}"
-PR = "r3"
+PR = "r4"
SRC_URI = "git://github.com/wrpseudo/pseudo.git;protocol=git \
- file://tweakflags.patch;patch=1"
+ file://tweakflags.patch \
+ file://path-munge.patch \
+ file://ld_sacredness.patch"
+
+FILES_${PN} = "${libdir}/libpseudo.so ${bindir}/* ${localstatedir}/pseudo"
+PROVIDES += "virtual/fakeroot"
S = "${WORKDIR}/git"
inherit siteinfo
do_configure () {
- ${S}/configure --prefix=${prefix} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --bits=${SITEINFO_BITS}
+ ${S}/configure --prefix=${prefix} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --bits=${SITEINFO_BITS} --data=${localstatedir}
}
-do_install() {
+do_install () {
oe_runmake 'DESTDIR=${D}' install
}