Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,295 changes: 674 additions & 621 deletions Cargo.lock

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "paru"
version = "2.1.0"
authors = ["morganamilo <morganamilo@archlinux.org>"]
edition = "2021"
edition = "2024"

description = "Feature packed AUR helper"
homepage = "https://github.com/Morganamilo/paru"
Expand All @@ -11,18 +11,18 @@ documentation = "https://docs.rs/paru"
license = "GPL-3.0"
keywords = ["archlinux", "arch", "alpm", "pacman", "aur"]
include = ["src/**/*", "LICENSE", "README.md", "CHANGELOG.md", "help"]
rust-version = "1.80"
rust-version = "1.87"


[dependencies]
alpm = "4.0.3"
alpm-utils = "4.0.1"
aur-depends = "4.0.5"
alpm = "5.0.0"
alpm-utils = "5.0.0"
aur-depends = "4.0.6"
aur-fetch = "0.11.3"
cini = "1.0.0"
pacmanconf = "3.0.0"
raur = "7.0.0"
srcinfo = "1.3.1"
raur = "7.0.1"
srcinfo = "2.0.0"


ansiterm = "0.12.2"
Expand All @@ -33,9 +33,9 @@ futures = "0.3.31"
globset = "0.4.16"
htmlescape = "0.3.1"
indicatif = "0.18.0"
scraper = "0.23.1"
scraper = "0.25.0"
nix = { version = "0.30.1", features = ["fs", "user"] }
reqwest = { version = "0.11.0", features = ["gzip", "socks"] }
reqwest = { version = "0.12.25", features = ["gzip", "socks"] }
rss = { version = "2.0.12", default-features = false }
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
Expand All @@ -55,8 +55,8 @@ tr = "0.1.10"
unicode-width = "0.2.1"
regex = "1.11.1"
signal-hook = "0.3.18"
bitflags = "2.9.1"
toml = { version = "0.8.23", features = ["preserve_order"] }
bitflags = "2.10.0"
toml = { version = "0.9.8", features = ["preserve_order"] }

[profile.release]
codegen-units = 1
Expand All @@ -75,4 +75,5 @@ mock_chroot = ["mock"]
#alpm = { path = "../alpm.rs/alpm" }
#alpm-utils = { path = "../alpm.rs/alpm-utils" }
#aur-depends = { path = "../aur-depends" }
#raur = { path = "../raur" }
#aur-fetch = { path = "../aur-fetch" }
4 changes: 2 additions & 2 deletions src/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::print_error;
use crate::printtr;
use crate::util::ask;

use std::fs::{read_dir, remove_dir_all, remove_file, set_permissions, DirEntry};
use std::fs::{DirEntry, read_dir, remove_dir_all, remove_file, set_permissions};

use std::os::unix::fs::PermissionsExt;
use std::path::Path;
Expand Down Expand Up @@ -135,7 +135,7 @@ fn clean_aur_pkg(
return do_remove(config, &file.path(), rm);
}

