# File lib/cft/rpm.rb, line 86
    def self.byfile(db, path)
        path = Pathname.new(path).cleanpath
        return [] unless path.exist?
        realpath = path.realpath.to_str
        iter = db.init_iterator(nil, nil)
        pkgs = iter.regexp(RPM::TAG_BASENAMES, RPM::MIRE_DEFAULT, 
                           File::basename(realpath))
        return pkgs.inject([]) do |result, k|
            if file = k.files.find { |f| f.path == realpath }
                result << PackageFile.new(path.to_str, k, file)
            end
            result
        end
    end