def compare_rpm_files(path1, path2, source=None): try: import rpm except ImportError: logger.info("Python module rpm not found.") return [] differences = [] # compare headers with make_temp_directory() as rpmdb_dir: rpm.addMacro("_dbpath", rpmdb_dir) ts = rpm.TransactionSet() ts.setVSFlags(-1) header1 = get_rpm_header(path1, ts) header2 = get_rpm_header(path2, ts) difference = Difference.from_unicode(header1, header2, path1, path2, source="header") if difference: differences.append(difference) # extract cpio archive with extract_rpm_payload(path1) as archive1: with extract_rpm_payload(path2) as archive2: differences.extend( debbindiff.comparators.compare_files(archive1, archive2, source=get_source( archive1, archive2))) return differences
def compare_rpm_files(path1, path2, source=None): try: import rpm except ImportError: logger.info("Python module rpm not found.") return [] differences = [] # compare headers with make_temp_directory() as rpmdb_dir: rpm.addMacro("_dbpath", rpmdb_dir) ts = rpm.TransactionSet() ts.setVSFlags(-1) header1 = get_rpm_header(path1, ts) header2 = get_rpm_header(path2, ts) difference = Difference.from_unicode( header1, header2, path1, path2, source="header") if difference: differences.append(difference) # extract cpio archive with extract_rpm_payload(path1) as archive1: with extract_rpm_payload(path2) as archive2: differences.extend(debbindiff.comparators.compare_files( archive1, archive2, source=get_source(archive1, archive2))) return differences
def compare_md5sums_files(path1, path2, source=None): if are_same_binaries(path1, path2): return [] return [ Difference(None, path1, path2, source=get_source(path1, path2), comment="Files in package differs") ]
def compare_rpm_files(path1, path2, source=None): differences = [] # compare headers with make_temp_directory() as rpmdb_dir: rpm.addMacro("_dbpath", rpmdb_dir) ts = rpm.TransactionSet() ts.setVSFlags(-1) header1 = get_rpm_header(path1, ts) header2 = get_rpm_header(path2, ts) differences.append(Difference.from_unicode(header1, header2, path1, path2, source="header")) # extract cpio archive with extract_rpm_payload(path1) as archive1: with extract_rpm_payload(path2) as archive2: differences.append( debbindiff.comparators.compare_files(archive1, archive2, source=get_source(archive1, archive2)) ) return differences
files_difference = Difference.from_unicode( dot_changes1.get_as_string('Files'), dot_changes2.get_as_string('Files'), dot_changes1.get_changes_file(), dot_changes2.get_changes_file(), source=source, comment="List of files does not match") if not files_difference: return differences files1 = dict([(d['name'], d) for d in files1]) files2 = dict([(d['name'], d) for d in files2]) for filename in sorted(set(files1.keys()).intersection(files2.keys())): d1 = files1[filename] d2 = files2[filename] if d1['md5sum'] != d2['md5sum']: logger.debug("%s mentioned in .changes have " "differences", filename) files_difference.add_details( debbindiff.comparators.compare_files( dot_changes1.get_path(filename), dot_changes2.get_path(filename), source=get_source(dot_changes1.get_path(filename), dot_changes2.get_path(filename)))) differences.append(files_difference) return differences
def compare_md5sums_files(path1, path2, source=None): if are_same_binaries(path1, path2): return [] return [Difference(None, path1, path2, source=get_source(path1, path2), comment="Files in package differs")]