Commit 06b0e5bc authored by Craig Keogh's avatar Craig Keogh

Correct min-age option and docs (GNOME bug 634866 and 634867)

Based upon patch by Adam Dingle
parent f779ef71
......@@ -126,11 +126,11 @@ jhbuild build [--autogen] [--clean] [--dist] [--distcheck]
build the module. This option forces JHBuild to build optional
dependencies.
--min-time=time
--min-age=time
Skip modules installed more recently than the specified relative
time. The time string format is a number followed by a unit. The
following units are supported: seconds (s), minutes (m), hours (h)
and days (d). For example, --min-time=2h will skip modules built
and days (d). For example, --min-age=2h will skip modules built
less than two hours ago.
jhbuild buildone [--autogen] [--clean] [--distcheck] [--no-network]
......
......@@ -1035,14 +1035,14 @@ jhbuildbot_password = 'password'
</varlistentry>
<varlistentry>
<term><option>--min-time</option>=<replaceable>time</replaceable></term>
<term><option>--min-age</option>=<replaceable>time</replaceable></term>
<listitem>
<simpara>Skip modules installed more recently than the
specified relative time. The <replaceable>time</replaceable>
string format is a number followed by a unit. The
following units are supported: seconds (s), minutes (m),
hours (h) and days (d). For example,
<option>--min-time=2h</option> will skip modules built less
<option>--min-age=2h</option> will skip modules built less
than two hours ago.</simpara>
</listitem>
</varlistentry>
......
......@@ -19,8 +19,10 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import os
import re
import sys
import traceback
import time
import types
import logging
import __builtin__
......@@ -47,7 +49,7 @@ _known_keys = [ 'moduleset', 'modules', 'skip', 'tags', 'prefix',
'tarballdir', 'pretty_print', 'svn_program', 'makedist',
'makedistcheck', 'nonotify', 'notrayicon', 'cvs_program',
'checkout_mode', 'copy_dir', 'module_checkout_mode',
'build_policy', 'trycheckout', 'min_time',
'build_policy', 'trycheckout', 'min_age',
'nopoison', 'module_nopoison', 'forcecheck',
'makecheck_advisory', 'quiet_mode', 'progress_bar',
'module_extra_env', 'jhbuildbot_master', 'jhbuildbot_slavename',
......@@ -135,7 +137,7 @@ def parse_relative_time(s):
coeffs = {'s': 1, 'm': 60, 'h': 3600, 'd': 86400, 'w':7*86400}
return float(m.group(1)) * coeffs[m.group(2)]
else:
raise ValueError(_('unable to parse \'%s\' as relative time.') % s)
raise ValueError
class Config:
......@@ -542,10 +544,10 @@ class Config:
self.build_policy = 'all'
if hasattr(options, 'min_age') and options.min_age:
try:
self.min_time = time.time() - parse_relative_time(options.min_age)
self.min_age = time.time() - parse_relative_time(options.min_age)
except ValueError:
raise FatalError(_('Failed to parse relative time'))
raise FatalError(_('Failed to parse \'min_age\' relative '
'time'))
def __setattr__(self, k, v):
'''Override __setattr__ for additional checks on some options.'''
......
......@@ -21,10 +21,10 @@ modules = [ 'meta-gnome-core' ]
# have changed.
build_policy = 'updated-deps'
# skip modules installed before $min_time (in seconds since epoch)
# for example: min_time = time.time() - 3600 will skip modules that
# have been installed less than one hour ago.
min_time = None
# Skip modules installed more recently than the specified relative time.
# min_age can only be specified via the command-line. Setting min_age within
# the configuration file has no effect.
min_age = None
# modules to skip during dependency expansion
skip = []
......
......@@ -81,9 +81,9 @@ class BuildScript:
for module in self.modulelist:
self.module_num = self.module_num + 1
if self.config.min_time is not None:
if self.config.min_age is not None:
installdate = self.packagedb.installdate(module.name)
if installdate > self.config.min_time:
if installdate > self.config.min_age:
self.message(_('Skipping %s (installed recently)') % module.name)
continue
......
......@@ -52,7 +52,7 @@ class Config(jhbuild.config.Config):
module_makeargs = {}
build_targets = ['install']
min_time = None
min_age = None
prefix = '/tmp/'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment