Exemple #1
0
    def getTarball(self, importpath, commit):
        """
		Search for a tarball in tarball directory.
		If it does not exist, download the tarball.

		TODO: Create a DirectoryStorage on top of TarballStorage?
		1) extract the archive to 
		2) rename its directory to TARBALLSIGNATURE_DIR
		3) return TARBALLSIGNATURE_DIR
		"""
        # tarball directory must exist
        if not os.path.exists(self.tarball_directory):
            self.err = "Tarball directory %s does not exist" % self.tarball_directory
            return ""

        ri = RepositoryInfo(importpath, commit)
        if not ri.retrieve():
            self.err = ri.getError()
            return ""

        # tarball exists?
        tarball_path = "%s/%s" % (self.tarball_directory, ri.getSignature())
        if not os.path.exists(tarball_path):
            ai = ri.getArchiveInfo()
            if self.verbose:
                print "Downloading %s ..." % ai.archive_url
            # download tarball
            so, se, rc = runCommand(
                "wget -nv %s --no-check-certificate -O %s" %
                (ai.archive_url, tarball_path))
            if rc != 0:
                print "Unable to download tarball:\n%s" % (se)
                return ""

        return tarball_path
Exemple #2
0
    def decodeRepository(self):
        # get repository info
        self.repository_info = RepositoryInfo(self.import_path, self.commit)
        if not self.repository_info.retrieve():
            self.err = self.repository_info.getError()
            return False

        # package name
        ip_info = self.repository_info.getImportPathInfo()

        r_info = self.repository_info.getArchiveInfo()

        self.repository_decoded = True
        self.archive_dir = r_info.archive_dir
        self.name = ip_info.getPackageName()
        return True
Exemple #3
0
    def __init__(self, workTree, gitDir=None, repoFlags=None):
        """Initialize a Repository object."""
        self.workTree = workTree
        if gitDir is None:
            self.gitDir = workTree + '/.git'
        else:
            self.gitDir = gitDir

        if repoFlags is None:
            self.repoFlags = RepositoryFlags()
        else:
            self.repoFlags = repoFlags

        self.repoInfo = RepositoryInfo(self.repoFlags)
        self.submoduleUTD = False
        self.workingTreeUTD = False
        self.submodules = list()