(catalog: &ExtensionCatalog)
| 389 | } |
| 390 | |
| 391 | fn build_plan_texts(catalog: &ExtensionCatalog) -> Result<BuildPlanTexts> { |
| 392 | let plan = build_plan(catalog)?; |
| 393 | let json = |
| 394 | serde_json::to_string_pretty(&plan).context("serialize extension build plan")? + "\n"; |
| 395 | let mut contrib_tsv = "# id\tsql_name\tcontrib_dir\tmodule_file\tarchive\tstable\n".to_owned(); |
| 396 | let mut pgxs_tsv = |
| 397 | "# id\tsql_name\tsource_dir\tmodule_file\tarchive\tstable\tmake_args\n".to_owned(); |
| 398 | for extension in &plan.extensions { |
| 399 | match extension.build_kind.as_str() { |
| 400 | "postgres-contrib" => { |
| 401 | let contrib_dir = extension.contrib_dir.as_deref().ok_or_else(|| { |
| 402 | anyhow!("contrib extension {} has no contrib_dir", extension.id) |
| 403 | })?; |
| 404 | contrib_tsv.push_str(&format!( |
| 405 | "{}\t{}\t{}\t{}\t{}\t{}\n", |
| 406 | extension.id, |
| 407 | extension.sql_name, |
| 408 | contrib_dir, |
| 409 | extension.module_file.as_deref().unwrap_or("-"), |
| 410 | extension.archive, |
| 411 | extension.stable |
| 412 | )); |
| 413 | } |
| 414 | "pgxs-external" => { |
| 415 | pgxs_tsv.push_str(&format!( |
| 416 | "{}\t{}\t{}\t{}\t{}\t{}\t{}\n", |
| 417 | extension.id, |
| 418 | extension.sql_name, |
| 419 | extension.source_dir, |
| 420 | extension.module_file.as_deref().unwrap_or("-"), |
| 421 | extension.archive, |
| 422 | extension.stable, |
| 423 | shell_words(&extension.make_args) |
| 424 | )); |
| 425 | } |
| 426 | "postgis" => {} |
| 427 | other => bail!( |
| 428 | "extension {} has unsupported build kind {other}", |
| 429 | extension.id |
| 430 | ), |
| 431 | } |
| 432 | } |
| 433 | Ok(BuildPlanTexts { |
| 434 | json, |
| 435 | contrib_tsv, |
| 436 | pgxs_tsv, |
| 437 | }) |
| 438 | } |
| 439 | |
| 440 | fn build_plan(catalog: &ExtensionCatalog) -> Result<ExtensionBuildPlan> { |
| 441 | let specs = build_specs(catalog)?; |
no test coverage detected