| OLD | NEW |
| 1 # Copyright 2015 The Native Client Authors. All rights reserved. | 1 # Copyright 2015 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 """Basic implemenation of FreeBSD pkg file format. | 5 """Basic implemenation of FreeBSD pkg file format. |
| 6 | 6 |
| 7 This is just enough to allow us to create archive files | 7 This is just enough to allow us to create archive files |
| 8 that pkg will then be able to install. | 8 that pkg will then be able to install. |
| 9 | 9 |
| 10 See https://github.com/freebsd/pkg#pkgfmt for information | 10 See https://github.com/freebsd/pkg#pkgfmt for information |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 pkg_info_file = os.path.join(paths.NACLPORTS_ROOT, | 121 pkg_info_file = os.path.join(paths.NACLPORTS_ROOT, |
| 122 subdir, dep, 'pkg_info') | 122 subdir, dep, 'pkg_info') |
| 123 | 123 |
| 124 if os.path.exists(pkg_info_file): | 124 if os.path.exists(pkg_info_file): |
| 125 dep_dict['version'] = package.Package(info_file=pkg_info_file).VERSION | 125 dep_dict['version'] = package.Package(info_file=pkg_info_file).VERSION |
| 126 return | 126 return |
| 127 | 127 |
| 128 raise Error("Package not found: %s" % dep) | 128 raise Error("Package not found: %s" % dep) |
| 129 | 129 |
| 130 | 130 |
| 131 # These packages are are built-time only depednecies and we won't want |
| 132 # encode them into the pkg file deps. |
| 133 BUILD_ONLY_DEPS = [ |
| 134 'glibc-compat', |
| 135 'libtar', |
| 136 'python-host', |
| 137 'gmp', |
| 138 'mpfr', |
| 139 'mpc', |
| 140 ] |
| 141 |
| 131 def CreateDependencies(depends_dict, depends): | 142 def CreateDependencies(depends_dict, depends): |
| 132 for dep in depends: | 143 for dep in depends: |
| 133 if dep != 'glibc-compat': | 144 if dep in BUILD_ONLY_DEPS: |
| 134 dep_dict = collections.OrderedDict() | 145 continue |
| 135 AddPackageDep(dep_dict, dep) | 146 dep_dict = collections.OrderedDict() |
| 136 depends_dict[dep] = dep_dict | 147 AddPackageDep(dep_dict, dep) |
| 148 depends_dict[dep] = dep_dict |
| 137 | 149 |
| 138 | 150 |
| 139 def CreatePkgFile(name, version, arch, payload_dir, outfile, depends): | 151 def CreatePkgFile(name, version, arch, payload_dir, outfile, depends): |
| 140 """Create an archive file in FreeBSD's pkg file format""" | 152 """Create an archive file in FreeBSD's pkg file format""" |
| 141 util.Log('Creating pkg package: %s' % outfile) | 153 util.Log('Creating pkg package: %s' % outfile) |
| 142 manifest = collections.OrderedDict() | 154 manifest = collections.OrderedDict() |
| 143 manifest['name'] = name | 155 manifest['name'] = name |
| 144 manifest['version'] = version | 156 manifest['version'] = version |
| 145 manifest['arch'] = 'nacl:0:%s' % arch | 157 manifest['arch'] = 'nacl:0:%s' % arch |
| 146 | 158 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 175 for filename in os.listdir(temp_dir): | 187 for filename in os.listdir(temp_dir): |
| 176 if filename.startswith('+'): | 188 if filename.startswith('+'): |
| 177 fullname = os.path.join(temp_dir, filename) | 189 fullname = os.path.join(temp_dir, filename) |
| 178 tar.add(fullname, arcname=filename) | 190 tar.add(fullname, arcname=filename) |
| 179 | 191 |
| 180 for filename in os.listdir(temp_dir): | 192 for filename in os.listdir(temp_dir): |
| 181 if not filename.startswith('+'): | 193 if not filename.startswith('+'): |
| 182 fullname = os.path.join(temp_dir, filename) | 194 fullname = os.path.join(temp_dir, filename) |
| 183 AddFilesInDir(fullname, tar, temp_dir) | 195 AddFilesInDir(fullname, tar, temp_dir) |
| 184 shutil.rmtree(temp_dir) | 196 shutil.rmtree(temp_dir) |
| OLD | NEW |