brew: added safeguards in script and changed default branch to 'master'

This commit is contained in:
shin- 2013-08-09 16:40:28 +02:00
Родитель b8f8f9d07e
Коммит 6178dc7f1b
3 изменённых файлов: 17 добавлений и 5 удалений

Просмотреть файл

@ -8,7 +8,7 @@ docker-brew is a command-line tool used to build the docker standard library.
1. Install the easy_install tool (`sudo apt-get install python-setuptools`
for Debian)
1. Install the python package manager, `pip` (`easy_install pip`)
1. Run the following command: `pip install -r requirements.txt`
1. Run the following command: `sudo pip install -r requirements.txt`
1. You should now be able to use the `docker-brew` script as such.
## Basics

Просмотреть файл

@ -7,7 +7,7 @@ import docker
import git
DEFAULT_REPOSITORY = 'git://github.com/dotcloud/docker'
DEFAULT_BRANCH = 'library'
DEFAULT_BRANCH = 'master'
logger = logging.getLogger(__name__)
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
@ -36,7 +36,13 @@ def build_library(repository=None, branch=None, namespace=None, push=False,
if not dst_folder:
logger.info('Cloning docker repo from {0}, branch: {1}'.format(
repository, branch))
dst_folder = git.clone_branch(repository, branch)
try:
dst_folder = git.clone_branch(repository, branch)
except Exception as e:
logger.exception(e)
logger.error('Source repository could not be fetched. Check '
'that the address is correct and the branch exists.')
return
for buildfile in os.listdir(os.path.join(dst_folder, 'library')):
if buildfile == 'MAINTAINERS':
continue

Просмотреть файл

@ -1,9 +1,15 @@
#!/usr/bin/env python
import argparse
import sys
import brew
try:
import brew
except ImportError as e:
print str(e)
print 'Please install the required dependencies first'
print 'sudo pip install -r requirements.txt'
sys.exit(1)
if __name__ == '__main__':
parser = argparse.ArgumentParser('Build the docker standard library')