(installedFrom string)
| 1285 | } |
| 1286 | |
| 1287 | func (p Port) writeTraceFile(installedFrom string) error { |
| 1288 | // Write installed files trace into its installation trace list. |
| 1289 | if err := fileio.MkdirAll(filepath.Dir(p.traceFile), os.ModePerm); err != nil { |
| 1290 | return fmt.Errorf("failed to create trace dir -> %w", err) |
| 1291 | } |
| 1292 | packageFiles, err := p.PackageFiles(p.PackageDir, p.ctx.Platform().GetName(), p.ctx.Project().GetName()) |
| 1293 | if err != nil { |
| 1294 | return fmt.Errorf("failed to get package files -> %w", err) |
| 1295 | } |
| 1296 | |
| 1297 | // For Python packages, transform paths to be relative to installed/. |
| 1298 | // PackageFiles returns "libraryDir/relative/path", we need "venv-x.y@project/relative/path". |
| 1299 | if p.MatchedConfig.IsPythonPackage() && buildtools.PythonTool != nil { |
| 1300 | venvDir := buildtools.PythonTool.VenvDir() |
| 1301 | venvFolder, _ := filepath.Rel(dirs.InstalledDir, venvDir) // "venv-3.10@ros2" |
| 1302 | for i, file := range packageFiles { |
| 1303 | // Strip libraryDir prefix (same as doInstallFromPackage). |
| 1304 | if p.DevDep || p.HostDep { |
| 1305 | file = strings.TrimPrefix(file, p.ctx.Platform().GetHostName()+"-dev"+string(os.PathSeparator)) |
| 1306 | } else { |
| 1307 | file = strings.TrimPrefix(file, filepath.Join(p.ctx.LibraryFolder(), string(os.PathSeparator))) |
| 1308 | } |
| 1309 | packageFiles[i] = filepath.Join(venvFolder, file) |
| 1310 | } |
| 1311 | } |
| 1312 | |
| 1313 | if err := os.WriteFile(p.traceFile, []byte(strings.Join(packageFiles, "\n")), os.ModePerm); err != nil { |
| 1314 | return fmt.Errorf("failed to write trace file -> %w", err) |
| 1315 | } |
| 1316 | |
| 1317 | // Print install trace. |
| 1318 | color.PrintPass("%s is installed from %s", p.NameVersion(), installedFrom) |
| 1319 | if p.MatchedConfig.IsPythonPackage() && buildtools.PythonTool != nil { |
| 1320 | color.PrintHint("Location: %s\n", buildtools.PythonTool.VenvDir()) |
| 1321 | } else { |
| 1322 | color.PrintHint("Location: %s\n", p.InstalledDir) |
| 1323 | } |
| 1324 | |
| 1325 | // Print reason why skip store artifact to pkgcache. |
| 1326 | if p.pkgCacheStoreSkippedReason != "" { |
| 1327 | color.PrintWarning("skip storing package cache for %s because %s\n", p.NameVersion(), p.pkgCacheStoreSkippedReason) |
| 1328 | } |
| 1329 | |
| 1330 | return nil |
| 1331 | } |
| 1332 | |
| 1333 | func (p *Port) checkCPythonVersionConflict() error { |
| 1334 | cpythonVer := p.cpythonDepVersion() |
no test coverage detected