~cjwatson/launchpad-buildd/snap-default-branch

« back to all changes in this revision

Viewing changes to buildsnap

  • Committer: Colin Watson
  • Date: 2016-11-30 10:24:17 UTC
  • mto: This revision was merged to the branch mainline in revision 206.
  • Revision ID: cjwatson@canonical.com-20161130102417-xcg5ajr9bxh2iui7
buildsnap: Grant access to the proxy during the repo phase, allowing the
base branch to be fetched from an external site.

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
    def repo(self):
104
104
        """Collect git or bzr branch."""
105
105
        print("Running repo phase...")
 
106
        env = {}
 
107
        if self.options.proxy_url:
 
108
            env["http_proxy"] = self.options.proxy_url
 
109
            env["https_proxy"] = self.options.proxy_url
106
110
        if self.options.branch is not None:
107
111
            self.run_build_command(['ls', '/build'])
108
112
            cmd = ["bzr", "branch", self.options.branch, self.name]
109
113
            if not self.ssl_verify:
110
114
                cmd.insert(1, "-Ossl.cert_reqs=none")
111
 
            self.run_build_command(cmd)
112
115
        else:
113
116
            assert self.options.git_repository is not None
114
117
            assert self.options.git_path is not None
115
 
            if not self.ssl_verify:
116
 
                env = {"GIT_SSL_NO_VERIFY": "1"}
117
 
            else:
118
 
                env = None
119
 
            self.run_build_command([
 
118
            cmd = [
120
119
                "git", "clone", "-b", self.options.git_path,
121
 
                self.options.git_repository, self.name],
122
 
                env=env)
 
120
                self.options.git_repository, self.name,
 
121
                ]
 
122
            if not self.ssl_verify:
 
123
                env["GIT_SSL_NO_VERIFY"] = "1"
 
124
        self.run_build_command(cmd, env=env)
123
125
 
124
126
    def pull(self):
125
127
        """Run pull phase."""