| |
@@ -0,0 +1,66 @@
|
| |
+ #!/usr/bin/python
|
| |
+ #
|
| |
+ # Copyright (C) 2006 Mandriva; 2009-2014 Red Hat, Inc.
|
| |
+ # Authors: Frederic Lepied, Florian Festi
|
| |
+ #
|
| |
+ # This program is free software; you can redistribute it and/or modify
|
| |
+ # it under the terms of the GNU General Public License as published by
|
| |
+ # the Free Software Foundation; either version 2 of the License, or
|
| |
+ # (at your option) any later version.
|
| |
+ #
|
| |
+ # This program is distributed in the hope that it will be useful,
|
| |
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| |
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| |
+ # GNU General Public License for more details.
|
| |
+ #
|
| |
+ # You should have received a copy of the GNU General Public License
|
| |
+ # along with this program; if not, write to the Free Software
|
| |
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
| |
+ #
|
| |
+ # This library and program is heavily based on rpmdiff from the rpmlint package
|
| |
+ # It was modified to be used as standalone library for the Koji project.
|
| |
+
|
| |
+ import getopt
|
| |
+ import sys
|
| |
+
|
| |
+ from koji.rpmdiff import Rpmdiff
|
| |
+
|
| |
+ def _usage(exit=1):
|
| |
+ print("Usage: %s [<options>] <old package> <new package>" % sys.argv[0])
|
| |
+ print("Options:")
|
| |
+ print(" -h, --help Output this message and exit")
|
| |
+ print(" -i, --ignore Tag to ignore when calculating differences")
|
| |
+ print(" (may be used multiple times)")
|
| |
+ print(" Valid values are: SM5DNLVUGFT")
|
| |
+ sys.exit(exit)
|
| |
+
|
| |
+ def main():
|
| |
+
|
| |
+ ignore_tags = []
|
| |
+ try:
|
| |
+ opts, args = getopt.getopt(sys.argv[1:], "hi:", ["help", "ignore="])
|
| |
+ except getopt.GetoptError as e:
|
| |
+ print("Error: %s" % e)
|
| |
+ _usage()
|
| |
+
|
| |
+ for option, argument in opts:
|
| |
+ if option in ("-h", "--help"):
|
| |
+ _usage(0)
|
| |
+ if option in ("-i", "--ignore"):
|
| |
+ ignore_tags.append(argument)
|
| |
+
|
| |
+ if len(args) != 2:
|
| |
+ _usage()
|
| |
+
|
| |
+ d = Rpmdiff(args[0], args[1], ignore=ignore_tags)
|
| |
+ print(d.textdiff())
|
| |
+ rv = d.differs()
|
| |
+ chk = (d.kojihash() != d.kojihash(new=True))
|
| |
+ if rv != chk:
|
| |
+ raise Exception('hash compare disagrees with rpmdiff')
|
| |
+ sys.exit(int(rv))
|
| |
+
|
| |
+ if __name__ == '__main__':
|
| |
+ main()
|
| |
+
|
| |
+ # rpmdiff ends here
|
| |
Related: https://pagure.io/koji/issue/715