Changeset 198
- Timestamp:
- 07/03/08 10:13:31 (3 months ago)
- Location:
- projects/apt-zeroconf/trunk
- Files:
-
- 5 modified
-
apt-zeroconf (modified) (1 diff)
-
aptzeroconf/__init__.py (modified) (2 diffs)
-
aptzeroconf/avaphi.py (modified) (4 diffs)
-
aptzeroconf/util.py (modified) (3 diffs)
-
support/apt-zeroconf.conf (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
projects/apt-zeroconf/trunk/apt-zeroconf
r184 r198 30 30 pidfile = '/var/run/apt-zeroconf.pid' 31 31 logfile = '/var/log/apt-zeroconf' 32 32 33 33 34 if options.background: -
projects/apt-zeroconf/trunk/aptzeroconf/__init__.py
r193 r198 35 35 logging.basicConfig(level=logging.DEBUG, 36 36 format='%(asctime)s [%(threadName)s] [%(levelname)-7s] %(message)s', 37 datefmt='%Y-%m-%d %H:%M:%S' 38 ) 37 datefmt='%Y-%m-%d %H:%M:%S') 39 38 40 39 import signal … … 47 46 48 47 def main(): 48 logging.debug('apt-zeroconf %s' % __version__) 49 49 50 # Kick off the httpd 50 logging.debug('apt-zeroconf %s' % __version__)51 51 logging.debug('Starting httpd on port %i.' % config['http_port']) 52 52 httpd = HttpServer() -
projects/apt-zeroconf/trunk/aptzeroconf/avaphi.py
r190 r198 36 36 from aptzeroconf.config import config 37 37 38 stype = '_apt._tcp'39 domain = ''40 host = ''41 txt = []42 43 38 44 39 class AZCAvahiService(threading.Thread): … … 50 45 self.n_rename = 0 51 46 52 self.name = config['avahi_name']% config['hostname']53 self.stype = stype54 self.domain = domain55 self.host = host47 self.name = 'apt-zeroconf repository on %s' % config['hostname'] 48 self.stype = '_apt._tcp' 49 self.domain = '' 50 self.host = '' 56 51 self.port = config['http_port'] 57 self. txt = txt52 self.data = ['downloading=False'] # TODO use me! 58 53 59 54 hosts.set_service(self) … … 81 76 self.name, self.stype, self.domain, self.host, 82 77 dbus.UInt16(self.port), 83 avahi.string_array_to_txt_array(self. txt))78 avahi.string_array_to_txt_array(self.data)) 84 79 self.group.Commit() 85 80 … … 187 182 return 188 183 184 data = {} 185 for i in avahi.txt_array_to_string_array(txt): 186 i = i.split('=') 187 data[i[0]] = [1] 188 189 189 url = make_url(address, port, protocol) 190 190 self['%s:%s:%s' % (name, interface, domain)] = { 191 'host': host, 'address': address, 'port': port, ' txt': txt,191 'host': host, 'address': address, 'port': port, 'data': data, 192 192 'proto': protocol, 'url': url, 193 193 'pkglist': self._fetch_list(url)} -
projects/apt-zeroconf/trunk/aptzeroconf/util.py
r184 r198 25 25 # synchronized decorator 26 26 def synchronized(lock): 27 """Wrapper function to make threadsave code easy. To be used as 28 decorater.""" 27 29 def wrap(f): 28 30 def func(*args, **kw): … … 38 40 EPOCH_PATTERN = re.compile(r'\_\d+\%3a') 39 41 40 def prune_epoch(f): 41 return EPOCH_PATTERN.sub('_', f) 42 def prune_epoch(fname): 43 """Prune epoch from package name as apt does. """ 44 return EPOCH_PATTERN.sub('_', fname) 42 45 43 46 def make_url(address, port, proto): … … 45 48 return '%s:%i' % \ 46 49 ((proto == avahi.PROTO_INET6 and '[%s]' or '%s') % address, port) 47 -
projects/apt-zeroconf/trunk/support/apt-zeroconf.conf
r172 r198 5 5 apt_cache_path = /var/cache/apt/archives 6 6 7 # name of the avahi-service, %s will be replaced with the hostname8 avahi_name = apt-zeroconf repository on %s9 7 # override hostname if needed 10 8 ;hostname = machine
