예제 #1
0
파일: source.py 프로젝트: abuecher/cerbero
    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()
예제 #2
0
    def fetch_impl(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 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)
예제 #3
0
파일: source.py 프로젝트: jpakkane/cerbero
    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)
예제 #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()