pull: don't fetch orig tarball for native packages
All checks were successful
CI / build (push) Successful in 1m51s
All checks were successful
CI / build (push) Successful in 1m51s
This commit is contained in:
@@ -129,6 +129,7 @@ pub struct PackageStanza {
|
||||
pub package: String,
|
||||
pub version: String,
|
||||
pub directory: String,
|
||||
pub format: String,
|
||||
pub vcs_git: Option<String>,
|
||||
pub vcs_browser: Option<String>,
|
||||
pub files: Vec<FileEntry>,
|
||||
@@ -143,6 +144,12 @@ pub struct PackageInfo {
|
||||
pub archive_url: String,
|
||||
}
|
||||
|
||||
impl PackageInfo {
|
||||
pub fn is_native(&self) -> bool {
|
||||
self.stanza.format.contains("(native)")
|
||||
}
|
||||
}
|
||||
|
||||
fn get_dist_pockets(dist: &str) -> Vec<&'static str> {
|
||||
match dist {
|
||||
"ubuntu" => vec!["proposed", "updates", ""],
|
||||
@@ -273,6 +280,10 @@ fn parse_sources(
|
||||
package: pkg.clone(),
|
||||
version: fields.get("Version").cloned().unwrap_or_default(),
|
||||
directory: fields.get("Directory").cloned().unwrap_or_default(),
|
||||
format: fields
|
||||
.get("Format")
|
||||
.cloned()
|
||||
.unwrap_or_else(|| "1.0".to_string()),
|
||||
vcs_git: fields.get("Vcs-Git").cloned(),
|
||||
vcs_browser: fields.get("Vcs-Browser").cloned(),
|
||||
files,
|
||||
@@ -449,7 +460,15 @@ mod tests {
|
||||
use flate2::write::GzEncoder;
|
||||
use std::io::Write;
|
||||
|
||||
let data = "Package: hello\nVersion: 2.10-2\nDirectory: pool/main/h/hello\nVcs-Git: https://salsa.debian.org/debian/hello.git\n\nPackage: other\nVersion: 1.0\n";
|
||||
let data = "Package: hello
|
||||
Version: 2.10-2
|
||||
Format: 3.0 (quilt)
|
||||
Directory: pool/main/h/hello
|
||||
Vcs-Git: https://salsa.debian.org/debian/hello.git
|
||||
|
||||
Package: other
|
||||
Version: 1.0
|
||||
";
|
||||
|
||||
let mut encoder = GzEncoder::new(Vec::new(), Compression::default());
|
||||
encoder.write_all(data.as_bytes()).unwrap();
|
||||
@@ -458,6 +477,7 @@ mod tests {
|
||||
let info = parse_sources(&compressed, "hello", None).unwrap().unwrap();
|
||||
assert_eq!(info.package, "hello");
|
||||
assert_eq!(info.version, "2.10-2");
|
||||
assert_eq!(info.format, "3.0 (quilt)");
|
||||
assert_eq!(info.directory, "pool/main/h/hello");
|
||||
assert_eq!(
|
||||
info.vcs_git.unwrap(),
|
||||
|
||||
10
src/pull.rs
10
src/pull.rs
@@ -406,10 +406,14 @@ pub async fn pull(
|
||||
Some(&package_dir),
|
||||
progress,
|
||||
)?;
|
||||
if let Some(cb) = progress {
|
||||
cb("Fetching orig tarball...", "", 0, 0);
|
||||
if !package_info.is_native() {
|
||||
if let Some(cb) = progress {
|
||||
cb("Fetching orig tarball...", "", 0, 0);
|
||||
}
|
||||
fetch_orig_tarball(&package_info, Some(&package_dir), progress).await?;
|
||||
} else {
|
||||
debug!("Native package, skipping orig tarball fetch.");
|
||||
}
|
||||
fetch_orig_tarball(&package_info, Some(&package_dir), progress).await?;
|
||||
} else {
|
||||
// Fallback to archive fetching
|
||||
if let Some(cb) = progress {
|
||||
|
||||
Reference in New Issue
Block a user