(options InstallOptions)
| 619 | } |
| 620 | |
| 621 | func (p *Port) doInstallFromDevCache(options InstallOptions) (bool, error) { |
| 622 | // Try to install dependencies first. |
| 623 | for _, nameVersion := range p.MatchedConfig.Dependencies { |
| 624 | // Skip Init() for already-processed ports. |
| 625 | key := expr.If(p.DevDep || p.HostDep, nameVersion+"[dev]", nameVersion) |
| 626 | if visitedPorts[key] { |
| 627 | continue |
| 628 | } |
| 629 | |
| 630 | var port Port |
| 631 | port.DevDep = false |
| 632 | port.HostDep = p.HostDep |
| 633 | port.Parent = p.NameVersion() |
| 634 | port.installReport = p.installReport |
| 635 | if err := port.Init(p.ctx, nameVersion); err != nil { |
| 636 | return false, err |
| 637 | } |
| 638 | |
| 639 | if _, err := port.Install(options); err != nil { |
| 640 | return false, err |
| 641 | } |
| 642 | visitedPorts[key] = true |
| 643 | } |
| 644 | |
| 645 | // No repo means cannot computer meta. |
| 646 | if !fileio.PathExists(p.MatchedConfig.PortConfig.RepoDir) { |
| 647 | return false, nil |
| 648 | } |
| 649 | |
| 650 | // Calculate buildhash. |
| 651 | buildhash, err := p.buildhash() |
| 652 | if err != nil { |
| 653 | return false, fmt.Errorf("failed to calculate buildhash -> %w", err) |
| 654 | } |
| 655 | |
| 656 | // Read cache file and extract them to package dir. |
| 657 | devArtifactCache := p.ctx.DevCacheConfig().GetDevArtifactCache() |
| 658 | if fromWhere, err := devArtifactCache.Restore(p.NameVersion(), buildhash, p.PackageDir); err != nil { |
| 659 | return false, fmt.Errorf("read cache with buildhash: %s", err) |
| 660 | } else if fromWhere != "" { |
| 661 | return true, nil |
| 662 | } |
| 663 | |
| 664 | return false, nil |
| 665 | } |
| 666 | |
| 667 | func (p *Port) doInstallFromSource() error { |
| 668 | var installFailed bool |
no test coverage detected