Skip to content

Commit

Permalink
Set branch tracking to master
Browse files Browse the repository at this point in the history
  • Loading branch information
perdy committed Oct 16, 2017
1 parent 29e8876 commit c87adb8
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions make
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ def install_service(service, *args, **kwargs):
# Clone or update
if not os.path.exists(service_path):
logger.info('Downloading Barrenero %s', service)
Repo.clone_from(SERVICES[service]['url'], service_path)
service_repo = Repo.clone_from(SERVICES[service]['url'], service_path)
service_repo.heads.master.set_tracking_branch(service_repo.remotes.origin.refs.master)
else:
logger.info('Updating Barrenero %s', service)
service_repo = Repo(service_path)
service_repo.remotes.origin.fetch()
service_repo.heads.master.set_tracking_branch(service_repo.remotes.origin.refs.master)
service_repo.remotes.origin.pull()

# Run installation
Expand All @@ -134,6 +136,7 @@ def update_service(service, path):
logger.info('Updating Barrenero %s', service)
service_repo = Repo(service_path)
service_repo.remotes.origin.fetch()
service_repo.heads.master.set_tracking_branch(service_repo.remotes.origin.refs.master)
service_repo.remotes.origin.pull()


Expand All @@ -149,7 +152,7 @@ def restart_service(service, path):
subprocess.run(shlex.split('./make restart'))


def build_service(service, path):
def build_service(service, path, no_cache):
service_path = os.path.abspath(os.path.join(path, 'barrenero', SERVICES[service]['name']))

# Check if service already exists and update it
Expand All @@ -158,7 +161,10 @@ def build_service(service, path):
else:
logger.info('Updating Barrenero %s', service)
os.chdir(service_path)
subprocess.run(shlex.split('./make build'))
cmd = shlex.split('./make build')
if no_cache:
cmd.append('--no-cache')
subprocess.run(cmd)


@command(command_type=CommandType.PYTHON,
Expand Down Expand Up @@ -215,13 +221,14 @@ def restart(*args, **kwargs):

@command(command_type=CommandType.PYTHON,
args=((('service',), {'help': 'Services to build', 'nargs': '+', 'choices': tuple(SERVICES.keys())}),
(('--no-cache',), {'help': 'Full build without using cache', 'action': 'store_true'}),
(('--path',), {'help': 'Barrenero full path', 'default': '/usr/local/lib'}),),
parser_opts={'help': 'Build Barrenero services'})
@donate
@superuser
def build(*args, **kwargs):
for service in kwargs['service']:
build_service(service, kwargs['path'])
build_service(service, kwargs['path'], kwargs['no_cache'])


@command(command_type=CommandType.PYTHON, parser_opts={'help': 'Clean installer'})
Expand Down

0 comments on commit c87adb8

Please sign in to comment.