示例#1
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()
示例#2
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)
示例#3
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)
示例#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()
示例#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)
示例#6
0
文件: source.py 项目: ikonst/cerbero
 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)
示例#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)
示例#8
0
    def self_update(self):
        '''Update this instance of cerbero git repository'''

        if not self.args.self_update:
            return

        try:
            manifest = Manifest(self.args.self_update)
            manifest.parse()
            project = manifest.find_project('cerbero')
            git_dir = os.path.dirname(sys.argv[0])
            git.add_remote(git_dir, project.remote, project.fetch_uri)
            git.fetch(git_dir)
            git.checkout(git_dir, project.revision)
        except FatalError as ex:
            self.log_error(
                _("ERROR: Failed to proceed with self update %s") % ex)
        sys.exit(0)