- print_formatted_text("no control info")
- else:
- for key in control_keys :
- output = " " + key + ": "
- if key == 'Depends':
- output += create_depends_string(depends)
- elif key == 'Recommends':
- output += create_depends_string(recommends)
- elif key == 'Section':
- output += section
- elif key == 'Architecture':
- output += arch
- elif key == 'Maintainer':
- output += maintainer
- elif key == 'Description':
- desc = control.Find(key)
- desc = re_newlinespace.sub('\n ', desc)
- output += escape_if_needed(desc)
- else:
- output += escape_if_needed(control.Find(key))
- to_print += output + '\n'
- print_escaped_text(to_print)
-
-def do_command (command, filename):
- o = os.popen("%s %s" % (command, filename))
- print_formatted_text(o.read())
+ return formatted_text("no control info")
+ to_print = ""
+ if not package_relations.has_key(packagename):
+ package_relations[packagename] = {}
+ for key in control_keys :
+ if key == 'Pre-Depends':
+ field_value = create_depends_string(suite, predepends, session)
+ package_relations[packagename][key] = field_value
+ elif key == 'Depends':
+ field_value = create_depends_string(suite, depends, session)
+ package_relations[packagename][key] = field_value
+ elif key == 'Recommends':
+ field_value = create_depends_string(suite, recommends, session)
+ package_relations[packagename][key] = field_value
+ elif key == 'Section':
+ field_value = section
+ elif key == 'Architecture':
+ field_value = arch
+ elif key == 'Maintainer':
+ field_value = maintainer
+ elif key == 'Homepage':
+ field_value = escape_if_needed(control.find(key))
+ if use_html:
+ field_value = '<a href="%s" rel="nofollow">%s</a>' % \
+ (field_value, field_value)
+ elif key == 'Description':
+ if use_html:
+ field_value = formatted_text(control.find(key), strip=True)
+ else:
+ desc = control.find(key)
+ desc = re_newlinespace.sub('\n ', desc)
+ field_value = escape_if_needed(desc)
+ else:
+ field_value = escape_if_needed(control.find(key))
+ to_print += " "+format_field(key,field_value)+'\n'
+ return to_print
+
+def do_command (command, escaped=False):
+ process = daklib.daksubprocess.Popen(command, stdout=subprocess.PIPE)
+ o = process.stdout
+ try:
+ if escaped:
+ return escaped_text(o.read())
+ else:
+ return formatted_text(o.read())
+ finally:
+ process.wait()