Skip to content

Update deps #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ license = "LGPL-3.0-or-later"
authors = ["liushuyu <[email protected]>"]
description = "A database-backed APT archive manager"
repository = "https://github.com/AOSC-Dev/p-vector-rs"
edition = "2021"
edition = "2024"
resolver = "2"

[dependencies]
Expand Down Expand Up @@ -46,7 +46,7 @@ tokio = { version = "^1", features = ["rt", "rt-multi-thread", "time", "macros",
sqlx = { version = "0.8", features = ["runtime-tokio-native-tls", "macros", "postgres", "chrono", "migrate", "json"] }
futures = "0.3"
async-compression = { version = "0.4", features = ["tokio", "gzip", "xz", "zstd"] }
redis = "0.29"
redis = "0.30"
zstd = "0.13"

[target.'cfg(unix)'.dependencies]
Expand Down
8 changes: 6 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,14 @@ pub fn convert_branch_description_config(config: &Config) -> ReleaseConfig {

pub fn lint_config(config: &Config) {
if config.config.discover && !config.branch.is_empty() {
warn!("Specifying any branch when auto-discover is enabled will only get their descriptions read.");
warn!(
"Specifying any branch when auto-discover is enabled will only get their descriptions read."
);
}
if config.config.abbs_sync {
warn!("ABBS sync is deprecated and will be removed in a future version. Please remove the option.");
warn!(
"ABBS sync is deprecated and will be removed in a future version. Please remove the option."
);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::io::Write;
use std::path::Path;
use std::time::{SystemTime, UNIX_EPOCH};

use anyhow::{anyhow, Error, Result};
use anyhow::{Error, Result, anyhow};
use async_compression::tokio::write::{GzipEncoder, XzEncoder, ZstdEncoder};
use log::{error, info, warn};
use nom::bytes::complete::{tag, take_until};
Expand All @@ -16,7 +16,7 @@ use sailfish::TemplateSimple;
use serde_json::Value;
use sqlx::PgPool;
use time::{format_description::well_known::Rfc2822, macros::offset};
use tokio::fs::{create_dir_all, metadata, File};
use tokio::fs::{File, create_dir_all, metadata};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::task::spawn_blocking;

Expand Down Expand Up @@ -173,7 +173,7 @@ fn create_release_file(
return Ok(());
}
let rendered = rendered.unwrap();
if let Some(ref cert) = cert {
if let Some(cert) = cert {
// TODO: don't fail when signing failed
let signed = if !cert.1 {
// if the key is not offloaded
Expand All @@ -198,7 +198,7 @@ fn create_release_files(
meta: &[BranchMeta],
ttl: u64,
) -> Result<()> {
if let Some(ref extra_dist_files) = &config.extra_dist_files {
if let Some(extra_dist_files) = &config.extra_dist_files {
info!(
"Copying extra distribution files from {} to dist root ...",
extra_dist_files
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ async fn reset_action(pool: &PgPool) -> Result<()> {
}

fn ask_for_key_info() -> Result<String> {
use dialoguer::theme::ColorfulTheme;
use dialoguer::Input;
use dialoguer::theme::ColorfulTheme;

let name: String = Input::with_theme(&ColorfulTheme::default())
.with_prompt("Your name")
Expand All @@ -203,7 +203,7 @@ fn ask_for_key_info() -> Result<String> {
async fn generate_key(config: &str) -> Result<()> {
use secrecy::ExposeSecret;
use time::OffsetDateTime;
use tokio::fs::{create_dir_all, File};
use tokio::fs::{File, create_dir_all};
use tokio::io::AsyncWriteExt;

let userid = spawn_blocking(ask_for_key_info).await??;
Expand Down
3 changes: 2 additions & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::collections::HashMap;

use nom::{
IResult, Parser,
bytes::complete::{tag, take_until},
character::complete::{char, space0},
combinator::{map, verify},
multi::many1,
sequence::{separated_pair, terminated},
IResult, Parser,
};

#[inline]
Expand Down Expand Up @@ -42,6 +42,7 @@ fn single_package(input: &[u8]) -> IResult<&[u8], Vec<(&[u8], &[u8])>> {
}

#[inline]
#[allow(clippy::type_complexity)]
pub fn single_package_map(input: &[u8]) -> IResult<&[u8], HashMap<&[u8], &[u8]>> {
let mut map = HashMap::new();
let (ret, res) = single_package(input)?;
Expand Down
18 changes: 9 additions & 9 deletions src/scan/dbscan.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Advanced database-based scanning.

use anyhow::{anyhow, Result};
use anyhow::{Result, anyhow};
use crossbeam_queue::SegQueue;
use log::{error, info, warn};
use rayon::prelude::*;
Expand All @@ -15,9 +15,9 @@ use std::{fs::Metadata, path::Component};

use crate::db;
use crate::ipc::PVMessage;
use crate::scan::{determine_format, open_compressed_control, ArArchive, TarArchive};
use crate::scan::{ArArchive, TarArchive, determine_format, open_compressed_control};

use super::{mtime, read_compressed, HashedReader, TarFormat};
use super::{HashedReader, TarFormat, mtime, read_compressed};

macro_rules! must_have {
($map:ident, $name:expr) => {{
Expand Down Expand Up @@ -147,6 +147,7 @@ pub fn collect_removed_packages(removed: SegQueue<PathBuf>, mirror_root: &Path)
}

/// Validate if the records in the database are up to date with the packages
#[allow(clippy::type_complexity)]
pub fn validate_packages<P: AsRef<Path>>(
root: P,
packages: &[db::PVPackage],
Expand Down Expand Up @@ -405,10 +406,9 @@ DELETE FROM pv_package_duplicate WHERE package=$1 AND version=$2 AND repo=$3"#,
// update dependencies information
for dep in PKG_RELATION {
if let Some(d) = meta.extra.get(dep.as_bytes()) {
let value =
std::str::from_utf8(d)
.ok()
.and_then(|x| if x.is_empty() { None } else { Some(x) });
let value = std::str::from_utf8(d)
.ok()
.and_then(|x| if x.is_empty() { None } else { Some(x) });
if let Some(value) = value {
sqlx::query!(
"INSERT INTO pv_package_dependencies VALUES($1, $2, $3, $4, $5) ON CONFLICT ON CONSTRAINT pv_package_dependencies_pkey DO UPDATE SET value = $5",
Expand Down Expand Up @@ -475,7 +475,7 @@ fn get_branch_name<P: AsRef<Path>>(rel_path: P) -> Result<(String, String)> {
return Err(anyhow!(
"Unexpected path component: {}",
rel_path.as_ref().display()
))
));
}
};
if let Some(branch) = branch {
Expand Down Expand Up @@ -673,7 +673,7 @@ fn open_deb_advanced<'a, R: Read + 'a>(
maintainer: must_have!(meta, "Maintainer"),
features: meta
.remove("X-AOSC-Features".as_bytes())
.map(|x| String::from_utf8_lossy(&x).to_string()),
.map(|x| String::from_utf8_lossy(x).to_string()),
extra: collect_left_over_fields(meta),
debtime,
});
Expand Down
2 changes: 1 addition & 1 deletion src/scan/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::{anyhow, Result};
use anyhow::{Result, anyhow};
use ar::Archive as ArArchive;
use faster_hex::hex_string;
use flate2::read::GzDecoder;
Expand Down
6 changes: 3 additions & 3 deletions src/sign.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use anyhow::{anyhow, Result};
use anyhow::{Result, anyhow};
use openpgp::cert::{Cert, CertBuilder};
use openpgp::parse::Parse;
use openpgp::policy::StandardPolicy;
use openpgp::serialize::stream::{Message, Signer};
use openpgp::serialize::SerializeInto;
use openpgp::serialize::stream::{Message, Signer};
use openpgp::types::KeyFlags;
use sailfish::TemplateSimple;
use secrecy::SecretSlice;
Expand Down Expand Up @@ -77,8 +77,8 @@ pub fn load_certificate<P: AsRef<Path>>(cert_path: P) -> Result<Cert> {
}

pub fn sign_message_agent(cert: &Cert, content: &[u8]) -> Result<Vec<u8>> {
use sequoia_gpg_agent::gnupg::Context;
use sequoia_gpg_agent::KeyPair;
use sequoia_gpg_agent::gnupg::Context;

let policy = StandardPolicy::new();
let keypair = cert
Expand Down