+ if not os.path.exists(os.path.join(path, \
+ '%s_%s.changelog' % (p, sources[p][s][0]))):
+ if not unpack.has_key(os.path.join(pool, sources[p][s][1])):
+ unpack[os.path.join(pool, sources[p][s][1])] = (path, set())
+ unpack[os.path.join(pool, sources[p][s][1])][1].add(s)
+ else:
+ for file in glob('%s/%s_%s*' % (path, p, sources[p][s][0])):
+ link = '%s%s' % (s, file.split('%s_%s' \
+ % (p, sources[p][s][0]))[1])
+ try:
+ os.unlink(os.path.join(path, link))
+ except OSError:
+ pass
+ os.link(os.path.join(path, file), os.path.join(path, link))
+
+ tempdir = utils.temp_dirname(parent=temppath)
+ os.rmdir(tempdir)
+
+ for p in unpack.keys():
+ package = os.path.splitext(os.path.basename(p))[0].split('_')
+ cmd = 'dpkg-source --no-check --no-copy -x %s %s' % (p, tempdir)
+ (result, output) = getstatusoutput(cmd)
+ if not result:
+ stats['unpack'] += 1