Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: lib/naclports/source_package.py

Issue 1285953002: Switch devenv to use pkg packages (Closed) Base URL: https://chromium.googlesource.com/external/naclports.git@toolchain_install
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. 1 # Copyright (c) 2014 The Native Client Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import contextlib 5 import contextlib
6 import os 6 import os
7 import re 7 import re
8 import subprocess 8 import subprocess
9 import sys 9 import sys
10 import tempfile 10 import tempfile
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 def IsInstalled(self): 210 def IsInstalled(self):
211 return util.IsInstalled(self.NAME, self.config, 211 return util.IsInstalled(self.NAME, self.config,
212 self.InstalledInfoContents()) 212 self.InstalledInfoContents())
213 213
214 def IsGitUpstream(self): 214 def IsGitUpstream(self):
215 return self.URL and self.URL.split('@')[0].endswith('.git') 215 return self.URL and self.URL.split('@')[0].endswith('.git')
216 216
217 def InstallDeps(self, force, from_source=False): 217 def InstallDeps(self, force, from_source=False):
218 for dep in self.Dependencies(): 218 for dep in self.Dependencies():
219 if self.TOOLCHAIN_INSTALL == '0':
220 continue
219 if not dep.IsAnyVersionInstalled() or force == 'all': 221 if not dep.IsAnyVersionInstalled() or force == 'all':
220 dep.Install(True, force, from_source) 222 dep.Install(True, force, from_source)
221 223
222 def PackageFile(self): 224 def PackageFile(self):
223 fullname = [os.path.join(paths.PACKAGES_ROOT, self.NAME)] 225 fullname = [os.path.join(paths.PACKAGES_ROOT, self.NAME)]
224 fullname.append(self.VERSION) 226 fullname.append(self.VERSION)
225 fullname.append(util.arch_to_pkgarch[self.config.arch]) 227 fullname.append(util.arch_to_pkgarch[self.config.arch])
226 # for pnacl toolchain and arch are the same 228 # for pnacl toolchain and arch are the same
227 if self.config.toolchain != self.config.arch: 229 if self.config.toolchain != self.config.arch:
228 fullname.append(self.config.toolchain) 230 fullname.append(self.config.toolchain)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 286
285 if self.TOOLCHAIN_INSTALL != '0': 287 if self.TOOLCHAIN_INSTALL != '0':
286 binary_package.BinaryPackage(package_file).Install(force) 288 binary_package.BinaryPackage(package_file).Install(force)
287 289
288 def GetInstalledPackage(self): 290 def GetInstalledPackage(self):
289 return package.CreateInstalledPackage(self.NAME, self.config) 291 return package.CreateInstalledPackage(self.NAME, self.config)
290 292
291 def CreatePkgFile(self): 293 def CreatePkgFile(self):
292 """Create and pkg file for use with the FreeBSD pkg tool. 294 """Create and pkg file for use with the FreeBSD pkg tool.
293 295
294 This step is designed to run after the build scripts and will 296 Create a package from the result of the package's InstallStep.
295 package up any files published by the PublishByArchForDevEnv
296 step.
297 """ 297 """
298 install_dir = self.GetInstallLocation() 298 install_dir = self.GetInstallLocation()
299 if not os.path.exists(install_dir): 299 if not os.path.exists(install_dir):
300 return 300 return
301 301
302 abi = 'pkg_' + self.config.toolchain 302 abi = 'pkg_' + self.config.toolchain
303 if self.config.arch != self.config.toolchain: 303 if self.config.arch != self.config.toolchain:
304 abi += "_" + util.arch_to_pkgarch[self.config.arch] 304 abi += "_" + util.arch_to_pkgarch[self.config.arch]
305 abi_dir = os.path.join(paths.PUBLISH_ROOT, abi) 305 abi_dir = os.path.join(paths.PUBLISH_ROOT, abi)
306 pkg_file = os.path.join(abi_dir, '%s-%s.tbz' % (self.NAME, 306 pkg_file = os.path.join(abi_dir, '%s-%s.tbz' % (self.NAME,
307 self.VERSION)) 307 self.VERSION))
308
309 util.Makedirs(abi_dir) 308 util.Makedirs(abi_dir)
310
311 deps = self.DEPENDS 309 deps = self.DEPENDS
312 if self.config.toolchain != 'glibc': 310 if self.config.toolchain != 'glibc':
313 deps = [] 311 deps = []
314 bsd_pkg.CreatePkgFile(self.NAME, self.VERSION, self.config.arch, 312 bsd_pkg.CreatePkgFile(self.NAME, self.VERSION, self.config.arch,
315 self.GetInstallLocation(), pkg_file, deps) 313 self.GetInstallLocation(), pkg_file, deps)
316 314
317 315
318 def Build(self, build_deps, force=None): 316 def Build(self, build_deps, force=None):
319 self.CheckBuildable() 317 self.CheckBuildable()
320 318
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 if os.path.isdir(package_name): 767 if os.path.isdir(package_name):
770 return SourcePackage(package_name, config) 768 return SourcePackage(package_name, config)
771 769
772 for subdir in DEFAULT_LOCATIONS: 770 for subdir in DEFAULT_LOCATIONS:
773 pkg_root = os.path.join(paths.NACLPORTS_ROOT, subdir, package_name) 771 pkg_root = os.path.join(paths.NACLPORTS_ROOT, subdir, package_name)
774 info = os.path.join(pkg_root, 'pkg_info') 772 info = os.path.join(pkg_root, 'pkg_info')
775 if os.path.exists(info): 773 if os.path.exists(info):
776 return SourcePackage(pkg_root, config) 774 return SourcePackage(pkg_root, config)
777 775
778 raise Error("Package not found: %s" % package_name) 776 raise Error("Package not found: %s" % package_name)
OLDNEW
« no previous file with comments | « build_tools/common.sh ('k') | ports/avrdude/build.sh » ('j') | ports/curl/nacl.patch » ('J')

Powered by Google App Engine
This is Rietveld 408576698