(portPath string)
| 304 | } |
| 305 | |
| 306 | func (p Port) Write(portPath string) error { |
| 307 | p.Package.Url = "" |
| 308 | p.Name = "" |
| 309 | p.Package.Ref = "" |
| 310 | p.Package.Checksum = "" |
| 311 | p.Package.SrcDir = "" |
| 312 | p.BuildConfigs = []buildsystems.BuildConfig{} |
| 313 | p.BuildConfigs = append(p.BuildConfigs, buildsystems.BuildConfig{ |
| 314 | SystemName: "", |
| 315 | SystemNames: []string{}, |
| 316 | SystemProcessor: "", |
| 317 | BuildSystem: "", |
| 318 | BuildTools: []string{}, |
| 319 | CStandard: "", |
| 320 | CXXStandard: "", |
| 321 | Envs: []string{}, |
| 322 | Patches: []string{}, |
| 323 | AutogenOptions: []string{}, |
| 324 | Options: []string{}, |
| 325 | Dependencies: []string{}, |
| 326 | DevDependencies: []string{}, |
| 327 | PreConfigure: []string{}, |
| 328 | PostConfigure: []string{}, |
| 329 | PreBuild: []string{}, |
| 330 | FixBuild: []string{}, |
| 331 | PostBuild: []string{}, |
| 332 | PreInstall: []string{}, |
| 333 | PostInstall: []string{}, |
| 334 | }) |
| 335 | bytes, err := toml.Marshal(p) |
| 336 | if err != nil { |
| 337 | return err |
| 338 | } |
| 339 | |
| 340 | // Check if tool exists. |
| 341 | if fileio.PathExists(portPath) { |
| 342 | return fmt.Errorf("%s is already exists", portPath) |
| 343 | } |
| 344 | |
| 345 | // Make sure the parent directory exists. |
| 346 | parentDir := filepath.Dir(portPath) |
| 347 | if err := os.MkdirAll(parentDir, os.ModePerm); err != nil { |
| 348 | return err |
| 349 | } |
| 350 | return os.WriteFile(portPath, bytes, os.ModePerm) |
| 351 | } |
| 352 | |
| 353 | func (p *Port) findMatchedConfig(buildType string) (*buildsystems.BuildConfig, error) { |
| 354 | matchedIndexes := make([]int, 0, len(p.BuildConfigs)) |
no test coverage detected