static-php-cli icon indicating copy to clipboard operation
static-php-cli copied to clipboard

Change --ignore-cache-sources to only re-download when the download artifact changed

Open henderkes opened this issue 4 months ago • 5 comments

i.e. if we have last downloaded from php.net/download/8-4-12.tar.gz and the new url is still the same, don't redownload.

That way we can add all downloads to the gh actions cache and still get a newer version of any component that releases a new version

henderkes avatar Sep 04 '25 08:09 henderkes

If we have to request the php.net API for each download, I'm not sure if it will exacerbate network issues. Currently, the only stable and persistent pull source is dl.static-php.dev itself.

crazywhalecc avatar Sep 07 '25 02:09 crazywhalecc

Only for --ignore-cache-sources.

My idea is that I can cache the downloads for the daily rpm/deb builds (that's 30 downloads of all sources!) and by only checking and overwriting existing downloads when a new version released, spc is still guaranteed to always get the latest version of each package.

So it would be 80 version checks and maybe 1-2 downloads of updated sources, instead of 80 version checks plus 80 downloads of sources on each of the 30 jobs.

henderkes avatar Sep 07 '25 02:09 henderkes

Ah get it. But this way will destroy the basic function of --ignore-cache-sources. The purpose of this option is to ignore the cache and force pull. We cannot ignore only part of it.

I prefer downloading php-src only when using --with-php=XXX. It will perform like: checking php.net API first, download latest php source if not exists.

But I haven't figured out how to do it. I think we may need to add an abstract method isAlreadyDownloaded to CustomSourceBase.

crazywhalecc avatar Sep 07 '25 03:09 crazywhalecc

We'd have to save the currently downloaded version (url, tag name, whatever, depending on the source type) and then cross-check against it.

henderkes avatar Sep 07 '25 03:09 henderkes

We'd have to save the currently downloaded version (url, tag name, whatever, depending on the source type) and then cross-check against it.

True. With php-src-$version lock inside PhpSource class. But That's another key point: how to deal with php-src and php-src-$version lock in current situation.

crazywhalecc avatar Sep 07 '25 03:09 crazywhalecc