Skip to content

Packages restored from cache are redownloaded #504

Description

@ntBre

Hi! I hope this isn't too off base because I got some help from Codex diagnosing this, but I've been noticing a lot of errors like this in Ruff CI runs:

Running the benchmarks
    Packages restored from cache: valgrind, libc6-dbg
    Error: Failed to download file: error sending request for url (https://github.com/CodSpeedHQ/valgrind-codspeed/releases/download/3.26.0-0codspeed6/valgrind_3.26.0-0codspeed6_ubuntu-24.04_amd64.deb)
    Error: Process completed with exit code 1.

This pattern also appears in a successful run:

Running the benchmarks
    Packages restored from cache: valgrind, libc6-dbg
    Installing packages: /tmp/valgrind-codspeed.deb, libc6-dbg
    Installation completed successfully

I think this was known, and the 5.0.3 release, which we haven't upgraded to yet, should help based on the release notes and #499. However, the logs look a bit suspicious still in that valgrind is reported as being restored from the cache, followed immediately by an error downloading some kind of valgrind package.

Codex suggests that this is caused by restoring the cache but not registering the restored files with dpkg, which is then used to query the files after #394. It also suggested an updated version of this is_package_installed_function:

Details

pub fn is_package_installed(package: &str) -> bool {
    Command::new("dpkg")
        .args(["-s", package])
        .output()
        .is_ok_and(|output| output.status.success())
        || std::fs::read_to_string(Path::new("/").join(METADATA_FILENAME))
            .is_ok_and(|metadata| metadata.lines().any(|cached| cached == package))
}

Again, not totally sure if this is accurate or helpful but figured I'd share just in case. And thanks for the fix in #499 already!

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions