- Speed up finding old package process
BUG:FIXED:9101
This commit is contained in:
@@ -709,20 +709,15 @@ class Builder:
|
|||||||
# find previous build in packages dir
|
# find previous build in packages dir
|
||||||
found = set()
|
found = set()
|
||||||
def locate_old_package(old_package_fn):
|
def locate_old_package(old_package_fn):
|
||||||
if not old_package_fn.endswith(ctx.const.package_suffix) or \
|
if not old_package_fn.endswith(ctx.const.package_suffix):
|
||||||
old_package_fn.endswith(ctx.const.delta_package_suffix):
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if pisi.util.is_package_name(os.path.basename(old_package_fn), package_name):
|
if pisi.util.is_package_name(os.path.basename(old_package_fn), package_name):
|
||||||
try:
|
try:
|
||||||
old_pkg = pisi.package.Package(old_package_fn, 'r')
|
pkg = os.path.basename(old_package_fn)
|
||||||
old_pkg.read()
|
name, version = pisi.util.parse_package_name(pkg[:-5])
|
||||||
ctx.ui.info(_('(found old version %s)') % old_package_fn)
|
ctx.ui.info(_('(found old version %s)') % old_package_fn)
|
||||||
if str(old_pkg.metadata.package.name) != package_name:
|
old_build = int(str(pisi.version.Version(version).build))
|
||||||
ctx.ui.warning(_('Skipping %s with wrong pkg name ') %
|
|
||||||
old_package_fn)
|
|
||||||
return
|
|
||||||
old_build = old_pkg.metadata.package.build
|
|
||||||
found.add( (old_package_fn, old_build) )
|
found.add( (old_package_fn, old_build) )
|
||||||
except Error:
|
except Error:
|
||||||
ctx.ui.warning('Package file %s may be corrupt. Skipping.' % old_package_fn)
|
ctx.ui.warning('Package file %s may be corrupt. Skipping.' % old_package_fn)
|
||||||
@@ -747,7 +742,7 @@ class Builder:
|
|||||||
return (1, None)
|
return (1, None)
|
||||||
ctx.ui.warning(_('(no previous build found, setting build no to 1.)'))
|
ctx.ui.warning(_('(no previous build found, setting build no to 1.)'))
|
||||||
else:
|
else:
|
||||||
a = filter(lambda (x,y): y != None, found)
|
a = filter(lambda (x,y): y != 0, found)
|
||||||
ctx.ui.debug(str(a))
|
ctx.ui.debug(str(a))
|
||||||
if a:
|
if a:
|
||||||
# sort in order of increasing build number
|
# sort in order of increasing build number
|
||||||
|
|||||||
Reference in New Issue
Block a user