Merge lp:~andrea.corbellini/beeseek/cross-platform-setup into lp:beeseek/1.0

Proposed by Andrea Corbellini
Status: Merged
Approved by: Andrea Corbellini
Approved revision: 301
Merged at revision: not available
Proposed branch: lp:~andrea.corbellini/beeseek/cross-platform-setup
Merge into: lp:beeseek/1.0
Diff against target: None lines
To merge this branch: bzr merge lp:~andrea.corbellini/beeseek/cross-platform-setup
Reviewer Review Type Date Requested Status
Andrea Corbellini Approve
Daniele Napolitano (community) Needs Fixing
Review via email: mp+8764@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Andrea Corbellini (andrea.corbellini) wrote :

This branch drastically improves the support for the directory structure of Windows.
The changed parts are the BeeSeek code and the setup script. Now the default values for the paths are calculated depending on the operating system.

If possible, we should do proper tests on a Windows machine before the beta 3 milestone, so I'm putting this branch on the review queue.

301. By Andrea Corbellini

Merge with trunk.

Revision history for this message
Daniele Napolitano (dnax88) :
review: Needs Fixing
Revision history for this message
Daniele Napolitano (dnax88) wrote :

After ~2 sec beeseek-peer crash.

$ beeseek-peer start --user dnax --debug
PeerSession: Starting up...
PeerSession:DEBUG: Lock file created at /var/lock/beeseek-peer.pid
PeerSession: Session started with arguments
'/usr/local/bin/beeseek-peer start --user dnax --debug'
PeerSession: Bound address localhost:8080
PeerSession: Bound address localhost:4096
PeerSession: Running as user dnax
PeerSession: Bound address /var/lock/beeseek-peer.sock
PeerSession: Database connected
Traceback (most recent call last):
 File "/usr/local/bin/beeseek-peer", line 21, in <module>
   PeerSession()
 File "/usr/local/lib/python2.6/dist-packages/beeseek/app/session.py",
line 278, in __init__
   self.run(arguments)
 File "/usr/local/lib/python2.6/dist-packages/beeseek/app/session.py",
line 308, in run
   command_obj(self, *arguments)
 File "/usr/local/lib/python2.6/dist-packages/beeseek/app/session.py",
line 559, in start
   self.setup()
 File "/usr/local/lib/python2.6/dist-packages/beeseek/app/peer/main.py",
line 74, in setup
   server.greet()
 File "/usr/local/lib/python2.6/dist-packages/beeseek/web/protocols/bsnp.py",
line 90, in greet
   self._recv_greeting(2)
 File "/usr/local/lib/python2.6/dist-packages/beeseek/web/protocols/bsnp.py",
line 75, in _recv_greeting
   raise NotImplementedError
NotImplementedError
PeerSession:ERROR: Daemon not started

review: Needs Fixing
Revision history for this message
Andrea Corbellini (andrea.corbellini) wrote :

The error that you are experiencing is not related to the setup script. You are seeing it because the version of the server running on beeseek.org is different by your local instance.

However it seems that everything was installed fine, so I'm approving and merging this branch.

Thank you very much for the log, Daniele! :)

> After ~2 sec beeseek-peer crash.
>
> $ beeseek-peer start --user dnax --debug
> PeerSession: Starting up...
> PeerSession:DEBUG: Lock file created at /var/lock/beeseek-peer.pid
> PeerSession: Session started with arguments
> '/usr/local/bin/beeseek-peer start --user dnax --debug'
> PeerSession: Bound address localhost:8080
> PeerSession: Bound address localhost:4096
> PeerSession: Running as user dnax
> PeerSession: Bound address /var/lock/beeseek-peer.sock
> PeerSession: Database connected
> Traceback (most recent call last):
> File "/usr/local/bin/beeseek-peer", line 21, in <module>
> PeerSession()
> File "/usr/local/lib/python2.6/dist-packages/beeseek/app/session.py",
> line 278, in __init__
> self.run(arguments)
> File "/usr/local/lib/python2.6/dist-packages/beeseek/app/session.py",
> line 308, in run
> command_obj(self, *arguments)
> File "/usr/local/lib/python2.6/dist-packages/beeseek/app/session.py",
> line 559, in start
> self.setup()
> File "/usr/local/lib/python2.6/dist-packages/beeseek/app/peer/main.py",
> line 74, in setup
> server.greet()
> File "/usr/local/lib/python2.6/dist-packages/beeseek/web/protocols/bsnp.py",
> line 90, in greet
> self._recv_greeting(2)
> File "/usr/local/lib/python2.6/dist-packages/beeseek/web/protocols/bsnp.py",
> line 75, in _recv_greeting
> raise NotImplementedError
> NotImplementedError
> PeerSession:ERROR: Daemon not started

