forked from gentoo-utils/gentoo-utils
Compare commits
7 Commits
profiles
...
feature/ad
| Author | SHA1 | Date | |
|---|---|---|---|
| 932cf32a24 | |||
| 90f82f3ae3 | |||
|
|
b753519a3e | ||
|
|
abf784a784 | ||
|
|
13a6ab5d21 | ||
|
|
f06859c447 | ||
|
|
b0311ba813 |
35
.docker/Dockerfile
Normal file
35
.docker/Dockerfile
Normal file
@@ -0,0 +1,35 @@
|
||||
FROM gentoo/stage3:latest
|
||||
|
||||
USER root
|
||||
|
||||
# Fix permissions for distfiles directory
|
||||
RUN mkdir -p /var/cache/distfiles && \
|
||||
chmod 755 /var/cache/distfiles && \
|
||||
chown -R portage:portage /var/cache/distfiles
|
||||
|
||||
# enable bintoo
|
||||
RUN echo "BINPKG_FORMAT=\"gpkg\"" >> /etc/portage/make.conf
|
||||
RUN echo "EMERGE_DEFAULT_OPTS=\"\${EMERGE_DEFAULT_OPTS} --getbinpkg\"" >> /etc/portage/make.conf
|
||||
RUN echo "FEATURES=\"getbinpkg\"" >> /etc/portage/make.conf
|
||||
|
||||
RUN getuto
|
||||
|
||||
RUN emerge-webrsync && \
|
||||
emerge --sync
|
||||
|
||||
# get super latest meson
|
||||
RUN echo "=dev-build/meson-9999 **" >> /etc/portage/package.accept_keywords/package.accept
|
||||
RUN emerge --ask=n =dev-build/meson-9999
|
||||
RUN meson --version
|
||||
|
||||
# install nightly rust
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
|
||||
RUN source "$HOME/.cargo/env" && rustc --version && cargo --version
|
||||
|
||||
RUN emerge --ask=n dev-vcs/git
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /workspace
|
||||
|
||||
# Default command
|
||||
CMD ["/bin/bash"]
|
||||
41
.gitea/workflows/docker.yml
Normal file
41
.gitea/workflows/docker.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
# name: Build gentoo-utils docker image
|
||||
|
||||
# on:
|
||||
# push:
|
||||
# branches:
|
||||
# - master
|
||||
# paths:
|
||||
# - '.docker/Dockerfile'
|
||||
# pull_request:
|
||||
# paths:
|
||||
# - '.docker/Dockerfile'
|
||||
# workflow_dispatch:
|
||||
|
||||
# jobs:
|
||||
# build-docker:
|
||||
# runs-on: ubuntu-latest
|
||||
|
||||
# steps:
|
||||
# - name: Checkout repo
|
||||
# uses: actions/checkout@v4
|
||||
|
||||
# - name: Set up Docker buildx
|
||||
# uses: docker/setup-buildx-action@v3
|
||||
|
||||
# - name: Log in to Github Container Registry
|
||||
# uses: docker/login-action@v3
|
||||
# with:
|
||||
# registry: ${{ secrets.PIPELINE_REGISTRY_URL }}
|
||||
# username: ${{ github.actor }}
|
||||
# password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# - name: Extract metadata for Docker
|
||||
# id: meta
|
||||
# uses: docker/metadata-action@v5
|
||||
# with:
|
||||
# images: ghcr.op/${{ github.repository_owner }}/gentoo-utils-builder
|
||||
# tags: |
|
||||
# type=raw,value=latest
|
||||
# type=sha,prefix={{branch}}-
|
||||
|
||||
# -name: Build and push docker image
|
||||
8
check.sh
8
check.sh
@@ -5,16 +5,18 @@ source /lib/gentoo/functions.sh
|
||||
|
||||
export PATH="${HOME}/.local/bin:${PATH}" CC=clang CXX=clang++
|
||||
|
||||
ldd=$(command -v ldd)
|
||||
lld=$(command -v lld)
|
||||
|
||||
if [[ -n ${ldd} ]]; then
|
||||
export LDFLAGS=-fuse-ld=${ldd}
|
||||
export LDFLAGS=-fuse-ld=${lld}
|
||||
fi
|
||||
|
||||
if [[ ! -d build ]]; then
|
||||
meson setup -Dfuzz=enabled -Dtests=enabled build || exit $?
|
||||
meson setup -Dfuzz=enabled -Dtests=enabled -Dbuildtype=debugoptimized -Ddocs=enabled build || exit $?
|
||||
fi
|
||||
|
||||
meson compile -C build || exit $?
|
||||
|
||||
ebegin "running check commands"
|
||||
parallel --halt soon,fail=1 --keep-order -j$(nproc) < check_commands.txt
|
||||
eend $? || exit $?
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/usr/bin/meson format --recursive --check-only
|
||||
rustfmt --edition 2024 --check $(find src -type f -name '*.rs')
|
||||
ninja rustdoc -C build
|
||||
ninja clippy -C build
|
||||
meson test unittests '*repo*' '*porthole*' -C build
|
||||
meson test unittests doctests '*repo*' '*porthole*' -C build
|
||||
|
||||
10
meson.build
10
meson.build
@@ -28,3 +28,13 @@ endif
|
||||
if get_option('fuzz').enabled()
|
||||
subdir('fuzz')
|
||||
endif
|
||||
|
||||
if get_option('docs').enabled()
|
||||
rust.doctest(
|
||||
'doctests',
|
||||
gentoo_utils,
|
||||
dependencies: [mon, get, itertools],
|
||||
link_with: [thiserror],
|
||||
args: ['--nocapture'],
|
||||
)
|
||||
endif
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
option('fuzz', type: 'feature', value: 'disabled')
|
||||
option('tests', type: 'feature', value: 'disabled')
|
||||
option('tests', type: 'feature', value: 'disabled')
|
||||
option('docs', type: 'feature', value: 'disabled')
|
||||
73
src/lib.rs
73
src/lib.rs
@@ -1,3 +1,17 @@
|
||||
//! Gentoo and PMS related utils.
|
||||
//!
|
||||
//! Currently implements:
|
||||
//! - parsers for atoms and DEPEND expressions
|
||||
//! - strongly typed representations of atoms, versions, etc
|
||||
//! - version comparison and equality impls
|
||||
//! - iterator over repos categories and ebuilds
|
||||
//!
|
||||
//! Planned features
|
||||
//! - profile evaluation
|
||||
//! - vdb reader
|
||||
//! - sourcing ebuilds with bash
|
||||
//!
|
||||
|
||||
#![deny(clippy::pedantic, unused_imports)]
|
||||
#![allow(
|
||||
dead_code,
|
||||
@@ -7,14 +21,71 @@
|
||||
)]
|
||||
#![feature(impl_trait_in_assoc_type)]
|
||||
|
||||
use mon::{Parser, input::Input};
|
||||
use mon::{
|
||||
Parser,
|
||||
input::{Input, InputIter},
|
||||
};
|
||||
|
||||
pub trait Parseable<'a, I: Input + 'a> {
|
||||
type Parser: Parser<I, Output = Self>;
|
||||
|
||||
fn parser() -> Self::Parser;
|
||||
|
||||
fn parse(input: I) -> Result<Self, I>
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
Self::parser()
|
||||
.parse_finished(InputIter::new(input))
|
||||
.map_err(|e| e.rest())
|
||||
}
|
||||
}
|
||||
|
||||
/// Strongly typed atom and cpv representations.
|
||||
///
|
||||
/// Create atoms from parsers:
|
||||
/// ```
|
||||
/// use gentoo_utils::{Parseable, atom::Atom};
|
||||
///
|
||||
/// let emacs = Atom::parse("=app-editors/emacs-31.0-r1")
|
||||
/// .expect("failed to parse atom");
|
||||
///
|
||||
/// assert_eq!(emacs.to_string(), "=app-editors/emacs-31.0-r1");
|
||||
/// ````
|
||||
///
|
||||
/// Compare versions:
|
||||
/// ```
|
||||
/// use gentoo_utils::{Parseable, atom::Cpv};
|
||||
///
|
||||
/// let a = Cpv::parse("foo/bar-1.0").unwrap();
|
||||
/// let b = Cpv::parse("foo/bar-2.0").unwrap();
|
||||
///
|
||||
/// assert!(a < b);
|
||||
/// ```
|
||||
pub mod atom;
|
||||
|
||||
/// Access to repos and ebuilds.
|
||||
///
|
||||
/// ```
|
||||
/// use gentoo_utils::repo::Repo;
|
||||
///
|
||||
/// let repo = Repo::new("/var/db/repos/gentoo");
|
||||
///
|
||||
/// for result in repo.categories().expect("failed to read categories") {
|
||||
/// let category = result.expect("failed to read category");
|
||||
///
|
||||
/// for result in category.ebuilds().expect("failed to read ebuilds") {
|
||||
/// let ebuild = result.expect("failed to read ebuild");
|
||||
///
|
||||
/// println!(
|
||||
/// "{}-{}: {}",
|
||||
/// ebuild.name(),
|
||||
/// ebuild.version(),
|
||||
/// ebuild.description().clone().unwrap_or("no description available".to_string())
|
||||
/// );
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// ```
|
||||
pub mod repo;
|
||||
pub mod useflag;
|
||||
|
||||
Reference in New Issue
Block a user