/[gentoo-alt]/trunk/ruby-checker/runchecks.rb
Gentoo

Contents of /trunk/ruby-checker/runchecks.rb

Parent Directory Parent Directory | Revision Log Revision Log


Revision 804 - (show annotations) (download)
Fri Oct 7 14:28:41 2005 UTC (8 years, 6 months ago) by flameeyes
File size: 2665 byte(s)
Added check for uclibctoolize calls and for --with-gnu-ld.
1 # First check: scan all last and last-unmasked ebuilds
2 # to check if they use /bin/false in enewuser!
3
4 load "pmask.rb"
5 load "ebuild.rb"
6 load "package.rb"
7 load "categories.rb"
8 load "checks.rb"
9
10 unless ENV["PORTDIR"]
11 procdesc = IO.popen("portageq portdir")
12 ENV["PORTDIR"] = procdesc.readline.chomp
13 procdesc.close
14 end
15
16 File.unlin("logs") unless ! File.exists?("logs") or File.directory?("logs")
17 Dir.mkdir("logs") unless File.exists?("logs")
18
19 # Now load all the checks
20 checks = Array.new
21 checks << Check_regexp.new("logs/enewuser.log", /enewuser.*\/bin\/false/, "enewuser called with /bin/false")
22 checks << Check_regexp.new("logs/rootroot.log", /chown.*root:root/, "chown called on root:root")
23 checks << Check_regexp.new("logs/epatchdie.log", /epatch\s.*\|\|\sdie/, "die on failed epatch")
24 checks << Check_regexp.new("logs/initdconfd.log", /(ins|exe)into\s\/etc\/(init|conf).d/, "Does not use doinitd|doconfd")
25 checks << Check_options.new("logs/cpoptions.log", "cp", ["a", "d"], "GNUish cp -<PARAM> call.")
26 checks << Check_regexp.new("logs/copying.log", /dodoc.*(COPYING|INSTALL|ABOUT-NLS).*/, "Installs <PARAM> file")
27 checks << Check_regexp.new("logs/libtool.log", /elibtoolize.*([^e]libtoolize|aclocal|autoreconf|autoconf)/m, "elibtoolize called before autoretooling")
28 checks << Check_regexp.new("logs/libdl.log", /-ldl/, "Somehow refers to libdl")
29 checks << Check_regexp.new("logs/cpparents.log", /cp.*--parent.*/, "Tries to use cp --parents")
30 checks << Check_missingfunction.new("logs/seq.log", "seq", "portability", "Uses seq without portability eclass")
31 checks << Check_regexp.new("logs/uclibctoolize.log", /uclibctoolize/, "uclibctoolize called")
32 checks << Check_regexp.new("logs/gnuld.log", /--with-gnu-ld/, "Assumes GNU ld")
33
34 Categories.List.each do |catname|
35 Category.new(catname).packages.each do |pkgname|
36 pkg = Package.new(pkgname)
37
38 last = Ebuild.new(pkg.versions.last) if pkg.versions.last and not pkg.versions.last.empty?
39 unmask = Ebuild.new(pkg.unmasked.last) if pkg.unmasked.last and not pkg.unmasked.last.empty? \
40 and pkg.versions.last != pkg.unmasked.last
41
42 if last then
43 ebcontent = IO.read("#{ENV["PORTDIR"]}/#{last}").gsub("\\\n", " ").gsub(/^\s*#.*/, "")
44 checks.each { |chk| chk.check(pkg, last.to_s, ebcontent) }
45 end
46
47 if unmask and last != unmask then
48 ebcontent = IO.read("#{ENV["PORTDIR"]}/#{unmask}").gsub("\\\n", " ").gsub(/^\s*#.*/, "")
49 checks.each { |chk| chk.check(pkg, unmask.to_s, ebcontent) }
50 end
51 end
52 end
53
54 checks.each { |chk| chk.summarize }
55
56 ## Kate modeline: leave at the end
57 # kate: indent-width 2; replace-trailing-space-save 1; space-indent 1; backspace-indents 1;

  ViewVC Help
Powered by ViewVC 1.1.20