This file is indexed.

/usr/bin/dpkg-checkdeps is in ruby-debian 0.3.8build2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/usr/bin/env ruby
# 
# dpkg-checkdeps - utilities to check deb dependency
# Copyright (c) 2001 Fumitoshi UKAI <ukai@debian.or.jp>
#
# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# $Id: dpkg-checkdeps.rb,v 1.6 2001/05/15 18:16:26 ukai Exp $
#

require 'debian'
require 'getoptlong'
include Debian

opts = GetoptLong.new(["--to", "-t", GetoptLong::REQUIRED_ARGUMENT],
		      ["--check", "-c", GetoptLong::NO_ARGUMENT],
		      ["--from", "-f", GetoptLong::REQUIRED_ARGUMENT],
		      ["--arch", "-a", GetoptLong::REQUIRED_ARGUMENT],
		      ["--all", "-A", GetoptLong::NO_ARGUMENT],
		      ["--verbose", "-v", GetoptLong::NO_ARGUMENT],
		      ["--quiet", "-q", GetoptLong::NO_ARGUMENT],
		      ["--help", "-h", GetoptLong::NO_ARGUMENT])

$quiet = false
$verbose = false
arch = Dpkg.installation_architecture
def usage
  puts "Usage: #{$0} [opts] [{packagename|package}...]"
  puts "  #{$0} [--to <Packages>] --from <Packages> <packagename> ..."
  puts "  #{$0} [--to <Packages>] --from <Packages> -A"
  puts "  #{$0} [--to <Packages>] <packagefile>..."
  puts "  #{$0} [--to <Packages>] --check <packagename>"
end

$stdout.sync = true
to_packages = nil
from_packages = nil
check_inset = false

begin
  opts.each {|opt, arg|
    case opt
    when "--to" then
      if to_packages == nil
	to_packages = Packages.new
      end
      arg.gsub!(/\$ARCH/,arch)
      Dir[arg].each {|p|
	print "* Loading target #{p}..." if $verbose
	to_packages += Packages.new(p)
	print "done\n" if $verbose
      }
    when "--from" then 
      if from_packages == nil
	from_packages = Packages.new
      end
      arg.gsub!(/\$ARCH/,arch)
      Dir[arg].each {|p|
	print "* Loading source #{p}..." if $verbose
	from_packages += Packages.new(p)
	print "done\n" if $verbose
      }
    when "--arch" then
      arch = arg
      print "* Architecture: #{arch}\n" if $verbose
    when "--all" then
      if from_packages == nil
	$stderr.puts "#{$0}: --all requires --from option"
	raise GetoptLong::InvalidOption
      end
      from_packages.pkgnames {|p|
	ARGV.push(p)
      }
    when "--check" then 
      check_inset = true
    when "--verbose" then $verbose = true
    when "--quiet" then $quiet = true
    when "--help" then usage; exit 0
    else raise GetoptLong::InvalidOption
    end
  }
rescue GetoptLong::InvalidOption
  usage; exit 1
end

if to_packages == nil
  print "* Loading target (dpkg status)..." if $verbose
  to_packages = Status.new
  print "done\n" if $verbose
end
if check_inset && from_packages == nil
  from_packages = to_packages
end

check_packages = to_packages
check_debs = []
while arg = ARGV.shift
  if from_packages == nil
    deb = DpkgDeb.load(arg)
  else
    deb = from_packages[arg]
  end
  if deb == nil
    $stderr.puts "E: Package: #{arg} not found"
    exit 1
  end
  if deb['architecture'] != arch && deb['architecture'] != 'all'
    next
  end
  check_debs.push(deb)
  check_packages[deb.package] = deb
end

unmets = 0
mets = 0
num = 0
if check_inset
  to_packages.each_package {|deb|
    print "* Checking #{deb}\n" if $verbose
    num += 1
    safe = true
    deb.deps('depends').each {|dep|
      check_debs.each {|cdeb|
	if dep.include?(cdeb) && ! dep.satisfy?(cdeb)
	  puts "E: #{deb} does not satisfy #{dep} against #{cdeb}"
	  unmets += 1
	  safe = false
	end
      }
    }
    if safe
      mets += 1
    end
  }
else
  check_debs.each {|deb|
    print "* Checking #{deb}\n" if $verbose
    num += 1
    safe = true
    deb.unmet(check_packages).each {|u|
      puts u
      unmets += 1
      safe = false
    }
    if safe
      mets += 1
    end
  }
end
puts "#{num} packages: #{unmets} unmet in #{num - mets} packages / #{mets} packages ok" unless $quiet
exit (unmets == 0 ? 0 : 1)