1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// SPDX-FileCopyrightText: 2022-2024 Michael Picht <mipi@fsfe.org>
//
// SPDX-License-Identifier: GPL-3.0-or-later
//! # repodb_parser
//!
//! repodb_parser parses [Arch Linux](https://archlinux.org) repository DB's
//! into Rust data structures. The repository DB's are expected as
//! [gzip](https://en.wikipedia.org/wiki/Gzip) or
//! [xz](https://en.wikipedia.org/wiki/XZ_Utils) compressed
//! [tar](https://en.wikipedia.org/wiki/Tar_(computing)) archives (i.e.,
//! `*.tar.gz` or `*.tar.xz` files) or symbolic links to such files.
//!
pub use crate::;
use Context;
use Path;
/// Parses an Arch Linux repository DB and returns the content as B-tree map of
/// package meta data structures. The map is sorted by the package name in
/// ascending alphabetical order.
/// parse expects a path to a repository DB file or a symbolic link to
/// such a file. The file must be a gzip or xz compressed tar archive.
///
/// # Example
///
/// ```
/// let mut path = std::path::PathBuf::new();
/// path.push(<PATH-TO-REPOSITORY-DB>);
///
/// match repodb_parser::parse(path.as_path()) {
/// Err(err) => {
/// eprintln!("{:?}", err);
/// std::process::exit(1);
/// }
/// Ok(pkgs) => {
/// for pkg in pkgs.packages() {
/// println!("{}", pkg);
/// }
/// }
/// }
/// ```
///