| 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 fnmatch | 6 import fnmatch |
| 7 import os | 7 import os |
| 8 import re | 8 import re |
| 9 import subprocess | 9 import subprocess |
| 10 import sys | 10 import sys |
| 11 import tempfile | 11 import tempfile |
| 12 import time | 12 import time |
| 13 import urlparse | 13 import urlparse |
| 14 | 14 |
| 15 from naclports import binary_package | 15 from naclports import binary_package |
| 16 from naclports import configuration | 16 from naclports import configuration |
| 17 from naclports import package | 17 from naclports import package |
| 18 from naclports import package_index | 18 from naclports import package_index |
| 19 from naclports import installed_package |
| 19 from naclports import util | 20 from naclports import util |
| 20 from naclports import paths | 21 from naclports import paths |
| 21 from naclports import bsd_pkg | 22 from naclports import bsd_pkg |
| 22 from naclports.util import Log, Trace, LogVerbose | 23 from naclports.util import Log, Trace, LogVerbose |
| 23 from naclports.error import Error, DisabledError, PkgFormatError | 24 from naclports.error import Error, DisabledError, PkgFormatError |
| 24 | 25 |
| 25 | 26 |
| 26 class PkgConflictError(Error): | 27 class PkgConflictError(Error): |
| 27 pass | 28 pass |
| 28 | 29 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 self.Build(build_deps, force) | 283 self.Build(build_deps, force) |
| 283 | 284 |
| 284 if self.IsAnyVersionInstalled(): | 285 if self.IsAnyVersionInstalled(): |
| 285 installed_pkg = self.GetInstalledPackage() | 286 installed_pkg = self.GetInstalledPackage() |
| 286 installed_pkg.LogStatus('Uninstalling existing') | 287 installed_pkg.LogStatus('Uninstalling existing') |
| 287 installed_pkg.DoUninstall(force=True) | 288 installed_pkg.DoUninstall(force=True) |
| 288 | 289 |
| 289 binary_package.BinaryPackage(package_file).Install(force) | 290 binary_package.BinaryPackage(package_file).Install(force) |
| 290 | 291 |
| 291 def GetInstalledPackage(self): | 292 def GetInstalledPackage(self): |
| 292 return package.CreateInstalledPackage(self.NAME, self.config) | 293 return installed_package.CreateInstalledPackage(self.NAME, self.config) |
| 293 | 294 |
| 294 def CreatePkgFile(self): | 295 def CreatePkgFile(self): |
| 295 """Create and pkg file for use with the FreeBSD pkg tool. | 296 """Create and pkg file for use with the FreeBSD pkg tool. |
| 296 | 297 |
| 297 Create a package from the result of the package's InstallStep. | 298 Create a package from the result of the package's InstallStep. |
| 298 """ | 299 """ |
| 299 install_dir = self.GetInstallLocation() | 300 install_dir = self.GetInstallLocation() |
| 300 if not os.path.exists(install_dir): | 301 if not os.path.exists(install_dir): |
| 301 Log('Skiping pkg creation. Install dir not found: %s' % install_dir) | 302 Log('Skiping pkg creation. Install dir not found: %s' % install_dir) |
| 302 return | 303 return |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 if os.path.isdir(package_name): | 788 if os.path.isdir(package_name): |
| 788 return SourcePackage(package_name, config) | 789 return SourcePackage(package_name, config) |
| 789 | 790 |
| 790 for subdir in DEFAULT_LOCATIONS: | 791 for subdir in DEFAULT_LOCATIONS: |
| 791 pkg_root = os.path.join(paths.NACLPORTS_ROOT, subdir, package_name) | 792 pkg_root = os.path.join(paths.NACLPORTS_ROOT, subdir, package_name) |
| 792 info = os.path.join(pkg_root, 'pkg_info') | 793 info = os.path.join(pkg_root, 'pkg_info') |
| 793 if os.path.exists(info): | 794 if os.path.exists(info): |
| 794 return SourcePackage(pkg_root, config) | 795 return SourcePackage(pkg_root, config) |
| 795 | 796 |
| 796 raise Error("Package not found: %s" % package_name) | 797 raise Error("Package not found: %s" % package_name) |
| OLD | NEW |