()
| 236 | } |
| 237 | |
| 238 | func (p Port) Clone() error { |
| 239 | // Skip if this port was already cloned in the current cloneAllRepos run. |
| 240 | key := p.visitedKey() |
| 241 | if clonedPorts[key] { |
| 242 | return nil |
| 243 | } |
| 244 | clonedPorts[key] = true |
| 245 | |
| 246 | for _, nameVersion := range p.MatchedConfig.DevDependencies { |
| 247 | var port = Port{ |
| 248 | DevDep: true, |
| 249 | Parent: p.NameVersion(), |
| 250 | } |
| 251 | if err := port.Init(p.ctx, nameVersion); err != nil { |
| 252 | return err |
| 253 | } |
| 254 | |
| 255 | // Ports with a checksum are expected to be restored from the artifact |
| 256 | // pkgcache during install (no source build needed). |
| 257 | if port.Package.Checksum == "" { |
| 258 | if err := port.MatchedConfig.Clone( |
| 259 | port.Package.Url, |
| 260 | port.Package.Ref, |
| 261 | port.Package.Archive, |
| 262 | port.Package.Depth, |
| 263 | ); err != nil { |
| 264 | return err |
| 265 | } |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | for _, nameVersion := range p.MatchedConfig.Dependencies { |
| 270 | var port = Port{ |
| 271 | DevDep: p.DevDep, |
| 272 | HostDep: p.DevDep || p.HostDep, |
| 273 | Parent: p.NameVersion(), |
| 274 | } |
| 275 | if err := port.Init(p.ctx, nameVersion); err != nil { |
| 276 | return err |
| 277 | } |
| 278 | |
| 279 | // Ports with a checksum are expected to be restored from the artifact |
| 280 | // pkgcache during install (no source build needed). |
| 281 | if port.Package.Checksum == "" { |
| 282 | if err := port.MatchedConfig.Clone( |
| 283 | port.Package.Url, |
| 284 | port.Package.Ref, |
| 285 | port.Package.Archive, |
| 286 | port.Package.Depth, |
| 287 | ); err != nil { |
| 288 | return err |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | // url with "_" means virtual port, no need to clone. |
| 294 | if p.Package.Url != "_" { |
| 295 | // Repo may archived in pkgcache/repos with filename of commit hash, |
no test coverage detected