index: If the build numbers are same, use the release number.
Pisi was selecting "icon-naming-utils-0.8.90-7-1.pisi" when both icon-naming-utils-0.8.90-7-1.pisi icon-naming-utils-0.8.90-8-1.pisi files exist in the same directory. With this commit, it chooses the one with greater release number.
This commit is contained in:
+28
-14
@@ -640,21 +640,35 @@ def filter_latest_packages(package_paths):
|
|||||||
name, version = parse_package_name(os.path.basename(path[:-len(ctx.const.package_suffix)]))
|
name, version = parse_package_name(os.path.basename(path[:-len(ctx.const.package_suffix)]))
|
||||||
|
|
||||||
if latest.has_key(name):
|
if latest.has_key(name):
|
||||||
l_version = pisi.version.Version(latest[name][2])
|
l_version, l_release, l_build = split_version(latest[name][2])
|
||||||
r_version = pisi.version.Version(version)
|
r_version, r_release, r_build = split_version(version)
|
||||||
|
|
||||||
# Bug 6352
|
try:
|
||||||
# If version format changes in repo and a repo also keeps the old packages (bad.bad.bad.)
|
l_release = int(l_release)
|
||||||
# than only use the build nos
|
r_release = int(r_release)
|
||||||
if l_version.build and r_version.build:
|
|
||||||
if l_version.build < r_version.build:
|
l_build = int(l_build) if l_build else None
|
||||||
latest[name] = (root, name, version)
|
r_build = int(r_build) if r_build else None
|
||||||
else:
|
|
||||||
if l_version < r_version:
|
except ValueError:
|
||||||
latest[name] = (root, name, version)
|
continue
|
||||||
else:
|
|
||||||
if version:
|
if l_build and r_build:
|
||||||
latest[name] = (root, name, version)
|
if l_build > r_build:
|
||||||
|
continue
|
||||||
|
|
||||||
|
elif l_release > r_release:
|
||||||
|
continue
|
||||||
|
|
||||||
|
elif l_release == r_release:
|
||||||
|
l_version = pisi.version.Version(l_version)
|
||||||
|
r_version = pisi.version.Version(r_version)
|
||||||
|
|
||||||
|
if l_version > r_version:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if version:
|
||||||
|
latest[name] = (root, name, version)
|
||||||
|
|
||||||
return map(lambda x:"%s/%s-%s.pisi" % x, latest.values())
|
return map(lambda x:"%s/%s-%s.pisi" % x, latest.values())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user