mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Brew: Avoid duplicate commands, added --debug option, added local repo support
This commit is contained in:
parent
7813f2a25e
commit
362f1735e6
3 changed files with 22 additions and 15 deletions
|
@ -1 +1 @@
|
|||
from brew import build_library
|
||||
from brew import build_library, DEFAULT_REPOSITORY, DEFAULT_BRANCH
|
||||
|
|
|
@ -10,21 +10,29 @@ DEFAULT_BRANCH = 'library'
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
|
||||
level='DEBUG')
|
||||
level='INFO')
|
||||
client = docker.Client()
|
||||
processed = {}
|
||||
|
||||
|
||||
def build_library(repository=None, branch=None, namespace=None, push=False):
|
||||
def build_library(repository=None, branch=None, namespace=None, push=False,
|
||||
debug=False):
|
||||
if repository is None:
|
||||
repository = DEFAULT_REPOSITORY
|
||||
if branch is None:
|
||||
branch = DEFAULT_BRANCH
|
||||
if debug:
|
||||
logger.setLevel('DEBUG')
|
||||
|
||||
if not (repository.startswith('https://') or repository.startswith('git://')):
|
||||
logger.info('Repository provided assumed to be a local path')
|
||||
dst_folder = repository
|
||||
|
||||
logger.info('Cloning docker repo from {0}, branch: {1}'.format(
|
||||
repository, branch))
|
||||
#FIXME: set destination folder and only pull latest changes instead of
|
||||
# cloning the whole repo everytime
|
||||
if not dst_folder:
|
||||
logger.info('Cloning docker repo from {0}, branch: {1}'.format(
|
||||
repository, branch))
|
||||
dst_folder = git.clone_branch(repository, branch)
|
||||
for buildfile in os.listdir(os.path.join(dst_folder, 'library')):
|
||||
if buildfile == 'MAINTAINERS':
|
||||
|
|
|
@ -5,21 +5,20 @@ import argparse
|
|||
import brew
|
||||
|
||||
|
||||
DEFAULT_REPOSITORY = 'git://github.com/dotcloud/docker'
|
||||
DEFAULT_BRANCH = 'library'
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser('Build the docker standard library')
|
||||
parser.add_argument('--push', action='store_true', default=False,
|
||||
help='push generated repositories to the official registry')
|
||||
parser.add_argument('--debug', default=False, action='store_true',
|
||||
help='Enable debugging output')
|
||||
parser.add_argument('-n', metavar='NAMESPACE', default='library',
|
||||
help='namespace used for generated repositories.'
|
||||
' Default is library')
|
||||
parser.add_argument('-b', metavar='BRANCH', default=DEFAULT_BRANCH,
|
||||
parser.add_argument('-b', metavar='BRANCH', default=brew.DEFAULT_BRANCH,
|
||||
help='branch in the repository where the library definition'
|
||||
' files will be fetched. Default is ' + DEFAULT_BRANCH)
|
||||
parser.add_argument('repository', default=DEFAULT_REPOSITORY, nargs='?',
|
||||
help='git repository containing the library definition files.'
|
||||
' Default is ' + DEFAULT_REPOSITORY)
|
||||
' files will be fetched. Default is ' + brew.DEFAULT_BRANCH)
|
||||
parser.add_argument('repository', default=brew.DEFAULT_REPOSITORY,
|
||||
nargs='?', help='git repository containing the library definition'
|
||||
' files. Default is ' + brew.DEFAULT_REPOSITORY)
|
||||
args = parser.parse_args()
|
||||
brew.build_library(args.repository, args.b, args.n, args.push)
|
||||
brew.build_library(args.repository, args.b, args.n, args.push, args.debug)
|
||||
|
|
Loading…
Reference in a new issue