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

Checkout repos at latest tag by default #2

Merged
merged 7 commits into from
Jun 28, 2018
Merged
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
Use default root of . and change some dir names
  • Loading branch information
jeanconn committed Jun 26, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit caafcc30d67f2f407eca6700a46d7a31cd8ea65b
6 changes: 3 additions & 3 deletions scripts/build_ska_packages
Original file line number Diff line number Diff line change
@@ -13,13 +13,13 @@ parser = argparse.ArgumentParser(description="Build Ska Conda packages.")
parser.add_argument("mode", type=str, help="The build mode. Either 'all' for all "
"packages, 'updated' for updated "
"packages, or a specific package name.")
parser.add_argument("--ska_root", type=str,
parser.add_argument("--build_root", default=".", type=str,
help="The path to the root directory for the Ska packages. "
"Default: /data/acis/ska3_pkg")
"Default: '.'")

args = parser.parse_args()

ska_builder = SkaBuilder(ska_root=args.ska_root)
ska_builder = SkaBuilder(build_root=args.build_root)

if args.mode == "all":
ska_builder.build_all_packages()
6 changes: 3 additions & 3 deletions scripts/clone_ska_sources
Original file line number Diff line number Diff line change
@@ -8,13 +8,13 @@ parser = argparse.ArgumentParser(description="Clone Ska Conda sources.")

parser.add_argument("mode", type=str, help="The clone mode. Either 'all' for all "
"packages, or a specific package name.")
parser.add_argument("--ska_root", type=str,
parser.add_argument("--build_root", default=".", type=str,
help="The path to the root directory for the Ska packages. "
"Default: /data/acis/ska3_pkg")
"Default: '.'")

args = parser.parse_args()

ska_builder = SkaBuilder(ska_root=args.ska_root)
ska_builder = SkaBuilder(build_root=args.build_root)

if args.mode == "all":
ska_builder.clone_all_packages()
20 changes: 9 additions & 11 deletions ska_conda/ska_builder.py
Original file line number Diff line number Diff line change
@@ -9,25 +9,23 @@

class SkaBuilder(object):

def __init__(self, ska_root=None):
if ska_root is None:
ska_root = "/tmp/ska3_pkg/"
self.ska_root = ska_root
self.ska_build_dir = os.path.join(self.ska_root, "builds")
self.ska_src_dir = os.path.join(self.ska_root, "src")
os.environ["SKA_TOP_SRC_DIR"] = self.ska_src_dir
def __init__(self, build_root='.', user='sot', git_repo_path='git@github.com:{user}/{name}.git'):
self.user = user
self.git_repo_path = git_repo_path
self.build_dir = os.path.join(build_root, "builds")
self.src_dir = os.path.join(build_root, "src")
os.environ["SKA_TOP_SRC_DIR"] = self.src_dir
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we want to use this as a somewhat global environment variable, or pass it to conda build as an env in the subprocess.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it doesn't matter.


def _clone_repo(self, name, tag=None):
if name == "ska":
return
print("Cloning source %s." % name)
clone_path = os.path.join(self.ska_src_dir, name)
clone_path = os.path.join(self.src_dir, name)
if not os.path.exists(clone_path):
# Try ssh first to avoid needing passwords for the private repos
# We could add these ssh strings to the meta.yaml for convenience
try:
git_ssh_path = 'git@github.com:sot/' + name + '.git'
repo = git.Repo.clone_from(git_ssh_path, clone_path)
repo = git.Repo.clone_from(self.git_repo_path.format(user=self.user, name=name), clone_path)
assert not repo.bare
except:
yml = os.path.join(pkg_defs_path, name, "meta.yaml")
@@ -73,7 +71,7 @@ def clone_all_packages(self):
def _get_repo(self, name):
if name == "ska":
return None
repo_path = os.path.join(self.ska_src_dir, name)
repo_path = os.path.join(self.src_dir, name)
if not os.path.exists(repo_path):
self._clone_repo(name)
repo = git.Repo(repo_path)