Merge pull request #5 from craigtracey/git-depth-info

Add information about the git repo and limit depth
This commit is contained in:
Paul Czarkowski 2014-11-20 20:07:57 -06:00
commit 233e514861
3 changed files with 11 additions and 4 deletions

View File

@ -81,9 +81,11 @@ class DockerBuilder(Builder):
' '.join(project.system_dependencies))
project_src_path = os.path.join(src_path, project.name)
commands.append('git clone %s -b %s %s' % (project.giturl,
project.gitref,
project_src_path))
commands.append('git clone --depth 1 %s -b %s %s' %
(project.giturl, project.gitref, project_src_path))
commands.append('COMMIT=`git rev-parse HEAD` && echo "%s $COMMIT" '
'> %s/gitinfo' % (project.giturl,
project.install_path))
commands.append('mkdir -p %s' %
os.path.dirname(project.install_path))
commands.append('virtualenv --system-site-packages %s' %

View File

@ -75,6 +75,11 @@ class PackageBuilder(Builder):
repo = OpenstackGitRepo(project.giturl, project.gitref)
repo.clone(project_src_path)
# tell package users where this came from
gitinfo_file = os.path.join(install_path, 'gitinfo')
with open(gitinfo_file, 'w') as fh:
fh.write("%s %s" % (project.giturl, repo.head.hexsha))
# start building the virtualenv for the project
LOG.info("Creating the virtualenv for '%s'", project.name)
execute(project.venv_command, install_path)

View File

@ -60,7 +60,7 @@ class OpenstackGitRepo(object):
def clone(self, outdir):
LOG.debug("Cloning '%s' to '%s'", self.url, outdir)
self._repo = Repo.clone_from(self.url, outdir, recursive=True)
self._repo = Repo.clone_from(self.url, outdir, recursive=True, depth=1)
git = self._repo.git
git.checkout(self.branch)
self._invalidate_attrs()