mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-04-30 03:21:28 +00:00
binary packages of the same source package. Useful to spot moved files, dropped files, etc. * README: briefly document added scripts.
69 lines
1.7 KiB
Python
Executable File
69 lines
1.7 KiB
Python
Executable File
#!/usr/bin/python
|
|
#
|
|
# Copyright 2007, Canonical, Daniel Holbach
|
|
#
|
|
# GPL 3
|
|
|
|
import os
|
|
import sys
|
|
import glob
|
|
|
|
USAGE = \
|
|
"""compare-packages <source-package> [<directory>]
|
|
|
|
compares contents of binary packages of <source-package> in the current
|
|
directory with those in <directory>"""
|
|
|
|
def check_args():
|
|
directory = "/var/cache/pbuilder/result"
|
|
sourcepackage = ""
|
|
|
|
if len(sys.argv) < 2:
|
|
print USAGE
|
|
sys.exit(1)
|
|
|
|
if sys.argv[1] in [ '-h', '--help' ]:
|
|
print USAGE
|
|
sys.exit(0)
|
|
|
|
if len(sys.argv) > 1:
|
|
sourcepackage = sys.argv[1]
|
|
if len(sys.argv) > 2:
|
|
directory = sys.argv[2]
|
|
|
|
return (sourcepackage, directory)
|
|
|
|
|
|
def main():
|
|
(sourcepackage, directory) = check_args()
|
|
|
|
(dummy, output, dummy) = os.popen3("apt-cache showsrc %s | grep ^Binary" % \
|
|
(sourcepackage))
|
|
binarypackages = output.read().split(":")[1].strip().split(", ")
|
|
|
|
if not os.path.exists("/usr/bin/debdiff"):
|
|
print >> sys.stderr, \
|
|
"'/usr/bin/debdiff' not found, please install 'devscripts'."
|
|
sys.exit(1)
|
|
|
|
if not os.path.isdir(directory):
|
|
print >> sys.stderr, "Directory %s not found." % directory
|
|
sys.exit(1)
|
|
|
|
for package in binarypackages:
|
|
old = glob.glob("./%s*.deb" % package)
|
|
new = glob.glob("%s/%s*.deb" % (directory, package))
|
|
|
|
if not new or not old:
|
|
print "Skipping %s, no matching new and old package found." % package
|
|
else:
|
|
print "Comparing %s and %s" % (old[0], new[0])
|
|
sys.stdout.flush()
|
|
os.system("debdiff %s %s" % (old[0], new[0]))
|
|
print ''
|
|
print '---'
|
|
|
|
if __name__ == '__main__':
|
|
main()
|
|
|