- m = re_split.match(line[:-1])
- package = m.group(1)
- maintainer = fix_maintainer(m.group(2))
- if not packages.has_key(package):
- packages[package] = { "maintainer": maintainer, "priority": 0 }
- file.close()
-
+ line = utils.re_comments.sub('', line).strip();
+ if line == "":
+ continue;
+ split = line.split();
+ lhs = split[0];
+ maintainer = fix_maintainer(" ".join(split[1:]));
+ if lhs.find('~') != -1:
+ (package, version) = lhs.split('~');
+ else:
+ package = lhs;
+ version = '*';
+ # A version of '*' overwhelms all real version numbers
+ if not packages.has_key(package) or version == '*' \
+ or apt_pkg.VersionCompare(packages[package]["version"], version) == -1:
+ packages[package] = { "maintainer": maintainer, "version": version };
+ file.close();
+