Lines 24-30
__version__ = "$Id: db.py 309 2007-04-09 16:23:38Z wrobel $"
Link Here
|
24 |
# |
24 |
# |
25 |
#------------------------------------------------------------------------------- |
25 |
#------------------------------------------------------------------------------- |
26 |
|
26 |
|
27 |
import os, codecs, os.path, urllib2, re, md5 |
27 |
import os, codecs, os.path, urllib2, re, hashlib |
28 |
|
28 |
|
29 |
from layman.utils import path |
29 |
from layman.utils import path |
30 |
from layman.overlay import Overlays |
30 |
from layman.overlay import Overlays |
Lines 318-324
class RemoteDB(Overlays):
Link Here
|
318 |
|
318 |
|
319 |
OUT.debug('Generating cache path.', 6) |
319 |
OUT.debug('Generating cache path.', 6) |
320 |
|
320 |
|
321 |
return base + '_' + md5.md5(url).hexdigest() + '.xml' |
321 |
return base + '_' + hashlib.md5(url).hexdigest() + '.xml' |
322 |
|
322 |
|
323 |
#=============================================================================== |
323 |
#=============================================================================== |
324 |
# |
324 |
# |
Lines 332-338
class MakeConf:
Link Here
|
332 |
|
332 |
|
333 |
Check that an add/remove cycle does not modify the make.conf: |
333 |
Check that an add/remove cycle does not modify the make.conf: |
334 |
|
334 |
|
335 |
>>> import md5 |
335 |
>>> import hashlib |
336 |
>>> write = os.tmpnam() |
336 |
>>> write = os.tmpnam() |
337 |
>>> here = os.path.dirname(os.path.realpath(__file__)) |
337 |
>>> here = os.path.dirname(os.path.realpath(__file__)) |
338 |
>>> config = {'local_list' : |
338 |
>>> config = {'local_list' : |
Lines 343-349
class MakeConf:
Link Here
|
343 |
... 'quietness':3} |
343 |
... 'quietness':3} |
344 |
>>> b = DB(config) |
344 |
>>> b = DB(config) |
345 |
>>> a = MakeConf(config, b.overlays) |
345 |
>>> a = MakeConf(config, b.overlays) |
346 |
>>> o_md5 = str(md5.md5(open(here + '/tests/testfiles/make.conf').read()).hexdigest()) |
346 |
>>> o_md5 = str(hashlib.md5(open(here + '/tests/testfiles/make.conf').read()).hexdigest()) |
347 |
>>> a.path = write |
347 |
>>> a.path = write |
348 |
>>> a.add(b.overlays['wrobel-stable']) |
348 |
>>> a.add(b.overlays['wrobel-stable']) |
349 |
>>> [i.name for i in a.overlays] |
349 |
>>> [i.name for i in a.overlays] |
Lines 358-364
class MakeConf:
Link Here
|
358 |
>>> [i.name for i in a.overlays] |
358 |
>>> [i.name for i in a.overlays] |
359 |
[u'wrobel', u'wrobel-stable'] |
359 |
[u'wrobel', u'wrobel-stable'] |
360 |
>>> a.delete(b.overlays['wrobel']) |
360 |
>>> a.delete(b.overlays['wrobel']) |
361 |
>>> n_md5 = str(md5.md5(open(write).read()).hexdigest()) |
361 |
>>> n_md5 = str(hashlib.md5(open(write).read()).hexdigest()) |
362 |
>>> o_md5 == n_md5 |
362 |
>>> o_md5 == n_md5 |
363 |
True |
363 |
True |
364 |
>>> os.unlink(write) |
364 |
>>> os.unlink(write) |