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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
* Copyright (c) 2026 Jonathan Perkin <jonathan@perkin.org.uk>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*!
* # pkgsrc
*
* [pkgsrc](https://www.pkgsrc.org/) is a cross-platform package management
* system originally developed for NetBSD, now available on many Unix-like
* operating systems. This crate provides types and utilities for working
* with pkgsrc packages, the package database, and pkgsrc infrastructure.
*
* It is used by [bob](https://github.com/jperkin/bob), a pkgsrc package
* builder, and [mktool](https://github.com/jperkin/mktool), a collection of
* fast alternate implementations for various pkgsrc/mk scripts.
*
* ## Modules
*
* The crate is organised into modules that handle different aspects of pkgsrc:
*
* | Module | Purpose |
* |--------|---------|
* | [`archive`] | Read and create binary package archives |
* | [`depend`] | Parse and match package dependencies |
* | [`dewey`] | Dewey decimal version comparisons |
* | [`digest`] | Cryptographic hash functions for file verification |
* | [`distinfo`] | Parse and verify distinfo files |
* | [`kv`] | Parse KEY=VALUE formatted data |
* | [`metadata`] | Read package metadata from `+*` files |
* | [`pattern`] | Match packages against glob, dewey, and alternate patterns |
* | [`pkgdb`] | Access the installed package database |
* | [`pkgname`] | Parse package names into name and version components |
* | [`pkgpath`] | Parse pkgsrc package paths (category/package) |
* | [`plist`] | Parse packing list (PLIST) files |
* | [`scanindex`] | Parse pbulk-index scan output |
* | [`summary`] | Parse [`pkg_summary(5)`] files |
*
* ## Examples
*
* Read an installed package's metadata from the package database:
*
* ```no_run
* use pkgsrc::metadata::FileRead;
* use pkgsrc::PkgDB;
*
* let db = PkgDB::open("/var/db/pkg")?;
* for entry in db {
* let pkg = entry?;
* println!("{}: {}", pkg.pkgname(), pkg.comment()?);
* }
* # Ok::<(), std::io::Error>(())
* ```
*
* Extract files from a binary package:
*
* ```no_run
* use pkgsrc::archive::{Archive, ArchiveError};
*
* let mut archive = Archive::open("/path/to/package.tgz")?;
* for entry in archive.entries()? {
* let entry = entry?;
* println!("{}", entry.path()?.display());
* }
* # Ok::<(), ArchiveError>(())
* ```
*
* Parse a pkg_summary file to enumerate available packages:
*
* ```no_run
* use pkgsrc::summary::{SummaryError, Summary};
* use std::fs::File;
* use std::io::BufReader;
*
* let file = File::open("pkg_summary")?;
* let reader = BufReader::new(file);
* for entry in Summary::from_reader(reader) {
* let pkg = entry?;
* println!("{}: {}", pkg.pkgname(), pkg.comment());
* }
* # Ok::<(), SummaryError>(())
* ```
*
* Match packages using patterns:
*
* ```
* use pkgsrc::Pattern;
*
* let pattern = Pattern::new("perl>=5.30")?;
* assert!(pattern.matches("perl-5.38.0"));
* assert!(!pattern.matches("perl-5.28.0"));
* # Ok::<(), pkgsrc::PatternError>(())
* ```
*
* ## Feature Flags
*
* - `serde`: Enable serialization and deserialization support via
* [serde](https://serde.rs/) for various types.
*
* [`pkg_summary(5)`]: https://man.netbsd.org/pkg_summary.5
*/
extern crate self as pkgsrc;
pub use crate;
pub use crate;
pub use crate;
pub use crateDigest;
pub use crateDistinfo;
pub use crateKvError;
pub use crate;
pub use crate;
pub use crate;
pub use cratePkgName;
pub use crate;
pub use cratePlist;
pub use crate;
pub use crate;