Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove os prefix from consecutive build error. #51

Merged
merged 5 commits into from
Aug 11, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added an option to use an existing repository instead of cloning a te…
…mporary one.
  • Loading branch information
allenh1 committed Aug 11, 2017
commit aa659ff52374688fdd35801c41fa24993d5df53a
11 changes: 8 additions & 3 deletions superflore/generators/ebuild/overlay_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ def get_random_branch_name():


class RosOverlay(object):
def __init__(self):
def __init__(self, repo_dir=None):
# clone repo into a random tmp directory.
self.repo = RepoInstance('ros', 'ros-overlay', get_random_tmp_dir())
self.repo = RepoInstance(
'ros', 'ros-overlay',
repo_dir or get_random_tmp_dir(),
not os.path.exists(os.path.realpath(repo_dir))
)
self.branch_name = get_random_branch_name()
self.repo.clone()
if not os.path.exists(os.path.realpath(repo_dir)):
self.repo.clone()
branch_msg = 'Creating new branch {0}...'.format(self.branch_name)
self.repo.info(branch_msg)
self.repo.create_branch(self.branch_name)
Expand Down
23 changes: 16 additions & 7 deletions superflore/generators/ebuild/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import sys
import os

if sys.version_info < (3, 0):
from os.FileExistsError import FileExistsError

# Modify if a new distro is added
active_distros = ['indigo', 'kinetic', 'lunar']
# just update packages, by default.
Expand Down Expand Up @@ -63,12 +66,13 @@ def get_existing_repo():
return git_repo


def clean_up(distro):
def clean_up(distro, preserve_repo=False):
global overlay
clean_msg = \
'Cleaning up tmp directory {0}...'.format(overlay.repo.repo_dir)
RepoInstance.info(clean_msg)
shutil.rmtree(overlay.repo.repo_dir)
if not preserve_repo:
clean_msg = \
'Cleaning up tmp directory {0}...'.format(overlay.repo.repo_dir)
RepoInstance.info(clean_msg)
shutil.rmtree(overlay.repo.repo_dir)
RepoInstance.info('Cleaning up symbolic links...')
if distro in active_distros:
os.remove('ros-{0}'.format(distro))
Expand Down Expand Up @@ -115,6 +119,11 @@ def main():
help='ONLY file a PR to remote',
action='store_true'
)
parser.add_argument(
'--output-repository-path',
help='location of the Git repo',
type=str
)

args = parser.parse_args(sys.argv[1:])

Expand Down Expand Up @@ -154,7 +163,7 @@ def main():
RepoInstance.error('reason: {0}'.format(e))
sys.exit(1)
# clone current repo
overlay = RosOverlay()
overlay = RosOverlay(args.output_repository_path)
selected_targets = active_distros

try:
Expand Down Expand Up @@ -246,5 +255,5 @@ def main():
sys.exit(0)
file_pr(overlay, delta, missing_deps)

clean_up(args.ros_distro)
clean_up(args.ros_distro, args.output_repository_path)
RepoInstance.happy('Successfully synchronized repositories!')
5 changes: 1 addition & 4 deletions superflore/repo_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ def __init__(self, repo_owner, repo_name, repo_dir=None, do_clone=True):
self.repo_name = repo_name
repo_url = 'https://github.com/{0}/{1}'
self.repo_url = repo_url.format(self.repo_owner, self.repo_name)
if repo_dir is not None:
self.repo_dir = repo_dir
else:
self.repo_dir = self.repo_name
self.repo_dir = repo_dir or self.repo_name
if do_clone:
self.repo = Repo.clone_from(self.repo_url, self.repo_dir)
else:
Expand Down