Directory maintenance

- rearrange obsolete build scripts
- rearrange working build scripts
- add build / devel scripts I use
- add existing development tests (bloom filter, message encoding, thread
  interrupts)
- add directory descriptions
master
Peter Šurda 6 years ago
parent 7ca6576dfc
commit 3033520995
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
  1. 2
      build/README.md
  2. 16
      build/changelang.sh
  3. 0
      build/compiletest.py
  4. 11
      build/mergepullrequest.sh
  5. 0
      build/osx.sh
  6. 22
      build/updatetranslations.sh
  7. 3
      dev/README.md
  8. 60
      dev/bloomfiltertest.py
  9. 27
      dev/msgtest.py
  10. 49
      dev/powinterrupttest.py
  11. 36
      packages/README.md
  12. 0
      packages/pyinstaller/bitmessagemain.spec
  13. 0
      packages/unmaintained/Makefile
  14. 0
      packages/unmaintained/arch.sh
  15. 0
      packages/unmaintained/archpackage/PKGBUILD
  16. 0
      packages/unmaintained/debian.sh
  17. 0
      packages/unmaintained/debian/changelog
  18. 0
      packages/unmaintained/debian/compat
  19. 0
      packages/unmaintained/debian/control
  20. 0
      packages/unmaintained/debian/copyright
  21. 0
      packages/unmaintained/debian/docs
  22. 0
      packages/unmaintained/debian/manpages
  23. 0
      packages/unmaintained/debian/pybm
  24. 0
      packages/unmaintained/debian/rules
  25. 0
      packages/unmaintained/debian/source/format
  26. 0
      packages/unmaintained/debian/source/include-binaries
  27. 0
      packages/unmaintained/ebuild.sh
  28. 0
      packages/unmaintained/generate.sh
  29. 0
      packages/unmaintained/puppy.sh
  30. 0
      packages/unmaintained/puppypackage/icon14.xpm
  31. 0
      packages/unmaintained/puppypackage/pybitmessage-0.3.5.pet.specs
  32. 0
      packages/unmaintained/rpm.sh
  33. 0
      packages/unmaintained/rpmpackage/pybitmessage.spec
  34. 0
      packages/unmaintained/slack.sh
  35. 0
      packages/unmaintained/slackpackage/doinst.sh
  36. 0
      packages/unmaintained/slackpackage/slack-desc
  37. 0
      packages/upstart/bitmessage.conf

@ -0,0 +1,2 @@
This directory contains scripts that are helpful for developers when building
or maintaining PyBitmessage.

@ -0,0 +1,16 @@
export LANG=de_DE.UTF-8
export LANGUAGE=de_DE
export LC_CTYPE="de_DE.UTF-8"
export LC_NUMERIC=de_DE.UTF-8
export LC_TIME=de_DE.UTF-8
export LC_COLLATE="de_DE.UTF-8"
export LC_MONETARY=de_DE.UTF-8
export LC_MESSAGES="de_DE.UTF-8"
export LC_PAPER=de_DE.UTF-8
export LC_NAME=de_DE.UTF-8
export LC_ADDRESS=de_DE.UTF-8
export LC_TELEPHONE=de_DE.UTF-8
export LC_MEASUREMENT=de_DE.UTF-8
export LC_IDENTIFICATION=de_DE.UTF-8
export LC_ALL=
python2.7 src/bitmessagemain.py

@ -0,0 +1,11 @@
#!/bin/bash
if [ -z "$1" ]; then
echo "You must specify pull request number"
exit
fi
git pull
git checkout v0.6
git fetch origin pull/"$1"/head:"$1"
git merge --ff-only "$1"

