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

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
« no previous file with comments | « lib/naclports/package.py ('k') | lib/naclports/tests/test_installed_package.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 raise Error('Invalid package folder: %s' % pkg_root) 176 raise Error('Invalid package folder: %s' % pkg_root)
177 177
178 super(SourcePackage, self).__init__(info_file) 178 super(SourcePackage, self).__init__(info_file)
179 if self.NAME != os.path.basename(self.root): 179 if self.NAME != os.path.basename(self.root):
180 raise Error('%s: package NAME must match directory name' % self.info) 180 raise Error('%s: package NAME must match directory name' % self.info)
181 181
182 def GetInstallLocation(self): 182 def GetInstallLocation(self):
183 install_dir = 'install_%s' % util.arch_to_pkgarch[self.config.arch] 183 install_dir = 'install_%s' % util.arch_to_pkgarch[self.config.arch]
184 if self.config.arch != self.config.toolchain: 184 if self.config.arch != self.config.toolchain:
185 install_dir += '_' + self.config.toolchain 185 install_dir += '_' + self.config.toolchain
186 if self.config.config_name == 'debug':
187 install_dir += '_debug'
186 return os.path.join(paths.BUILD_ROOT, self.NAME, install_dir, 'payload') 188 return os.path.join(paths.BUILD_ROOT, self.NAME, install_dir, 'payload')
187 189
188 def GetBuildLocation(self): 190 def GetBuildLocation(self):
189 package_dir = self.ARCHIVE_ROOT or '%s-%s' % (self.NAME, self.VERSION) 191 package_dir = self.ARCHIVE_ROOT or '%s-%s' % (self.NAME, self.VERSION)
190 return os.path.join(paths.BUILD_ROOT, self.NAME, package_dir) 192 return os.path.join(paths.BUILD_ROOT, self.NAME, package_dir)
191 193
192 def GetPatchFile(self): 194 def GetPatchFile(self):
193 return os.path.join(self.root, 'nacl.patch') 195 return os.path.join(self.root, 'nacl.patch')
194 196
195 def GetArchiveFilename(self): 197 def GetArchiveFilename(self):
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 from_source = True 277 from_source = True
276 278
277 if from_source: 279 if from_source:
278 self.Build(build_deps, force) 280 self.Build(build_deps, force)
279 281
280 if self.IsAnyVersionInstalled(): 282 if self.IsAnyVersionInstalled():
281 installed_pkg = self.GetInstalledPackage() 283 installed_pkg = self.GetInstalledPackage()
282 installed_pkg.LogStatus('Uninstalling existing') 284 installed_pkg.LogStatus('Uninstalling existing')
283 installed_pkg.DoUninstall() 285 installed_pkg.DoUninstall()
284 286
285 if self.TOOLCHAIN_INSTALL != '0': 287 binary_package.BinaryPackage(package_file).Install(force)
286 binary_package.BinaryPackage(package_file).Install(force)
287 288
288 def GetInstalledPackage(self): 289 def GetInstalledPackage(self):
289 return package.CreateInstalledPackage(self.NAME, self.config) 290 return package.CreateInstalledPackage(self.NAME, self.config)
290 291
291 def CreatePkgFile(self): 292 def CreatePkgFile(self):
292 """Create and pkg file for use with the FreeBSD pkg tool. 293 """Create and pkg file for use with the FreeBSD pkg tool.
293 294
294 This step is designed to run after the build scripts and will 295 Create a package from the result of the package's InstallStep.
295 package up any files published by the PublishByArchForDevEnv
296 step.
297 """ 296 """
298 install_dir = self.GetInstallLocation() 297 install_dir = self.GetInstallLocation()
299 if not os.path.exists(install_dir): 298 if not os.path.exists(install_dir):
299 Log('Skiping pkg creation. Install dir not found: %s' % 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 | « lib/naclports/package.py ('k') | lib/naclports/tests/test_installed_package.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698