scripts/app_image.py
author Todd Larsen <tlarsen@google.com>
Wed, 13 Aug 2008 20:33:25 +0000
changeset 68 0ae506b51e97
parent 48 39e1c8a54b37
permissions -rw-r--r--
Relative URL path structure example for Organization admin role, for a specific Program. View mock-up form will be added later.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     2
#
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     4
#
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     8
#
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    10
#
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    15
# limitations under the License.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    16
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    17
"""Functions used by multiple scripts to form Google App Engine images.
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    18
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    19
These utility functions are used by multiple scripts for creating and managing
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    20
Google App Engine "uploadable image" directories produced by combining a
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    21
specific Melange application (for example: trunk/apps/proto, trunk/apps/gsoc,
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    22
trunk/apps/ghop, etc.), the SoC framework in trunk/soc, and any /thirdparty/
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    23
packages, such as thirdparty/django.
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    24
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    25
The directory layout expected by Google App Engine is (approximately):
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    26
  <app>/
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    27
        app.yaml
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    28
        index.yaml
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    29
        content/     (a static content directory for the Melange application)
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    30
        main.py      (a WSGI wrapper for Django-based Google App Engine apps)
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    31
        settings.py  (application-specific Django settings)
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    32
        urls.py      (application-specific URL handler mappings)
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    33
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    34
The application itself can have application-specific code and templates, so
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    35
there is an additional subdirectory with the same name as the application
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    36
(to disambiguate modules in the Melange application with same-named modules
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    37
in the SoC framework):
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    38
  <app>/
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    39
        <app>/
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    40
              models/, templates/, views/, etc.
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    41
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    42
Google App Engine assumes that the root of package paths is <app>/, so all
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    43
packages are placed in sub-directories of <app>/, and the SoC framework
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    44
is considered a package:
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    45
  <app>/
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    46
        soc/
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    47
            models/, templates/, views/, etc.
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    49
For Django template based applications (which Melange applications are),
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    50
include the django distribution directory (which is one of the /thirdparty/
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    51
packages) and some Django-specific files:
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    52
  <app>/
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    53
        django/
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    54
               core/, db/, dispatch/, etc.
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    55
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    56
Any other /thirdparty/ packages would be included in the the Google App Engine
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    57
"uploadable image" directory similarly to Django above.
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    58
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    59
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    60
A NOTE ABOUT DIRECTORY NAMES RETURNED BY FUNCTIONS IN THIS MODULE
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    61
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    62
The functions in this module return directory names with a trailing / svn path
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    63
separator.  This is done by convention only (svn_helper functions normalize
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    64
the path names of directories in this same way).  The trailing separator is
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    65
kept to make it easier to combine paths (since the caller can always assume
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    66
directories end with the / separator) and to make it easier to distinguish
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    67
directories from files in human-readable output.
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    68
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    69
Some pysvn Client methods accept directories named this way, others raise
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    70
exceptions and expect a "canonical" form that does not include the trailing
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    71
/ separator.  This does not seem to be documented in the pysvn documentation,
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    72
so the trailing separator is removed in svn_helper when necessary.
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    73
"""
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    74
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    75
__authors__ = [
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    76
  # alphabetical order by last name, please
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    77
  '"Todd Larsen" <tlarsen@google.com>',
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    78
]
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    79
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    80
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    81
import sys
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    82
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    83
from trunk.scripts import svn_helper
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    84
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    85
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    86
def getRepoAppPath(repo, app):
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    87
  """Returns path to specified Melange app in the supplied svn repository.
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    88
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    89
  Args:
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    90
    repo: SVN repository URL
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    91
    app: Melange application name (expected to exist in trunk/apps)
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    92
  """
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    93
  # see note about directory names ending with / svn path separators in the
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    94
  # module __doc__ string
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    95
  return svn_helper.formatDirPath('%strunk/apps/%s' % (
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
    96
      svn_helper.formatDirPath(repo), app))
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    97
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    98
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    99
def getRepoThirdPartyPath(repo):
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   100
  """Returns path to third-party packages in the supplied svn repository.
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   101
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   102
  Args:
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   103
    repo: SVN repository URL
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   104
  """
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   105
  # see note about directory names ending with / svn path separators in the
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   106
  # module __doc__ string
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   107
  return '%sthirdparty/' % svn_helper.formatDirPath(repo)
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   108
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   109
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   110
def getThirdPartyPackageNames(pkg_path, **svn_kwargs):
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   111
  """Returns a list of third-party packages in the supplied URL.
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   112
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   113
  Args:
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   114
    pkg_path: full SVN URL path to the directory containing third-party
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   115
      packages, usually the path formed by calling getRepoThirdPartyPath()
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   116
    **svn_kwargs: keyword arguments passed through to svn_helper.lsDirs()
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   117
      (for "advanced users")
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   118
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   119
  Returns:
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   120
    A list of third-party packages found in pkg_path.  Third-party "packages"
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   121
    are all of the directories is the pkg_path  directory (but not individual
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   122
    files in pkg_path) that do *not* begin with an underscore (_).  Individual
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   123
    files and directories beginning with underscores in the pkg_path directory
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   124
    are omitted from the results.
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   125
  """
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   126
  return [pkg for pkg in svn_helper.lsDirs(pkg_path, **svn_kwargs)
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   127
            if not pkg.startswith('_')]
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   128
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   129
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   130
def getRepoFrameworksPath(repo):
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   131
  """Returns path to Melange framework packages in the supplied svn repository.
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   132
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   133
  Args:
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   134
    repo: SVN repository URL
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   135
  """
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   136
  # see note about directory names ending with / svn path separators in the
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   137
  # module __doc__ string
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   138
  return '%strunk/' % svn_helper.formatDirPath(repo)
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   139
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   140
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   141
def getFrameworksNames():
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   142
  """Returns a list of Melange framework packages (currently a constant list).
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   143
  """
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   144
  # see note about directory names ending with / svn path separators in the
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   145
  # module __doc__ string
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   146
  return ['soc/']
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   147
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   148
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   149
def formDefaultAppBranchPath(branch, user, src, dest):
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   150
  """Returns a relative path to a to-be-created App Image branch.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   151
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   152
  Args:
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   153
    branch: explicit branch name, if it was specified (or None, '', etc.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   154
      instead, if it was not)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   155
    user: subdirectory of /users/ representing a particular contributor
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   156
    src: sub-directory name of the specific Melange application to branch
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   157
    dest: alternate destination sub-directory name of the Melange application
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   158
      in its new, branched location, if it was specified (or None, '', etc.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   159
      instead, if it was not)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   160
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   161
  Returns:
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   162
    * branch if it was specified ("non-False"), or
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   163
    * users/user/dest/ if dest was specified, or
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   164
    * users/user/src/ otherwise
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   165
  """
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   166
  if not branch:
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   167
    if dest:
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   168
      branch = 'users/%s%s' % (svn_helper.formatDirPath(user), dest)
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   169
    else:
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   170
      branch = 'users/%s%s' % (svn_helper.formatDirPath(user), src)
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   171
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   172
  return svn_helper.formatDirPath(branch)
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   173
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   174
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   175
def verbosePrint(verbose, fmt_str, *fmt_args, **fmt_kwargs):
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   176
  """If verbosity level greater than zero, print out formatted string.
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   177
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   178
  Since app_image.py is a utility module most often used by scripts, many
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   179
  of its functions print to stdout.  For cases when printed output may not
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   180
  be desired, functions should supply a 'verbose' parameter to disable
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   181
  output.  The functions in app_image.py use this function to implement
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   182
  that selective printing capability.
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   183
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   184
  Args:
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   185
    verbose: verbosity level integer, any value greater than 0 enables
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   186
      output
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   187
    fmt_str: required format string
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   188
    *fmt_args: if present, positional arguments supplied to fmt_str
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   189
    **fmt_kwargs: if *fmt_args is not present, named arguments supplied to
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   190
      fmt_str, which is expected to contain named format specifiers, for
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   191
      example: '%(foo)s'
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   192
  """
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   193
  if verbose > 0:
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   194
    if not fmt_args:
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   195
      fmt_args = fmt_kwargs
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   196
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   197
    print fmt_str % fmt_args
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   198
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   199
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   200
def branchFromSrcApp(app, repo, dest, verbose=1, **svn_kwargs):
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   201
  """Branch one Melange app in /trunk/apps/ to form basis of App Engine image.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   202
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   203
  Args:
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   204
    app: Melange application name in /trunk/apps/
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   205
    repo: svn repository root URL
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   206
    dest: working copy destination path of the image branch
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   207
    verbose: print status if greater than 0; default is 1
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   208
    **svn_kwargs: keyword arguments passed on to svn_helper.branchDir()
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   209
  """
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   210
  repo_app = getRepoAppPath(repo, app)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   211
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   212
  verbosePrint(verbose, 'Branching %s from:\n %s\nto:\n %s\n',
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   213
               app, repo_app, dest)
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   214
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   215
  svn_helper.branchDir(repo_app, dest, **svn_kwargs)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   216
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   217
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   218
def branchFromThirdParty(repo, dest, verbose=1, **svn_kwargs):
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   219
  """Branch all subdirectories in /thirdparty/ into a new App Engine image.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   220
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   221
  Subdirectories (except for those with names beginning with underscores) in
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   222
  /thirdparty/ represent third-party packages that are to be placed in each
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   223
  Google App Engine "image" branch.  Files in the root of /thirdparty/ (that
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   224
  is, not in a package) and, as previously mentioned, subdrectories beginning
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   225
  with underscores, are *not* branched.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   226
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   227
  Args:
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   228
    repo: svn repository root URL
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   229
    dest: working copy destination path of the image branch
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   230
    verbose: print status if greater than 0; default is 1
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   231
    **svn_kwargs: keyword arguments passed on to svn_helper.branchItems()
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   232
  """
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   233
  pkg_dir = getRepoThirdPartyPath(repo)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   234
  packages = getThirdPartyPackageNames(pkg_dir)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   235
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   236
  verbosePrint(verbose,
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   237
      'Branching third-party packages:\n %s\nfrom:\n %s\ninto:\n %s\n',
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   238
      '  '.join(packages), pkg_dir, dest)
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   239
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   240
  svn_helper.branchItems(pkg_dir, dest, packages, **svn_kwargs)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   241
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   242
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   243
def branchFromFramework(repo, dest, verbose=1, **svn_kwargs):
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   244
  """Branch the SoC framework into a new App Engine image branch.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   245
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   246
  The SoC framework current consists of only the contents of /trunk/soc/.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   247
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   248
  Args:
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   249
    repo: svn repository root URL
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   250
    dest: working copy destination path of the image branch
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   251
    verbose: print status if greater than 0; default is 1
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   252
    **svn_kwargs: keyword arguments passed on to svn_helper.branchItems()
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   253
  """
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   254
  framework_dir = getRepoFrameworksPath(repo)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   255
  packages = getFrameworksNames()
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   256
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   257
  verbosePrint(verbose,
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   258
      'Branching framework components:\n %s\nfrom:\n %s\ninto:\n %s\n',
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   259
      '  '.join(packages), framework_dir, dest)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   260
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   261
  svn_helper.branchItems(framework_dir, dest, packages, **svn_kwargs)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   262
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   263
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   264
def exportFromSrcApp(app, repo, dest, verbose=1, **svn_kwargs):
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   265
  """Export one Melange app in /trunk/apps/ to form basis of App Engine image.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   266
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   267
  Args:
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   268
    app: Melange application name in /trunk/apps/
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   269
    repo: svn repository root URL
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   270
    dest: local filesystem destination path of the exported image
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   271
    verbose: print status if greater than 0; default is 1
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   272
    **svn_kwargs: keyword arguments passed on to svn_helper.exportDir()
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   273
  """
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   274
  repo_app = getRepoAppPath(repo, app)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   275
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   276
  verbosePrint(verbose, 'Exporting %s from:\n %s\nto:\n %s\n',
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   277
               app, repo_app, dest)
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   278
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   279
  svn_helper.exportDir(repo_app, dest, **svn_kwargs)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   280
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   281
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   282
def exportFromThirdParty(repo, dest, verbose=1, **svn_kwargs):
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   283
  """Export all subdirectories in /thirdparty/ into a new App Engine image.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   284
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   285
  Subdirectories (except for those with names beginning with underscores) in
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   286
  /thirdparty/ represent third-party packages that are to be placed in each
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   287
  Google App Engine "image".  Files in the root of /thirdparty/ (that is,
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   288
  not in a package) and, as previously mentioned, subdirectories beginning
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   289
  with underscores, are *not* exported.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   290
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   291
  Args:
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   292
    repo: svn repository root URL
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   293
    dest: local filesystem destination path of the exported image
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   294
    verbose: print status if greater than 0; default is 1
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   295
    **svn_kwargs: keyword arguments passed on to svn_helper.exportItems()
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   296
  """
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   297
  pkg_dir = getRepoThirdPartyPath(repo)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   298
  packages = getThirdPartyPackageNames(pkg_dir)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   299
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   300
  verbosePrint(verbose,
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   301
      'Exporting third-party packages:\n %s\nfrom:\n %s\ninto:\n  %s\n',
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   302
      '  '.join(packages), pkg_dir, dest)
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   303
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   304
  svn_helper.exportItems(pkg_dir, dest, packages, **svn_kwargs)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   305
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   306
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   307
def exportFromFramework(repo, dest, verbose=1, **svn_kwargs):
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   308
  """Export the SoC framework into a new App Engine image.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   309
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   310
  The SoC framework current consists of only the contents of /trunk/soc/.
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   311
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   312
  Args:
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   313
    repo: svn repository root URL
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   314
    dest: local filesystem destination path of the exported image
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   315
    verbose: print status if greater than 0; default is 1
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   316
    **svn_kwargs: keyword arguments passed on to svn_helper.exportItems()
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   317
  """
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   318
  framework_dir = getRepoFrameworksPath(repo)
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   319
  packages = getFrameworksNames()
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   320
48
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   321
  verbosePrint(verbose,
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   322
      'Exporting framework components:\n %s\nfrom:\n %s\ninto:\n %s\n',
39e1c8a54b37 Addressed Sverre's commits on the previous commit.
Todd Larsen <tlarsen@google.com>
parents: 45
diff changeset
   323
      '  '.join(packages), framework_dir, dest)
45
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   324
66c450a53786 Module for new_branch.py and related scripts to manipulate Google App Engine
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   325
  svn_helper.exportItems(framework_dir, dest, packages, **svn_kwargs)