review: Approve
302. By Andrea Corbellini

Merge with trunk.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'beeseek/app/directory.py'
--- beeseek/app/directory.py 2009-07-09 11:37:49 +0000
+++ beeseek/app/directory.py 2009-07-14 16:07:24 +0000
@@ -15,24 +15,37 @@
1515
16import os16import os
17import stat17import stat
18import sys
18import tempfile19import tempfile
1920
2021
21tempdirs = tempfile._candidate_tempdir_list()22lockdirs = tempfile._candidate_tempdir_list()
23if os.name != 'nt':
24 lockdirs.insert(0, '/var/lock')
2225
23class Directory(object):26class Directory(object):
2427
25 __slots__ = 'dirlist', '_mode', '_subdirs', '_directory', '_create'28 __slots__ = 'dirlist', '_mode', '_subdirs', '_directory', '_create'
2629
27 def __init__(self, dirlist, **kwargs):30 def __init__(self, dirlist, mode='rw', subdirs=(), create=False,
31 adjust=False):
28 if isinstance(dirlist, basestring):32 if isinstance(dirlist, basestring):
29 dirlist = (dirlist,)33 dirlist = (dirlist,)
34 if adjust and os.name == 'nt':
35 dirlist = self._adjust_for_win(dirlist)
30 self.dirlist = tuple(os.path.normcase(os.path.abspath(36 self.dirlist = tuple(os.path.normcase(os.path.abspath(
31 os.path.expanduser(directory)))37 os.path.expanduser(directory)))
32 for directory in dirlist)38 for directory in dirlist)
33 self._mode = kwargs.get('mode', 'rw')39 self._mode = mode
34 self._subdirs = kwargs.get('subdirs', ())40 self._subdirs = subdirs
35 self._create = kwargs.get('create', ())41 self._create = create
42
43 def _adjust_for_win(self, dirlist):
44 basepath = os.path.dirname(sys.executable)
45 for directory in dirlist:
46 yield os.path.join(basepath,
47 'BeeSeek',
48 os.path.basename(directory))
3649
37 def _check_permissions(self, directory):50 def _check_permissions(self, directory):
38 strmode = self._mode51 strmode = self._mode
@@ -41,7 +54,6 @@
41 stat_result = os.stat(directory)54 stat_result = os.stat(directory)
42 usermode = groupmode = othermode = 055 usermode = groupmode = othermode = 0
4356
44 # _issuitable() should be called rarely so we can use hasattr() here
45 if not hasattr(os, 'getuid') or stat_result.st_uid == os.getuid():57 if not hasattr(os, 'getuid') or stat_result.st_uid == os.getuid():
46 if 'r' in strmode:58 if 'r' in strmode:
47 usermode = stat.S_IXUSR59 usermode = stat.S_IXUSR
4860
=== modified file 'beeseek/app/options.py'
--- beeseek/app/options.py 2009-07-11 12:46:12 +0000
+++ beeseek/app/options.py 2009-07-14 16:10:16 +0000
@@ -15,7 +15,7 @@
1515
16import os16import os
17from beeseek.app import instance17from beeseek.app import instance
18from beeseek.app.directory import Directory, tempdirs18from beeseek.app.directory import Directory, lockdirs
19from beeseek.ui import BaseUserInterface, html19from beeseek.ui import BaseUserInterface, html
20from beeseek.interface import Interface, implements20from beeseek.interface import Interface, implements
2121
@@ -212,7 +212,7 @@
212 lockdir = Option(Directory, 'LockDirectory',212 lockdir = Option(Directory, 'LockDirectory',
213 ('-L', '--lock-dir'), None,213 ('-L', '--lock-dir'), None,
214 'The directory for lock files.',214 'The directory for lock files.',
215 default=['/var/lock'] + tempdirs,215 default=lockdirs,
216 convert_default=True)216 convert_default=True)
217217
218 user = Option(str, 'User',218 user = Option(str, 'User',
@@ -235,7 +235,8 @@
235 convert_kwargs={235 convert_kwargs={
236 'subdirs': ('keywords', 'pages', 'configuration',236 'subdirs': ('keywords', 'pages', 'configuration',
237 'statistics', 'keys', 'needed-results'),237 'statistics', 'keys', 'needed-results'),
238 'create': True})238 'create': True,
239 'adjust': True})
239240
240 daemon = Option(bool, 'Daemon',241 daemon = Option(bool, 'Daemon',
241 ('-b', '--daemon'), ('-f', '--foreground'),242 ('-b', '--daemon'), ('-f', '--foreground'),
@@ -254,7 +255,9 @@
254 testing_default='webdata',255 testing_default='webdata',
255 convert_default=True,256 convert_default=True,
256 convert_kwargs={257 convert_kwargs={
257 'mode': 'r', 'subdirs': ('css', 'html', 'images', 'javascript')})258 'mode': 'r',
259 'subdirs': ('css', 'html', 'images', 'javascript'),
260 'adjust': True})
258261
259 server_hostname = Option(str, 'ServerHostname',262 server_hostname = Option(str, 'ServerHostname',
260 ('-s', '--server'), None,263 ('-s', '--server'), None,
261264
=== modified file 'beeseek/app/session.py'
--- beeseek/app/session.py 2009-07-12 16:46:07 +0000
+++ beeseek/app/session.py 2009-07-14 16:10:16 +0000
@@ -200,7 +200,10 @@
200 scriptname = os.path.basename(sys.argv[0])200 scriptname = os.path.basename(sys.argv[0])
201201
202 # Configuration202 # Configuration
203 configdir = Directory(('/etc/beeseek', '~/.beeseek', 'config'), mode='r')203 # XXX This should be set elsewhere
204 configdir = Directory(('/etc/beeseek', 'config'),
205 mode='r',
206 adjust=True)
204 logfile = open(os.devnull, 'w')207 logfile = open(os.devnull, 'w')
205208
206 # Server specific objects and methods209 # Server specific objects and methods
207210
=== modified file 'setup.py'
--- setup.py 2009-07-05 19:05:50 +0000
+++ setup.py 2009-07-14 16:10:39 +0000
@@ -23,19 +23,34 @@
23import os23import os
24from distutils.core import setup24from distutils.core import setup
25from distutils.command.install_data import install_data25from distutils.command.install_data import install_data
26import pwd26try:
27 import pwd
28except ImportError:
29 pwd = None
27import beeseek30import beeseek
2831
2932
30class configure_and_install_data(install_data):33class configure_and_install_data(install_data):
3134
35 def initialize_options(self):
36 install_data.initialize_options(self)
37 if os.name != 'nt':
38 self.install_dir = '/'
39
32 def run(self):40 def run(self):
33 data_files = self.data_files = []41 data_files = self.data_files = []
34 dirs_map = {42 if os.name == 'nt':
35 'etc/beeseek': 'config',43 dirs_map = {
36 'var/lib/beeseek/database': 'database',44 'BeeSeek/config': 'config',
37 'usr/share/beeseek/webdata': 'webdata'45 'BeeSeek/database': 'database',
38 }46 'BeeSeek/webdata': 'webdata'
47 }
48 else:
49 dirs_map = {
50 'etc/beeseek': 'config',
51 'var/lib/beeseek/database': 'database',
52 'usr/share/beeseek/webdata': 'webdata'
53 }
3954
40 for destination, source in dirs_map.iteritems():55 for destination, source in dirs_map.iteritems():
41 sourcelen = len(source) + 156 sourcelen = len(source) + 1
@@ -46,20 +61,23 @@
46 data_files.append((path, subfiles))61 data_files.append((path, subfiles))
4762
48 install_data.run(self)63 install_data.run(self)
49 self.mkpath(os.path.join(self.install_dir, 'etc/init.d'))64
50 self.copy_file('beeseek-peer.init',65 if os.name != 'nt':
51 os.path.join(self.install_dir,66 self.mkpath(os.path.join(self.install_dir, 'etc/init.d'))
52 'etc/init.d/beeseek-peer'))67 self.copy_file('beeseek-peer.init',
53 self.mkpath(os.path.join(self.install_dir, 'var/log/beeseek'))68 os.path.join(self.install_dir,
5469 'etc/init.d/beeseek-peer'))
55 items = pwd.getpwnam('www-data')70 self.mkpath(os.path.join(self.install_dir, 'var/log/beeseek'))
56 uid, gid = items[2], items[3]71
57 for path in ('var/log/beeseek', 'var/lib/beeseek'):72 if not self.dry_run and pwd:
58 path = os.path.join(self.install_dir, path)73 items = pwd.getpwnam('www-data')
59 for directory, subdirs, subfiles in os.walk(path):74 uid, gid = items[2], items[3]
60 os.chown(directory, uid, gid)75 for path in ('var/log/beeseek', 'var/lib/beeseek'):
61 for filename in subfiles:76 path = os.path.join(self.install_dir, path)
62 os.chown(os.path.join(directory, filename), uid, gid)77 for directory, subdirs, subfiles in os.walk(path):
78 os.chown(directory, uid, gid)
79 for filename in subfiles:
80 os.chown(os.path.join(directory, filename), uid, gid)
6381
6482
65def add_packages(metadata):83def add_packages(metadata):

Subscribers

People subscribed via source and target branches