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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 793 - (show annotations) (download)
Sun Oct 2 13:43:15 2005 UTC (8 years, 11 months ago) by flameeyes
File size: 776 byte(s)
Aded ruby script to run checks on the portage tree.
1 # Singleton class to access package.mask
2 class Pdotmask
3 def initialize
4 end
5
6 def initialize(file = "#{ENV["PORTDIR"]}/profiles/package.mask")
7 @masks = Array.new
8
9 IO.foreach(file) do |line| # For each line in p.mask
10 line =~ /^([^\#]*)(#.*)?\n$/
11 @masks << $1 if $1 != nil and $1 != ""
12 end
13 end
14
15 # gets the mask for a given package
16 def masksfor(package)
17 package_re=package.gsub('+', "[+]")
18 pmasks = Array.new
19 masks.each do |mask|
20 pmasks << mask if mask =~ /^(>|>=|=|<=|<)?(#{package_re}-[^a-zA-Z*][^*]*$|#{package_re}$)/
21 end
22
23 return pmasks
24 end
25
26 attr_reader :masks
27 end
28
29 ## Kate modeline: leave at the end
30 # kate: indent-width 2; replace-trailing-space-save 1; space-indent 1; backspace-indents 1;

  ViewVC Help
Powered by ViewVC 1.1.20