Merge lp:~andrea.corbellini/beeseek/cross-platform-setup into lp:beeseek/1.0
- cross-platform-setup
- Merge into 1.0
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrea Corbellini | Approve | ||
Daniele Napolitano (community) | Needs Fixing | ||
Review via email: mp+8764@code.launchpad.net |
Commit message
Description of the change
Andrea Corbellini (andrea.corbellini) wrote : | # |
- 301. By Andrea Corbellini
-
Merge with trunk.
Daniele Napolitano (dnax88) : | # |
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/
PeerSession: Session started with arguments
'/usr/local/
PeerSession: Bound address localhost:8080
PeerSession: Bound address localhost:4096
PeerSession: Running as user dnax
PeerSession: Bound address /var/lock/
PeerSession: Database connected
Traceback (most recent call last):
File "/usr/local/
PeerSession()
File "/usr/local/
line 278, in __init__
self.
File "/usr/local/
line 308, in run
command_
File "/usr/local/
line 559, in start
self.setup()
File "/usr/local/
line 74, in setup
server.greet()
File "/usr/local/
line 90, in greet
self.
File "/usr/local/
line 75, in _recv_greeting
raise NotImplementedError
NotImplementedError
PeerSession:ERROR: Daemon not started
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/
> PeerSession: Session started with arguments
> '/usr/local/
> PeerSession: Bound address localhost:8080
> PeerSession: Bound address localhost:4096
> PeerSession: Running as user dnax
> PeerSession: Bound address /var/lock/
> PeerSession: Database connected
> Traceback (most recent call last):
> File "/usr/local/
> PeerSession()
> File "/usr/local/
> line 278, in __init__
> self.run(arguments)
> File "/usr/local/
> line 308, in run
> command_obj(self, *arguments)
> File "/usr/local/
> line 559, in start
> self.setup()
> File "/usr/local/
> line 74, in setup
> server.greet()
> File "/usr/local/
> line 90, in greet
> self._recv_
> File "/usr/local/
> line 75, in _recv_greeting
> raise NotImplementedError
> NotImplementedError
> PeerSession:ERROR: Daemon not started
- 302. By Andrea Corbellini
-
Merge with trunk.
Preview Diff
1 | === modified file 'beeseek/app/directory.py' | |||
2 | --- beeseek/app/directory.py 2009-07-09 11:37:49 +0000 | |||
3 | +++ beeseek/app/directory.py 2009-07-14 16:07:24 +0000 | |||
4 | @@ -15,24 +15,37 @@ | |||
5 | 15 | 15 | ||
6 | 16 | import os | 16 | import os |
7 | 17 | import stat | 17 | import stat |
8 | 18 | import sys | ||
9 | 18 | import tempfile | 19 | import tempfile |
10 | 19 | 20 | ||
11 | 20 | 21 | ||
13 | 21 | tempdirs = tempfile._candidate_tempdir_list() | 22 | lockdirs = tempfile._candidate_tempdir_list() |
14 | 23 | if os.name != 'nt': | ||
15 | 24 | lockdirs.insert(0, '/var/lock') | ||
16 | 22 | 25 | ||
17 | 23 | class Directory(object): | 26 | class Directory(object): |
18 | 24 | 27 | ||
19 | 25 | __slots__ = 'dirlist', '_mode', '_subdirs', '_directory', '_create' | 28 | __slots__ = 'dirlist', '_mode', '_subdirs', '_directory', '_create' |
20 | 26 | 29 | ||
22 | 27 | def __init__(self, dirlist, **kwargs): | 30 | def __init__(self, dirlist, mode='rw', subdirs=(), create=False, |
23 | 31 | adjust=False): | ||
24 | 28 | if isinstance(dirlist, basestring): | 32 | if isinstance(dirlist, basestring): |
25 | 29 | dirlist = (dirlist,) | 33 | dirlist = (dirlist,) |
26 | 34 | if adjust and os.name == 'nt': | ||
27 | 35 | dirlist = self._adjust_for_win(dirlist) | ||
28 | 30 | self.dirlist = tuple(os.path.normcase(os.path.abspath( | 36 | self.dirlist = tuple(os.path.normcase(os.path.abspath( |
29 | 31 | os.path.expanduser(directory))) | 37 | os.path.expanduser(directory))) |
30 | 32 | for directory in dirlist) | 38 | for directory in dirlist) |
34 | 33 | self._mode = kwargs.get('mode', 'rw') | 39 | self._mode = mode |
35 | 34 | self._subdirs = kwargs.get('subdirs', ()) | 40 | self._subdirs = subdirs |
36 | 35 | self._create = kwargs.get('create', ()) | 41 | self._create = create |
37 | 42 | |||
38 | 43 | def _adjust_for_win(self, dirlist): | ||
39 | 44 | basepath = os.path.dirname(sys.executable) | ||
40 | 45 | for directory in dirlist: | ||
41 | 46 | yield os.path.join(basepath, | ||
42 | 47 | 'BeeSeek', | ||
43 | 48 | os.path.basename(directory)) | ||
44 | 36 | 49 | ||
45 | 37 | def _check_permissions(self, directory): | 50 | def _check_permissions(self, directory): |
46 | 38 | strmode = self._mode | 51 | strmode = self._mode |
47 | @@ -41,7 +54,6 @@ | |||
48 | 41 | stat_result = os.stat(directory) | 54 | stat_result = os.stat(directory) |
49 | 42 | usermode = groupmode = othermode = 0 | 55 | usermode = groupmode = othermode = 0 |
50 | 43 | 56 | ||
51 | 44 | # _issuitable() should be called rarely so we can use hasattr() here | ||
52 | 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(): |
53 | 46 | if 'r' in strmode: | 58 | if 'r' in strmode: |
54 | 47 | usermode = stat.S_IXUSR | 59 | usermode = stat.S_IXUSR |
55 | 48 | 60 | ||
56 | === modified file 'beeseek/app/options.py' | |||
57 | --- beeseek/app/options.py 2009-07-11 12:46:12 +0000 | |||
58 | +++ beeseek/app/options.py 2009-07-14 16:10:16 +0000 | |||
59 | @@ -15,7 +15,7 @@ | |||
60 | 15 | 15 | ||
61 | 16 | import os | 16 | import os |
62 | 17 | from beeseek.app import instance | 17 | from beeseek.app import instance |
64 | 18 | from beeseek.app.directory import Directory, tempdirs | 18 | from beeseek.app.directory import Directory, lockdirs |
65 | 19 | from beeseek.ui import BaseUserInterface, html | 19 | from beeseek.ui import BaseUserInterface, html |
66 | 20 | from beeseek.interface import Interface, implements | 20 | from beeseek.interface import Interface, implements |
67 | 21 | 21 | ||
68 | @@ -212,7 +212,7 @@ | |||
69 | 212 | lockdir = Option(Directory, 'LockDirectory', | 212 | lockdir = Option(Directory, 'LockDirectory', |
70 | 213 | ('-L', '--lock-dir'), None, | 213 | ('-L', '--lock-dir'), None, |
71 | 214 | 'The directory for lock files.', | 214 | 'The directory for lock files.', |
73 | 215 | default=['/var/lock'] + tempdirs, | 215 | default=lockdirs, |
74 | 216 | convert_default=True) | 216 | convert_default=True) |
75 | 217 | 217 | ||
76 | 218 | user = Option(str, 'User', | 218 | user = Option(str, 'User', |
77 | @@ -235,7 +235,8 @@ | |||
78 | 235 | convert_kwargs={ | 235 | convert_kwargs={ |
79 | 236 | 'subdirs': ('keywords', 'pages', 'configuration', | 236 | 'subdirs': ('keywords', 'pages', 'configuration', |
80 | 237 | 'statistics', 'keys', 'needed-results'), | 237 | 'statistics', 'keys', 'needed-results'), |
82 | 238 | 'create': True}) | 238 | 'create': True, |
83 | 239 | 'adjust': True}) | ||
84 | 239 | 240 | ||
85 | 240 | daemon = Option(bool, 'Daemon', | 241 | daemon = Option(bool, 'Daemon', |
86 | 241 | ('-b', '--daemon'), ('-f', '--foreground'), | 242 | ('-b', '--daemon'), ('-f', '--foreground'), |
87 | @@ -254,7 +255,9 @@ | |||
88 | 254 | testing_default='webdata', | 255 | testing_default='webdata', |
89 | 255 | convert_default=True, | 256 | convert_default=True, |
90 | 256 | convert_kwargs={ | 257 | convert_kwargs={ |
92 | 257 | 'mode': 'r', 'subdirs': ('css', 'html', 'images', 'javascript')}) | 258 | 'mode': 'r', |
93 | 259 | 'subdirs': ('css', 'html', 'images', 'javascript'), | ||
94 | 260 | 'adjust': True}) | ||
95 | 258 | 261 | ||
96 | 259 | server_hostname = Option(str, 'ServerHostname', | 262 | server_hostname = Option(str, 'ServerHostname', |
97 | 260 | ('-s', '--server'), None, | 263 | ('-s', '--server'), None, |
98 | 261 | 264 | ||
99 | === modified file 'beeseek/app/session.py' | |||
100 | --- beeseek/app/session.py 2009-07-12 16:46:07 +0000 | |||
101 | +++ beeseek/app/session.py 2009-07-14 16:10:16 +0000 | |||
102 | @@ -200,7 +200,10 @@ | |||
103 | 200 | scriptname = os.path.basename(sys.argv[0]) | 200 | scriptname = os.path.basename(sys.argv[0]) |
104 | 201 | 201 | ||
105 | 202 | # Configuration | 202 | # Configuration |
107 | 203 | configdir = Directory(('/etc/beeseek', '~/.beeseek', 'config'), mode='r') | 203 | # XXX This should be set elsewhere |
108 | 204 | configdir = Directory(('/etc/beeseek', 'config'), | ||
109 | 205 | mode='r', | ||
110 | 206 | adjust=True) | ||
111 | 204 | logfile = open(os.devnull, 'w') | 207 | logfile = open(os.devnull, 'w') |
112 | 205 | 208 | ||
113 | 206 | # Server specific objects and methods | 209 | # Server specific objects and methods |
114 | 207 | 210 | ||
115 | === modified file 'setup.py' | |||
116 | --- setup.py 2009-07-05 19:05:50 +0000 | |||
117 | +++ setup.py 2009-07-14 16:10:39 +0000 | |||
118 | @@ -23,19 +23,34 @@ | |||
119 | 23 | import os | 23 | import os |
120 | 24 | from distutils.core import setup | 24 | from distutils.core import setup |
121 | 25 | from distutils.command.install_data import install_data | 25 | from distutils.command.install_data import install_data |
123 | 26 | import pwd | 26 | try: |
124 | 27 | import pwd | ||
125 | 28 | except ImportError: | ||
126 | 29 | pwd = None | ||
127 | 27 | import beeseek | 30 | import beeseek |
128 | 28 | 31 | ||
129 | 29 | 32 | ||
130 | 30 | class configure_and_install_data(install_data): | 33 | class configure_and_install_data(install_data): |
131 | 31 | 34 | ||
132 | 35 | def initialize_options(self): | ||
133 | 36 | install_data.initialize_options(self) | ||
134 | 37 | if os.name != 'nt': | ||
135 | 38 | self.install_dir = '/' | ||
136 | 39 | |||
137 | 32 | def run(self): | 40 | def run(self): |
138 | 33 | data_files = self.data_files = [] | 41 | data_files = self.data_files = [] |
144 | 34 | dirs_map = { | 42 | if os.name == 'nt': |
145 | 35 | 'etc/beeseek': 'config', | 43 | dirs_map = { |
146 | 36 | 'var/lib/beeseek/database': 'database', | 44 | 'BeeSeek/config': 'config', |
147 | 37 | 'usr/share/beeseek/webdata': 'webdata' | 45 | 'BeeSeek/database': 'database', |
148 | 38 | } | 46 | 'BeeSeek/webdata': 'webdata' |
149 | 47 | } | ||
150 | 48 | else: | ||
151 | 49 | dirs_map = { | ||
152 | 50 | 'etc/beeseek': 'config', | ||
153 | 51 | 'var/lib/beeseek/database': 'database', | ||
154 | 52 | 'usr/share/beeseek/webdata': 'webdata' | ||
155 | 53 | } | ||
156 | 39 | 54 | ||
157 | 40 | for destination, source in dirs_map.iteritems(): | 55 | for destination, source in dirs_map.iteritems(): |
158 | 41 | sourcelen = len(source) + 1 | 56 | sourcelen = len(source) + 1 |
159 | @@ -46,20 +61,23 @@ | |||
160 | 46 | data_files.append((path, subfiles)) | 61 | data_files.append((path, subfiles)) |
161 | 47 | 62 | ||
162 | 48 | install_data.run(self) | 63 | install_data.run(self) |
177 | 49 | self.mkpath(os.path.join(self.install_dir, 'etc/init.d')) | 64 | |
178 | 50 | self.copy_file('beeseek-peer.init', | 65 | if os.name != 'nt': |
179 | 51 | os.path.join(self.install_dir, | 66 | self.mkpath(os.path.join(self.install_dir, 'etc/init.d')) |
180 | 52 | 'etc/init.d/beeseek-peer')) | 67 | self.copy_file('beeseek-peer.init', |
181 | 53 | self.mkpath(os.path.join(self.install_dir, 'var/log/beeseek')) | 68 | os.path.join(self.install_dir, |
182 | 54 | 69 | 'etc/init.d/beeseek-peer')) | |
183 | 55 | items = pwd.getpwnam('www-data') | 70 | self.mkpath(os.path.join(self.install_dir, 'var/log/beeseek')) |
184 | 56 | uid, gid = items[2], items[3] | 71 | |
185 | 57 | for path in ('var/log/beeseek', 'var/lib/beeseek'): | 72 | if not self.dry_run and pwd: |
186 | 58 | path = os.path.join(self.install_dir, path) | 73 | items = pwd.getpwnam('www-data') |
187 | 59 | for directory, subdirs, subfiles in os.walk(path): | 74 | uid, gid = items[2], items[3] |
188 | 60 | os.chown(directory, uid, gid) | 75 | for path in ('var/log/beeseek', 'var/lib/beeseek'): |
189 | 61 | for filename in subfiles: | 76 | path = os.path.join(self.install_dir, path) |
190 | 62 | os.chown(os.path.join(directory, filename), uid, gid) | 77 | for directory, subdirs, subfiles in os.walk(path): |
191 | 78 | os.chown(directory, uid, gid) | ||
192 | 79 | for filename in subfiles: | ||
193 | 80 | os.chown(os.path.join(directory, filename), uid, gid) | ||
194 | 63 | 81 | ||
195 | 64 | 82 | ||
196 | 65 | def add_packages(metadata): | 83 | def add_packages(metadata): |
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.