From 4703367a23e4eff73391807fda42fcb7edc61900 Mon Sep 17 00:00:00 2001 From: amy null Date: Wed, 24 May 2023 20:45:34 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20Fix=20compression=20on=20?= =?UTF-8?q?Arch=20artifacts=20(for=20now)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/artifact/arch.rs | 50 +++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/src/artifact/arch.rs b/src/artifact/arch.rs index ef08e44..2b465b6 100644 --- a/src/artifact/arch.rs +++ b/src/artifact/arch.rs @@ -2,8 +2,6 @@ use std::path::PathBuf; use eyre::Result; use regex::Regex; -use tokio::fs::File; -use tokio_stream::StreamExt; use tracing::*; use crate::fs::MemFS; @@ -76,39 +74,33 @@ impl SelfValidation for ArchArtifact { } if let Some(file_name) = self.path.file_name() { - if !file_name - .to_string_lossy() - .to_string() - .ends_with(".pkg.tar") - { - errors.push(format!( - "{} does not end with .pkg.tar", - self.path.display(), - )); + if !file_name.to_string_lossy().to_string().contains(".pkg.tar") { + errors.push(format!("{} does not contain .pkg.tar", self.path.display(),)); } } else { errors.push(format!("{} does not have a file name", self.path.display())); } // Validate that the .PKGINFO file exists in the tarball - let mut tarball = tokio_tar::Archive::new(File::open(&self.path).await?); - let mut pkginfo_exists = false; - - let mut entries = tarball.entries()?; - while let Some(gz_entry) = entries.try_next().await? { - let path = gz_entry.path()?; - if path.ends_with(".PKGINFO") { - pkginfo_exists = true; - break; - } - } - - if !pkginfo_exists { - errors.push(format!( - "{} does not contain a .PKGINFO file", - self.path.display() - )); - } + // TODO: This check needs to handle compression correctly. + // let mut tarball = tokio_tar::Archive::new(File::open(&self.path).await?); + // let mut pkginfo_exists = false; + + // let mut entries = tarball.entries()?; + // while let Some(gz_entry) = entries.try_next().await? { + // let path = gz_entry.path()?; + // if path.ends_with(".PKGINFO") { + // pkginfo_exists = true; + // break; + // } + // } + + // if !pkginfo_exists { + // errors.push(format!( + // "{} does not contain a .PKGINFO file", + // self.path.display() + // )); + // } if !errors.is_empty() { Err(eyre::eyre!(