make sure not to use cached channels for nix-channel --update
fixes #1964
This commit is contained in:
		
							parent
							
								
									a1adcdf087
								
							
						
					
					
						commit
						b9289e4855
					
				
					 3 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -623,7 +623,7 @@ DownloadResult Downloader::download(const DownloadRequest & request)
 | 
				
			||||||
    return enqueueDownload(request).get();
 | 
					    return enqueueDownload(request).get();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpack, string name, const Hash & expectedHash, string * effectiveUrl)
 | 
					Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpack, string name, const Hash & expectedHash, string * effectiveUrl, int ttl)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    auto url = resolveUri(url_);
 | 
					    auto url = resolveUri(url_);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -653,7 +653,6 @@ Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpa
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    string expectedETag;
 | 
					    string expectedETag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int ttl = settings.tarballTtl;
 | 
					 | 
				
			||||||
    bool skip = false;
 | 
					    bool skip = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (pathExists(fileLink) && pathExists(dataFile)) {
 | 
					    if (pathExists(fileLink) && pathExists(dataFile)) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "types.hh"
 | 
					#include "types.hh"
 | 
				
			||||||
#include "hash.hh"
 | 
					#include "hash.hh"
 | 
				
			||||||
 | 
					#include "globals.hh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
#include <future>
 | 
					#include <future>
 | 
				
			||||||
| 
						 | 
					@ -54,7 +55,7 @@ struct Downloader
 | 
				
			||||||
       use the recorded ETag to verify if the server has a more
 | 
					       use the recorded ETag to verify if the server has a more
 | 
				
			||||||
       recent version, and if so, download it to the Nix store. */
 | 
					       recent version, and if so, download it to the Nix store. */
 | 
				
			||||||
    Path downloadCached(ref<Store> store, const string & uri, bool unpack, string name = "",
 | 
					    Path downloadCached(ref<Store> store, const string & uri, bool unpack, string name = "",
 | 
				
			||||||
        const Hash & expectedHash = Hash(), string * effectiveUri = nullptr);
 | 
					        const Hash & expectedHash = Hash(), string * effectiveUri = nullptr, int ttl = settings.tarballTtl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    enum Error { NotFound, Forbidden, Misc, Transient, Interrupted };
 | 
					    enum Error { NotFound, Forbidden, Misc, Transient, Interrupted };
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -86,7 +86,7 @@ static void update(const StringSet & channelNames)
 | 
				
			||||||
        // definition from a consistent location if the redirect changes mid-download.
 | 
					        // definition from a consistent location if the redirect changes mid-download.
 | 
				
			||||||
        std::string effectiveUrl;
 | 
					        std::string effectiveUrl;
 | 
				
			||||||
        auto dl = getDownloader();
 | 
					        auto dl = getDownloader();
 | 
				
			||||||
        auto filename = dl->downloadCached(store, url, false, "", Hash(), &effectiveUrl);
 | 
					        auto filename = dl->downloadCached(store, url, false, "", Hash(), &effectiveUrl, 0);
 | 
				
			||||||
        url = chomp(std::move(effectiveUrl));
 | 
					        url = chomp(std::move(effectiveUrl));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // If the URL contains a version number, append it to the name
 | 
					        // If the URL contains a version number, append it to the name
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue