update to proxmox-sys 0.2 crate
- imported pbs-api-types/src/common_regex.rs from old proxmox crate - use hex crate to generate/parse hex digest - remove all reference to proxmox crate (use proxmox-sys and proxmox-serde instead) Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
@ -10,6 +10,7 @@ anyhow = "1.0"
|
||||
bitflags = "1.2.1"
|
||||
bytes = "1.0"
|
||||
futures = "0.3"
|
||||
hex = "0.4.3"
|
||||
h2 = { version = "0.3", features = [ "stream" ] }
|
||||
http = "0.2"
|
||||
hyper = { version = "0.14", features = [ "full" ] }
|
||||
@ -28,15 +29,17 @@ tower-service = "0.3.0"
|
||||
xdg = "2.2"
|
||||
|
||||
pathpatterns = "0.1.2"
|
||||
proxmox = "0.15.3"
|
||||
proxmox-async = "0.2"
|
||||
|
||||
proxmox-async = "0.3"
|
||||
proxmox-fuse = "0.1.1"
|
||||
proxmox-http = { version = "0.5.4", features = [ "client", "http-helpers", "websocket" ] }
|
||||
proxmox-http = { version = "0.6", features = [ "client", "http-helpers", "websocket" ] }
|
||||
proxmox-io = { version = "1", features = [ "tokio" ] }
|
||||
proxmox-lang = "1"
|
||||
proxmox-router = { version = "1.1", features = [ "cli" ] }
|
||||
proxmox-schema = "1"
|
||||
proxmox-time = "1"
|
||||
proxmox-sys = "0.2"
|
||||
|
||||
pxar = { version = "0.10.1", features = [ "tokio-io" ] }
|
||||
|
||||
pbs-api-types = { path = "../pbs-api-types" }
|
||||
|
@ -7,8 +7,6 @@ use std::os::unix::fs::OpenOptionsExt;
|
||||
use futures::future::AbortHandle;
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use proxmox::tools::digest_to_hex;
|
||||
|
||||
use pbs_tools::crypt_config::CryptConfig;
|
||||
use pbs_tools::sha::sha256;
|
||||
use pbs_datastore::{PROXMOX_BACKUP_READER_PROTOCOL_ID_V1, BackupManifest};
|
||||
@ -121,7 +119,7 @@ impl BackupReader {
|
||||
output: W,
|
||||
) -> Result<(), Error> {
|
||||
let path = "chunk";
|
||||
let param = json!({ "digest": digest_to_hex(digest) });
|
||||
let param = json!({ "digest": hex::encode(digest) });
|
||||
self.h2.download(path, Some(param), output).await
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,6 @@ use tokio::io::AsyncReadExt;
|
||||
use tokio::sync::{mpsc, oneshot};
|
||||
use tokio_stream::wrappers::ReceiverStream;
|
||||
|
||||
use proxmox::tools::digest_to_hex;
|
||||
|
||||
use pbs_api_types::HumanByte;
|
||||
use pbs_tools::crypt_config::CryptConfig;
|
||||
use pbs_datastore::{CATALOG_NAME, PROXMOX_BACKUP_PROTOCOL_ID_V1};
|
||||
@ -389,7 +387,7 @@ impl BackupWriter {
|
||||
"wid": wid ,
|
||||
"chunk-count": upload_stats.chunk_count,
|
||||
"size": upload_stats.size,
|
||||
"csum": proxmox::tools::digest_to_hex(&upload_stats.csum),
|
||||
"csum": hex::encode(&upload_stats.csum),
|
||||
});
|
||||
let _value = self.h2.post(&close_path, Some(param)).await?;
|
||||
Ok(BackupStats {
|
||||
@ -481,7 +479,7 @@ impl BackupWriter {
|
||||
let mut digest_list = vec![];
|
||||
let mut offset_list = vec![];
|
||||
for (offset, digest) in chunk_list {
|
||||
digest_list.push(digest_to_hex(&digest));
|
||||
digest_list.push(hex::encode(&digest));
|
||||
offset_list.push(offset);
|
||||
}
|
||||
if verbose { println!("append chunks list len ({})", digest_list.len()); }
|
||||
@ -712,7 +710,7 @@ impl BackupWriter {
|
||||
if let MergedChunkInfo::New(chunk_info) = merged_chunk_info {
|
||||
let offset = chunk_info.offset;
|
||||
let digest = chunk_info.digest;
|
||||
let digest_str = digest_to_hex(&digest);
|
||||
let digest_str = hex::encode(&digest);
|
||||
|
||||
/* too verbose, needs finer verbosity setting granularity
|
||||
if verbose {
|
||||
|
@ -14,7 +14,7 @@ use nix::fcntl::OFlag;
|
||||
use nix::sys::stat::Mode;
|
||||
|
||||
use pathpatterns::{MatchEntry, MatchList, MatchPattern, MatchType, PatternFlag};
|
||||
use proxmox::tools::fs::{create_path, CreateOptions};
|
||||
use proxmox_sys::fs::{create_path, CreateOptions};
|
||||
use proxmox_router::cli::{self, CliCommand, CliCommandMap, CliHelper, CommandLineInterface};
|
||||
use proxmox_schema::api;
|
||||
use pxar::{EntryKind, Metadata};
|
||||
|
@ -14,10 +14,8 @@ use serde_json::{json, Value};
|
||||
use percent_encoding::percent_encode;
|
||||
use xdg::BaseDirectories;
|
||||
|
||||
use proxmox::{
|
||||
sys::linux::tty,
|
||||
tools::fs::{file_get_json, replace_file, CreateOptions},
|
||||
};
|
||||
use proxmox_sys::linux::tty;
|
||||
use proxmox_sys::fs::{file_get_json, replace_file, CreateOptions};
|
||||
use proxmox_router::HttpError;
|
||||
|
||||
use proxmox_http::client::{HttpsConnector, RateLimiter};
|
||||
@ -521,7 +519,7 @@ impl HttpClient {
|
||||
Ok(fp) => fp,
|
||||
Err(err) => bail!("failed to calculate certificate FP - {}", err), // should not happen
|
||||
};
|
||||
let fp_string = proxmox::tools::digest_to_hex(&fp);
|
||||
let fp_string = hex::encode(&fp);
|
||||
let fp_string = fp_string.as_bytes().chunks(2).map(|v| std::str::from_utf8(v).unwrap())
|
||||
.collect::<Vec<&str>>().join(":");
|
||||
|
||||
|
@ -19,14 +19,14 @@ use pathpatterns::{MatchEntry, MatchFlag, MatchList, MatchType, PatternFlag};
|
||||
use pxar::Metadata;
|
||||
use pxar::encoder::{SeqWrite, LinkOffset};
|
||||
|
||||
use proxmox::sys::error::SysError;
|
||||
use proxmox::tools::fd::RawFdNum;
|
||||
use proxmox::tools::fd::Fd;
|
||||
use proxmox_sys::error::SysError;
|
||||
use proxmox_sys::fd::RawFdNum;
|
||||
use proxmox_sys::fd::Fd;
|
||||
use proxmox_sys::fs::{self, acl, xattr};
|
||||
use proxmox_io::vec;
|
||||
use proxmox_lang::c_str;
|
||||
|
||||
use pbs_datastore::catalog::BackupCatalogWriter;
|
||||
use pbs_tools::{acl, fs, xattr};
|
||||
use pbs_tools::str::strip_ascii_whitespace;
|
||||
|
||||
use crate::pxar::metadata::errno_is_unsupported;
|
||||
@ -60,7 +60,7 @@ fn detect_fs_type(fd: RawFd) -> Result<i64, Error> {
|
||||
|
||||
#[rustfmt::skip]
|
||||
pub fn is_virtual_file_system(magic: i64) -> bool {
|
||||
use proxmox::sys::linux::magic::*;
|
||||
use proxmox_sys::linux::magic::*;
|
||||
|
||||
matches!(magic, BINFMTFS_MAGIC |
|
||||
CGROUP2_SUPER_MAGIC |
|
||||
@ -855,7 +855,7 @@ fn get_chattr(metadata: &mut Metadata, fd: RawFd) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
fn get_fat_attr(metadata: &mut Metadata, fd: RawFd, fs_magic: i64) -> Result<(), Error> {
|
||||
use proxmox::sys::linux::magic::*;
|
||||
use proxmox_sys::linux::magic::*;
|
||||
|
||||
if fs_magic != MSDOS_SUPER_MAGIC && fs_magic != FUSE_SUPER_MAGIC {
|
||||
return Ok(());
|
||||
@ -891,7 +891,7 @@ fn get_quota_project_id(
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
use proxmox::sys::linux::magic::*;
|
||||
use proxmox_sys::linux::magic::*;
|
||||
|
||||
match magic {
|
||||
EXT4_SUPER_MAGIC | XFS_SUPER_MAGIC | FUSE_SUPER_MAGIC | ZFS_SUPER_MAGIC => (),
|
||||
|
@ -7,8 +7,8 @@ use nix::dir::Dir;
|
||||
use nix::fcntl::OFlag;
|
||||
use nix::sys::stat::{mkdirat, Mode};
|
||||
|
||||
use proxmox::sys::error::SysError;
|
||||
use proxmox::tools::fd::BorrowedFd;
|
||||
use proxmox_sys::error::SysError;
|
||||
use proxmox_sys::fd::BorrowedFd;
|
||||
use pxar::Metadata;
|
||||
|
||||
use crate::pxar::tools::{assert_single_path_component, perms_from_metadata};
|
||||
|
@ -21,8 +21,8 @@ use pxar::decoder::aio::Decoder;
|
||||
use pxar::format::Device;
|
||||
use pxar::{Entry, EntryKind, Metadata};
|
||||
|
||||
use proxmox::c_result;
|
||||
use proxmox::tools::fs::{create_path, CreateOptions};
|
||||
use proxmox_sys::c_result;
|
||||
use proxmox_sys::fs::{create_path, CreateOptions};
|
||||
use proxmox_io::{sparse_copy, sparse_copy_async};
|
||||
|
||||
use proxmox_async::zip::{ZipEncoder, ZipEntry};
|
||||
|
@ -255,7 +255,7 @@ impl Flags {
|
||||
|
||||
/// Return the supported *pxar* feature flags based on the magic number of the filesystem.
|
||||
pub fn from_magic(magic: i64) -> Flags {
|
||||
use proxmox::sys::linux::magic::*;
|
||||
use proxmox_sys::linux::magic::*;
|
||||
match magic {
|
||||
MSDOS_SUPER_MAGIC => {
|
||||
Flags::WITH_2SEC_TIME |
|
||||
|
@ -25,8 +25,7 @@ use pxar::accessor::{self, EntryRangeInfo, ReadAt};
|
||||
|
||||
use proxmox_fuse::requests::{self, FuseRequest};
|
||||
use proxmox_fuse::{EntryParam, Fuse, ReplyBufState, Request, ROOT_ID};
|
||||
|
||||
use pbs_tools::xattr;
|
||||
use proxmox_sys::fs::xattr;
|
||||
|
||||
/// We mark inodes for regular files this way so we know how to access them.
|
||||
const NON_DIRECTORY_INODE: u64 = 1u64 << 63;
|
||||
|
@ -9,11 +9,10 @@ use nix::sys::stat::Mode;
|
||||
|
||||
use pxar::Metadata;
|
||||
|
||||
use proxmox::c_result;
|
||||
use proxmox::sys::error::SysError;
|
||||
use proxmox::tools::fd::RawFdNum;
|
||||
|
||||
use pbs_tools::{acl, fs, xattr};
|
||||
use proxmox_sys::c_result;
|
||||
use proxmox_sys::error::SysError;
|
||||
use proxmox_sys::fd::RawFdNum;
|
||||
use proxmox_sys::fs::{self, acl, xattr};
|
||||
|
||||
use crate::pxar::tools::perms_from_metadata;
|
||||
use crate::pxar::Flags;
|
||||
@ -67,7 +66,7 @@ pub fn apply_at(
|
||||
path_info: &Path,
|
||||
on_error: &mut (dyn FnMut(Error) -> Result<(), Error> + Send),
|
||||
) -> Result<(), Error> {
|
||||
let fd = proxmox::tools::fd::Fd::openat(
|
||||
let fd = proxmox_sys::fd::Fd::openat(
|
||||
&unsafe { RawFdNum::from_raw_fd(parent) },
|
||||
file_name,
|
||||
OFlag::O_PATH | OFlag::O_CLOEXEC | OFlag::O_NOFOLLOW,
|
||||
|
@ -6,8 +6,8 @@ use std::io::Read;
|
||||
use anyhow::{bail, format_err, Error};
|
||||
use serde_json::Value;
|
||||
|
||||
use proxmox::sys::linux::tty;
|
||||
use proxmox::tools::fs::file_get_contents;
|
||||
use proxmox_sys::linux::tty;
|
||||
use proxmox_sys::fs::file_get_contents;
|
||||
use proxmox_schema::*;
|
||||
|
||||
use pbs_api_types::CryptMode;
|
||||
@ -374,7 +374,7 @@ fn create_testdir(name: &str) -> Result<String, Error> {
|
||||
// safe w.r.t. concurrency
|
||||
fn test_crypto_parameters_handling() -> Result<(), Error> {
|
||||
use serde_json::json;
|
||||
use proxmox::tools::fs::{replace_file, CreateOptions};
|
||||
use proxmox_sys::fs::{replace_file, CreateOptions};
|
||||
|
||||
let some_key = vec![1;1];
|
||||
let default_key = vec![2;1];
|
||||
|
@ -12,7 +12,7 @@ use xdg::BaseDirectories;
|
||||
|
||||
use proxmox_schema::*;
|
||||
use proxmox_router::cli::{complete_file_name, shellword_split};
|
||||
use proxmox::tools::fs::file_get_json;
|
||||
use proxmox_sys::fs::file_get_json;
|
||||
|
||||
use pbs_api_types::{BACKUP_REPO_URL, Authid, RateLimitConfig, UserWithTokens};
|
||||
use pbs_datastore::BackupDir;
|
||||
@ -100,7 +100,7 @@ pub fn get_secret_from_env(base_name: &str) -> Result<Option<String>, Error> {
|
||||
let args = shellword_split(command)?;
|
||||
let mut command = Command::new(&args[0]);
|
||||
command.args(&args[1..]);
|
||||
let output = pbs_tools::run_command(command, None)?;
|
||||
let output = proxmox_sys::command::run_command(command, None)?;
|
||||
return Ok(Some(firstline(output)));
|
||||
}
|
||||
Err(NotUnicode(_)) => bail!(format!("{} contains bad characters", env_name)),
|
||||
|
Reference in New Issue
Block a user