let srcinfo = Srcinfo::parse_file(file.path().join(".SRCINFO")).with_context(|| {
let srcinfo = Srcinfo::from_path(file.path().join(".SRCINFO")).with_context(|| {
let file_name = file.file_name();
tr!(
"could not parse .SRCINFO for '{}'",
Expand Down
2 changes: 1 addition & 1 deletion src/command_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::config::{

use std::fmt;

use anyhow::{anyhow, bail, Context, Result};
use anyhow::{Context, Result, anyhow, bail};
use globset::Glob;
use tr::tr;
use url::Url;
Expand Down
8 changes: 4 additions & 4 deletions src/completion.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::config::Config;
use crate::print_error;

use std::fs::{create_dir_all, metadata, OpenOptions};
use std::io::{stdout, BufRead, BufReader, Write};
use std::fs::{OpenOptions, create_dir_all, metadata};
use std::io::{BufRead, BufReader, Write, stdout};
use std::path::Path;
use std::time::{Duration, SystemTime};

use anyhow::{ensure, Context, Result};
use anyhow::{Context, Result, ensure};
use reqwest::get;
use tr::tr;
use url::Url;
Expand Down Expand Up @@ -93,7 +93,7 @@ fn repo_list<W: Write>(config: &Config, w: &mut W) {
fn pkgbuild_list<W: Write>(config: &Config, w: &mut W) {
for db in &config.pkgbuild_repos.repos {
for base in db.pkgs(config) {
for pkg in base.srcinfo.names() {
for pkg in base.srcinfo.pkgnames() {
let _ = w.write_all(pkg.as_bytes());
let _ = w.write_all(b" ");
let _ = w.write_all(db.name.as_bytes());
Expand Down
12 changes: 7 additions & 5 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use crate::{alpm_debug_enabled, help, printtr, repo};
use std::env::consts::ARCH;
use std::env::{remove_var, set_var, var};
use std::fmt;
use std::fs::{remove_file, OpenOptions};
use std::io::{stderr, stdin, stdout, BufRead, IsTerminal};
use std::fs::{OpenOptions, remove_file};
use std::io::{BufRead, IsTerminal, stderr, stdin, stdout};
use std::path::{Path, PathBuf};
use std::str::FromStr;

Expand All @@ -20,7 +20,7 @@ use alpm::{
};
use ansiterm::Color::{Blue, Cyan, Green, Purple, Red, Yellow};
use ansiterm::Style;
use anyhow::{anyhow, bail, ensure, Context, Error, Result};
use anyhow::{Context, Error, Result, anyhow, bail, ensure};

use bitflags::bitflags;
use cini::{Callback, CallbackKind, Ini};
Expand Down Expand Up @@ -836,7 +836,8 @@ then initialise it with:
}

if self.chroot {
remove_var("PKGEXT");
// SAFETY: paru is single-threaded at this point
unsafe { remove_var("PKGEXT") };
}

Ok(())
Expand Down Expand Up @@ -995,7 +996,8 @@ then initialise it with:
);

self.env.push((key.to_owned(), value.to_string()));
set_var(key, value);
// SAFETY: paru is single-threaded at this point
unsafe { set_var(key, value) };
Ok(())
}

Expand Down
22 changes: 11 additions & 11 deletions src/devel.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
use crate::config::{Config, LocalRepos};
use crate::download::{self, cache_info_with_warnings, Bases};
use crate::download::{self, Bases, cache_info_with_warnings};
use crate::print_error;
use crate::repo;
use crate::util::{pkg_base_or_name, split_repo_aur_pkgs};

use std::cmp::Ordering;
use std::collections::hash_map::Entry;
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
use std::fs::{create_dir_all, read_to_string, OpenOptions};
use std::fs::{OpenOptions, create_dir_all, read_to_string};
use std::hash::{Hash, Hasher};
use std::io::Write;
use std::iter::FromIterator;
use std::time::Duration;

use alpm_utils::{DbListExt, Target};
use ansiterm::Style;
use anyhow::{anyhow, bail, Context, Result};
use anyhow::{Context, Result, anyhow, bail};
use aur_depends::Base;
use futures::future::{join_all, select_ok, FutureExt};
use futures::future::{FutureExt, join_all, select_ok};
use log::debug;
use raur::{Cache, Raur};
use serde::{Deserialize, Serialize, Serializer};
Expand Down Expand Up @@ -153,7 +153,7 @@ pub async fn gendb(config: &mut Config) -> Result<()> {
for base in &bases.bases {
let path = config.build_dir.join(base.package_base()).join(".SRCINFO");
if path.exists() {
let srcinfo = Srcinfo::parse_file(path)
let srcinfo = Srcinfo::from_path(path)
.with_context(|| tr!("failed to parse srcinfo for '{}'", base));

match srcinfo {
Expand All @@ -177,7 +177,7 @@ pub async fn gendb(config: &mut Config) -> Result<()> {
let path = config.build_dir.join(base.package_base()).join(".SRCINFO");
if path.exists() {
if let Entry::Vacant(vacant) = srcinfos.entry(base.package_base().to_string()) {
let srcinfo = Srcinfo::parse_file(path)
let srcinfo = Srcinfo::from_path(path)
.with_context(|| tr!("failed to parse srcinfo for '{}'", base));

match srcinfo {
Expand Down Expand Up @@ -447,10 +447,10 @@ pub async fn filter_devel_updates(
Ok(updates)
}

pub async fn pkg_has_update<'pkg, 'info, 'cfg>(
config: &'cfg Config,
pub async fn pkg_has_update<'pkg>(
config: &Config,
pkg: &'pkg str,
info: &'info HashSet<RepoInfo>,
info: &HashSet<RepoInfo>,
) -> Option<&'pkg str> {
if info.is_empty() {
return None;
Expand Down Expand Up @@ -511,7 +511,7 @@ pub async fn fetch_devel_info(
None => continue,
};

for url in srcinfo.base.source.iter().flat_map(|v| &v.vec) {
for url in srcinfo.base.source.iter().flat_map(|v| v.values()) {
if let Some((remote, _, branch)) = parse_url(url) {
let future = ls_remote(
config.color.error,
Expand Down Expand Up @@ -558,7 +558,7 @@ pub fn load_devel_info(config: &Config) -> Result<Option<DevelInfo>> {
Ok(file) => file,
_ => return Ok(None),
};
let devel_info = DevelInfo::deserialize(toml::Deserializer::new(&file))
let devel_info: DevelInfo = toml::from_str(&file)
.with_context(|| tr!("invalid toml: {}", config.devel_path.display()))?;

let mut pkgbases: HashMap<&str, Vec<&alpm::Package>> = HashMap::new();
Expand Down
6 changes: 3 additions & 3 deletions src/download.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::RaurHandle;
use crate::config::{Colors, Config, SortMode, YesNoAll};
use crate::fmt::print_indent;
use crate::printtr;
use crate::util::is_arch_repo;
use crate::RaurHandle;

use std::collections::btree_map::Entry;
use std::collections::{BTreeMap, HashMap};
Expand All @@ -16,7 +16,7 @@ use std::result::Result as StdResult;
use alpm::Version;
use alpm_utils::{AsTarg, DbListExt, Targ};
use ansiterm::Style;
use anyhow::{bail, ensure, Context, Result};
use anyhow::{Context, Result, bail, ensure};
use aur_depends::AurBase;

use globset::GlobSet;
Expand Down Expand Up @@ -560,7 +560,7 @@ fn split_target_pkgbuilds<'a, T: AsTarg>(
}
}

if config.mode.repo() && targ.repo.map_or(false, |repo| is_arch_repo(repo)) {
if config.mode.repo() && targ.repo.is_some_and(is_arch_repo) {
local.push(targ);
continue;
}
Expand Down
10 changes: 3 additions & 7 deletions src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use std::ffi::OsStr;
use std::fmt::{Debug, Display, Formatter};
use std::path::Path;
use std::process::{Command, Output, Stdio};
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use std::thread;
use std::time::Duration;

use anyhow::{bail, Context, Result};
use anyhow::{Context, Result, bail};
use log::debug;
use signal_hook::consts::signal::*;
use signal_hook::flag as signal_flag;
Expand Down Expand Up @@ -56,11 +56,7 @@ impl Status {
}

pub fn success(self) -> Result<i32, Status> {
if self.0 == 0 {
Ok(0)
} else {
Err(self)
}
if self.0 == 0 { Ok(0) } else { Err(self) }
}
}

Expand Down
6 changes: 2 additions & 4 deletions src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,11 @@ fn repo<'a>(config: &'a Config, pkg: &str) -> &'a str {
return "aur";
}

let db = dbs
dbs
.iter()
.find(|db| db.pkg(pkg).is_ok())
.map(|db| db.name())
.unwrap_or_else(|| dbs.first().unwrap().name());

db
.unwrap_or_else(|| dbs.first().unwrap().name())
}

fn old_ver<'a>(config: &'a Config, pkg: &str) -> Option<&'a Ver> {
Expand Down
8 changes: 4 additions & 4 deletions src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ fn longest(config: &Config) -> usize {

fn arch_len(vec: &[ArchVec]) -> usize {
vec.iter()
.filter_map(|v| v.arch.as_ref())
.filter_map(|v| v.arch())
.map(|a| a.len() + 1)
.max()
.unwrap_or(0)
Expand All @@ -157,9 +157,9 @@ pub fn print_pkgbuild_info(
if v.is_empty() {
print_list(k, &[]);
}
v.iter().for_each(|v| match &v.arch {
Some(arch) => print_list(format!("{} {}", k, arch).as_str(), &v.vec),
None => print_list(k, &v.vec),
v.iter().for_each(|v| match v.arch() {
Some(arch) => print_list(format!("{} {}", k, arch).as_str(), v.values()),
None => print_list(k, v.values()),
})
};
for targ in pkgs {
Expand Down
Loading