| OLD | NEW |
| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 284 |
| 285 if self.TOOLCHAIN_INSTALL != '0': | 285 if self.TOOLCHAIN_INSTALL != '0': |
| 286 binary_package.BinaryPackage(package_file).Install(force) | 286 binary_package.BinaryPackage(package_file).Install(force) |
| 287 | 287 |
| 288 def GetInstalledPackage(self): | 288 def GetInstalledPackage(self): |
| 289 return package.CreateInstalledPackage(self.NAME, self.config) | 289 return package.CreateInstalledPackage(self.NAME, self.config) |
| 290 | 290 |
| 291 def CreatePkgFile(self): | 291 def CreatePkgFile(self): |
| 292 """Create and pkg file for use with the FreeBSD pkg tool. | 292 """Create and pkg file for use with the FreeBSD pkg tool. |
| 293 | 293 |
| 294 This step is designed to run after the build scripts and will | 294 Create a package from the result of the package's InstallStep. |
| 295 package up any files published by the PublishByArchForDevEnv | |
| 296 step. | |
| 297 """ | 295 """ |
| 298 install_dir = self.GetInstallLocation() | 296 install_dir = self.GetInstallLocation() |
| 299 if not os.path.exists(install_dir): | 297 if not os.path.exists(install_dir): |
| 300 return | 298 return |
| 301 | 299 |
| 302 abi = 'pkg_' + self.config.toolchain | 300 abi = 'pkg_' + self.config.toolchain |
| 303 if self.config.arch != self.config.toolchain: | 301 if self.config.arch != self.config.toolchain: |
| 304 abi += "_" + util.arch_to_pkgarch[self.config.arch] | 302 abi += "_" + util.arch_to_pkgarch[self.config.arch] |
| 305 abi_dir = os.path.join(paths.PUBLISH_ROOT, abi) | 303 abi_dir = os.path.join(paths.PUBLISH_ROOT, abi) |
| 306 pkg_file = os.path.join(abi_dir, '%s-%s.tbz' % (self.NAME, | 304 pkg_file = os.path.join(abi_dir, '%s-%s.tbz' % (self.NAME, |
| 307 self.VERSION)) | 305 self.VERSION)) |
| 308 | |
| 309 util.Makedirs(abi_dir) | 306 util.Makedirs(abi_dir) |
| 310 | |
| 311 bsd_pkg.CreatePkgFile(self.NAME, self.VERSION, self.config.arch, | 307 bsd_pkg.CreatePkgFile(self.NAME, self.VERSION, self.config.arch, |
| 312 self.GetInstallLocation(), pkg_file) | 308 self.GetInstallLocation(), pkg_file) |
| 313 | 309 |
| 314 def Build(self, build_deps, force=None): | 310 def Build(self, build_deps, force=None): |
| 315 self.CheckBuildable() | 311 self.CheckBuildable() |
| 316 | 312 |
| 317 if build_deps: | 313 if build_deps: |
| 318 self.InstallDeps(force) | 314 self.InstallDeps(force) |
| 319 | 315 |
| 320 if not force and self.IsBuilt(): | 316 if not force and self.IsBuilt(): |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 if os.path.isdir(package_name): | 761 if os.path.isdir(package_name): |
| 766 return SourcePackage(package_name, config) | 762 return SourcePackage(package_name, config) |
| 767 | 763 |
| 768 for subdir in DEFAULT_LOCATIONS: | 764 for subdir in DEFAULT_LOCATIONS: |
| 769 pkg_root = os.path.join(paths.NACLPORTS_ROOT, subdir, package_name) | 765 pkg_root = os.path.join(paths.NACLPORTS_ROOT, subdir, package_name) |
| 770 info = os.path.join(pkg_root, 'pkg_info') | 766 info = os.path.join(pkg_root, 'pkg_info') |
| 771 if os.path.exists(info): | 767 if os.path.exists(info): |
| 772 return SourcePackage(pkg_root, config) | 768 return SourcePackage(pkg_root, config) |
| 773 | 769 |
| 774 raise Error("Package not found: %s" % package_name) | 770 raise Error("Package not found: %s" % package_name) |
| OLD | NEW |