Exemple #1
0
    async def fetch(self, checkout=True):
        # First try to get the sources from the cached dir if there is one
        cached_dir = os.path.join(self.config.cached_sources,  self.name)

        if not os.path.exists(self.repo_dir):
            if not cached_dir and self.offline:
                msg = 'Offline mode: git repo for {!r} not found in cached sources ({}) or local sources ({})'
                raise FatalError(msg.format(self.name, self.config.cached_sources, self.repo_dir))
            git.init(self.repo_dir, logfile=get_logfile(self))

        if os.path.isdir(os.path.join(cached_dir, ".git")):
            for remote, url in self.remotes.items():
                git.add_remote(self.repo_dir, remote, "file://" + cached_dir, logfile=get_logfile(self))
            await git.fetch(self.repo_dir, fail=False, logfile=get_logfile(self))
        else:
            cached_dir = None
            # add remotes from both upstream and config so user can easily
            # cherry-pick patches between branches
            for remote, url in self.remotes.items():
                git.add_remote(self.repo_dir, remote, url, logfile=get_logfile(self))
            # fetch remote branches
            if not self.offline:
                await git.fetch(self.repo_dir, fail=False, logfile=get_logfile(self))
        if checkout:
            commit = self.config.recipe_commit(self.name) or self.commit
            await git.checkout(self.repo_dir, commit, logfile=get_logfile(self))
            await git.submodules_update(self.repo_dir, cached_dir, fail=False, offline=self.offline, logfile=get_logfile(self))
Exemple #2
0
    def fetch(self, checkout=True):
        self._git_env_setup()
        if not os.path.exists(self.repo_dir):
            git.init(self.repo_dir)

        # First try to get the sources from the cached dir if there is one
        cached_dir = os.path.join(self.config.cached_sources, self.name)
        if os.path.isdir(os.path.join(cached_dir, ".git")):
            for remote, url in self.remotes.items():
                git.add_remote(self.repo_dir, remote, "file://" + cached_dir)
            for remote, url in self.config.recipe_remotes(self.name).items():
                git.add_remote(self.repo_dir, remote, "file://" + cached_dir)
            git.fetch(self.repo_dir, fail=False)
        else:
            cached_dir = None
            # add remotes from both upstream and config so user can easily
            # cherry-pick patches between branches
            for remote, url in self.remotes.items():
                git.add_remote(self.repo_dir, remote, url)
            for remote, url in self.config.recipe_remotes(self.name).items():
                git.add_remote(self.repo_dir, remote, url)
            # fetch remote branches
            git.fetch(self.repo_dir, fail=False)
        if checkout:
            commit = self.config.recipe_commit(self.name) or self.commit
            git.checkout(self.repo_dir, commit)
            git.submodules_update(self.repo_dir, cached_dir, fail=False)
        self._git_env_restore()
Exemple #3
0
    def fetch(self, checkout=True):
        if not os.path.exists(self.repo_dir):
            git.init(self.repo_dir)

        # First try to get the sources from the cached dir if there is one
        cached_dir = os.path.join(self.config.cached_sources,  self.name)
        if os.path.isdir(os.path.join(cached_dir, ".git")):
            for remote, url in self.remotes.items():
                git.add_remote(self.repo_dir, remote, "file://" + cached_dir)
            for remote, url in self.config.recipe_remotes(self.name).items():
                git.add_remote(self.repo_dir, remote, "file://" + cached_dir)
            git.fetch(self.repo_dir, fail=False)
        else:
            cached_dir = None
            # add remotes from both upstream and config so user can easily
            # cherry-pick patches between branches
            for remote, url in self.remotes.items():
                git.add_remote(self.repo_dir, remote, url)
            for remote, url in self.config.recipe_remotes(self.name).items():
                git.add_remote(self.repo_dir, remote, url)
            # fetch remote branches
            git.fetch(self.repo_dir, fail=False)
        if checkout:
            commit = self.config.recipe_commit(self.name) or self.commit
            git.checkout(self.repo_dir, commit)
            git.submodules_update(self.repo_dir, cached_dir, fail=False)
Exemple #4
0
    def fetch(self, checkout=True):
        self._git_env_setup()
        # First try to get the sources from the cached dir if there is one
        cached_dir = os.path.join(self.config.cached_sources,  self.name)

        if not os.path.exists(self.repo_dir):
            if not cached_dir and offline:
                msg = 'Offline mode: git repo for {!r} not found in cached sources ({}) or local sources ({})'
                raise FatalError(msg.format(self.name, self.config.cached_sources, self.repo_dir))
            git.init(self.repo_dir)

        if os.path.isdir(os.path.join(cached_dir, ".git")):
            for remote, url in self.remotes.items():
                git.add_remote(self.repo_dir, remote, "file://" + cached_dir)
            git.fetch(self.repo_dir, fail=False)
        else:
            cached_dir = None
            # add remotes from both upstream and config so user can easily
            # cherry-pick patches between branches
            for remote, url in self.remotes.items():
                git.add_remote(self.repo_dir, remote, url)
            # fetch remote branches
            if not self.offline:
                git.fetch(self.repo_dir, fail=False)
        if checkout:
            commit = self.config.recipe_commit(self.name) or self.commit
            git.checkout(self.repo_dir, commit)
            git.submodules_update(self.repo_dir, cached_dir, fail=False, offline=self.offline)
        self._git_env_restore()
Exemple #5
0
 def fetch(self, checkout=True):
     if not os.path.exists(self.repo_dir):
         git.init(self.repo_dir)
     for remote, url in self.remotes.iteritems():
         git.add_remote(self.repo_dir, remote, url)
     # fetch remote branches
     git.fetch(self.repo_dir, fail=False)
     if checkout:
         commit = self.config.recipe_commit(self.name) or self.commit
         git.checkout(self.repo_dir, commit)
Exemple #6
0
 def fetch(self, checkout=True):
     if not os.path.exists(self.repo_dir):
         git.init(self.repo_dir)
     # add remotes from both upstream and config so user can easily
     # cherry-pick patches between branches
     for remote, url in self.remotes.iteritems():
         git.add_remote(self.repo_dir, remote, url)
     for remote, url in self.config.recipe_remotes(self.name).iteritems():
         git.add_remote(self.repo_dir, remote, url)
     # fetch remote branches
     git.fetch(self.repo_dir, fail=False)
     if checkout:
         commit = self.config.recipe_commit(self.name) or self.commit
         git.checkout(self.repo_dir, commit)
Exemple #7
0
 def fetch(self, checkout=True):
     if not os.path.exists(self.repo_dir):
         git.init(self.repo_dir)
     # add remotes from both upstream and config so user can easily
     # cherry-pick patches between branches
     for remote, url in self.remotes.iteritems():
         git.add_remote(self.repo_dir, remote, url)
     for remote, url in self.config.recipe_remotes(self.name).iteritems():
         git.add_remote(self.repo_dir, remote, url)
     # fetch remote branches
     git.fetch(self.repo_dir, fail=False)
     if checkout:
         commit = self.config.recipe_commit(self.name) or self.commit
         git.checkout(self.repo_dir, commit)