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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 929 - (show annotations) (download)
Fri Dec 16 12:14:35 2005 UTC (8 years, 9 months ago) by flameeyes
File size: 2987 byte(s)
Commented out style checks.
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 checks << Check_regexp.new("logs/setXid.log", /-Wl,-z,now/, "Hardcodes -Wl,-z,now for setXid binaries")
34 #checks << Check_regexp.new("logs/autotools.log", /[^e\/](aclocal|autoconf|automake)/, "Don't use autotools eclass")
35 checks << Check_regexp.new("logs/fpic.log", /append-flags -fPIC/, "Appends -fPIC ")
36
37 Categories.List.each do |catname|
38 Category.new(catname).packages.each do |pkgname|
39 pkg = Package.new(pkgname)
40
41 last = Ebuild.new(pkg.versions.last).ebuild if pkg.versions.last and not pkg.versions.last.empty?
42 unmask = Ebuild.new(pkg.unmasked.last).ebuild if pkg.unmasked.last and not pkg.unmasked.last.empty? \
43 and pkg.versions.last != pkg.unmasked.last
44
45 if last then
46 ebcontent = IO.read("#{ENV["PORTDIR"]}/#{last}").gsub("\\\n", " ").gsub(/^\s*#.*/, "")
47 checks.each { |chk| chk.check(pkg, last.to_s, ebcontent) }
48 end
49
50 if unmask and last != unmask then
51 ebcontent = IO.read("#{ENV["PORTDIR"]}/#{unmask}").gsub("\\\n", " ").gsub(/^\s*#.*/, "")
52 checks.each { |chk| chk.check(pkg, unmask.to_s, ebcontent) }
53 end
54 end
55 end
56
57 checks.each { |chk| chk.summarize }
58
59 ## Kate modeline: leave at the end
60 # kate: indent-width 2; replace-trailing-space-save 1; space-indent 1; backspace-indents 1;

  ViewVC Help
Powered by ViewVC 1.1.20