def __call__(self, out):
        ret = 0

        new = Symbols(open(self.filename_new))
        try:
            ref = Symbols(open(self.filename_ref))
        except IOError:
            out.write(
                "Can't read ABI reference.  ABI not checked!  Continuing.\n")
            return 0

        symbols, add, change, remove = self._cmp(ref, new)

        ignore = self._ignore(symbols)

        add_effective = add - ignore
        change_effective = change - ignore
        remove_effective = remove - ignore

        if change_effective or remove_effective:
            out.write("ABI has changed!  Refusing to continue.\n")
            ret = 1
        elif change or remove:
            out.write(
                "ABI has changed but all changes have been ignored.  Continuing.\n"
            )
        elif add_effective:
            out.write("New symbols have been added.  Continuing.\n")
        elif add:
            out.write(
                "New symbols have been added but have been ignored.  Continuing.\n"
            )
        else:
            out.write("No ABI changes.\n")

        if add:
            out.write("\nAdded symbols:\n")
            for name in sorted(add):
                symbols[name].write(out, name in ignore)

        if change:
            out.write("\nChanged symbols:\n")
            for name in sorted(change):
                symbols[name].write(out, name in ignore)

        if remove:
            out.write("\nRemoved symbols:\n")
            for name in sorted(remove):
                symbols[name].write(out, name in ignore)

        return ret
示例#2
0
 def get_abi(self, arch, prefix):
     filename = "linux-headers-%s-%s_%s_%s.deb" % (
         self.version_abi, prefix, self.version_source, arch)
     f = self.retrieve_package(self.url, filename, arch)
     d = self.extract_package(f, "linux-headers-%s_%s" % (prefix, arch))
     f1 = d + "/usr/src/linux-headers-%s-%s/Module.symvers" % (
         self.version_abi, prefix)
     s = Symbols(open(f1))
     shutil.rmtree(d)
     return s
示例#3
0
 def get_abi(self, arch, prefix):
     try:
         version_abi = (self.config['version',]['abiname_base'] + '-' +
                        self.config['abi', arch]['abiname'])
     except KeyError:
         version_abi = self.version_abi
     filename = "linux-headers-%s-%s_%s_%s.deb" % (version_abi, prefix, self.version_source, arch)
     f = self.retrieve_package(self.url, filename, arch)
     d = self.extract_package(f, "linux-headers-%s_%s" % (prefix, arch))
     f1 = d + "/usr/src/linux-headers-%s-%s/Module.symvers" % (version_abi, prefix)
     s = Symbols(open(f1))
     shutil.rmtree(d)
     return version_abi, s
示例#4
0
    def __call__(self, out):
        ret = 0

        new = Symbols(open(self.filename_new))
        unversioned = [
            name for name in new if new[name].version == '0x00000000'
        ]
        if unversioned:
            out.write(
                "ABI is not completely versioned!  Refusing to continue.\n")
            out.write("\nUnversioned symbols:\n")
            for name in sorted(unversioned):
                self.SymbolInfo(new[name]).write(out, False)
            ret = 1

        try:
            ref = Symbols(open(self.filename_ref))
        except IOError:
            out.write("Can't read ABI reference.  ABI not checked!\n")
            return ret

        symbols, add, change, remove = self._cmp(ref, new)

        ignore = self._ignore(symbols)

        add_effective = add - ignore
        change_effective = change - ignore
        remove_effective = remove - ignore

        if change_effective or remove_effective:
            out.write("ABI has changed!  Refusing to continue.\n")
            ret = 1
        elif change or remove:
            out.write(
                "ABI has changed but all changes have been ignored.  Continuing.\n"
            )
        elif add_effective:
            out.write("New symbols have been added.  Continuing.\n")
        elif add:
            out.write(
                "New symbols have been added but have been ignored.  Continuing.\n"
            )
        else:
            out.write("No ABI changes.\n")

        if add:
            out.write("\nAdded symbols:\n")
            for name in sorted(add):
                symbols[name].write(out, name in ignore)

        if change:
            out.write("\nChanged symbols:\n")
            for name in sorted(change):
                symbols[name].write(out, name in ignore)

        if remove:
            out.write("\nRemoved symbols:\n")
            for name in sorted(remove):
                symbols[name].write(out, name in ignore)

        return ret