@ -0,0 +1,22 @@
#!/bin/bash
if [ ! -f "$1" ]; then
echo "$1 not found, please specify the file name for source"
exit
fi
srcdir=`mktemp -d`
unzip "$1" -d $srcdir
for i in $srcdir/*ts; do
o=`basename $i|cut -b3-`
o="${o,,}"
o="${o//@/_}"
echo "$i -> $o"
mv "$i" "$HOME/src/PyBitmessage/src/translations/$o"
done
rm -rf -- $srcdir
lrelease-qt4 "$HOME/src/PyBitmessage/src/translations/bitmessage.pro"

@ -0,0 +1,3 @@
This directory contains code for future features, but it's not integrated into
PyBitmessage and may not work at all. Developers can look at it if they are
interested.

@ -0,0 +1,60 @@
from math import ceil
from os import stat, getenv, path
from pybloom import BloomFilter as BloomFilter1
from pybloomfilter import BloomFilter as BloomFilter2
import sqlite3
from time import time
# Ubuntu: apt-get install python-pybloomfiltermmap
conn = sqlite3.connect(path.join(getenv("HOME"), '.config/PyBitmessage/messages.dat'))
conn.text_factory = str
cur = conn.cursor()
rawlen = 0
itemcount = 0
cur.execute('''SELECT COUNT(hash) FROM inventory''')
for row in cur.fetchall():
itemcount = row[0]
filtersize = 1000 * (int(itemcount / 1000) + 1)
errorrate = 1.0 / 1000.0
bf1 = BloomFilter1(capacity=filtersize, error_rate=errorrate)
bf2 = BloomFilter2(capacity=filtersize, error_rate=errorrate)
item = '''SELECT hash FROM inventory'''
cur.execute(item, '')
bf1time = 0
bf2time = 0
for row in cur.fetchall():
rawlen += len(row[0])
try:
times = [time()]
bf1.add(row[0])
times.append(time())
bf2.add(row[0])
times.append(time())
bf1time += times[1] - times[0]
bf2time += times[2] - times[1]
except IndexError:
pass
#f = open("/home/shurdeek/tmp/bloom.dat", "wb")
#sb1.tofile(f)
#f.close()
print "Item count: %i" % (itemcount)
print "Raw length: %i" % (rawlen)
print "Bloom filter 1 length: %i, reduction to: %.2f%%" % \
(bf1.bitarray.buffer_info()[1],
100.0 * bf1.bitarray.buffer_info()[1] / rawlen)
print "Bloom filter 1 capacity: %i and error rate: %.3f%%" % (bf1.capacity, 100.0 * bf1.error_rate)
print "Bloom filter 1 took %.2fs" % (bf1time)
print "Bloom filter 2 length: %i, reduction to: %.3f%%" % \
(bf2.num_bits / 8,
100.0 * bf2.num_bits / 8 / rawlen)
print "Bloom filter 2 capacity: %i and error rate: %.3f%%" % (bf2.capacity, 100.0 * bf2.error_rate)
print "Bloom filter 2 took %.2fs" % (bf2time)

@ -0,0 +1,27 @@
import importlib
from os import listdir, path
from pprint import pprint
import sys
import traceback
data = {"": "message", "subject": "subject", "body": "body"}
#data = {"": "vote", "msgid": "msgid"}
#data = {"fsck": 1}
import messagetypes
if __name__ == '__main__':
try:
msgType = data[""]
except KeyError:
print "Message type missing"
sys.exit(1)
else:
print "Message type: %s" % (msgType)
msgObj = messagetypes.constructObject(data)
if msgObj is None:
sys.exit(1)
try:
msgObj.process()
except:
pprint(sys.exc_info())

@ -0,0 +1,49 @@
import ctypes
import hashlib
from multiprocessing import current_process
import os
import signal
from struct import unpack, pack
from threading import current_thread
shutdown = 0
def signal_handler(signal, frame):
global shutdown
print "Got signal %i in %s/%s" % (signal, current_process().name, current_thread().name)
if current_process().name != "MainProcess":
raise StopIteration("Interrupted")
if current_thread().name != "MainThread":
return
shutdown = 1
def _doCPoW(target, initialHash):
# global shutdown
h = initialHash
m = target
out_h = ctypes.pointer(ctypes.create_string_buffer(h, 64))
out_m = ctypes.c_ulonglong(m)
print "C PoW start"
for c in range(0, 200000):
print "Iter: %i" % (c)
nonce = bmpow(out_h, out_m)
if shutdown:
break
trialValue, = unpack('>Q', hashlib.sha512(hashlib.sha512(pack('>Q', nonce) + initialHash).digest()).digest()[0:8])
if shutdown != 0:
raise StopIteration("Interrupted")
print "C PoW done"
return [trialValue, nonce]
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
bso = ctypes.CDLL(os.path.join("bitmsghash", "bitmsghash.so"))
bmpow = bso.BitmessagePOW
bmpow.restype = ctypes.c_ulonglong
_doCPoW(2**44, "")

@ -0,0 +1,36 @@
The `generate.sh` script is obsolete, but is included for historical reasons.
Maintained packages can be obtained:
Windows:
========
https://github.com/Bitmessage/PyBitmessage/releases
Works on Windows XP or higher.
OSX:
====
https://github.com/Bitmessage/PyBitmessage/releases
Wors on OSX 10.7.5 or higher
Arch linux:
===========
Releases matching PyBitmessage releases:
https://aur.archlinux.org/packages/pybitmessage-git/
Development snapshot equivalent to the v0.6 git branch:
https://aur.archlinux.org/packages/pybitmessage-dev-git/
FreeBSD:
========
Use the FreeBSD ports.
Loading…
Cancel
Save