generic-poky/meta/packages/pseudo/pseudo/path-munge.patch

160 lines
5.1 KiB
Diff

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;