Gentoo Archives: gentoo-commits

From: "Anthony G. Basile (blueness)" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-p2p/primecoind/files: primecoin.service primecoin.conf primecoin-sys_leveldb.patch primecoin.confd primecoind.logrotate primecoin.initd
Date: Sun, 01 Dec 2013 15:20:53
Message-Id: 20131201152047.054122004B@flycatcher.gentoo.org
1 blueness 13/12/01 15:20:46
2
3 Added: primecoin.service primecoin.conf
4 primecoin-sys_leveldb.patch primecoin.confd
5 primecoind.logrotate primecoin.initd
6 Log:
7 Initial commit
8
9 (Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key 0xF52D4BBA)
10
11 Revision Changes Path
12 1.1 net-p2p/primecoind/files/primecoin.service
13
14 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/primecoind/files/primecoin.service?rev=1.1&view=markup
15 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/primecoind/files/primecoin.service?rev=1.1&content-type=text/plain
16
17 Index: primecoin.service
18 ===================================================================
19 # It's not recommended to modify this file in-place, because it will be
20 # overwritten during package upgrades. If you want to customize, the
21 # best way is to create file
22 # "/etc/systemd/system/primecoind.service.d/*.conf"
23 # containing your changes
24
25 # For example, if you want to change some daemon and/or unit options,
26 # create a file named
27 # "/etc/systemd/system/primecoind.service.d/myopts.conf"
28 # containing:
29 # [Service]
30 # Environment="PRIMECOIN_OPTS=-debug -logtimestamps"
31 # Nice=10
32 # This will override the setting appearing below.
33
34 # Note that almost all daemon options could be specified in
35 # /etc/primecoin/primecoin.conf
36
37 [Unit]
38 Description=Primecoin Daemon
39 After=network.target
40
41 [Service]
42 User=primecoin
43 Environment=PRIMECOIN_OPTS=
44 ExecStart=/usr/bin/primecoind -daemon=0 $PRIMECOIN_OPTS
45 ExecReload=/bin/kill -HUP $MAINPID
46
47 [Install]
48 WantedBy=multi-user.target
49
50
51
52 1.1 net-p2p/primecoind/files/primecoin.conf
53
54 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/primecoind/files/primecoin.conf?rev=1.1&view=markup
55 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/primecoind/files/primecoin.conf?rev=1.1&content-type=text/plain
56
57 Index: primecoin.conf
58 ===================================================================
59 # http://www.bitcoin.org/smf/index.php?topic=644.0
60 #rpcuser=
61 #rpcpassword=
62
63
64
65
66
67
68
69
70 1.1 net-p2p/primecoind/files/primecoin-sys_leveldb.patch
71
72 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/primecoind/files/primecoin-sys_leveldb.patch?rev=1.1&view=markup
73 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/primecoind/files/primecoin-sys_leveldb.patch?rev=1.1&content-type=text/plain
74
75 Index: primecoin-sys_leveldb.patch
76 ===================================================================
77 diff -Naur primecoin-0.1.2-linux.orig/src/bitcoin-qt.pro primecoin-0.1.2-linux/src/bitcoin-qt.pro
78 --- primecoin-0.1.2-linux.orig/src/bitcoin-qt.pro 2013-08-05 08:37:14.000000000 -0400
79 +++ primecoin-0.1.2-linux/src/bitcoin-qt.pro 2013-11-30 16:39:48.464770389 -0500
80 @@ -4,7 +4,7 @@
81 VERSION = 0.8.3
82 INCLUDEPATH += src src/json src/qt
83 QT += network
84 -DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE
85 +DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE LEVELDB_WITHOUT_MEMENV
86 CONFIG += no_include_pwd
87 CONFIG += thread
88
89 @@ -98,25 +98,29 @@
90 QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs qtaccessiblewidgets
91 }
92
93 +contains(USE_SYSTEM_LEVELDB, 1) {
94 + LIBS += -lleveldb
95 +} else {
96 INCLUDEPATH += src/leveldb/include src/leveldb/helpers
97 -LIBS += $$PWD/src/leveldb/libleveldb.a $$PWD/src/leveldb/libmemenv.a
98 +LIBS += $$PWD/src/leveldb/libleveldb.a
99 !win32 {
100 # we use QMAKE_CXXFLAGS_RELEASE even without RELEASE=1 because we use RELEASE to indicate linking preferences not -O preferences
101 - genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a
102 + genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a
103 } else {
104 # make an educated guess about what the ranlib command is called
105 isEmpty(QMAKE_RANLIB) {
106 QMAKE_RANLIB = $$replace(QMAKE_STRIP, strip, ranlib)
107 }
108 LIBS += -lshlwapi
109 - genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libmemenv.a
110 + genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a
111 }
112 genleveldb.target = $$PWD/src/leveldb/libleveldb.a
113 genleveldb.depends = FORCE
114 PRE_TARGETDEPS += $$PWD/src/leveldb/libleveldb.a
115 QMAKE_EXTRA_TARGETS += genleveldb
116 +}
117 # Gross ugly hack that depends on qmake internals, unfortunately there is no other way to do it.
118 -QMAKE_CLEAN += $$PWD/src/leveldb/libleveldb.a; cd $$PWD/src/leveldb ; $(MAKE) clean
119 +QMAKE_CLEAN += $$PWD/src/leveldb/libleveldb.a; cd $$PWD/src/leveldb && $(MAKE) clean || true
120
121 # regenerate src/build.h
122 !win32|contains(USE_BUILD_INFO, 1) {
123 diff -Naur primecoin-0.1.2-linux.orig/src/src/leveldb.cpp primecoin-0.1.2-linux/src/src/leveldb.cpp
124 --- primecoin-0.1.2-linux.orig/src/src/leveldb.cpp 2013-08-05 08:37:20.000000000 -0400
125 +++ primecoin-0.1.2-linux/src/src/leveldb.cpp 2013-11-30 16:41:25.632773774 -0500
126 @@ -8,7 +8,9 @@
127 #include <leveldb/env.h>
128 #include <leveldb/cache.h>
129 #include <leveldb/filter_policy.h>
130 -#include <memenv/memenv.h>
131 +#ifndef LEVELDB_WITHOUT_MEMENV
132 +#include <memenv.h>
133 +#endif
134
135 #include <boost/filesystem.hpp>
136
137 @@ -43,8 +45,12 @@
138 options = GetOptions(nCacheSize);
139 options.create_if_missing = true;
140 if (fMemory) {
141 +#ifndef LEVELDB_WITHOUT_MEMENV
142 penv = leveldb::NewMemEnv(leveldb::Env::Default());
143 options.env = penv;
144 +#else
145 + throw std::runtime_error("CLevelDB(): compiled without memenv support");
146 +#endif
147 } else {
148 if (fWipe) {
149 printf("Wiping LevelDB in %s\n", path.string().c_str());
150 diff -Naur primecoin-0.1.2-linux.orig/src/src/makefile.unix primecoin-0.1.2-linux/src/src/makefile.unix
151 --- primecoin-0.1.2-linux.orig/src/src/makefile.unix 2013-08-05 08:37:21.000000000 -0400
152 +++ primecoin-0.1.2-linux/src/src/makefile.unix 2013-11-30 17:20:06.545854617 -0500
153 @@ -111,8 +111,7 @@
154 # adds some defaults in front. Unfortunately, LDFLAGS=... $(LDFLAGS) does not work.
155 xLDFLAGS=$(LDHARDENING) $(LDFLAGS)
156
157 -OBJS= \
158 - leveldb/libleveldb.a \
159 +BASEOBJS := \
160 obj/alert.o \
161 obj/version.o \
162 obj/checkpoints.o \
163 @@ -121,7 +120,6 @@
164 obj/crypter.o \
165 obj/key.o \
166 obj/db.o \
167 - obj/init.o \
168 obj/keystore.o \
169 obj/main.o \
170 obj/net.o \
171 @@ -141,25 +139,44 @@
172 obj/hash.o \
173 obj/bloom.o \
174 obj/noui.o \
175 - obj/leveldb.o \
176 obj/txdb.o \
177 obj/prime.o \
178 obj/checkpointsync.o
179
180 +OBJS := \
181 + obj/leveldb.o \
182 + obj/init.o \
183 + $(BASEOBJS)
184 +
185 +TESTOBJS := \
186 + obj-test/leveldb.o \
187 + $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) \
188 + $(BASEOBJS)
189 +
190 all: primecoind
191
192 test check: test_primecoin FORCE
193 ./test_primecoin
194
195 +ifdef USE_SYSTEM_LEVELDB
196 + LIBS += -lleveldb
197 + TESTLIBS += -lmemenv
198 +else
199 #
200 # LevelDB support
201 #
202 MAKEOVERRIDES =
203 -LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a
204 +LIBS += $(CURDIR)/leveldb/libleveldb.a
205 +TESTLIBS += $(CURDIR)/leveldb/libmemenv.a
206 DEFS += $(addprefix -I,$(CURDIR)/leveldb/include)
207 DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
208 leveldb/libleveldb.a:
209 - @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a libmemenv.a && cd ..
210 + @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a && cd ..
211 +leveldb/libmemenv.a:
212 + @echo "Building LevelDB memenv ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libmemenv.a && cd ..
213 +OBJS += leveldb/libleveldb.a
214 +TESTOBJS += leveldb/libmemenv.a
215 +endif
216
217 # auto-generated dependencies:
218 -include obj/*.P
219 @@ -170,24 +187,22 @@
220 version.cpp: obj/build.h
221 DEFS += -DHAVE_BUILD_INFO
222
223 -obj/%.o: %.cpp
224 - $(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
225 +P_TO_D = \
226 @cp $(@:%.o=%.d) $(@:%.o=%.P); \
227 - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
228 + sed -e 's/\#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
229 -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
230 rm -f $(@:%.o=%.d)
231
232 -primecoind: $(OBJS:obj/%=obj/%)
233 - $(LINK) $(xCXXFLAGS) -o $@ $^ $(xLDFLAGS) $(LIBS)
234 +obj/%.o: %.cpp
235 + $(CXX) -c $(xCXXFLAGS) -DLEVELDB_WITHOUT_MEMENV -MMD -MF $(@:%.o=%.d) -o $@ $<
236 + $(P_TO_D)
237
238 -TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))
239 +primecoind: $(OBJS)
240 + $(LINK) $(xCXXFLAGS) -o $@ $^ $(xLDFLAGS) $(LIBS)
241
242 obj-test/%.o: test/%.cpp
243 - $(CXX) -c $(TESTDEFS) $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
244 - @cp $(@:%.o=%.d) $(@:%.o=%.P); \
245 - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
246 - -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
247 - rm -f $(@:%.o=%.d)
248 + $(CXX) -c $(xCXXFLAGS) -DLEVELDB_WITHOUT_MEMENV -MMD -MF $(@:%.o=%.d) -o $@ $<
249 + $(P_TO_D)
250
251 test_primecoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
252 $(LINK) $(xCXXFLAGS) -o $@ $(LIBPATHS) $^ $(TESTLIBS) $(xLDFLAGS) $(LIBS)
253
254
255
256 1.1 net-p2p/primecoind/files/primecoin.confd
257
258 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/primecoind/files/primecoin.confd?rev=1.1&view=markup
259 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/primecoind/files/primecoin.confd?rev=1.1&content-type=text/plain
260
261 Index: primecoin.confd
262 ===================================================================
263 # Config file for /etc/init.d/primecoind
264
265 # owner of primeciond process (don't change, must be existing)
266 PRIMECOIN_USER="primecoin"
267
268 # See http://www.bitcoin.org/smf/index.php?topic=1063
269 PRIMECOIN_OPTS="${PRIMECOIN_OPTS}"
270
271 # nice level
272 NICELEVEL="19"
273
274
275
276 1.1 net-p2p/primecoind/files/primecoind.logrotate
277
278 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/primecoind/files/primecoind.logrotate?rev=1.1&view=markup
279 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/primecoind/files/primecoind.logrotate?rev=1.1&content-type=text/plain
280
281 Index: primecoind.logrotate
282 ===================================================================
283 /var/lib/primecoin/.primecoin/debug.log {
284 weekly
285 sharedscripts
286 postrotate
287 killall -HUP primecoind
288 endscript
289 }
290
291
292
293 1.1 net-p2p/primecoind/files/primecoin.initd
294
295 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/primecoind/files/primecoin.initd?rev=1.1&view=markup
296 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/primecoind/files/primecoin.initd?rev=1.1&content-type=text/plain
297
298 Index: primecoin.initd
299 ===================================================================
300 #!/sbin/runscript
301 # Distributed under the terms of the GNU General Public License, v2 or later
302
303 VARDIR="/var/lib/primecoin"
304 CONFFILE="${VARDIR}/.primecoin/primecoin.conf"
305
306 depend() {
307 need net
308 }
309
310 checkconfig() {
311 if [[ "${PRIMECOIN_USER}" == "" ]] ; then
312 eerror "Please edit /etc/conf.d/primecoind"
313 eerror "A user must be specified to run primecoind as that user."
314 eerror "Modify USER to your needs (you may also add a group after a colon)"
315 return 1
316 fi
317 if ! `getent passwd | cut -d ':' -f 1 | grep $( echo "${PRIMECOIN_USER}" | cut -d ':' -f 1 ) -sq` ; then
318 eerror "Please edit /etc/conf.d/primecoind"
319 eerror "Specified user must exist!"
320 return 1
321 fi
322 if `echo "${PRIMECOIN_USER}" | grep ':' -sq` ; then
323 if ! `cut -d ':' -f 1 /etc/group | grep $( echo "${PRIMECOIN_USER}" | cut -d ':' -f 2 ) -sq` ; then
324 eerror "Please edit /etc/conf.d/primecoind"
325 eerror "Specified group must exist!"
326 return 1
327 fi
328 fi
329 if ! grep -q '^rpcpassword=' "${CONFFILE}"; then
330 eerror "Please edit `readlink -f ${CONFFILE}`"
331 eerror "There must be at least a line assigning rpcpassword=something-secure"
332 return 1
333 fi
334 if ! stat -Lc '%a' "${CONFFILE}" | grep -q '^[4567]00$'; then
335 eerror "`readlink -f ${CONFFILE}` should not be readable by other users"
336 return 1
337 fi
338 return 0
339 }
340
341 start() {
342 checkconfig || return 1
343 ebegin "Starting Primecoind daemon"
344
345 pkg-config openrc
346 if [ $? = 0 ]; then
347 start_openrc
348 else
349 start_baselayout
350 fi
351 }
352
353 stop() {
354 ebegin "Stopping Primecoin daemon"
355
356 pkg-config openrc
357 if [ $? = 0 ]; then
358 stop_openrc
359 else
360 stop_baselayout
361 fi
362 }
363
364 start_openrc() {
365 start-stop-daemon \
366 --start --user "${PRIMECOIN_USER}" --name primecoind \
367 --pidfile /var/run/primecoind.pid --make-pidfile \
368 --env HOME="${VARDIR}" --exec /usr/bin/primecoind \
369 --nicelevel "${NICELEVEL}" \
370 --background \
371 --wait 2000 \
372 -- ${PRIMECOIN_OPTS}
373 eend $?
374 }
375
376 stop_openrc() {
377 start-stop-daemon --stop --user "${PRIMECOIN_USER}" \
378 --name primecoind --pidfile /var/run/primecoind.pid \
379 --wait 30000 \
380 --progress
381 eend $?
382 }
383
384 start_baselayout() {
385 start-stop-daemon \
386 --start --user "${PRIMECOIN_USER}" --name primecoind \
387 --pidfile /var/run/primecoind.pid --make-pidfile \
388 --env HOME="${VARDIR}" --exec /usr/bin/primecoind \
389 --chuid "${PRIMECOIN_USER}" \
390 --nicelevel "${NICELEVEL}" \
391 --background \
392 -- ${PRIMECOIN_OPTS}
393 eend $?
394 }
395
396 stop_baselayout() {
397 start-stop-daemon \
398 --stop \
399 --user "${PRIMECOIN_USER}" \
400 --name primecoind \
401 --pidfile /var/run/primecoind.pid
402 eend $?
403 }