################################################################################
+# suppress some deprecation warnings in squeeze related to md5 module
+import warnings
+warnings.filterwarnings('ignore', \
+ "the md5 module is deprecated; use hashlib instead", \
+ DeprecationWarning)
+
import errno
import os
import re
import threading
from daklib import utils
-from daklib.dbconn import DBConn, get_binary_from_name_suite
+from daklib.dbconn import DBConn, get_component_by_package_suite
from daklib.regexes import html_escaping, re_html_escaping, re_version, re_spacestrip, \
re_contrib, re_nonfree, re_localhost, re_newlinespace, \
re_package, re_doc_directory
'arch': "\033[32m",
'end': "\033[0m",
'bold': "\033[1m",
- 'maintainer': "\033[32m"}
+ 'maintainer': "\033[32m",
+ 'distro': "\033[1m\033[41m"}
html_colours = {
'main': ('<span style="color: aqua">',"</span>"),
'nonfree': ('<span style="color: red">',"</span>"),
'arch': ('<span style="color: green">',"</span>"),
'bold': ('<span style="font-weight: bold">',"</span>"),
- 'maintainer': ('<span style="color: green">',"</span>")}
+ 'maintainer': ('<span style="color: green">',"</span>"),
+ 'distro': ('<span style="font-weight: bold; background-color: red">',"</span>")}
def colour_output(s, colour):
if use_html:
elif k == "architecture":
if (dsc["architecture"] != "any"):
dsc['architecture'] = colour_output(dsc["architecture"], 'arch')
+ elif k == "distribution":
+ if dsc["distribution"] not in ('unstable', 'experimental'):
+ dsc['distribution'] = colour_output(dsc["distribution"], 'distro')
elif k in ("files","changes","description"):
if use_html:
dsc[k] = formatted_text(dsc[k], strip=True)
def create_depends_string (suite, depends_tree, session = None):
result = ""
if suite == 'experimental':
- suite_where = "in ('experimental','unstable')"
+ suite_list = ['experimental','unstable']
else:
- suite_where = "= '%s'" % suite
+ suite_list = [suite]
comma_count = 1
for l in depends_tree:
result += " | "
# doesn't do version lookup yet.
- res = get_binary_from_name_suite(d['name'], suite_where, session)
- if res.rowcount > 0:
- i = res.fetchone()
-
+ component = get_component_by_package_suite(d['name'], suite_list, \
+ session = session)
+ if component is not None:
adepends = d['name']
if d['version'] != '' :
adepends += " (%s)" % (d['version'])
- if i[2] == "contrib":
+ if component == "contrib":
result += colour_output(adepends, "contrib")
- elif i[2] == "non-free":
+ elif component == "non-free":
result += colour_output(adepends, "nonfree")
else :
result += colour_output(adepends, "main")