Commit b371a1c8 authored by luqui@chromium.org's avatar luqui@chromium.org

Rename recipes/ to fetch_configs/

We are making depot_tools a proper (chromium) recipe package, which assumes
that recipes are located in recipes/.  So I need to move these other kinds of
recipes out of the way.

BUG=564920
R=dpranke@chromium.org, iannucci@chromium.org

Review URL: https://codereview.chromium.org/1494793002 .

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@297837 0039d316-1c4b-4281-b951-d872f2087c98
parent 29d5e56c
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
Tool to perform checkouts in one easy command line! Tool to perform checkouts in one easy command line!
Usage: Usage:
fetch <recipe> [--property=value [--property2=value2 ...]] fetch <config> [--property=value [--property2=value2 ...]]
This script is a wrapper around various version control and repository This script is a wrapper around various version control and repository
checkout commands. It requires a |recipe| name, fetches data from that checkout commands. It requires a |config| name, fetches data from that
recipe in depot_tools/recipes, and then performs all necessary inits, config in depot_tools/fetch_configs, and then performs all necessary inits,
checkouts, pulls, fetches, etc. checkouts, pulls, fetches, etc.
Optional arguments may be passed on the command line in key-value pairs. Optional arguments may be passed on the command line in key-value pairs.
These parameters will be passed through to the recipe's main method. These parameters will be passed through to the config's main method.
""" """
import json import json
...@@ -39,10 +39,10 @@ class Checkout(object): ...@@ -39,10 +39,10 @@ class Checkout(object):
Attributes: Attributes:
|base|: the absolute path of the directory in which this script is run. |base|: the absolute path of the directory in which this script is run.
|spec|: the spec for this checkout as returned by the recipe. Different |spec|: the spec for this checkout as returned by the config. Different
subclasses will expect different keys in this dictionary. subclasses will expect different keys in this dictionary.
|root|: the directory into which the checkout will be performed, as returned |root|: the directory into which the checkout will be performed, as returned
by the recipe. This is a relative path from |base|. by the config. This is a relative path from |base|.
""" """
def __init__(self, options, spec, root): def __init__(self, options, spec, root):
self.base = os.getcwd() self.base = os.getcwd()
...@@ -222,7 +222,7 @@ def usage(msg=None): ...@@ -222,7 +222,7 @@ def usage(msg=None):
print 'Error:', msg print 'Error:', msg
print textwrap.dedent("""\ print textwrap.dedent("""\
usage: %s [options] <recipe> [--property=value [--property2=value2 ...]] usage: %s [options] <config> [--property=value [--property2=value2 ...]]
This script can be used to download the Chromium sources. See This script can be used to download the Chromium sources. See
http://www.chromium.org/developers/how-tos/get-the-code http://www.chromium.org/developers/how-tos/get-the-code
...@@ -234,21 +234,21 @@ def usage(msg=None): ...@@ -234,21 +234,21 @@ def usage(msg=None):
-n, --dry-run Don't run commands, only print them. -n, --dry-run Don't run commands, only print them.
--no-history Perform shallow clones, don't fetch the full git history. --no-history Perform shallow clones, don't fetch the full git history.
Valid fetch recipes:""") % os.path.basename(sys.argv[0]) Valid fetch configs:""") % os.path.basename(sys.argv[0])
recipes_dir = os.path.join(SCRIPT_PATH, 'recipes') configs_dir = os.path.join(SCRIPT_PATH, 'fetch_configs')
recipes = [f[:-3] for f in os.listdir(recipes_dir) if f.endswith('.py')] configs = [f[:-3] for f in os.listdir(configs_dir) if f.endswith('.py')]
recipes.sort() configs.sort()
for fname in recipes: for fname in configs:
print ' ' + fname print ' ' + fname
sys.exit(bool(msg)) sys.exit(bool(msg))
def handle_args(argv): def handle_args(argv):
"""Gets the recipe name from the command line arguments.""" """Gets the config name from the command line arguments."""
if len(argv) <= 1: if len(argv) <= 1:
usage('Must specify a recipe.') usage('Must specify a config.')
if argv[1] in ('-h', '--help', 'help'): if argv[1] in ('-h', '--help', 'help'):
usage() usage()
...@@ -276,32 +276,33 @@ def handle_args(argv): ...@@ -276,32 +276,33 @@ def handle_args(argv):
if bad_parms: if bad_parms:
usage('Got bad arguments %s' % bad_parms) usage('Got bad arguments %s' % bad_parms)
recipe = argv[1] config = argv[1]
props = argv[2:] props = argv[2:]
return ( return (
optparse.Values( optparse.Values(
{'dry_run':dry_run, 'nohooks':nohooks, 'no_history': no_history }), {'dry_run':dry_run, 'nohooks':nohooks, 'no_history': no_history }),
recipe, config,
props) props)
def run_recipe_fetch(recipe, props, aliased=False): def run_config_fetch(config, props, aliased=False):
"""Invoke a recipe's fetch method with the passed-through args """Invoke a config's fetch method with the passed-through args
and return its json output as a python object.""" and return its json output as a python object."""
recipe_path = os.path.abspath(os.path.join(SCRIPT_PATH, 'recipes', recipe)) config_path = os.path.abspath(
if not os.path.exists(recipe_path + '.py'): os.path.join(SCRIPT_PATH, 'fetch_configs', config))
print "Could not find a recipe for %s" % recipe if not os.path.exists(config_path + '.py'):
print "Could not find a config for %s" % config
sys.exit(1) sys.exit(1)
cmd = [sys.executable, recipe_path + '.py', 'fetch'] + props cmd = [sys.executable, config_path + '.py', 'fetch'] + props
result = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] result = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
spec = json.loads(result) spec = json.loads(result)
if 'alias' in spec: if 'alias' in spec:
assert not aliased assert not aliased
return run_recipe_fetch( return run_config_fetch(
spec['alias']['recipe'], spec['alias']['props'] + props, aliased=True) spec['alias']['config'], spec['alias']['props'] + props, aliased=True)
cmd = [sys.executable, recipe_path + '.py', 'root'] cmd = [sys.executable, config_path + '.py', 'root']
result = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] result = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
root = json.loads(result) root = json.loads(result)
return spec, root return spec, root
...@@ -312,7 +313,7 @@ def run(options, spec, root): ...@@ -312,7 +313,7 @@ def run(options, spec, root):
Args: Args:
options: Options instance. options: Options instance.
spec: Checkout configuration returned by the the recipe's fetch_spec spec: Checkout configuration returned by the the config's fetch_spec
method (checkout type, repository url, etc.). method (checkout type, repository url, etc.).
root: The directory into which the repo expects to be checkout out. root: The directory into which the repo expects to be checkout out.
""" """
...@@ -335,8 +336,8 @@ def run(options, spec, root): ...@@ -335,8 +336,8 @@ def run(options, spec, root):
def main(): def main():
options, recipe, props = handle_args(sys.argv) options, config, props = handle_args(sys.argv)
spec, root = run_recipe_fetch(recipe, props) spec, root = run_config_fetch(config, props)
return run(options, spec, root) return run(options, spec, root)
......
...@@ -4,19 +4,19 @@ ...@@ -4,19 +4,19 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class Android(recipe_util.Recipe): class Android(config_util.Config):
"""Basic Recipe alias for Android -> Chromium.""" """Basic Config alias for Android -> Chromium."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
return { return {
'alias': { 'alias': {
'recipe': 'chromium', 'config': 'chromium',
'props': ['--target_os=android'], 'props': ['--target_os=android'],
}, },
} }
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class Breakpad(recipe_util.Recipe): class Breakpad(config_util.Config):
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
url = 'https://chromium.googlesource.com/breakpad/breakpad.git' url = 'https://chromium.googlesource.com/breakpad/breakpad.git'
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class Chromium(recipe_util.Recipe): class Chromium(config_util.Config):
"""Basic Recipe class for Chromium.""" """Basic Config class for Chromium."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
"""This module holds utilities which make writing recipes easier.""" """This module holds utilities which make writing configs easier."""
import json import json
class Recipe(object): class Config(object):
"""Base class for all recipes. """Base class for all configs.
Provides methods that are expected to be overridden by child classes. Also Provides methods that are expected to be overridden by child classes. Also
provides an command-line parsing method that converts the unified command-line provides an command-line parsing method that converts the unified command-line
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class CrashpadRecipe(recipe_util.Recipe): class CrashpadConfig(config_util.Config):
"""Basic Recipe class for Crashpad.""" """Basic Config class for Crashpad."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
...@@ -34,7 +34,7 @@ class CrashpadRecipe(recipe_util.Recipe): ...@@ -34,7 +34,7 @@ class CrashpadRecipe(recipe_util.Recipe):
def main(argv=None): def main(argv=None):
return CrashpadRecipe().handle_args(argv) return CrashpadConfig().handle_args(argv)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class Dart(recipe_util.Recipe): class Dart(config_util.Config):
"""Basic Recipe class for Dart.""" """Basic Config class for Dart."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class Dart(recipe_util.Recipe): class Dart(config_util.Config):
"""Basic Recipe class for Dart.""" """Basic Config class for Dart."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class DepotTools(recipe_util.Recipe): class DepotTools(config_util.Config):
"""Basic Recipe class for DepotTools.""" """Basic Config class for DepotTools."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class Fletch(recipe_util.Recipe): class Fletch(config_util.Config):
"""Basic Recipe class for Fletch.""" """Basic Config class for Fletch."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class Chromium(recipe_util.Recipe): class Chromium(config_util.Config):
"""Basic Recipe class for Chromium.""" """Basic Config class for Chromium."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class Infra(recipe_util.Recipe): class Infra(config_util.Config):
"""Basic Recipe class for the Infrastructure repositories.""" """Basic Config class for the Infrastructure repositories."""
@staticmethod @staticmethod
def fetch_spec(_props): def fetch_spec(_props):
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class InfraInternal(recipe_util.Recipe): class InfraInternal(config_util.Config):
"""Basic Recipe class for the whole set of Infrastructure repositories.""" """Basic Config class for the whole set of Infrastructure repositories."""
@staticmethod @staticmethod
def fetch_spec(_props): def fetch_spec(_props):
......
...@@ -4,19 +4,19 @@ ...@@ -4,19 +4,19 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class IOS(recipe_util.Recipe): class IOS(config_util.Config):
"""Basic Recipe alias for iOS -> Chromium.""" """Basic Config alias for iOS -> Chromium."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
return { return {
'alias': { 'alias': {
'recipe': 'chromium', 'config': 'chromium',
'props': ['--target_os=ios', '--target_os_only=True'], 'props': ['--target_os=ios', '--target_os_only=True'],
}, },
} }
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class Mojo(recipe_util.Recipe): class Mojo(config_util.Config):
"""Basic Recipe class for Mojo.""" """Basic Config class for Mojo."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class NaCl(recipe_util.Recipe): class NaCl(config_util.Config):
"""Basic Recipe class for NaCl.""" """Basic Config class for NaCl."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class Naclports(recipe_util.Recipe): class Naclports(config_util.Config):
"""Basic Recipe class for naclports.""" """Basic Config class for naclports."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class PdfiumRecipe(recipe_util.Recipe): class PdfiumConfig(config_util.Config):
"""Basic Recipe class for pdfium.""" """Basic Config class for pdfium."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
...@@ -33,7 +33,7 @@ class PdfiumRecipe(recipe_util.Recipe): ...@@ -33,7 +33,7 @@ class PdfiumRecipe(recipe_util.Recipe):
def main(argv=None): def main(argv=None):
return PdfiumRecipe().handle_args(argv) return PdfiumConfig().handle_args(argv)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class Skia(recipe_util.Recipe): class Skia(config_util.Config):
"""Basic Recipe class for the Skia repository.""" """Basic Config class for the Skia repository."""
@staticmethod @staticmethod
def fetch_spec(_props): def fetch_spec(_props):
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class SkiaBuildbot(recipe_util.Recipe): class SkiaBuildbot(config_util.Config):
"""Basic Recipe class for the Skia Buildbot repository.""" """Basic Config class for the Skia Buildbot repository."""
@staticmethod @staticmethod
def fetch_spec(_props): def fetch_spec(_props):
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class V8(recipe_util.Recipe): class V8(config_util.Config):
"""Basic Recipe class for V8.""" """Basic Config class for V8."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class WebRTC(recipe_util.Recipe): class WebRTC(config_util.Config):
"""Basic Recipe class for WebRTC.""" """Basic Config class for WebRTC."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
......
...@@ -4,19 +4,19 @@ ...@@ -4,19 +4,19 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class WebRTCAndroid(recipe_util.Recipe): class WebRTCAndroid(config_util.Config):
"""Basic Recipe alias for Android -> WebRTC.""" """Basic Config alias for Android -> WebRTC."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
return { return {
'alias': { 'alias': {
'recipe': 'webrtc', 'config': 'webrtc',
'props': ['--target_os=android,unix'], 'props': ['--target_os=android,unix'],
}, },
} }
......
...@@ -4,19 +4,19 @@ ...@@ -4,19 +4,19 @@
import sys import sys
import recipe_util # pylint: disable=F0401 import config_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=W0232
class WebRTCIOS(recipe_util.Recipe): class WebRTCIOS(config_util.Config):
"""Basic Recipe alias for iOS -> WebRTC.""" """Basic Config alias for iOS -> WebRTC."""
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
return { return {
'alias': { 'alias': {
'recipe': 'webrtc', 'config': 'webrtc',
'props': ['--target_os=ios,mac'], 'props': ['--target_os=ios,mac'],
}, },
} }
......
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