1 unstable release
new 0.1.0 | Feb 28, 2025 |
---|
#445 in Unix APIs
69KB
1.5K
SLoC
alpm-buildinfo
A library and commandline toolkit for the specification, writing and parsing of Arch Linux Package Management (ALPM) BUILDINFO
files.
BUILDINFO
files describe the build environment of a package and carry various datasets, that help in reproducing the same package bit-by-bit.
Documentation
- https://alpm.archlinux.page/rustdoc/alpm_buildinfo/ for development version of the crate
- https://docs.rs/alpm-buildinfo/latest/alpm_buildinfo/ for released versions of the crate
Examples
Library
use std::str::FromStr;
use alpm_buildinfo::BuildInfoV2;
let buildinfo_data = r#"format = 2
pkgname = foo
pkgbase = foo
pkgver = 1:1.0.0-1
pkgarch = any
pkgbuild_sha256sum = b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c
packager = Foobar McFooface <foobar@mcfooface.org>
builddate = 1
builddir = /build
buildenv = envfoo
buildenv = envbar
options = some_option
options = !other_option
installed = bar-1.2.3-1-any
installed = beh-2.2.3-4-any
startdir = /startdir/
buildtool = devtools
buildtoolver = 1:1.2.1-1-any
"#;
assert!(BuildInfoV2::from_str(buildinfo_data).is_ok());
Commandline
Create a BUILDINFO version 1 file using alpm-buildinfo
:
alpm-buildinfo create v2 \
--builddate 1 \
--builddir /build \
--buildenv env \
--buildenv '!otherenv' \
--installed 'bar-1:1.0.1-15-any' \
--installed 'beh-2.3-1-any' \
--options something \
--options '!else' \
--packager 'Foobar McFooface <foobar@mcfooface.org>' \
--pkgarch any \
--pkgbase foo \
--pkgbuild-sha256sum b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c \
--pkgname foo \
--pkgver 1.0.0-1 \
--startdir /startdir/ \
--buildtool devtools \
--buildtoolver '1:1.2.1-1-any'
All options for alpm-buildinfo
can also be provided as environment variables. The following is equivalent to the above:
BUILDINFO_BUILDDATE="1" \
BUILDINFO_BUILDDIR="/build" \
BUILDINFO_BUILDENV='env !otherenv' \
BUILDINFO_INSTALLED="bar-1:1.0.1-15-any beh-2.3-1-any" \
BUILDINFO_OPTIONS='something !else' \
BUILDINFO_PACKAGER="Foobar McFooface <foobar@mcfooface.org>" \
BUILDINFO_PKGARCH="any" \
BUILDINFO_PKGBASE="foo" \
BUILDINFO_PKGBUILD_SHA256SUM="b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c" \
BUILDINFO_PKGNAME="foo" \
BUILDINFO_PKGVER="1.0.0-1" \
BUILDINFO_STARTDIR="/startdir/" \
BUILDINFO_BUILDTOOL="devtools" \
BUILDINFO_BUILDTOOLVER="1:1.2.1-1-any" \
alpm-buildinfo create v2
Features
cli
adds the commandline handling needed for thealmp-buildinfo
binary (enabled by default).winnow-debug
enables thewinnow/debug
feature, which shows the exact parsing process of winnow.
Contributing
Please refer to the contribution guidelines to learn how to contribute to this project.
License
This project can be used under the terms of the Apache-2.0 or MIT. Contributions to this project, unless noted otherwise, are automatically licensed under the terms of both of those licenses.
Dependencies
~9–20MB
~292K SLoC