[merge] cleanup from -catbox branch
This commit is contained in:
+15
-15
@@ -74,8 +74,8 @@ def create_delta_package(old_package, new_package):
|
|||||||
ctx.build_leftover = util.join_path(ctx.config.tmp_dir(), ctx.const.install_tar_lzma)
|
ctx.build_leftover = util.join_path(ctx.config.tmp_dir(), ctx.const.install_tar_lzma)
|
||||||
|
|
||||||
tar = archive.ArchiveTar(util.join_path(ctx.config.tmp_dir(), ctx.const.install_tar_lzma), "tarlzma")
|
tar = archive.ArchiveTar(util.join_path(ctx.config.tmp_dir(), ctx.const.install_tar_lzma), "tarlzma")
|
||||||
for file in files_delta:
|
for f in files_delta:
|
||||||
tar.add_to_archive(file.path)
|
tar.add_to_archive(f.path)
|
||||||
tar.close()
|
tar.close()
|
||||||
|
|
||||||
os.chdir(ctx.config.tmp_dir())
|
os.chdir(ctx.config.tmp_dir())
|
||||||
@@ -99,34 +99,34 @@ def create_delta_package(old_package, new_package):
|
|||||||
def find_delta(oldfiles, newfiles):
|
def find_delta(oldfiles, newfiles):
|
||||||
|
|
||||||
hashto_files = {}
|
hashto_files = {}
|
||||||
for file in newfiles.list:
|
for f in newfiles.list:
|
||||||
hashto_files.setdefault(file.hash, []).append(file)
|
hashto_files.setdefault(f.hash, []).append(f)
|
||||||
|
|
||||||
files_new = sets.Set(map(lambda x:x.hash, newfiles.list))
|
files_new = sets.Set(map(lambda x:x.hash, newfiles.list))
|
||||||
files_old = sets.Set(map(lambda x:x.hash, oldfiles.list))
|
files_old = sets.Set(map(lambda x:x.hash, oldfiles.list))
|
||||||
files_delta = files_new - files_old
|
files_delta = files_new - files_old
|
||||||
|
|
||||||
deltas = []
|
deltas = []
|
||||||
for hash in files_delta:
|
for h in files_delta:
|
||||||
deltas.extend(hashto_files[hash])
|
deltas.extend(hashto_files[h])
|
||||||
|
|
||||||
return deltas
|
return deltas
|
||||||
|
|
||||||
def find_relocations(oldfiles, newfiles):
|
def find_relocations(oldfiles, newfiles):
|
||||||
|
|
||||||
files_new = {}
|
files_new = {}
|
||||||
for file in newfiles.list:
|
for f in newfiles.list:
|
||||||
files_new.setdefault(file.hash, []).append(file)
|
files_new.setdefault(f.hash, []).append(f)
|
||||||
|
|
||||||
files_old = {}
|
files_old = {}
|
||||||
for file in oldfiles.list:
|
for f in oldfiles.list:
|
||||||
files_old.setdefault(file.hash, []).append(file)
|
files_old.setdefault(f.hash, []).append(f)
|
||||||
|
|
||||||
relocations = []
|
relocations = []
|
||||||
for hash in files_new.keys():
|
for h in files_new.keys():
|
||||||
if hash and hash in files_old:
|
if h and h in files_old:
|
||||||
for i in range(len(files_new[hash])):
|
for i in range(len(files_new[h])):
|
||||||
if files_old[hash][0].path != files_new[hash][i].path:
|
if files_old[h][0].path != files_new[h][i].path:
|
||||||
relocations.append((files_old[hash][0], files_new[hash][i]))
|
relocations.append((files_old[h][0], files_new[h][i]))
|
||||||
|
|
||||||
return relocations
|
return relocations
|
||||||
|
|||||||
Reference in New Issue
Block a user