summaryrefslogtreecommitdiffstats
path: root/meta/packages/pseudo/pseudo/path-munge.patch
blob: 2ccdea17ea48eda9510804456c0a7ad87535807e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
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;