diff options
| -rw-r--r-- | meta/packages/pseudo/pseudo/ld_sacredness.patch | 68 | ||||
| -rw-r--r-- | meta/packages/pseudo/pseudo/path-munge.patch | 161 | ||||
| -rw-r--r-- | meta/packages/pseudo/pseudo_git.bb | 15 |
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 @@ | |||
| 1 | Image creation runs under a pseudo context and calls a script which refers | ||
| 2 | to the build systems's python. This loads but can find a libpython from staging | ||
| 3 | if these are incompatible, anything can break. These scripts should *not* be | ||
| 4 | changing LD_LIBRARY_PATH, just adding an LD_PRELOAD with an absolute path. The | ||
| 5 | dyanmic linker can figure out anything else with rpaths. | ||
| 6 | |||
| 7 | Inspired by RP's patch of a similar intent for fakeroot | ||
| 8 | |||
| 9 | JL 15/07/10 | ||
| 10 | |||
| 11 | Index: git/pseudo_util.c | ||
| 12 | =================================================================== | ||
| 13 | --- git.orig/pseudo_util.c 2010-03-25 17:57:24.000000000 +0000 | ||
| 14 | +++ git/pseudo_util.c 2010-07-15 16:13:09.431459640 +0100 | ||
| 15 | @@ -362,40 +362,25 @@ | ||
| 16 | */ | ||
| 17 | void | ||
| 18 | pseudo_setupenv(char *opts) { | ||
| 19 | - char *ld_env; | ||
| 20 | char *newenv; | ||
| 21 | size_t len; | ||
| 22 | char debugvalue[64]; | ||
| 23 | |||
| 24 | - newenv = "libpseudo.so"; | ||
| 25 | + /* need to set LD_PRELOAD to the absolute library path, as tweaking | ||
| 26 | + * LD_LIBRARY_PATH makes the Beaver sad. | ||
| 27 | + * Fortunately we can hack this as we know we don't use lib64 :-) | ||
| 28 | + */ | ||
| 29 | + | ||
| 30 | + char *libname = "libpseudo.so"; | ||
| 31 | + char *prefix = pseudo_prefix_path("lib"); | ||
| 32 | + len = strlen(prefix) + strlen(libname) + 2; | ||
| 33 | + newenv = malloc(len); | ||
| 34 | + | ||
| 35 | + snprintf(newenv, len, "%s/%s", prefix, libname); | ||
| 36 | + | ||
| 37 | setenv("LD_PRELOAD", newenv, 1); | ||
| 38 | |||
| 39 | - ld_env = getenv("LD_LIBRARY_PATH"); | ||
| 40 | - if (ld_env) { | ||
| 41 | - char *prefix = pseudo_prefix_path(NULL); | ||
| 42 | - if (!strstr(ld_env, prefix)) { | ||
| 43 | - char *e1, *e2; | ||
| 44 | - e1 = pseudo_prefix_path("lib"); | ||
| 45 | - e2 = pseudo_prefix_path("lib64"); | ||
| 46 | - len = strlen(ld_env) + strlen(e1) + strlen(e2) + 3; | ||
| 47 | - newenv = malloc(len); | ||
| 48 | - snprintf(newenv, len, "%s:%s:%s", ld_env, e1, e2); | ||
| 49 | - free(e1); | ||
| 50 | - free(e2); | ||
| 51 | - setenv("LD_LIBRARY_PATH", newenv, 1); | ||
| 52 | - free(newenv); | ||
| 53 | - } | ||
| 54 | - free(prefix); | ||
| 55 | - } else { | ||
| 56 | - char *e1, *e2; | ||
| 57 | - e1 = pseudo_prefix_path("lib"); | ||
| 58 | - e2 = pseudo_prefix_path("lib64"); | ||
| 59 | - len = strlen(e1) + strlen(e2) + 2; | ||
| 60 | - newenv = malloc(len); | ||
| 61 | - snprintf(newenv, len, "%s:%s", e1, e2); | ||
| 62 | - setenv("LD_LIBRARY_PATH", newenv, 1); | ||
| 63 | - free(newenv); | ||
| 64 | - } | ||
| 65 | + free(newenv); | ||
| 66 | |||
| 67 | if (max_debug_level) { | ||
| 68 | 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 @@ | |||
| 1 | Pseudo defaults to storing state files in ${prefix}/var/pseudo, we want them in | ||
| 2 | $(localstatedir) so this quick hack makes pseudo use a data directory specified | ||
| 3 | with --data, and defaults to pseudo's way if it's not set. | ||
| 4 | |||
| 5 | JL 14/07/10 | ||
| 6 | |||
| 7 | Index: git/Makefile.in | ||
| 8 | =================================================================== | ||
| 9 | --- git.orig/Makefile.in 2010-07-14 16:50:45.772094105 +0100 | ||
| 10 | +++ git/Makefile.in 2010-07-14 16:50:45.897400059 +0100 | ||
| 11 | @@ -20,6 +20,7 @@ | ||
| 12 | # configuration flags | ||
| 13 | PREFIX=@PREFIX@ | ||
| 14 | SUFFIX=@SUFFIX@ | ||
| 15 | +DATA=@DATA@ | ||
| 16 | SQLITE=@SQLITE@ | ||
| 17 | BITS=@BITS@ | ||
| 18 | MARK64=@MARK64@ | ||
| 19 | @@ -27,11 +28,15 @@ | ||
| 20 | |||
| 21 | LIBDIR=$(PREFIX)/lib | ||
| 22 | BINDIR=$(PREFIX)/bin | ||
| 23 | +ifndef DATA | ||
| 24 | DATADIR=$(PREFIX)/var/pseudo | ||
| 25 | +else | ||
| 26 | +DATADIR=$(DATA)/pseudo | ||
| 27 | +endif | ||
| 28 | |||
| 29 | CFLAGS_BASE=-pipe -std=gnu99 -Wall | ||
| 30 | CFLAGS_CODE=-fPIC -D_LARGEFILE64_SOURCE -D_ATFILE_SOURCE -m$(BITS) | ||
| 31 | -CFLAGS_DEFS=-DPSEUDO_PREFIX='"$(PREFIX)"' -DPSEUDO_SUFFIX='"$(SUFFIX)"' -DPSEUDO_VERSION='"$(VERSION)"' | ||
| 32 | +CFLAGS_DEFS=-DPSEUDO_PREFIX='"$(PREFIX)"' -DPSEUDO_SUFFIX='"$(SUFFIX)"' -DPSEUDO_VERSION='"$(VERSION)"' -DPSEUDO_DATA='"$(DATADIR)"' | ||
| 33 | CFLAGS_DEBUG=-O2 -g | ||
| 34 | CFLAGS_SQL=-L$(SQLITE)/lib -I$(SQLITE)/include | ||
| 35 | EXTRA_CFLAGS=$(CFLAGS_BASE) $(CFLAGS_CODE) $(CFLAGS_DEFS) \ | ||
| 36 | Index: git/configure | ||
| 37 | =================================================================== | ||
| 38 | --- git.orig/configure 2010-03-25 17:57:24.000000000 +0000 | ||
| 39 | +++ git/configure 2010-07-14 16:50:45.897400059 +0100 | ||
| 40 | @@ -20,13 +20,14 @@ | ||
| 41 | # not a real configure script... | ||
| 42 | opt_prefix= | ||
| 43 | opt_suffix= | ||
| 44 | +opt_data= | ||
| 45 | opt_bits=32 | ||
| 46 | opt_sqlite=/usr | ||
| 47 | |||
| 48 | usage() | ||
| 49 | { | ||
| 50 | echo >&2 "usage:" | ||
| 51 | - echo >&2 " configure --prefix=... [--suffix=...] [--with-sqlite=...] [--bits=32|64]" | ||
| 52 | + echo >&2 " configure --prefix=... [--suffix=...] [--data=...] [--with-sqlite=...] [--bits=32|64]" | ||
| 53 | exit 1 | ||
| 54 | } | ||
| 55 | |||
| 56 | @@ -43,6 +44,9 @@ | ||
| 57 | --suffix=*) | ||
| 58 | opt_suffix=${arg#--suffix=} | ||
| 59 | ;; | ||
| 60 | + --data=*) | ||
| 61 | + opt_data=${arg#--data=} | ||
| 62 | + ;; | ||
| 63 | --bits=*) | ||
| 64 | opt_bits=${arg#--bits=} | ||
| 65 | case $opt_bits in | ||
| 66 | @@ -65,6 +69,7 @@ | ||
| 67 | sed -e ' | ||
| 68 | s,@PREFIX@,'"$opt_prefix"',g | ||
| 69 | s,@SUFFIX@,'"$opt_suffix"',g | ||
| 70 | + s,@DATA@,'"$opt_data"',g | ||
| 71 | s,@SQLITE@,'"$opt_sqlite"',g | ||
| 72 | s,@MARK64@,'"$opt_mark64"',g | ||
| 73 | s,@BITS@,'"$opt_bits"',g | ||
| 74 | Index: git/pseudo.c | ||
| 75 | =================================================================== | ||
| 76 | --- git.orig/pseudo.c 2010-03-25 17:57:24.000000000 +0000 | ||
| 77 | +++ git/pseudo.c 2010-07-14 16:50:45.898400595 +0100 | ||
| 78 | @@ -191,7 +191,7 @@ | ||
| 79 | pseudo_new_pid(); | ||
| 80 | |||
| 81 | pseudo_debug(3, "opening lock.\n"); | ||
| 82 | - lockname = pseudo_prefix_path(PSEUDO_LOCKFILE); | ||
| 83 | + lockname = strdup(PSEUDO_LOCKFILE); | ||
| 84 | if (!lockname) { | ||
| 85 | pseudo_diag("Couldn't allocate a file path.\n"); | ||
| 86 | exit(1); | ||
| 87 | Index: git/pseudo.h | ||
| 88 | =================================================================== | ||
| 89 | --- git.orig/pseudo.h 2010-03-25 17:57:24.000000000 +0000 | ||
| 90 | +++ git/pseudo.h 2010-07-14 16:50:45.899360463 +0100 | ||
| 91 | @@ -121,8 +121,7 @@ | ||
| 92 | |||
| 93 | extern char *pseudo_version; | ||
| 94 | |||
| 95 | -#define PSEUDO_DATA "var/pseudo/" | ||
| 96 | -#define PSEUDO_LOCKFILE PSEUDO_DATA "pseudo.lock" | ||
| 97 | -#define PSEUDO_LOGFILE PSEUDO_DATA "pseudo.log" | ||
| 98 | -#define PSEUDO_PIDFILE PSEUDO_DATA "pseudo.pid" | ||
| 99 | -#define PSEUDO_SOCKET PSEUDO_DATA "pseudo.socket" | ||
| 100 | +#define PSEUDO_LOCKFILE PSEUDO_DATA "/pseudo.lock" | ||
| 101 | +#define PSEUDO_LOGFILE PSEUDO_DATA "/pseudo.log" | ||
| 102 | +#define PSEUDO_PIDFILE PSEUDO_DATA "/pseudo.pid" | ||
| 103 | +#define PSEUDO_SOCKET PSEUDO_DATA "/pseudo.socket" | ||
| 104 | Index: git/pseudo_db.c | ||
| 105 | =================================================================== | ||
| 106 | --- git.orig/pseudo_db.c 2010-03-25 17:57:24.000000000 +0000 | ||
| 107 | +++ git/pseudo_db.c 2010-07-14 16:51:07.506464213 +0100 | ||
| 108 | @@ -458,11 +458,11 @@ | ||
| 109 | if (*db) | ||
| 110 | return 0; | ||
| 111 | if (db == &file_db) { | ||
| 112 | - dbfile = pseudo_prefix_path(PSEUDO_DATA "files.db"); | ||
| 113 | + dbfile = strdup(PSEUDO_DATA "/files.db"); | ||
| 114 | rc = sqlite3_open(dbfile, db); | ||
| 115 | free(dbfile); | ||
| 116 | } else { | ||
| 117 | - dbfile = pseudo_prefix_path(PSEUDO_DATA "logs.db"); | ||
| 118 | + dbfile = strdup(PSEUDO_DATA "/logs.db"); | ||
| 119 | rc = sqlite3_open(dbfile, db); | ||
| 120 | free(dbfile); | ||
| 121 | } | ||
| 122 | Index: git/pseudo_server.c | ||
| 123 | =================================================================== | ||
| 124 | --- git.orig/pseudo_server.c 2010-03-25 17:57:24.000000000 +0000 | ||
| 125 | +++ git/pseudo_server.c 2010-07-14 16:50:45.901462874 +0100 | ||
| 126 | @@ -101,9 +101,9 @@ | ||
| 127 | } | ||
| 128 | |||
| 129 | /* cd to the data directory */ | ||
| 130 | - pseudo_path = pseudo_prefix_path(PSEUDO_DATA); | ||
| 131 | + pseudo_path = strdup(PSEUDO_DATA); | ||
| 132 | if (!pseudo_path) { | ||
| 133 | - pseudo_diag("can't find prefix/%s directory.\n", PSEUDO_DATA); | ||
| 134 | + pseudo_diag("can't find %s directory.\n", PSEUDO_DATA); | ||
| 135 | return 1; | ||
| 136 | } | ||
| 137 | if (chdir(pseudo_path) == -1) { | ||
| 138 | @@ -132,9 +132,9 @@ | ||
| 139 | return 0; | ||
| 140 | } | ||
| 141 | setsid(); | ||
| 142 | - pseudo_path = pseudo_prefix_path(PSEUDO_PIDFILE); | ||
| 143 | + pseudo_path = strdup(PSEUDO_PIDFILE); | ||
| 144 | if (!pseudo_path) { | ||
| 145 | - pseudo_diag("Couldn't get path for prefix/%s\n", PSEUDO_PIDFILE); | ||
| 146 | + pseudo_diag("Couldn't get path for %s\n", PSEUDO_PIDFILE); | ||
| 147 | return 1; | ||
| 148 | } | ||
| 149 | fp = fopen(pseudo_path, "w"); | ||
| 150 | @@ -152,9 +152,9 @@ | ||
| 151 | pseudo_new_pid(); | ||
| 152 | fclose(stdin); | ||
| 153 | fclose(stdout); | ||
| 154 | - pseudo_path = pseudo_prefix_path(PSEUDO_LOGFILE); | ||
| 155 | + pseudo_path = strdup(PSEUDO_LOGFILE); | ||
| 156 | if (!pseudo_path) { | ||
| 157 | - pseudo_diag("can't get path for prefix/%s\n", PSEUDO_LOGFILE); | ||
| 158 | + pseudo_diag("can't get path for %s\n", PSEUDO_LOGFILE); | ||
| 159 | return 1; | ||
| 160 | } | ||
| 161 | 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 @@ | |||
| 1 | DESCRIPTION = "Pseudo gives fake root capabilities to a normal user" | 1 | DESCRIPTION = "Pseudo gives fake root capabilities to a normal user" |
| 2 | HOMEPAGE = "http://wiki.github.com/wrpseudo/pseudo/" | ||
| 3 | LIC_FILES_CHKSUM = "file://COPYING;md5=243b725d71bb5df4a1e5920b344b86ad" | ||
| 2 | SECTION = "base" | 4 | SECTION = "base" |
| 3 | LICENSE = "LGPL2.1" | 5 | LICENSE = "LGPL2.1" |
| 4 | DEPENDS = "sqlite3" | 6 | DEPENDS = "sqlite3" |
| 5 | 7 | ||
| 6 | PV = "0.0+git${SRCPV}" | 8 | PV = "0.0+git${SRCPV}" |
| 7 | PR = "r3" | 9 | PR = "r4" |
| 8 | 10 | ||
| 9 | SRC_URI = "git://github.com/wrpseudo/pseudo.git;protocol=git \ | 11 | SRC_URI = "git://github.com/wrpseudo/pseudo.git;protocol=git \ |
| 10 | file://tweakflags.patch;patch=1" | 12 | file://tweakflags.patch \ |
| 13 | file://path-munge.patch \ | ||
| 14 | file://ld_sacredness.patch" | ||
| 15 | |||
| 16 | FILES_${PN} = "${libdir}/libpseudo.so ${bindir}/* ${localstatedir}/pseudo" | ||
| 17 | PROVIDES += "virtual/fakeroot" | ||
| 11 | 18 | ||
| 12 | S = "${WORKDIR}/git" | 19 | S = "${WORKDIR}/git" |
| 13 | 20 | ||
| 14 | inherit siteinfo | 21 | inherit siteinfo |
| 15 | 22 | ||
| 16 | do_configure () { | 23 | do_configure () { |
| 17 | ${S}/configure --prefix=${prefix} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --bits=${SITEINFO_BITS} | 24 | ${S}/configure --prefix=${prefix} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --bits=${SITEINFO_BITS} --data=${localstatedir} |
| 18 | } | 25 | } |
| 19 | 26 | ||
| 20 | do_install() { | 27 | do_install () { |
| 21 | oe_runmake 'DESTDIR=${D}' install | 28 | oe_runmake 'DESTDIR=${D}' install |
| 22 | } | 29 | } |
| 23 | 30 | ||
