md5sum and dak
Daniele Favara
nomed at dsslive.org
Thu Sep 13 08:56:27 UTC 2007
hi,
Would it be a good idea to start including some "def" from dak ?
ex: daklib.utils.poolify, daklib.utils.extract_component_from_section
and a get_md5sum :
def _get_md5sum(path):
import md5
BLOCKSIZE = 16384
digest = md5.md5()
f = open(path)
data = f.read(BLOCKSIZE)
while data:
digest.update(data)
data = f.read(BLOCKSIZE)
return str(digest.hexdigest())
====================================================
def poolify (source, component):
if component:
component += '/'
# FIXME: this is nasty
component = component.lower().replace("non-us/", "non-US/")
if source[:3] == "lib":
return component + source[:4] + '/' + source + '/'
else:
return component + source[:1] + '/' + source + '/'
def extract_component_from_section(section):
component = ""
if section.find('/') != -1:
component = section.split('/')[0]
if component.lower() == "non-us" and section.find('/') != -1:
s = component + '/' + section.split('/')[1]
if Cnf.has_key("Component::%s" % s): # Avoid e.g. non-US/libs
component = s
if section.lower() == "non-us":
component = "non-US/main"
# non-US prefix is case insensitive
if component.lower()[:6] == "non-us":
component = "non-US"+component[6:]
# Expand default component
if component == "":
if Cnf.has_key("Component::%s" % section):
component = section
else:
component = "main"
elif component == "non-US":
component = "non-US/main"
return (section, component)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: =?ISO-8859-1?Q?Questa_=E8_un_messaggio_firmato_elettronicamente?=
Url : http://lists.alioth.debian.org/pipermail/pkg-python-debian-discuss/attachments/20070913/f753449e/attachment.pgp
More information about the pkg-python-debian-discuss
mailing list