refact: virtual manifest

restructure project into a virtual manifest

See #72, implemented by @ripytide
This commit is contained in:
steven-omaha
2024-04-14 18:32:42 +02:00
committed by GitHub
51 changed files with 44 additions and 81 deletions
Generated
-8
View File
@@ -390,14 +390,6 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]] [[package]]
name = "pacdef" name = "pacdef"
version = "1.6.0" version = "1.6.0"
dependencies = [
"anyhow",
"pacdef_core",
]
[[package]]
name = "pacdef_core"
version = "1.6.0"
dependencies = [ dependencies = [
"alpm", "alpm",
"anyhow", "anyhow",
+7 -21
View File
@@ -1,8 +1,9 @@
[package] [workspace]
name = "pacdef" members = ["crates/*"]
version = "1.6.0" resolver = "2"
[workspace.package]
edition = "2021" edition = "2021"
description = "multi-backend declarative package manager for Linux"
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
repository = "https://github.com/steven-omaha/pacdef" repository = "https://github.com/steven-omaha/pacdef"
readme = "README.md" readme = "README.md"
@@ -10,26 +11,11 @@ keywords = ["package-manager", "linux", "declarative", "cli"]
categories = ["command-line-utilities"] categories = ["command-line-utilities"]
rust-version = "1.74" rust-version = "1.74"
[workspace]
members = ["crates/pacdef_macros", "crates/pacdef_core"]
[workspace.dependencies] [workspace.dependencies]
anyhow = "1.0" pacdef_macros = { path = "crates/pacdef_macros", version = "1.0" }
pacdef = { path = "crates/pacdef", version = "1.6" }
[dependencies]
anyhow = {workspace = true}
pacdef_core = {path = "crates/pacdef_core", version = "=1.6.0" }
[[bin]]
name = "pacdef"
path = "crates/main/main.rs"
[profile.release] [profile.release]
lto = "off" lto = "off"
opt-level = "z" opt-level = "z"
strip = true strip = true
[features]
default = []
debian = ["pacdef_core/debian"]
arch = ["pacdef_core/arch"]
+1 -2
View File
@@ -6,8 +6,7 @@ Release Checklist
* Run `cargo outdated` and review semver incompatible updates. * Run `cargo outdated` and review semver incompatible updates.
Unless there is a strong motivation otherwise, review and update every dependency. Unless there is a strong motivation otherwise, review and update every dependency.
* Update the date and version in all man pages: "chore(release): bump man pages". * Update the date and version in all man pages: "chore(release): bump man pages".
* Run `cargo release -p pacdef_core -p pacdef <level>`. * Run `cargo release -p pacdef <version>`.
`pacdef_core` and `pacdef` shall have the same version at all times.
Verify everything works as expected. Verify everything works as expected.
* Rerun `cargo publish` with `--execute.` * Rerun `cargo publish` with `--execute.`
* Generate GitHub release with `git cliff` * Generate GitHub release with `git cliff`
+1 -1
View File
@@ -42,7 +42,7 @@ command = [
"--color", "--color",
"always", "always",
"--package", "--package",
"pacdef_core", "pacdef",
"--", "--",
"--color", "--color",
"always", # see https://github.com/Canop/bacon/issues/124 "always", # see https://github.com/Canop/bacon/issues/124
@@ -1,16 +1,17 @@
[package] [package]
name = "pacdef_core" name = "pacdef"
description = "multi-backend declarative package manager for Linux"
version = "1.6.0" version = "1.6.0"
edition = "2021"
description = "pacdef core library" edition.workspace = true
license = "GPL-3.0-or-later" license.workspace = true
repository = "https://github.com/steven-omaha/pacdef/tree/main/crates/pacdef_core" repository.workspace = true
readme = "README.md" readme.workspace = true
keywords = ["package-manager", "linux", "declarative", "cli"] keywords.workspace = true
categories = ["command-line-utilities"] categories.workspace = true
[dependencies] [dependencies]
anyhow = { workspace = true } anyhow = "1.0"
clap = "4.5" clap = "4.5"
const_format = { version = "0.2", default-features = false } const_format = { version = "0.2", default-features = false }
path-absolutize = "3.1" path-absolutize = "3.1"
@@ -24,7 +25,7 @@ serde_derive = "1.0"
serde_json = "1.0" serde_json = "1.0"
serde_yaml = "0.9" serde_yaml = "0.9"
pacdef_macros = { path = "../pacdef_macros", version = "1.0" } pacdef_macros.workspace = true
# backends # backends
alpm = { version = "3.0", optional = true } alpm = { version = "3.0", optional = true }
@@ -45,7 +45,7 @@ impl Backend for Rust {
let json: Value = let json: Value =
serde_json::from_str(&content).context("parsing JSON from crates file")?; serde_json::from_str(&content).context("parsing JSON from crates file")?;
extract_packages(&json).context("extracing packages from crates file") extract_packages(&json).context("extracting packages from crates file")
} }
fn get_explicitly_installed_packages(&self) -> Result<HashSet<Package>> { fn get_explicitly_installed_packages(&self) -> Result<HashSet<Package>> {
@@ -114,7 +114,7 @@ pub trait Backend: Debug {
/// ///
/// # Panics /// # Panics
/// ///
/// This method shall panic when the backend does not support depedent packages. /// This method shall panic when the backend does not support dependent packages.
fn make_dependency(&self, packages: &[Package]) -> Result<()> { fn make_dependency(&self, packages: &[Package]) -> Result<()> {
let mut cmd = Command::new(self.get_binary()); let mut cmd = Command::new(self.get_binary());
cmd.args(self.get_switches_make_dependency()); cmd.args(self.get_switches_make_dependency());
@@ -57,7 +57,7 @@ impl Config {
if e.kind() == ErrorKind::NotFound { if e.kind() == ErrorKind::NotFound {
bail!(crate::Error::ConfigFileNotFound) bail!(crate::Error::ConfigFileNotFound)
} }
bail!("unexpected error occured: {e:?}"); bail!("unexpected error occurred: {e:?}");
} }
}; };
@@ -548,7 +548,7 @@ where
Err(e) => { Err(e) => {
// CrossesDevices is nightly. See rust #86442. // CrossesDevices is nightly. See rust #86442.
// We cannot check that here, so we just assume that // We cannot check that here, so we just assume that
// that would be the error if permisisons are okay. // that would be the error if permissions are okay.
if e.kind() == std::io::ErrorKind::PermissionDenied { if e.kind() == std::io::ErrorKind::PermissionDenied {
bail!(e); bail!(e);
} }
@@ -583,7 +583,7 @@ fn find_groups_by_name<'a>(names: &[String], groups: &'a HashSet<Group>) -> Resu
Ok(result) Ok(result)
} }
/// Show the error chain for an error that has occured when a backend was queried /// Show the error chain for an error that has occurred when a backend was queried
/// if the `RUST_BACKTRACE` env variable is set to `1` or `full`. /// if the `RUST_BACKTRACE` env variable is set to `1` or `full`.
#[allow(clippy::option_if_let_else)] #[allow(clippy::option_if_let_else)]
fn show_backend_query_error(error: &anyhow::Error, backend: &dyn Backend) { fn show_backend_query_error(error: &anyhow::Error, backend: &dyn Backend) {
@@ -1,7 +1,7 @@
use std::fmt::{Display, Write}; use std::fmt::{Display, Write};
use std::hash::Hash; use std::hash::Hash;
/// A struct to represent a single package, consiting of a `name`, and /// A struct to represent a single package, consisting of a `name`, and
/// optionally a `repo`. /// optionally a `repo`.
#[derive(Debug, Eq, PartialOrd, Ord, Clone)] #[derive(Debug, Eq, PartialOrd, Ord, Clone)]
pub struct Package { pub struct Package {
@@ -1,5 +1,5 @@
/*! /*!
Main program for `pacdef`. All internal logic happens in [`pacdef_core`]. Main program for `pacdef`.
*/ */
#![warn( #![warn(
@@ -21,8 +21,8 @@ use std::process::{ExitCode, Termination};
use anyhow::{bail, Context, Result}; use anyhow::{bail, Context, Result};
use pacdef_core::path::{get_config_path, get_config_path_old_version, get_group_dir}; use pacdef::path::{get_config_path, get_config_path_old_version, get_group_dir};
use pacdef_core::{get_args, Config, Error as PacdefError, Group, Pacdef}; use pacdef::{get_args, Config, Error as PacdefError, Group, Pacdef};
const MAJOR_UPDATE_MESSAGE: &str = "VERSION UPGRADE const MAJOR_UPDATE_MESSAGE: &str = "VERSION UPGRADE
You seem to have used version 0.x of pacdef before. You seem to have used version 0.x of pacdef before.
@@ -53,8 +53,8 @@ pub fn review(
println!(); println!();
let mut iter = strategies.iter().peekable(); let mut iter = strategies.iter().peekable();
while let Some(strat) = iter.next() { while let Some(strategy) = iter.next() {
strat.show(); strategy.show();
if iter.peek().is_some() { if iter.peek().is_some() {
println!(); println!();
@@ -66,8 +66,8 @@ pub fn review(
return Ok(()); return Ok(());
} }
for strat in strategies { for strategy in strategies {
strat.execute()?; strategy.execute()?;
} }
Ok(()) Ok(())
-8
View File
@@ -1,8 +0,0 @@
# pacdef_core
core library for pacdef
## supported rust version
latest stable
+8 -7
View File
@@ -1,13 +1,14 @@
[package] [package]
name = "pacdef_macros" name = "pacdef_macros"
version = "1.0.1"
edition = "2021"
license = "GPL-3.0-or-later"
readme = "README.md"
repository = "https://github.com/steven-omaha/pacdef/tree/main/crates/pacdef_macros"
description = "procedural macros for pacdef" description = "procedural macros for pacdef"
keywords = ["macro", "proc-macro"] version = "1.0.1"
categories = ["command-line-utilities"]
edition.workspace = true
license.workspace = true
repository.workspace = true
readme.workspace = true
keywords.workspace = true
categories.workspace = true
[dependencies] [dependencies]
proc-macro2 = "1.0" proc-macro2 = "1.0"
-8
View File
@@ -1,8 +0,0 @@
# pacdef_macros
procedural macros for pacdef
## supported rust version
latest stable
+1 -1
View File
@@ -27,7 +27,7 @@ mod register;
use proc_macro::TokenStream; use proc_macro::TokenStream;
/// Derive (1) an iterator over the variants, (2) imports for the individual backends, and (3) /// Derive (1) an iterator over the variants, (2) imports for the individual backends, and (3)
/// instatiation code for each backend. /// instantiationn code for each backend.
#[proc_macro_derive(Register)] #[proc_macro_derive(Register)]
pub fn register(input: TokenStream) -> TokenStream { pub fn register(input: TokenStream) -> TokenStream {
register::register(input) register::register(input)
+1 -1
View File
@@ -92,7 +92,7 @@ $EDITOR or $VISUAL.
<r|remove> <group> [...] <r|remove> <group> [...]
.RS 4 .RS 4
remove group file. remove group file.
\fBWARNING\fR: If the group file is not a symlink, you wil loose the file! \fBWARNING\fR: If the group file is not a symlink, you will loose the file!
. .
.RE .RE
.sp .sp
+1 -1
View File
@@ -46,7 +46,7 @@ Warn if any group file is not a symlink and is not a child of a symlinked dir in
.TP .TP
.B flatpak_systemwide: true .B flatpak_systemwide: true
Whether flatpak packages shold be installed system-wide or per user. Whether flatpak packages should be installed system-wide or per user.
.SH SEE ALSO .SH SEE ALSO
.BR pacdef(8) .BR pacdef(8)