[paludis-commits] paludis-scripts.git (master) -- 2f416b2 by David Shakaryan
git at git.pioto.org
git at git.pioto.org
Mon Sep 29 19:22:41 EDT 2008
Module: paludis-scripts.git
Branch: master
Commit: 2f416b27629f71d3a256073a18f10320d1976d45
URL: http://git.pioto.org/?p=paludis-scripts.git;a=commit;h=2f416b27629f71d3a256073a18f10320d1976d45
Author: David Shakaryan <omp at gentoo.org>
Committer: Ciaran McCreesh <ciaran.mccreesh at googlemail.com>
Date: Mon Sep 29 16:20:28 2008 -0700
----
pint.rb: Do not create a new environment for each dependency spec.
----
pint.rb | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/pint.rb b/pint.rb
index d82e9fa..e190203 100755
--- a/pint.rb
+++ b/pint.rb
@@ -3,7 +3,7 @@
# Copyright 2007-2008 David Shakaryan <omp at gentoo.org>
# Distributed under the terms of the GNU General Public License v2.
#
-# pint.rb [version 0.6]
+# pint.rb [version 0.10]
#
# Parse a Paludis log file and output install times of one or more packages,
# defaulting to all packages if none are specified.
@@ -20,8 +20,8 @@ getopt = GetoptLong.new(
['--current', '-c', GetoptLong::NO_ARGUMENT],
['--no-colour', '-C', GetoptLong::NO_ARGUMENT],
['--file', '-f', GetoptLong::REQUIRED_ARGUMENT],
- ['--help', '-h', GetoptLong::NO_ARGUMENT],
- ['--version', '-v', GetoptLong::NO_ARGUMENT])
+ ['--version', '-v', GetoptLong::NO_ARGUMENT],
+ ['--help', '-h', GetoptLong::NO_ARGUMENT])
$opts = Hash['file' => '/var/log/paludis.log', 'repository' => '\S+']
getopt.each do |opt, arg| $opts[opt.sub('--', '')] = arg end
@@ -31,9 +31,9 @@ if $opts.has_key?('no-colour')
def colour_date(str); return str; end
def colour_time(str); return str; end
else
+ $env = Paludis::EnvironmentFactory.instance.create ''
def colour_name(str)
- env = Paludis::EnvironmentFactory.instance.create ""
- depspec = Paludis::parse_user_package_dep_spec('=' + str, env, Array.new)
+ depspec = Paludis::parse_user_package_dep_spec('=' + str, $env, Array.new)
name = depspec.package
version = depspec.version_requirements.first[:spec]
@@ -48,10 +48,8 @@ end
# Format time from seconds to a readable string.
def format_time(s)
# Calculate hours, minutes and seconds.
- h = s / 3600
- s = s % 3600
- m = s / 60
- s = s % 60
+ h, s = s.divmod(3600)
+ m, s = s.divmod(60)
# Convert numbers to a string.
str = ''
@@ -103,7 +101,7 @@ end
# Program version.
if $opts.has_key?('version')
- puts "pint.rb 0.6"
+ puts 'pint.rb 0.10'
exit
end
---
More information about the paludis-commits
mailing list