diff options
-rw-r--r-- | MgaRepo/git.py | 14 | ||||
-rw-r--r-- | MgaRepo/rpmutil.py | 17 |
2 files changed, 19 insertions, 12 deletions
diff --git a/MgaRepo/git.py b/MgaRepo/git.py index 8c6bc50..49b13db 100644 --- a/MgaRepo/git.py +++ b/MgaRepo/git.py @@ -1,7 +1,7 @@ from MgaRepo import Error, config from MgaRepo.util import execcmd from MgaRepo.VCS import * -from os.path import basename, dirname +from os.path import basename, dirname, abspath from os import chdir, getcwd import sys import re @@ -24,7 +24,7 @@ class GIT(VCS): def clone(self, url, targetpath, **kwargs): if url.split(':')[0].find("svn") < 0: - return VCS.clone(self, url, targetpath, **kwargs) + return VCS.clone(self, url, **kwargs) else: # To speed things up on huge repositories, we'll just grab all the # revision numbers for this specific directory and grab these only @@ -43,11 +43,10 @@ class GIT(VCS): trunk = basename(url) tags = "releases" # cloning svn braches as well should rather be optionalif reenabled.. - #cmd = ["svn", "init", topurl, "--trunk="+trunk, "--tags="+tags, targetpath] - cmd = ["svn", "init", url, targetpath] + #cmd = ["svn", "init", topurl, "--trunk="+trunk, "--tags="+tags", targetpath] + cmd = ["svn", "init", url, abspath(targetpath)] self._execVcs(*cmd, **kwargs) - chdir(targetpath) - revisions.sort() + os.environ.update({"GIT_WORK_TREE" : abspath(targetpath)}) for entry in logentries: revisions.append(int(entry.attrib["revision"])) revisions.sort() @@ -79,6 +78,8 @@ class GIT(VCS): return None def update(self, path, **kwargs): + os.environ.update({"GIT_WORK_TREE" : abspath(path)}) + cmd = ["svn", "log", "--oneline", "--limit=1"] retval, result = self._execVcs(*cmd) if retval: @@ -119,7 +120,6 @@ class GIT(VCS): log = parser.close() logentries = log.getiterator("logentry") revisions = [] - chdir(path) for entry in logentries: revisions.append(int(entry.attrib["revision"])) revisions.sort() diff --git a/MgaRepo/rpmutil.py b/MgaRepo/rpmutil.py index 1c0adbd..1b6f261 100644 --- a/MgaRepo/rpmutil.py +++ b/MgaRepo/rpmutil.py @@ -14,6 +14,7 @@ import string import glob import sys import os +from time import sleep def detectVCS(url): if ':' in url: @@ -514,16 +515,22 @@ def checkout(pkgdirurl, path=None, revision=None, branch=None, distro=None, back if not spec: binrepo.download_binaries(path) -def clone(pkgdirurl, path=None, branch=None, - distro=None): +def clone(pkgdirurl, path=None, revision=None, branch=None, distro=None, backports=None, + spec=False): o_pkgdirurl = pkgdirurl - pkgdirurl = layout.package_url(o_pkgdirurl, distro=distro) - current = layout.checkout_url(pkgdirurl, branch=branch) + pkgdirurl = layout.package_url(o_pkgdirurl, distro=distro, backports=backports) + append = None + if spec: + append = "SPECS" + current = layout.checkout_url(pkgdirurl, branch=branch, backports=backports, + append_path=append) if path is None: path = layout.package_name(pkgdirurl) - mirror.info(current) + mirror.info(current, write=True) git = GIT() git.clone(current, path, show=1) + if not spec: + binrepo.download_binaries(path) def getpkgtopdir(basedir=None): |