MCPcopy Create free account
hub / github.com/archlinux/alpm / create

Function create

alpm-srcinfo/src/commands.rs:48–70  ·  view source on GitHub ↗

Take a [PKGBUILD], create [SRCINFO] data from it and print it. # Errors Returns an error if - running the [`alpm-pkgbuild-bridge`] script fails, - or parsing the output of the ``alpm-pkgbuild-bridge`] script fails. [PKGBUILD]: https://man.archlinux.org/man/PKGBUILD.5 [SRCINFO]: https://alpm.archlinux.page/specifications/SRCINFO.5.html [`alpm-pkgbuild-bridge`]: https://gitlab.archlinux.org/arch

(
    pkgbuild_path: &Path,
    output_format: SourceInfoOutputFormat,
    pretty: bool,
)

Source from the content-addressed store, hash-verified

46/// [SRCINFO]: https://alpm.archlinux.page/specifications/SRCINFO.5.html
47/// [`alpm-pkgbuild-bridge`]: https://gitlab.archlinux.org/archlinux/alpm/alpm-pkgbuild-bridge
48pub fn create(
49 pkgbuild_path: &Path,
50 output_format: SourceInfoOutputFormat,
51 pretty: bool,
52) -> Result<(), Error> {
53 let source_info = SourceInfoV1::from_pkgbuild(pkgbuild_path)?;
54
55 match output_format {
56 SourceInfoOutputFormat::Json => {
57 let json = if pretty {
58 serde_json::to_string_pretty(&source_info)?
59 } else {
60 serde_json::to_string(&source_info)?
61 };
62 println!("{json}");
63 }
64 SourceInfoOutputFormat::Srcinfo => {
65 print!("{}", source_info.as_srcinfo())
66 }
67 }
68
69 Ok(())
70}
71
72/// Validates a SRCINFO file from a path or stdin.
73///

Callers 15

mainFunction · 0.70
create_fileFunction · 0.50
output_dir_new_failsFunction · 0.50
input_dir_new_failsFunction · 0.50
try_fromMethod · 0.50
package_newFunction · 0.50
create_data_filesFunction · 0.50
create_build_info_fileFunction · 0.50
create_package_info_fileFunction · 0.50
create_install_scriptletFunction · 0.50
create_mtree_file_in_dirFunction · 0.50

Calls

no outgoing calls

Tested by 15

output_dir_new_failsFunction · 0.40
input_dir_new_failsFunction · 0.40
package_newFunction · 0.40
create_data_filesFunction · 0.40
create_build_info_fileFunction · 0.40
create_package_info_fileFunction · 0.40
create_install_scriptletFunction · 0.40
create_data_filesFunction · 0.40
create_build_info_fileFunction · 0.40
create_package_info_fileFunction · 0.40