diff options
author | Alex Legler <a3li@gentoo.org> | 2012-08-27 22:12:49 +0200 |
---|---|---|
committer | Alex Legler <a3li@gentoo.org> | 2012-08-27 22:12:49 +0200 |
commit | c210c12a6c8ba12e3711a09f6aa70c2aa97c9f23 (patch) | |
tree | f7c8244332827fbb022c8acc29b65e154986e3f7 | |
parent | Add meaningful page titles (diff) | |
download | glsamaker-c210c12a6c8ba12e3711a09f6aa70c2aa97c9f23.tar.gz glsamaker-c210c12a6c8ba12e3711a09f6aa70c2aa97c9f23.tar.bz2 glsamaker-c210c12a6c8ba12e3711a09f6aa70c2aa97c9f23.zip |
Portage lib: Add helper to find out whether a package has ebuilds in the tree
-rw-r--r-- | lib/glsamaker/portage.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/glsamaker/portage.rb b/lib/glsamaker/portage.rb index a039c9e..49e4105 100644 --- a/lib/glsamaker/portage.rb +++ b/lib/glsamaker/portage.rb @@ -63,7 +63,22 @@ module Glsamaker # Validates the atom +atom+ def valid_atom?(atom) atom =~ /[a-zA-Z0-9_-]\/[a-zA-Z0-9_-]/ - end + end + + # Checks if there are any ebuilds for the +atom+ + def has_ebuilds?(atom) + return false unless valid_atom? atom + + Dir.chdir("#{portdir}/#{atom}") do + Dir.glob('*.ebuild') do |ebuild| + return true + end + end + + false + rescue Errno::ENOENT + false + end # Gets a description def get_description(atom) |