- filecontents = escape_if_needed(strip_pgp_signature(dsc_filename))
-
- if dsc.has_key("build-depends"):
- builddep = split_depends(dsc["build-depends"])
- builddepstr = create_depends_string(builddep)
- filecontents = re_builddep.sub("Build-Depends: "+builddepstr, filecontents)
-
- if dsc.has_key("build-depends-indep"):
- builddepindstr = create_depends_string(split_depends(dsc["build-depends-indep"]))
- filecontents = re_builddepind.sub("Build-Depends-Indep: "+builddepindstr, filecontents)
+ filecontents = strip_pgp_signature(filename)
+ keysinorder = []
+ for l in filecontents.split('\n'):
+ m = re.match(r'([-a-zA-Z0-9]*):', l)
+ if m:
+ keysinorder.append(m.group(1))
+
+ for k in dsc.keys():
+ if k in ("build-depends","build-depends-indep"):
+ dsc[k] = create_depends_string(split_depends(dsc[k]))
+ elif k == "architecture":
+ if (dsc["architecture"] != "any"):
+ dsc['architecture'] = colour_output(dsc["architecture"], 'arch')
+ elif k in ("files","changes","description"):
+ if use_html:
+ dsc[k] = formatted_text(dsc[k], strip=True)
+ else:
+ dsc[k] = ('\n'+'\n'.join(map(lambda x: ' '+x, dsc[k].split('\n')))).rstrip()
+ else:
+ dsc[k] = escape_if_needed(dsc[k])