diff options
author | sgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-05 17:20:36 +0000 |
---|---|---|
committer | sgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-05 17:20:36 +0000 |
commit | 618c071b507f071ebb5591e4427f2d63b4fab538 (patch) | |
tree | 6774d2711e7e4fef0df99702534b4b08df650585 | |
parent | 6d78af53b8ddf56e50d9d8ffe81dbabfa8fc7f0e (diff) | |
download | chromium_src-618c071b507f071ebb5591e4427f2d63b4fab538.zip chromium_src-618c071b507f071ebb5591e4427f2d63b4fab538.tar.gz chromium_src-618c071b507f071ebb5591e4427f2d63b4fab538.tar.bz2 |
Allow the lastchange target to get a hard-coded default last change
from build/LASTCHANGE.in if there's no actual svn or git change found.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/159876
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22489 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | build/util/build_util.gyp | 10 | ||||
-rw-r--r-- | build/util/lastchange.py | 11 |
2 files changed, 16 insertions, 5 deletions
diff --git a/build/util/build_util.gyp b/build/util/build_util.gyp index 7ece392..ad17be6 100644 --- a/build/util/build_util.gyp +++ b/build/util/build_util.gyp @@ -12,11 +12,14 @@ 'type': 'none', 'variables': { 'lastchange_out_path': '<(SHARED_INTERMEDIATE_DIR)/build/LASTCHANGE', + 'default_lastchange_path': '../LASTCHANGE.in', }, 'actions': [ { 'action_name': 'lastchange', 'inputs': [ + # Note: <(default_lastchange_path) is optional, + # so it doesn't show up in inputs. './lastchange.py', ], 'outputs': [ @@ -24,9 +27,12 @@ '<(lastchange_out_path).always', ], 'action': [ - 'python', '<@(_inputs)', '-o', '<(lastchange_out_path)', + 'python', '<@(_inputs)', + '-o', '<(lastchange_out_path)', + '-d', '<(default_lastchange_path)', ], - 'message': 'Extracting last change to <(lastchange_out_path)' + 'message': 'Extracting last change to <(lastchange_out_path)', + 'process_outputs_as_sources': '1', }, ], }, diff --git a/build/util/lastchange.py b/build/util/lastchange.py index 1b68acd..8f1fb64 100644 --- a/build/util/lastchange.py +++ b/build/util/lastchange.py @@ -60,7 +60,7 @@ def git_fetch_id(): return id -def fetch_change(): +def fetch_change(default_lastchange): """ Returns the last change, from some appropriate revision control system. """ @@ -68,7 +68,10 @@ def fetch_change(): if not change and sys.platform in ('linux2',): change = git_fetch_id() if not change: - change = '0' + if default_lastchange and os.path.exists(default_lastchange): + change = open(default_lastchange, 'r').read().strip() + else: + change = '0' return change @@ -93,6 +96,8 @@ def main(argv=None): argv = sys.argv parser = optparse.OptionParser(usage="lastchange.py [-h] [[-o] FILE]") + parser.add_option("-d", "--default-lastchange", metavar="FILE", + help="default last change input FILE") parser.add_option("-o", "--output", metavar="FILE", help="write last change to FILE") opts, args = parser.parse_args(argv[1:]) @@ -107,7 +112,7 @@ def main(argv=None): parser.print_help() sys.exit(2) - change = fetch_change() + change = fetch_change(opts.default_lastchange) contents = "LASTCHANGE=%s\n" % change |