Merge lp:~rainct/apt-zeroconf/cheetah into lp:apt-zeroconf
- cheetah
- Merge into trunk
Status: | Needs review |
---|---|
Proposed branch: | lp:~rainct/apt-zeroconf/cheetah |
Merge into: | lp:apt-zeroconf |
Diff against target: |
1002 lines (+313/-327) 19 files modified
HACKING (+2/-1) MANIFEST (+1/-2) apt-zeroconf (+9/-7) aptzeroconf/exceptions.py (+32/-0) aptzeroconf/http.py (+17/-7) aptzeroconf/parse.py (+76/-120) azc_daemon/__init__.py (+14/-1) debian/apt-zeroconf.postinst (+7/-12) debian/changelog (+21/-0) debian/control (+28/-14) debian/init (+23/-29) debian/rules (+2/-6) debian/templates (+4/-0) setup.py (+10/-5) support/apt-zeroconf.1 (+65/-0) support/apt-zeroconf.xml (+0/-115) support/azc_rule (+1/-1) support/build.sh (+0/-5) test/test_general.py (+1/-2) |
To merge this branch: | bzr merge lp:~rainct/apt-zeroconf/cheetah |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Apt Zeroconf Team | Pending | ||
Review via email: mp+18348@code.launchpad.net |
Commit message
Description of the change
- 142. By Siegfried Gevatter
-
Catch exception when socket is already in use and signalize this
condition with a special code. - 143. By Siegfried Gevatter
-
apt-zeroconf.1: clarify the use of --daemon.
- 144. By Siegfried Gevatter
-
Fix debian/init.
The previous version was good enough for the package to work, but
"sudo service apt-zeroconf start/stop/restart" didn't work. - 145. By Siegfried Gevatter
-
Some more changes here and there to make pep-8.py happy.
Change debian/init to always return 0 on stop, else dpkg-reconfigure gets mad. - 146. By Siegfried Gevatter
-
azc_daemon/
__init_ _.py: close all file descriptors after forking Now that we don't use start-stop-daemon with the --background
workaround option anymore, dpkg-reconfigure was hanging again.
*Finally* I discovered the problem as being in _daemonize() :/. - 147. By Siegfried Gevatter
-
Update debian/changelog.
Unmerged revisions
- 147. By Siegfried Gevatter
-
Update debian/changelog.
- 146. By Siegfried Gevatter
-
azc_daemon/
__init_ _.py: close all file descriptors after forking Now that we don't use start-stop-daemon with the --background
workaround option anymore, dpkg-reconfigure was hanging again.
*Finally* I discovered the problem as being in _daemonize() :/. - 145. By Siegfried Gevatter
-
Some more changes here and there to make pep-8.py happy.
Change debian/init to always return 0 on stop, else dpkg-reconfigure gets mad. - 144. By Siegfried Gevatter
-
Fix debian/init.
The previous version was good enough for the package to work, but
"sudo service apt-zeroconf start/stop/restart" didn't work. - 143. By Siegfried Gevatter
-
apt-zeroconf.1: clarify the use of --daemon.
- 142. By Siegfried Gevatter
-
Catch exception when socket is already in use and signalize this
condition with a special code. - 141. By Siegfried Gevatter
-
Fix postinst, init file, etc. Installing the package works now!
- 140. By Siegfried Gevatter
-
Fix wrong path for HTML files when installed.
- 139. By Siegfried Gevatter
-
Remove now superfluous manpage generation code from setup.py.
- 138. By Siegfried Gevatter
-
Change python-central dependency to python-support.
Preview Diff
1 | === modified file 'HACKING' | |||
2 | --- HACKING 2009-08-09 01:45:52 +0000 | |||
3 | +++ HACKING 2010-02-01 20:58:13 +0000 | |||
4 | @@ -15,7 +15,8 @@ | |||
5 | 15 | ------- | 15 | ------- |
6 | 16 | 16 | ||
7 | 17 | We use py.test for testing at the moment. | 17 | We use py.test for testing at the moment. |
9 | 18 | You can get it by running "[sudo] easy_install -U py" | 18 | You can get it by running "[sudo] easy_install -U py", or installing |
10 | 19 | python-codespeak-lib on Debian systems. | ||
11 | 19 | 20 | ||
12 | 20 | - For every change, try to create a new test. | 21 | - For every change, try to create a new test. |
13 | 21 | - Run all tests: 'py.test' in main project dir. | 22 | - Run all tests: 'py.test' in main project dir. |
14 | 22 | 23 | ||
15 | === modified file 'MANIFEST' | |||
16 | --- MANIFEST 2009-07-14 19:40:59 +0000 | |||
17 | +++ MANIFEST 2010-02-01 20:58:13 +0000 | |||
18 | @@ -21,10 +21,9 @@ | |||
19 | 21 | pages/list.xsl | 21 | pages/list.xsl |
20 | 22 | pages/logo.png | 22 | pages/logo.png |
21 | 23 | pages/stats.html | 23 | pages/stats.html |
23 | 24 | support/apt-zeroconf.1.gz | 24 | support/apt-zeroconf.1 |
24 | 25 | support/apt-zeroconf.apt.conf | 25 | support/apt-zeroconf.apt.conf |
25 | 26 | support/apt-zeroconf.conf | 26 | support/apt-zeroconf.conf |
26 | 27 | support/apt-zeroconf.xml | ||
27 | 28 | support/azc_rule | 27 | support/azc_rule |
28 | 29 | support/build.sh | 28 | support/build.sh |
29 | 30 | support/make_docs.sh | 29 | support/make_docs.sh |
30 | 31 | 30 | ||
31 | === modified file 'apt-zeroconf' | |||
32 | --- apt-zeroconf 2009-07-25 21:59:12 +0000 | |||
33 | +++ apt-zeroconf 2010-02-01 20:58:13 +0000 | |||
34 | @@ -1,4 +1,4 @@ | |||
36 | 1 | #!/usr/bin/python | 1 | #!/usr/bin/python2.6 |
37 | 2 | # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil -*- | 2 | # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil -*- |
38 | 3 | 3 | ||
39 | 4 | # This file is part of apt-zeroconf. | 4 | # This file is part of apt-zeroconf. |
40 | @@ -25,10 +25,10 @@ | |||
41 | 25 | import optparse | 25 | import optparse |
42 | 26 | import sys | 26 | import sys |
43 | 27 | import os | 27 | import os |
45 | 28 | #from pwd import getpwnam | 28 | |
46 | 29 | sys.path.append('/usr/share/pyshared/') | ||
47 | 29 | from aptzeroconf import main | 30 | from aptzeroconf import main |
50 | 30 | 31 | from aptzeroconf.exceptions import AlreadyRunningError | |
49 | 31 | SCRIPTPATH = os.path.dirname(os.path.abspath(__file__)) | ||
51 | 32 | 32 | ||
52 | 33 | if __name__ == "__main__": | 33 | if __name__ == "__main__": |
53 | 34 | parser = optparse.OptionParser() | 34 | parser = optparse.OptionParser() |
54 | @@ -50,10 +50,8 @@ | |||
55 | 50 | class azcDaemon(Daemon): | 50 | class azcDaemon(Daemon): |
56 | 51 | 51 | ||
57 | 52 | def run(self): | 52 | def run(self): |
58 | 53 | os.chdir(SCRIPTPATH) | ||
59 | 54 | main(options) | 53 | main(options) |
60 | 55 | 54 | ||
61 | 56 | |||
62 | 57 | if os.getuid() != 0: | 55 | if os.getuid() != 0: |
63 | 58 | print ("** Logging has been disabled. **" | 56 | print ("** Logging has been disabled. **" |
64 | 59 | "You need root privileges to start apt-zeroconf as daemon." | 57 | "You need root privileges to start apt-zeroconf as daemon." |
65 | @@ -97,4 +95,8 @@ | |||
66 | 97 | print "--background has been deprecated, use --daemon." | 95 | print "--background has been deprecated, use --daemon." |
67 | 98 | sys.exit(2) | 96 | sys.exit(2) |
68 | 99 | 97 | ||
70 | 100 | main(options) | 98 | try: |
71 | 99 | main(options) | ||
72 | 100 | except AlreadyRunningError: | ||
73 | 101 | print "Another instance of Apt-ZeroConf is already running." | ||
74 | 102 | sys.exit(42) | ||
75 | 101 | 103 | ||
76 | === added file 'aptzeroconf/exceptions.py' | |||
77 | --- aptzeroconf/exceptions.py 1970-01-01 00:00:00 +0000 | |||
78 | +++ aptzeroconf/exceptions.py 2010-02-01 20:58:13 +0000 | |||
79 | @@ -0,0 +1,32 @@ | |||
80 | 1 | # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil -*- | ||
81 | 2 | # | ||
82 | 3 | # Copyright (C) 2010 - Siegfried Gevatter <rainct@ubuntu.com> | ||
83 | 4 | # | ||
84 | 5 | # Apt-zeroconf is free software; you can redistribute it and/or modify | ||
85 | 6 | # it under the terms of the GNU General Public License as published by | ||
86 | 7 | # the Free Software Foundation; either version 2 of the License, or | ||
87 | 8 | # (at your option) any later version. | ||
88 | 9 | # | ||
89 | 10 | # Apt-zeroconf is distributed in the hope that it will be useful, | ||
90 | 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
91 | 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
92 | 13 | # GNU General Public License for more details. | ||
93 | 14 | # | ||
94 | 15 | # You should have received a copy of the GNU General Public License | ||
95 | 16 | # along with apt-zeroconf; if not, write to the Free Software | ||
96 | 17 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
97 | 18 | |||
98 | 19 | |||
99 | 20 | class AptZeroConfException(Exception): | ||
100 | 21 | """ | ||
101 | 22 | Base class for exceptions from AptZeroConf. | ||
102 | 23 | """ | ||
103 | 24 | pass | ||
104 | 25 | |||
105 | 26 | |||
106 | 27 | class AlreadyRunningError(AptZeroConfException): | ||
107 | 28 | """ | ||
108 | 29 | Exception raised if another instance or a conflicting service is | ||
109 | 30 | already running. | ||
110 | 31 | """ | ||
111 | 32 | pass | ||
112 | 0 | 33 | ||
113 | === modified file 'aptzeroconf/http.py' | |||
114 | --- aptzeroconf/http.py 2009-09-12 02:04:35 +0000 | |||
115 | +++ aptzeroconf/http.py 2010-02-01 20:58:13 +0000 | |||
116 | @@ -25,9 +25,11 @@ | |||
117 | 25 | redirected, or page url. | 25 | redirected, or page url. |
118 | 26 | 26 | ||
119 | 27 | @requires: logging | 27 | @requires: logging |
120 | 28 | @requires: socket | ||
121 | 28 | @requires: SocketServer.[ThreadingTCPServer|BaseServer] | 29 | @requires: SocketServer.[ThreadingTCPServer|BaseServer] |
122 | 29 | @requires: SimpleHTTPServer.SimpleHTTPRequestHandler | 30 | @requires: SimpleHTTPServer.SimpleHTTPRequestHandler |
123 | 30 | @requires: aptzeroconf.config.[config|cache] | 31 | @requires: aptzeroconf.config.[config|cache] |
124 | 32 | @requires: aptzeroconf.exceptions.AlreadyRunningError | ||
125 | 31 | @requires: socket | 33 | @requires: socket |
126 | 32 | @requires: urllib2.HTTPError | 34 | @requires: urllib2.HTTPError |
127 | 33 | """ | 35 | """ |
128 | @@ -37,6 +39,7 @@ | |||
129 | 37 | from SocketServer import ThreadingTCPServer, BaseServer | 39 | from SocketServer import ThreadingTCPServer, BaseServer |
130 | 38 | from SimpleHTTPServer import SimpleHTTPRequestHandler | 40 | from SimpleHTTPServer import SimpleHTTPRequestHandler |
131 | 39 | from aptzeroconf.config import config, cache | 41 | from aptzeroconf.config import config, cache |
132 | 42 | from aptzeroconf.exceptions import AlreadyRunningError | ||
133 | 40 | 43 | ||
134 | 41 | 44 | ||
135 | 42 | class HttpServer(ThreadingTCPServer): | 45 | class HttpServer(ThreadingTCPServer): |
136 | @@ -45,11 +48,18 @@ | |||
137 | 45 | """ | 48 | """ |
138 | 46 | 49 | ||
139 | 47 | def __init__(self): | 50 | def __init__(self): |
145 | 48 | BaseServer.__init__(self, ('', config['http_port']), AZCHTTPHandler) | 51 | try: |
146 | 49 | self.socket = socket.socket(socket.AF_INET6, self.socket_type) | 52 | BaseServer.__init__(self, ('', config['http_port']), |
147 | 50 | self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | 53 | AZCHTTPHandler) |
148 | 51 | self.server_bind() | 54 | self.socket = socket.socket(socket.AF_INET6, self.socket_type) |
149 | 52 | self.server_activate() | 55 | self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) |
150 | 56 | self.server_bind() | ||
151 | 57 | self.server_activate() | ||
152 | 58 | except socket.error as error: | ||
153 | 59 | if error.args and error.args[0] == 98: | ||
154 | 60 | # Address already in use | ||
155 | 61 | raise AlreadyRunningError | ||
156 | 62 | raise | ||
157 | 53 | 63 | ||
158 | 54 | 64 | ||
159 | 55 | def trap_socketerror(method): | 65 | def trap_socketerror(method): |
160 | @@ -145,7 +155,7 @@ | |||
161 | 145 | @trap_socketerror | 155 | @trap_socketerror |
162 | 146 | def do_GET(self): | 156 | def do_GET(self): |
163 | 147 | self._do_GET() | 157 | self._do_GET() |
165 | 148 | 158 | ||
166 | 149 | def _do_GET(self): | 159 | def _do_GET(self): |
167 | 150 | """ | 160 | """ |
168 | 151 | Respond to a GET request by proxy the url to preferably local content, | 161 | Respond to a GET request by proxy the url to preferably local content, |
169 | @@ -186,7 +196,7 @@ | |||
170 | 186 | if os.path.isfile("pages/" + filename): | 196 | if os.path.isfile("pages/" + filename): |
171 | 187 | page = "pages/" + filename | 197 | page = "pages/" + filename |
172 | 188 | else: | 198 | else: |
174 | 189 | page = "/usr/share/pages/" + filename | 199 | page = "/usr/share/apt-zeroconf/pages/" + filename |
175 | 190 | return open(page, "r") | 200 | return open(page, "r") |
176 | 191 | 201 | ||
177 | 192 | httpCode = 200 #: Default HTTP Error code set | 202 | httpCode = 200 #: Default HTTP Error code set |
178 | 193 | 203 | ||
179 | === modified file 'aptzeroconf/parse.py' | |||
180 | --- aptzeroconf/parse.py 2009-08-09 02:39:51 +0000 | |||
181 | +++ aptzeroconf/parse.py 2010-02-01 20:58:13 +0000 | |||
182 | @@ -21,116 +21,72 @@ | |||
183 | 21 | from xml.sax import parseString, ContentHandler | 21 | from xml.sax import parseString, ContentHandler |
184 | 22 | #from xml.sax.handler import feature_namespaces | 22 | #from xml.sax.handler import feature_namespaces |
185 | 23 | from xml.sax._exceptions import SAXParseException | 23 | from xml.sax._exceptions import SAXParseException |
186 | 24 | from apt_pkg import VersionCompare | ||
187 | 24 | import logging | 25 | import logging |
188 | 25 | import re | 26 | import re |
189 | 26 | 27 | ||
190 | 27 | __version__ = float(0.3) | 28 | __version__ = float(0.3) |
191 | 28 | 29 | ||
192 | 29 | V2, V3 = 0.2, 0.3 | 30 | V2, V3 = 0.2, 0.3 |
197 | 30 | EPOCH_PATTERN = { | 31 | EPOCH_PATTERN = re.compile(r'\_\d+\%3a') |
198 | 31 | V2 : re.compile(r'\_\d+\%3a'), | 32 | |
195 | 32 | V3 : re.compile(r'\_\d+\:') | ||
196 | 33 | } | ||
199 | 34 | 33 | ||
200 | 35 | def normalize_whitespace(text): | 34 | def normalize_whitespace(text): |
201 | 36 | """Remove excessive whitespace in spaces.""" | 35 | """Remove excessive whitespace in spaces.""" |
202 | 37 | return ' '.join(text.split()) | 36 | return ' '.join(text.split()) |
203 | 38 | 37 | ||
205 | 39 | def _is_equal(pkg, find, ver): | 38 | |
206 | 39 | def _is_equal(pkg, find): | ||
207 | 40 | """Are the packages equal disregarding the epoch?""" | 40 | """Are the packages equal disregarding the epoch?""" |
245 | 41 | return EPOCH_PATTERN[ver].sub('_', pkg) == find or pkg == find | 41 | return EPOCH_PATTERN.sub('_', pkg) == find or pkg == find |
246 | 42 | 42 | ||
247 | 43 | 43 | ||
248 | 44 | class _PackageList(list): | 44 | class Package(object): |
249 | 45 | """ | 45 | """Represents a single package.""" |
250 | 46 | Found Package list container. | 46 | def __init__(self, name=''): |
251 | 47 | """ | 47 | self.name = name |
215 | 48 | |||
216 | 49 | def found(self, item): | ||
217 | 50 | """ | ||
218 | 51 | Callback to add a found package to contatiner | ||
219 | 52 | |||
220 | 53 | @param item: Package Name | ||
221 | 54 | @type item: basestring | ||
222 | 55 | """ | ||
223 | 56 | self.append(item) | ||
224 | 57 | |||
225 | 58 | def __str__(self): | ||
226 | 59 | """ | ||
227 | 60 | String representaion of found package container. Displays the best | ||
228 | 61 | package found in container if multiples were added. | ||
229 | 62 | |||
230 | 63 | @return: Best or only package | ||
231 | 64 | @rtype: basestring | ||
232 | 65 | """ | ||
233 | 66 | from apt_pkg import VersionCompare | ||
234 | 67 | from urllib2 import quote | ||
235 | 68 | if len(self) > 1: | ||
236 | 69 | self.sort(cmp=VersionCompare) | ||
237 | 70 | return quote(self[-1]) | ||
238 | 71 | |||
239 | 72 | elif len(self) == 1: | ||
240 | 73 | return quote(self[0]) | ||
241 | 74 | |||
242 | 75 | else: | ||
243 | 76 | return "" | ||
244 | 77 | |||
252 | 78 | def __repr__(self): | 48 | def __repr__(self): |
257 | 79 | return '<Package name="%s" count="%d">' % (str(self), len(self)) | 49 | return '<Package name=' + self.name + '>' |
258 | 80 | 50 | ||
259 | 81 | 51 | ||
260 | 82 | class _PackageFinder(ContentHandler): | 52 | class _XMLDecoder(ContentHandler): |
261 | 53 | """Decodes an xml package list, calling a callback for each package.""" | ||
262 | 83 | callback = None #: Callback function to be set when item found | 54 | callback = None #: Callback function to be set when item found |
263 | 84 | inPkgElemCnt = {} | ||
264 | 85 | 55 | ||
266 | 86 | def __init__(self, package): | 56 | def __init__(self): |
267 | 87 | """ | 57 | """ |
268 | 88 | Initialize sax content handler. | 58 | Initialize sax content handler. |
269 | 89 | 59 | ||
270 | 90 | @param search_name: Package to locate in search data. | 60 | @param search_name: Package to locate in search data. |
271 | 91 | @type search_name: basestring | 61 | @type search_name: basestring |
272 | 92 | """ | 62 | """ |
278 | 93 | self.packageSearch = normalize_whitespace(package) | 63 | self.text = '' |
279 | 94 | 64 | self.package = None | |
280 | 95 | self.inPkgName = False #: Initialize the content flag to False | 65 | self.list_version = '' |
276 | 96 | self.inPkg = False #: Initialize the content flag to False | ||
277 | 97 | self.list_version = '' #: Initialize the version value to None | ||
281 | 98 | 66 | ||
282 | 99 | def startElement(self, name, attrs): | 67 | def startElement(self, name, attrs): |
283 | 100 | """ | 68 | """ |
284 | 101 | Check start element tags for packagelist or name. | 69 | Check start element tags for packagelist or name. |
285 | 102 | 70 | ||
290 | 103 | @param name: element tag. | 71 | @param name: element tag |
291 | 104 | @type name: basestring | 72 | @type name: basestring |
292 | 105 | @param name: element tag attrs. | 73 | @param name: element attributes |
293 | 106 | @type name: basestring | 74 | @type name: dict |
294 | 107 | """ | 75 | """ |
295 | 108 | if name == 'packagelist': #: handle element by getting ver. attribute | 76 | if name == 'packagelist': #: handle element by getting ver. attribute |
296 | 109 | self.list_version = normalize_whitespace(attrs.get('version', "")) | 77 | self.list_version = normalize_whitespace(attrs.get('version', "")) |
311 | 110 | 78 | if name == 'package': | |
312 | 111 | if float(self.list_version) == __version__: | 79 | self.package = Package() |
313 | 112 | 80 | self.text = '' | |
300 | 113 | if name == 'package': | ||
301 | 114 | self.inPkg = True | ||
302 | 115 | self.inPkgElemCnt = {'name': 0} | ||
303 | 116 | |||
304 | 117 | elif name == 'name': #: handle element by set flag, reset value | ||
305 | 118 | if self.inPkgElemCnt[name] > 1: | ||
306 | 119 | raise SAXParseException | ||
307 | 120 | |||
308 | 121 | self.inPkgName = True | ||
309 | 122 | self.packageName = "" | ||
310 | 123 | self.inPkgElemCnt[name] += 1 | ||
314 | 124 | 81 | ||
315 | 125 | def characters(self, char): | 82 | def characters(self, char): |
316 | 126 | """ | 83 | """ |
318 | 127 | Check characters for name value. | 84 | Add character input to text buffer. |
319 | 128 | 85 | ||
320 | 129 | @param char: text chunk | 86 | @param char: text chunk |
321 | 130 | @type name: basestring | 87 | @type name: basestring |
322 | 131 | """ | 88 | """ |
325 | 132 | if self.inPkgName: | 89 | self.text += char |
324 | 133 | self.packageName = self.packageName + char | ||
326 | 134 | 90 | ||
327 | 135 | def endElement(self, name): | 91 | def endElement(self, name): |
328 | 136 | """ | 92 | """ |
329 | @@ -140,70 +96,72 @@ | |||
330 | 140 | @param name: element tag. | 96 | @param name: element tag. |
331 | 141 | @type name: basestring | 97 | @type name: basestring |
332 | 142 | """ | 98 | """ |
346 | 143 | if float(self.list_version) == __version__: | 99 | if name == 'package': |
347 | 144 | if name == 'package': | 100 | self.callback(self.package) |
348 | 145 | self.inPkgName = False | 101 | elif name == 'name': |
349 | 146 | elif name == 'name': | 102 | self.package.name = self.text |
350 | 147 | self.inPkgName = False | 103 | |
351 | 148 | self.packageName = normalize_whitespace(self.packageName) | 104 | |
352 | 149 | 105 | def decode_list(data): | |
340 | 150 | #{ Check search_name for match with packagename | ||
341 | 151 | if _is_equal(self.packageName, self.packageSearch, V3): | ||
342 | 152 | self.callback(self.packageName) | ||
343 | 153 | |||
344 | 154 | |||
345 | 155 | def has_package(package, data): | ||
353 | 156 | """ | 106 | """ |
359 | 157 | Locate package in data string. | 107 | @param data: xml/raw package data |
355 | 158 | |||
356 | 159 | @param package: package name | ||
357 | 160 | @type package: basestring | ||
358 | 161 | @param data: xml package data | ||
360 | 162 | @type data: basestring | 108 | @type data: basestring |
363 | 163 | @return: PkgList object | 109 | @return: list of Packages |
364 | 164 | @rtype: object | 110 | @rtype: list |
365 | 165 | """ | 111 | """ |
366 | 166 | pkglist = _PackageList() | ||
367 | 167 | if not data.startswith('<?xml'): | 112 | if not data.startswith('<?xml'): |
372 | 168 | for name in data.split(): | 113 | data = data.split() |
373 | 169 | if _is_equal(name, package, V2): | 114 | if data[0] == str(V2): |
374 | 170 | pkglist.found(name) | 115 | return [Package(name) for name in data[1:]] |
371 | 171 | return pkglist | ||
375 | 172 | 116 | ||
378 | 173 | handler = _PackageFinder(package) | 117 | pkglist = [] |
379 | 174 | handler.callback = pkglist.found | 118 | handler = _XMLDecoder() |
380 | 119 | handler.callback = pkglist.append | ||
381 | 175 | 120 | ||
382 | 176 | try: | 121 | try: |
383 | 177 | parseString(data, handler) | 122 | parseString(data, handler) |
384 | 178 | |||
385 | 179 | except SAXParseException: | 123 | except SAXParseException: |
386 | 180 | #{ Non-conforming list | 124 | #{ Non-conforming list |
387 | 181 | logging.warning( | 125 | logging.warning( |
388 | 182 | '[PARSER] Parse Error, Ignoring: malformed package list.') | 126 | '[PARSER] Parse Error, Ignoring: malformed package list.') |
391 | 183 | return _PackageList() | 127 | return [] |
390 | 184 | |||
392 | 185 | return pkglist | 128 | return pkglist |
393 | 186 | 129 | ||
394 | 187 | 130 | ||
395 | 131 | def has_package(package, list): | ||
396 | 132 | """ | ||
397 | 133 | Locate package (disregarding the epoch) in package list. | ||
398 | 134 | |||
399 | 135 | Returns the package name, including the epoch if there is one. | ||
400 | 136 | |||
401 | 137 | @param package: package name | ||
402 | 138 | @type package: basestring | ||
403 | 139 | @param data: list of Packages | ||
404 | 140 | @type data: list | ||
405 | 141 | @return: package name | ||
406 | 142 | @rtype: basestring | ||
407 | 143 | """ | ||
408 | 144 | results = [] | ||
409 | 145 | for pkg in list: | ||
410 | 146 | if _is_equal(pkg.name, package): | ||
411 | 147 | results.append(pkg.name) | ||
412 | 148 | |||
413 | 149 | results.sort(cmp=VersionCompare) | ||
414 | 150 | if results: | ||
415 | 151 | return results[-1] | ||
416 | 152 | else: | ||
417 | 153 | return '' | ||
418 | 154 | |||
419 | 155 | |||
420 | 188 | def store_packages(url, port): | 156 | def store_packages(url, port): |
421 | 189 | """ | 157 | """ |
422 | 190 | Fetch non-local AZC Cache service host cache listings. | 158 | Fetch non-local AZC Cache service host cache listings. |
423 | 191 | |||
424 | 192 | @param url: | ||
425 | 193 | @type url: | ||
426 | 194 | """ | 159 | """ |
427 | 195 | from urllib2 import Request, urlopen | 160 | from urllib2 import Request, urlopen |
428 | 196 | 161 | ||
439 | 197 | pkglist = urlopen(Request(url="http://%s:%d/list" % (url, port))) | 162 | pkglist = urlopen("http://%s:%d/list" % (url, port)) |
440 | 198 | pkgdata = pkglist.read(4) | 163 | data = pkglist.read() |
441 | 199 | 164 | return decode_list(data) | |
432 | 200 | if pkgdata[:3] == V2: | ||
433 | 201 | return pkglist.read() | ||
434 | 202 | |||
435 | 203 | elif pkgdata == '<?xm': | ||
436 | 204 | return pkgdata + pkglist.read() | ||
437 | 205 | |||
438 | 206 | return '' | ||
442 | 207 | 165 | ||
443 | 208 | 166 | ||
444 | 209 | def make_packagelist(packages): | 167 | def make_packagelist(packages): |
445 | @@ -215,12 +173,10 @@ | |||
446 | 215 | @return: xml package data | 173 | @return: xml package data |
447 | 216 | @rtype: basestring | 174 | @rtype: basestring |
448 | 217 | """ | 175 | """ |
449 | 218 | from urllib2 import unquote | ||
450 | 219 | |||
451 | 220 | form = ("<?xml version='1.0' ?>\n" | 176 | form = ("<?xml version='1.0' ?>\n" |
452 | 221 | "<?xml-stylesheet href='list.xsl' type='text/xsl' ?>\n" | 177 | "<?xml-stylesheet href='list.xsl' type='text/xsl' ?>\n" |
453 | 222 | "<packagelist version='%.1f'>\n" % __version__) | 178 | "<packagelist version='%.1f'>\n" % __version__) |
454 | 223 | for pkg in packages: | 179 | for pkg in packages: |
456 | 224 | form += " <package>\n <name>%s</name>\n </package>" % unquote(pkg) | 180 | form += " <package>\n <name>%s</name>\n </package>" % pkg |
457 | 225 | form += "</packagelist>\n" | 181 | form += "</packagelist>\n" |
458 | 226 | return form | 182 | return form |
459 | 227 | 183 | ||
460 | === modified file 'azc_daemon/__init__.py' | |||
461 | --- azc_daemon/__init__.py 2009-07-11 22:12:07 +0000 | |||
462 | +++ azc_daemon/__init__.py 2010-02-01 20:58:13 +0000 | |||
463 | @@ -23,6 +23,7 @@ | |||
464 | 23 | import os | 23 | import os |
465 | 24 | import time | 24 | import time |
466 | 25 | import atexit | 25 | import atexit |
467 | 26 | import resource | ||
468 | 26 | from signal import SIGTERM | 27 | from signal import SIGTERM |
469 | 27 | 28 | ||
470 | 28 | 29 | ||
471 | @@ -85,9 +86,21 @@ | |||
472 | 85 | error.errno, error.strerror)) | 86 | error.errno, error.strerror)) |
473 | 86 | sys.exit(1) | 87 | sys.exit(1) |
474 | 87 | 88 | ||
475 | 88 | #{ redirect standard file descriptors | ||
476 | 89 | sys.stdout.flush() | 89 | sys.stdout.flush() |
477 | 90 | sys.stderr.flush() | 90 | sys.stderr.flush() |
478 | 91 | |||
479 | 92 | #{ close all file descriptors; without this dpkg-reconfigure gets mad | ||
480 | 93 | #{ code taken from http://code.activestate.com/recipes/278731/ | ||
481 | 94 | maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1] | ||
482 | 95 | if maxfd == resource.RLIM_INFINITY: | ||
483 | 96 | maxfd = 1024 | ||
484 | 97 | for fd in xrange(0, maxfd): | ||
485 | 98 | try: | ||
486 | 99 | os.close(fd) | ||
487 | 100 | except OSError: | ||
488 | 101 | pass # fd wasn't open, ignore it | ||
489 | 102 | |||
490 | 103 | #{ redirect standard file descriptors | ||
491 | 91 | si = file(self.stdin, 'r') | 104 | si = file(self.stdin, 'r') |
492 | 92 | so = file(self.stdout, 'a+') | 105 | so = file(self.stdout, 'a+') |
493 | 93 | se = file(self.stderr, 'a+', 0) | 106 | se = file(self.stderr, 'a+', 0) |
494 | 94 | 107 | ||
495 | === renamed file 'debian/postinst' => 'debian/apt-zeroconf.postinst' | |||
496 | --- debian/postinst 2009-07-24 23:20:29 +0000 | |||
497 | +++ debian/apt-zeroconf.postinst 2010-02-01 20:58:13 +0000 | |||
498 | @@ -9,23 +9,18 @@ | |||
499 | 9 | 9 | ||
500 | 10 | case "$1" in | 10 | case "$1" in |
501 | 11 | configure) | 11 | configure) |
502 | 12 | db_input medium apt-zeroconf/activate || true | ||
503 | 13 | db_go | ||
504 | 12 | db_get apt-zeroconf/activate | 14 | db_get apt-zeroconf/activate |
506 | 13 | if [ "$RET" = true ]; then | 15 | if [ "$RET" = "false" ]; then |
507 | 16 | echo "ENABLED=0" > /etc/default/apt-zeroconf | ||
508 | 17 | else | ||
509 | 14 | echo "ENABLED=1" > /etc/default/apt-zeroconf | 18 | echo "ENABLED=1" > /etc/default/apt-zeroconf |
511 | 15 | ln -s /usr/share/apt-zeroconf/apt-zeroconf.apt.conf \ | 19 | [ -L /etc/apt/apt.conf.d/10apt-zeroconf ] || \ |
512 | 20 | ln -s /usr/share/apt-zeroconf/apt-zeroconf.apt.conf \ | ||
513 | 16 | /etc/apt/apt.conf.d/10apt-zeroconf || true | 21 | /etc/apt/apt.conf.d/10apt-zeroconf || true |
514 | 17 | else | ||
515 | 18 | echo "ENABLED=0" > /etc/default/apt-zeroconf | ||
516 | 19 | fi | 22 | fi |
517 | 20 | ;; | 23 | ;; |
518 | 21 | |||
519 | 22 | abort-upgrade|abort-remove|abort-deconfigure) | ||
520 | 23 | ;; | ||
521 | 24 | |||
522 | 25 | *) | ||
523 | 26 | echo "postinst called with unknown argument \`$1'" >&2 | ||
524 | 27 | exit 1 | ||
525 | 28 | ;; | ||
526 | 29 | esac | 24 | esac |
527 | 30 | 25 | ||
528 | 31 | update-rc.d -f apt-zeroconf remove >/dev/null | 26 | update-rc.d -f apt-zeroconf remove >/dev/null |
529 | 32 | 27 | ||
530 | === modified file 'debian/changelog' | |||
531 | --- debian/changelog 2009-07-01 00:04:09 +0000 | |||
532 | +++ debian/changelog 2010-02-01 20:58:13 +0000 | |||
533 | @@ -1,3 +1,24 @@ | |||
534 | 1 | apt-zeroconf (0.5.0+20100131-0ubuntu1~ppa1) unstable; urgency=low | ||
535 | 2 | |||
536 | 3 | [ Josh Holland ] | ||
537 | 4 | * Moved packaging to use debhelper 7. | ||
538 | 5 | |||
539 | 6 | [ Siegfried-Angel Gevatter Pujals ] | ||
540 | 7 | * debian/ | ||
541 | 8 | - Fix Python dependencies so this works on Debian. | ||
542 | 9 | - Other little changes. | ||
543 | 10 | * debian/templates, debian/apt-zeroconf.postinst: | ||
544 | 11 | - Give the debconf question priority "medium" and define a template for it. | ||
545 | 12 | * apt-zeroconf: | ||
546 | 13 | - Add installation directory to the path. | ||
547 | 14 | * aptzeroconf/__init__.py: | ||
548 | 15 | - Close open file descriptors after forking, without this | ||
549 | 16 | dpkg-reconfigure would hang forever. | ||
550 | 17 | * Replace manpage with a troff version, which doesn't need to | ||
551 | 18 | be generated. | ||
552 | 19 | |||
553 | 20 | -- Siegfried-Angel Gevatter Pujals <rainct@ubuntu.com> Sun, 31 Jan 2010 21:55:46 +0100 | ||
554 | 21 | |||
555 | 1 | apt-zeroconf (0.5.0-0ubuntu1~karmic~ppa1) karmic; urgency=low | 22 | apt-zeroconf (0.5.0-0ubuntu1~karmic~ppa1) karmic; urgency=low |
556 | 2 | 23 | ||
557 | 3 | * Improve proxy server to include some test urls and improved pages. | 24 | * Improve proxy server to include some test urls and improved pages. |
558 | 4 | 25 | ||
559 | === modified file 'debian/control' | |||
560 | --- debian/control 2009-07-24 23:20:29 +0000 | |||
561 | +++ debian/control 2010-02-01 20:58:13 +0000 | |||
562 | @@ -1,30 +1,44 @@ | |||
563 | 1 | Source: apt-zeroconf | 1 | Source: apt-zeroconf |
564 | 2 | Section: admin | 2 | Section: admin |
566 | 3 | Priority: extra | 3 | Priority: optional |
567 | 4 | Maintainer: Apt-ZeroConf Launchpad Team <apt-zeroconf@lists.launchpad.net> | 4 | Maintainer: Apt-ZeroConf Launchpad Team <apt-zeroconf@lists.launchpad.net> |
569 | 5 | Uploaders: Jeremy Austin-Bardo <ausimage@ubuntu.com>, Martin-Éric Racine <q-funk@iki.fi> | 5 | Uploaders: Jeremy Austin-Bardo <ausimage@ubuntu.com>, |
570 | 6 | Martin-Éric Racine <q-funk@iki.fi>, | ||
571 | 7 | Siegfried-Angel Gevatter Pujals <rainct@ubuntu.com> | ||
572 | 6 | Homepage: https://launchpad.net/apt-zeroconf | 8 | Homepage: https://launchpad.net/apt-zeroconf |
578 | 7 | Build-Depends: cdbs (>= 0.4.49), debhelper (>= 5.0.37.2), python-central (>= 0.6), python-dev (>= 2.6) | 9 | Build-Depends: cdbs (>= 0.4.49), |
579 | 8 | Build-Depends-Indep: dpkg (>= 1.14.6), po-debconf | 10 | debhelper (>= 7), |
580 | 9 | Standards-Version: 3.8.0 | 11 | python-support (>= 0.6), |
581 | 10 | Vcs-Bzr: https://code.launchpad.net/~apt-zeroconf/apt-zeroconf/r0.5 | 12 | python2.6-dev, |
582 | 11 | XS-Python-Version: >=2.6 | 13 | dpkg (>= 1.14.6), |
583 | 14 | po-debconf | ||
584 | 15 | Standards-Version: 3.8.3 | ||
585 | 16 | Vcs-Bzr: https://code.launchpad.net/~apt-zeroconf/apt-zeroconf/trunk | ||
586 | 17 | Vcs-Browser: https://code.launchpad.net/~apt-zeroconf/apt-zeroconf/trunk | ||
587 | 18 | XS-Python-Version: >= 2.6 | ||
588 | 12 | 19 | ||
589 | 13 | Package: apt-zeroconf | 20 | Package: apt-zeroconf |
590 | 14 | Architecture: all | 21 | Architecture: all |
593 | 15 | Depends: python-apt, python-avahi, python-dbus, debconf, python-azc-daemon, | 22 | Depends: ${python:Depends}, |
594 | 16 | ${python:Depends}, ${misc:Depends} | 23 | ${misc:Depends}, |
595 | 24 | python-apt, | ||
596 | 25 | python-avahi, | ||
597 | 26 | python-dbus, | ||
598 | 27 | debconf, | ||
599 | 28 | python-azc-daemon, | ||
600 | 29 | lsb-base (>= 3.0-6) | ||
601 | 17 | XB-Python-Version: ${python:Versions} | 30 | XB-Python-Version: ${python:Versions} |
602 | 18 | Description: Caching peer-to-peer apt proxy for local networks | 31 | Description: Caching peer-to-peer apt proxy for local networks |
603 | 19 | Apt-zeroconf is an extension to apt which enables it to find other | 32 | Apt-zeroconf is an extension to apt which enables it to find other |
605 | 20 | instances on the LAN in order to exchange debian package files and not to | 33 | instances on the LAN in order to exchange Debian package files and not to |
606 | 21 | fetch them from the internet. | 34 | fetch them from the internet. |
607 | 22 | 35 | ||
608 | 23 | Package: python-azc-daemon | 36 | Package: python-azc-daemon |
609 | 24 | Architecture: all | 37 | Architecture: all |
610 | 25 | XB-Python-Version: ${python:Versions} | 38 | XB-Python-Version: ${python:Versions} |
615 | 26 | Depends: ${python:Depends}, ${misc:Depends} | 39 | Depends: ${python:Depends}, |
616 | 27 | Description: AZC daemon library. | 40 | ${misc:Depends} |
617 | 28 | Daemon library to allow python code to run in the background. Based on code | 41 | Description: apt-zeroconf daemon library |
618 | 29 | found at | 42 | Daemon library to allow Python code to run in the background. Based upon code |
619 | 43 | found at: | ||
620 | 30 | http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ | 44 | http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ |
621 | 31 | 45 | ||
622 | === modified file 'debian/init' | |||
623 | --- debian/init 2009-08-14 22:08:19 +0000 | |||
624 | +++ debian/init 2010-02-01 20:58:13 +0000 | |||
625 | @@ -4,20 +4,18 @@ | |||
626 | 4 | # Required-Start: $local_fs dbus avahi | 4 | # Required-Start: $local_fs dbus avahi |
627 | 5 | # Required-Stop: $local_fs dbus avahi | 5 | # Required-Stop: $local_fs dbus avahi |
628 | 6 | # Default-Start: 2 3 4 5 | 6 | # Default-Start: 2 3 4 5 |
630 | 7 | # Default-Stop: S 0 1 6 | 7 | # Default-Stop: 0 1 6 |
631 | 8 | # Short-Description: apt-zeroconf peer-to-peer apt proxy | 8 | # Short-Description: apt-zeroconf peer-to-peer apt proxy |
632 | 9 | # Description: apt-zeroconf is a caching peer-to-peer proxy for | 9 | # Description: apt-zeroconf is a caching peer-to-peer proxy for |
633 | 10 | # local networks | 10 | # local networks |
634 | 11 | ### END INIT INFO | 11 | ### END INIT INFO |
635 | 12 | 12 | ||
642 | 13 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | 13 | PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin |
637 | 14 | #PYTHONPATH=/usr/share/pyshared #<== Not sure of this... anyone??? -- ausimage | ||
638 | 15 | DAEMON=/usr/bin/apt-zeroconf | ||
639 | 16 | #DAEMON_OPTS_START="-d start" | ||
640 | 17 | #DAEMON_OPTS_STOP="-d stop" | ||
641 | 18 | #DAEMON_OPTS_RESTART="-d restart" | ||
643 | 19 | NAME=apt-zeroconf | 14 | NAME=apt-zeroconf |
644 | 20 | DESC="apt-zeroconf APT proxy" | 15 | DESC="apt-zeroconf APT proxy" |
645 | 16 | DAEMON=/usr/bin/apt-zeroconf | ||
646 | 17 | PIDFILE=/var/run/$NAME.pid | ||
647 | 18 | STATUSCODE=0 | ||
648 | 21 | 19 | ||
649 | 22 | test -x $DAEMON || exit 0 | 20 | test -x $DAEMON || exit 0 |
650 | 23 | 21 | ||
651 | @@ -25,40 +23,36 @@ | |||
652 | 25 | 23 | ||
653 | 26 | . /lib/lsb/init-functions | 24 | . /lib/lsb/init-functions |
654 | 27 | 25 | ||
655 | 28 | #start_azc() { | ||
656 | 29 | # start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ | ||
657 | 30 | # --startas $DAEMON -- $DAEMON_OPTS | ||
658 | 31 | #} | ||
659 | 32 | |||
660 | 33 | #stop_azc() { | ||
661 | 34 | # start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid | ||
662 | 35 | # rm -f /var/run/$NAME.pid | ||
663 | 36 | #} | ||
664 | 37 | |||
665 | 38 | case "$1" in | 26 | case "$1" in |
666 | 39 | start) | 27 | start) |
667 | 40 | if [ "$ENABLED" != 1 ]; then | 28 | if [ "$ENABLED" != 1 ]; then |
668 | 41 | log_begin_msg "Starting $DESC (not enabled)" | 29 | log_begin_msg "Starting $DESC (not enabled)" |
669 | 42 | else | 30 | else |
670 | 43 | log_begin_msg "Starting $DESC" | 31 | log_begin_msg "Starting $DESC" |
673 | 44 | #start_azc | 32 | if [ -f "$PIDFILE" ]; then |
674 | 45 | $DAEMON -d start | 33 | STATUSCODE=1 # already running |
675 | 34 | else | ||
676 | 35 | $DAEMON -d start | ||
677 | 36 | STATUSCODE=$? | ||
678 | 37 | if [ $STATUSCODE -eq 42 ]; then | ||
679 | 38 | STATUSCODE=1 # already running | ||
680 | 39 | elif [ $STATUSCODE -ne 0 ]; then | ||
681 | 40 | STATUSCODE=2 # error | ||
682 | 41 | fi | ||
683 | 42 | fi | ||
684 | 46 | fi | 43 | fi |
686 | 47 | log_end_msg 0 | 44 | log_end_msg $STATUSCODE |
687 | 48 | ;; | 45 | ;; |
688 | 49 | stop) | 46 | stop) |
689 | 50 | log_begin_msg "Stopping $DESC" | 47 | log_begin_msg "Stopping $DESC" |
693 | 51 | #stop_azc | 48 | $DAEMON -d stop >/dev/null 2>&1 |
694 | 52 | $DAEMON -d stop | 49 | log_end_msg 0 # else dpkg-reconfigure fails |
692 | 53 | log_end_msg 0 | ||
695 | 54 | ;; | 50 | ;; |
696 | 55 | restart|force-reload) | 51 | restart|force-reload) |
697 | 56 | log_begin_msg "Restarting $DESC" | 52 | log_begin_msg "Restarting $DESC" |
703 | 57 | #stop_azc | 53 | $DAEMON -d restart >/dev/null 2>&1 |
704 | 58 | #sleep 1 | 54 | STATUSCODE=$? |
705 | 59 | #start_azc | 55 | log_end_msg $STATUSCODE |
701 | 60 | $DAEMON -d restart | ||
702 | 61 | log_end_msg 0 | ||
706 | 62 | ;; | 56 | ;; |
707 | 63 | *) | 57 | *) |
708 | 64 | echo "Usage: $0 {start|stop|restart|force-reload}" >&2 | 58 | echo "Usage: $0 {start|stop|restart|force-reload}" >&2 |
709 | @@ -66,4 +60,4 @@ | |||
710 | 66 | ;; | 60 | ;; |
711 | 67 | esac | 61 | esac |
712 | 68 | 62 | ||
714 | 69 | exit 0 | 63 | exit $STATUSCODE |
715 | 70 | 64 | ||
716 | === modified file 'debian/rules' | |||
717 | --- debian/rules 2009-05-06 04:18:16 +0000 | |||
718 | +++ debian/rules 2010-02-01 20:58:13 +0000 | |||
719 | @@ -1,7 +1,3 @@ | |||
720 | 1 | #!/usr/bin/make -f | 1 | #!/usr/bin/make -f |
727 | 2 | 2 | %: | |
728 | 3 | DEB_UPDATE_RCD_PARAMS=defaults 25 | 3 | dh $@ |
723 | 4 | DEB_PYTHON_SYSTEM=pycentral | ||
724 | 5 | |||
725 | 6 | include /usr/share/cdbs/1/rules/debhelper.mk | ||
726 | 7 | include /usr/share/cdbs/1/class/python-distutils.mk | ||
729 | 8 | 4 | ||
730 | === added file 'debian/templates' | |||
731 | --- debian/templates 1970-01-01 00:00:00 +0000 | |||
732 | +++ debian/templates 2010-02-01 20:58:13 +0000 | |||
733 | @@ -0,0 +1,4 @@ | |||
734 | 1 | Template: apt-zeroconf/activate | ||
735 | 2 | Type: boolean | ||
736 | 3 | Default: true | ||
737 | 4 | Description: Do you want to apt-zeroconf to start automatically at boot? | ||
738 | 0 | 5 | ||
739 | === modified file 'setup.py' | |||
740 | --- setup.py 2009-08-14 22:08:19 +0000 | |||
741 | +++ setup.py 2010-02-01 20:58:13 +0000 | |||
742 | @@ -1,7 +1,11 @@ | |||
743 | 1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
744 | 2 | import os | ||
745 | 3 | |||
746 | 2 | from distutils.core import setup | 4 | from distutils.core import setup |
747 | 5 | from distutils.command.build import build | ||
748 | 3 | 6 | ||
750 | 4 | setup(name='apt-zeroconf', | 7 | setup( |
751 | 8 | name='apt-zeroconf', | ||
752 | 5 | version='0.6.x~bzr', | 9 | version='0.6.x~bzr', |
753 | 6 | author='Apt-Zeroconf Launchpad Team', | 10 | author='Apt-Zeroconf Launchpad Team', |
754 | 7 | author_email='apt-zeroconf@lists.launchpad.net', | 11 | author_email='apt-zeroconf@lists.launchpad.net', |
755 | @@ -18,18 +22,19 @@ | |||
756 | 18 | packages=['aptzeroconf', 'azc_daemon'], | 22 | packages=['aptzeroconf', 'azc_daemon'], |
757 | 19 | scripts=['apt-zeroconf'], | 23 | scripts=['apt-zeroconf'], |
758 | 20 | data_files=[ | 24 | data_files=[ |
761 | 21 | ('/usr/share/apt-zeroconf', ['support/apt-zeroconf.apt.conf', ]), | 25 | ('share/apt-zeroconf', ['support/apt-zeroconf.apt.conf', ]), |
762 | 22 | ('/usr/share/apt-zeroconf/pages', [ | 26 | ('share/apt-zeroconf/pages', [ |
763 | 23 | 'pages/aptzeroconf.css', 'pages/host.html', 'pages/index.html', | 27 | 'pages/aptzeroconf.css', 'pages/host.html', 'pages/index.html', |
764 | 24 | 'pages/listupdate.html', 'pages/list.xsl', 'pages/aptzeroconf.png', | 28 | 'pages/listupdate.html', 'pages/list.xsl', 'pages/aptzeroconf.png', |
765 | 25 | 'pages/stats.html', ]), | 29 | 'pages/stats.html', ]), |
767 | 26 | ('/usr/share/apt-zeroconf/tests', [ | 30 | ('share/apt-zeroconf/tests', [ |
768 | 27 | 'test/common.py', 'test/__init__.py', 'test/pep8.py', | 31 | 'test/common.py', 'test/__init__.py', 'test/pep8.py', |
769 | 28 | 'test/test_auth.py', 'test/test_general.py', | 32 | 'test/test_auth.py', 'test/test_general.py', |
770 | 29 | 'test/test_sourcecode.py', ]), | 33 | 'test/test_sourcecode.py', ]), |
771 | 30 | ('/etc/', ['support/apt-zeroconf.conf']), | 34 | ('/etc/', ['support/apt-zeroconf.conf']), |
772 | 31 | ('/etc/ufw/applications.d/', ['support/azc_rule']), | 35 | ('/etc/ufw/applications.d/', ['support/azc_rule']), |
774 | 32 | ('/usr/share/man/man1', ['support/apt-zeroconf.1.gz', ]), ], | 36 | ('share/man/man1', ['support/apt-zeroconf.1', ]), |
775 | 37 | ], | ||
776 | 33 | keywords="zeroconf, apt, cache, pacakage, proxy, adhoc", | 38 | keywords="zeroconf, apt, cache, pacakage, proxy, adhoc", |
777 | 34 | platforms="Ubuntu 9.04 and 9.10 (others may work as well)", | 39 | platforms="Ubuntu 9.04 and 9.10 (others may work as well)", |
778 | 35 | classifiers=[ | 40 | classifiers=[ |
779 | 36 | 41 | ||
780 | === added file 'support/apt-zeroconf.1' | |||
781 | --- support/apt-zeroconf.1 1970-01-01 00:00:00 +0000 | |||
782 | +++ support/apt-zeroconf.1 2010-02-01 20:58:13 +0000 | |||
783 | @@ -0,0 +1,65 @@ | |||
784 | 1 | .TH APT\-ZEROCONF 1 "January 31, 2010" "Apt-ZeroConf" | ||
785 | 2 | |||
786 | 3 | .SH NAME | ||
787 | 4 | apt\-zeroconf \- write summary here... | ||
788 | 5 | |||
789 | 6 | .SH SYNOPSIS | ||
790 | 7 | \fBapt\-zeroconf\fP \fI[OPTION]\fP | ||
791 | 8 | |||
792 | 9 | .SH DESCRIPTION | ||
793 | 10 | \fBapt\-zeroconf\fP creates an adhoc network on your local network to provide | ||
794 | 11 | apt repository packages. Allowing you download once, then retrieve locally for | ||
795 | 12 | all other computers on your network. | ||
796 | 13 | |||
797 | 14 | .SH OPTIONS | ||
798 | 15 | The program follows the usual GNU command line syntax, with | ||
799 | 16 | options starting with two dashes (`--'). A summary of options is | ||
800 | 17 | included below. | ||
801 | 18 | .TP | ||
802 | 19 | .B \-p, \-\-port | ||
803 | 20 | Start \fBapt\-zeroconf\fP at the given port. | ||
804 | 21 | .TP | ||
805 | 22 | .B \-r, \-\-restrict | ||
806 | 23 | Overrides the option in \fBapt\-zeroconf\fP's configuration file, on whether | ||
807 | 24 | to restrict the proxy to only operate for the URLs specified under the | ||
808 | 25 | [apt-cache] section. | ||
809 | 26 | .TP | ||
810 | 27 | .B \-d, \-\-daemon=start|stop|restart | ||
811 | 28 | Start \fBapt\-zeroconf\fP as a background process, stop an already running | ||
812 | 29 | instance or restart an already running instance. | ||
813 | 30 | .TP | ||
814 | 31 | .B -l, \-\-logger=debug|info|warning|error|critical | ||
815 | 32 | Change the verbosity of the log output. | ||
816 | 33 | |||
817 | 34 | .SH EXIT VALUES | ||
818 | 35 | .TP | ||
819 | 36 | .B 0 | ||
820 | 37 | Success. | ||
821 | 38 | .TP | ||
822 | 39 | .B 2 | ||
823 | 40 | Incorrect parameter or another user error. | ||
824 | 41 | .TP | ||
825 | 42 | .B 42 | ||
826 | 43 | Another instance of \fBapt\-zeroconf\fP is already running or there's | ||
827 | 44 | another service using the same port. | ||
828 | 45 | |||
829 | 46 | .SH BUGS | ||
830 | 47 | Please report any bugs at https://bugs.launchpad.net/apt-zeroconf. | ||
831 | 48 | |||
832 | 49 | .SH AUTHORS | ||
833 | 50 | Please see the AUTHORS file bundled with this application for | ||
834 | 51 | a complete list of contributors. | ||
835 | 52 | |||
836 | 53 | .SH LICENSE | ||
837 | 54 | This program is free software: you can redistribute it and/or modify | ||
838 | 55 | it under the terms of the GNU Lesser General Public License as published by | ||
839 | 56 | the Free Software Foundation, either version 3 of the License, or | ||
840 | 57 | (at your option) any later version. | ||
841 | 58 | .PP | ||
842 | 59 | This program is distributed in the hope that it will be useful, | ||
843 | 60 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
844 | 61 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
845 | 62 | GNU Lesser General Public License for more details. | ||
846 | 63 | .PP | ||
847 | 64 | You should have received a copy of the GNU Lesser General Public License | ||
848 | 65 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
849 | 0 | 66 | ||
850 | === removed file 'support/apt-zeroconf.xml' | |||
851 | --- support/apt-zeroconf.xml 2009-07-04 03:53:33 +0000 | |||
852 | +++ support/apt-zeroconf.xml 1970-01-01 00:00:00 +0000 | |||
853 | @@ -1,115 +0,0 @@ | |||
854 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
855 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" | ||
856 | 3 | "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> | ||
857 | 4 | <!-- See http://www.docbook.org/tdg/en/html/refentry.html for more info | ||
858 | 5 | Use docbook2x-man to generate manpage. --> | ||
859 | 6 | <refentry id="application.soovee"> | ||
860 | 7 | <refentryinfo> | ||
861 | 8 | <author>Apt-ZeroConf Launchpad Team</author> | ||
862 | 9 | <address></address> | ||
863 | 10 | |||
864 | 11 | <copyright><year>2009</year><holder>Jeremy Austin-Bardo</holder></copyright> | ||
865 | 12 | </refentryinfo> | ||
866 | 13 | |||
867 | 14 | <refmeta> | ||
868 | 15 | <refentrytitle>apt-zeroconf</refentrytitle><manvolnum>1</manvolnum> | ||
869 | 16 | </refmeta> | ||
870 | 17 | |||
871 | 18 | <refnamediv> | ||
872 | 19 | <refname>apt-zeroconf</refname> | ||
873 | 20 | <refpurpose>Create an adhoc network on your local network to provide | ||
874 | 21 | Internet apt repository packages. Allowing you download once, then retrieve | ||
875 | 22 | locally for all other computers on your network. | ||
876 | 23 | </refpurpose> | ||
877 | 24 | </refnamediv> | ||
878 | 25 | <refsynopsisdiv> | ||
879 | 26 | <cmdsynopsis> | ||
880 | 27 | <command>apt-zeroconf</command> | ||
881 | 28 | <arg choice="opt"> | ||
882 | 29 | <option>-p</option><option>--port</option> Number | ||
883 | 30 | </arg> | ||
884 | 31 | <arg choice="opt"> | ||
885 | 32 | <option>-r</option><option>--restrict</option> | ||
886 | 33 | </arg> | ||
887 | 34 | <arg choice="opt"> | ||
888 | 35 | <option>-d</option><option>--daemon</option> | ||
889 | 36 | <arg choice="req">start stop restart</arg> | ||
890 | 37 | </arg> | ||
891 | 38 | <arg choice="opt"> | ||
892 | 39 | <option>-r</option><option>--restrict</option> | ||
893 | 40 | </arg> | ||
894 | 41 | <arg choice="opt"> | ||
895 | 42 | <option>-l</option><option>--logger</option> | ||
896 | 43 | <arg choice="req">debug info warning error critical</arg> | ||
897 | 44 | </arg> | ||
898 | 45 | </cmdsynopsis> | ||
899 | 46 | </refsynopsisdiv> | ||
900 | 47 | <refsect1> | ||
901 | 48 | <title>Description</title> | ||
902 | 49 | |||
903 | 50 | <para><command>apt-zeroconf</command> </para> | ||
904 | 51 | </refsect1> | ||
905 | 52 | |||
906 | 53 | <refsect1> | ||
907 | 54 | <title>Command Arguments</title> | ||
908 | 55 | |||
909 | 56 | <variablelist> | ||
910 | 57 | <varlistentry> | ||
911 | 58 | <term> | ||
912 | 59 | <option>--port</option><option>-p</option> | ||
913 | 60 | </term> | ||
914 | 61 | <listitem> | ||
915 | 62 | <para>Override configuration file port designation for | ||
916 | 63 | <option>Number</option></para> | ||
917 | 64 | </listitem> | ||
918 | 65 | </varlistentry> | ||
919 | 66 | <varlistentry> | ||
920 | 67 | <term> | ||
921 | 68 | <option>-r</option><option>--restrict</option> | ||
922 | 69 | </term> | ||
923 | 70 | <listitem> | ||
924 | 71 | <para>Override configuration file proxy restriction to enable only | ||
925 | 72 | designated urls in [apt-cache] section.</para> | ||
926 | 73 | </listitem> | ||
927 | 74 | </varlistentry> | ||
928 | 75 | <varlistentry> | ||
929 | 76 | <term> | ||
930 | 77 | <option>-d</option><option>--daemon</option> | ||
931 | 78 | </term> | ||
932 | 79 | <listitem> | ||
933 | 80 | <para>Daemonize apt-zeroconf process to run as a background process. | ||
934 | 81 | Daemons value should be <option>debug</option>, <option>info</option>, | ||
935 | 82 | <option>warning</option>, <option>error</option>, or | ||
936 | 83 | <option>critical</option>. Should be run with sudo priviledges to | ||
937 | 84 | enable logging functionality. | ||
938 | 85 | </para> | ||
939 | 86 | </listitem> | ||
940 | 87 | </varlistentry> | ||
941 | 88 | <varlistentry> | ||
942 | 89 | <term> | ||
943 | 90 | <option>-l</option><option>--logger</option> | ||
944 | 91 | </term> | ||
945 | 92 | <listitem> | ||
946 | 93 | <para>Set logger logging level for apt-zeroconf to one of the | ||
947 | 94 | following <option>info</option>, <option>warning</option>, | ||
948 | 95 | <option>error</option>, or <option>critical</option>. Without setting | ||
949 | 96 | this switch the default will be <option>info</option>. | ||
950 | 97 | </para> | ||
951 | 98 | </listitem> | ||
952 | 99 | </varlistentry> | ||
953 | 100 | </variablelist> | ||
954 | 101 | </refsect1> | ||
955 | 102 | |||
956 | 103 | <refsect1> | ||
957 | 104 | <title>See Also</title> | ||
958 | 105 | |||
959 | 106 | </refsect1> | ||
960 | 107 | |||
961 | 108 | <refsect1> | ||
962 | 109 | <title>Author</title> | ||
963 | 110 | <para>Apt-ZeroConf Launchpad Team</para> | ||
964 | 111 | <para>Permission is hereby granted to copy, distribute and/or modify this | ||
965 | 112 | document under the terms of the GNU General Public License, Version 2 or | ||
966 | 113 | later by the Free Software Foundation.</para> | ||
967 | 114 | </refsect1> | ||
968 | 115 | </refentry> | ||
969 | 116 | 0 | ||
970 | === modified file 'support/azc_rule' | |||
971 | --- support/azc_rule 2009-07-13 23:48:19 +0000 | |||
972 | +++ support/azc_rule 2010-02-01 20:58:13 +0000 | |||
973 | @@ -1,4 +1,4 @@ | |||
974 | 1 | [AptZeroConf] | 1 | [AptZeroConf] |
976 | 2 | title= Apt-ZeroConf | 2 | title=Apt-ZeroConf |
977 | 3 | description=Personal Package Cache using Avahi ZeroConf. | 3 | description=Personal Package Cache using Avahi ZeroConf. |
978 | 4 | ports=1618/tcp | 4 | ports=1618/tcp |
979 | 5 | 5 | ||
980 | === removed file 'support/build.sh' | |||
981 | --- support/build.sh 2009-06-30 21:20:54 +0000 | |||
982 | +++ support/build.sh 1970-01-01 00:00:00 +0000 | |||
983 | @@ -1,5 +0,0 @@ | |||
984 | 1 | #!/bin/sh | ||
985 | 2 | echo "building..." | ||
986 | 3 | for file in `ls *.xml`; do docbook2x-man $file; done | ||
987 | 4 | echo "compressing..." | ||
988 | 5 | for file in `ls *.1`; do gzip $file; done | ||
989 | 6 | 0 | ||
990 | === modified file 'test/test_general.py' | |||
991 | --- test/test_general.py 2009-08-09 03:57:29 +0000 | |||
992 | +++ test/test_general.py 2010-02-01 20:58:13 +0000 | |||
993 | @@ -122,8 +122,7 @@ | |||
994 | 122 | PORT, DEBNAME)).read() | 122 | PORT, DEBNAME)).read() |
995 | 123 | # make sure the data is equal | 123 | # make sure the data is equal |
996 | 124 | assert data == '*contents*' | 124 | assert data == '*contents*' |
999 | 125 | 125 | ||
998 | 126 | |||
1000 | 127 | def test_download_epoch_local_server(tmpdir): | 126 | def test_download_epoch_local_server(tmpdir): |
1001 | 128 | """ | 127 | """ |
1002 | 129 | Test fetching a file with an epoch from an AZC instance on the local network. | 128 | Test fetching a file with an epoch from an AZC instance on the local network. |
- Several fixes so that installing the package works correctly.
- Fix http.py to look in the right path for the installed files.
- Replace the manpage with a roff one, so that no conversion is needed.
- Change hashbang to python2.6 so this works on Debian too (where 2.5 is default).
- Merge in a couple other branches.
- Other little changes to debian/.